From a5f9e559f42b677d10a2a3de2a9a2f3f52c536a0 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Sat, 4 Jan 2014 03:20:04 -0800 Subject: [PATCH 1/3] No bug, Automated HSTS preload list update from host bld-linux64-ec2-441 - a=hsts-update --- security/manager/boot/src/nsSTSPreloadList.errors | 2 ++ security/manager/boot/src/nsSTSPreloadList.inc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/security/manager/boot/src/nsSTSPreloadList.errors b/security/manager/boot/src/nsSTSPreloadList.errors index 4d27adb50a1d..7440ca58b92b 100644 --- a/security/manager/boot/src/nsSTSPreloadList.errors +++ b/security/manager/boot/src/nsSTSPreloadList.errors @@ -30,6 +30,7 @@ dropcam.com: did not receive HSTS header email.lookout.com: could not connect to host emailprivacytester.com: did not receive HSTS header encrypted.google.com: did not receive HSTS header +espra.com: could not connect to host fatzebra.com.au: did not receive HSTS header fj.simple.com: did not receive HSTS header get.zenpayroll.com: did not receive HSTS header @@ -42,6 +43,7 @@ goto.google.com: did not receive HSTS header greplin.com: did not receive HSTS header grepular.com: max-age too low: 8640000 groups.google.com: did not receive HSTS header +haste.ch: could not connect to host history.google.com: did not receive HSTS header hostedtalkgadget.google.com: did not receive HSTS header id.atlassian.com: did not receive HSTS header diff --git a/security/manager/boot/src/nsSTSPreloadList.inc b/security/manager/boot/src/nsSTSPreloadList.inc index 60bfeecd54c2..838eb4e3c7a5 100644 --- a/security/manager/boot/src/nsSTSPreloadList.inc +++ b/security/manager/boot/src/nsSTSPreloadList.inc @@ -8,7 +8,7 @@ /*****************************************************************************/ #include -const PRTime gPreloadListExpirationTime = INT64_C(1399115288663000); +const PRTime gPreloadListExpirationTime = INT64_C(1399719973983000); class nsSTSPreload { From 1b83407ce96d687c83fc073c4b937b208564152c Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 4 Jan 2014 10:02:17 -0500 Subject: [PATCH 2/3] 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 --- accessible/src/atk/nsMaiInterfaceText.cpp | 2 +- accessible/src/base/DocManager.cpp | 2 +- .../src/base/nsAccessibilityService.cpp | 6 +- accessible/src/base/nsCoreUtils.h | 2 +- accessible/src/base/nsTextEquivUtils.cpp | 8 +- accessible/src/generic/DocAccessible.cpp | 2 +- accessible/src/generic/HyperTextAccessible.h | 10 +- .../src/html/HTMLElementAccessibles.cpp | 2 +- .../src/xpcom/xpcAccessibleHyperText.cpp | 2 +- b2g/app/nsBrowserApp.cpp | 2 +- .../shell/src/nsMacShellService.cpp | 2 +- .../shell/src/nsWindowsShellService.cpp | 8 +- caps/src/nsScriptSecurityManager.cpp | 14 +- chrome/src/nsChromeRegistryChrome.cpp | 2 +- chrome/src/nsChromeRegistryChrome.h | 2 +- chrome/src/nsChromeRegistryContent.cpp | 2 +- chrome/src/nsChromeRegistryContent.h | 2 +- content/base/public/DirectionalityUtils.h | 2 +- content/base/public/FragmentOrElement.h | 4 +- content/base/public/nsContentUtils.h | 20 +- content/base/public/nsIContent.h | 4 +- content/base/public/nsIDocument.h | 4 +- content/base/public/nsINode.h | 2 +- content/base/public/nsLineBreaker.h | 14 +- content/base/src/DOMImplementation.cpp | 2 +- content/base/src/DOMParser.cpp | 2 +- content/base/src/DirectionalityUtils.cpp | 8 +- content/base/src/Element.cpp | 4 +- content/base/src/EventSource.cpp | 40 +-- content/base/src/EventSource.h | 6 +- content/base/src/FragmentOrElement.cpp | 38 +-- content/base/src/Link.cpp | 4 +- content/base/src/WebSocket.cpp | 18 +- content/base/src/WebSocket.h | 4 +- content/base/src/nsAttrValue.cpp | 34 +-- content/base/src/nsAttrValue.h | 4 +- content/base/src/nsCCUncollectableMarker.cpp | 2 +- content/base/src/nsCSPService.cpp | 2 +- content/base/src/nsContentSink.cpp | 26 +- content/base/src/nsContentUtils.cpp | 180 +++++------ content/base/src/nsCopySupport.cpp | 2 +- content/base/src/nsDOMFile.cpp | 2 +- content/base/src/nsDOMFileReader.cpp | 6 +- content/base/src/nsDOMTokenList.cpp | 2 +- content/base/src/nsDocument.cpp | 8 +- content/base/src/nsDocument.h | 4 +- content/base/src/nsDocumentEncoder.cpp | 6 +- content/base/src/nsFormData.cpp | 2 +- content/base/src/nsFrameMessageManager.cpp | 2 +- content/base/src/nsFrameMessageManager.h | 2 +- content/base/src/nsGenericDOMDataNode.cpp | 18 +- content/base/src/nsGenericDOMDataNode.h | 6 +- content/base/src/nsHTMLContentSerializer.cpp | 26 +- content/base/src/nsLineBreaker.cpp | 16 +- content/base/src/nsMixedContentBlocker.cpp | 2 +- content/base/src/nsPlainTextSerializer.cpp | 58 ++-- content/base/src/nsPlainTextSerializer.h | 2 +- content/base/src/nsReferencedElement.cpp | 2 +- content/base/src/nsScriptLoader.cpp | 2 +- content/base/src/nsTextFragment.cpp | 60 ++-- content/base/src/nsTextFragment.h | 22 +- content/base/src/nsTextFragmentSSE2.cpp | 4 +- content/base/src/nsTextNode.cpp | 2 +- content/base/src/nsTextNode.h | 2 +- content/base/src/nsTreeSanitizer.cpp | 2 +- content/base/src/nsXMLContentSerializer.cpp | 74 ++--- content/base/src/nsXMLContentSerializer.h | 4 +- content/base/src/nsXMLHttpRequest.cpp | 34 +-- .../nsICanvasRenderingContextInternal.h | 2 +- content/canvas/src/CanvasImageCache.cpp | 2 +- .../canvas/src/CanvasRenderingContext2D.cpp | 6 +- content/canvas/src/CanvasRenderingContext2D.h | 2 +- content/canvas/src/ImageEncoder.cpp | 2 +- content/canvas/src/ImageEncoder.h | 2 +- content/canvas/src/WebGLContext.cpp | 4 +- content/canvas/src/WebGLContext.h | 4 +- content/canvas/src/WebGLValidateStrings.h | 24 +- content/events/src/nsContentEventHandler.cpp | 2 +- content/events/src/nsDOMDataTransfer.cpp | 2 +- content/events/src/nsEventStateManager.cpp | 2 +- .../html/content/public/HTMLMediaElement.h | 2 +- content/html/content/src/HTMLFormElement.cpp | 2 +- .../html/content/src/HTMLFrameSetElement.cpp | 8 +- content/html/content/src/HTMLInputElement.cpp | 34 +-- content/html/content/src/HTMLInputElement.h | 2 +- content/html/content/src/HTMLMediaElement.cpp | 24 +- .../html/content/src/HTMLTextAreaElement.cpp | 2 +- content/html/content/src/nsDOMStringMap.cpp | 26 +- content/html/content/src/nsFormSubmission.cpp | 12 +- .../html/content/src/nsGenericHTMLElement.cpp | 10 +- .../html/content/src/nsHTMLDNSPrefetch.cpp | 4 +- .../html/content/src/nsTextEditorState.cpp | 2 +- content/html/document/src/ImageDocument.cpp | 4 +- content/html/document/src/MediaDocument.cpp | 10 +- content/html/document/src/nsHTMLDocument.cpp | 4 +- .../mathml/content/src/nsMathMLElement.cpp | 14 +- content/media/Latency.cpp | 2 +- content/media/MediaCache.cpp | 2 +- content/media/MediaDecoder.cpp | 2 +- content/media/MediaRecorder.cpp | 2 +- content/media/MediaShutdownManager.cpp | 2 +- content/media/MediaStreamGraph.cpp | 2 +- content/media/webrtc/LoadMonitor.cpp | 2 +- .../recognition/SpeechRecognition.cpp | 2 +- .../test/FakeSpeechRecognitionService.cpp | 2 +- content/media/wmf/WMFUtils.cpp | 2 +- content/smil/nsSMILParserUtils.cpp | 62 ++-- content/svg/content/src/SVGContentUtils.cpp | 44 +-- content/svg/content/src/SVGContentUtils.h | 30 +- .../svg/content/src/SVGFragmentIdentifier.cpp | 2 +- content/svg/content/src/SVGLength.cpp | 8 +- content/svg/content/src/SVGNumberList.cpp | 2 +- content/svg/content/src/SVGPathSegUtils.cpp | 4 +- content/svg/content/src/SVGPathSegUtils.h | 44 +-- content/svg/content/src/SVGPointList.cpp | 6 +- .../content/src/SVGTransformListParser.cpp | 2 +- content/svg/content/src/nsSVGAngle.cpp | 8 +- content/svg/content/src/nsSVGDataParser.h | 6 +- content/svg/content/src/nsSVGElement.cpp | 2 +- content/svg/content/src/nsSVGLength2.cpp | 8 +- content/svg/content/src/nsSVGNumber2.cpp | 4 +- .../svg/content/src/nsSVGPathDataParser.cpp | 6 +- content/svg/content/src/nsSVGPathDataParser.h | 2 +- content/svg/content/src/nsSVGTransform.cpp | 20 +- content/svg/content/src/nsSVGViewBox.cpp | 4 +- content/xbl/src/nsXBLContentSink.cpp | 90 +++--- content/xbl/src/nsXBLContentSink.h | 34 +-- content/xbl/src/nsXBLProtoImpl.cpp | 4 +- content/xbl/src/nsXBLProtoImpl.h | 2 +- content/xbl/src/nsXBLProtoImplField.cpp | 4 +- content/xbl/src/nsXBLProtoImplField.h | 8 +- content/xbl/src/nsXBLProtoImplMember.h | 12 +- content/xbl/src/nsXBLProtoImplMethod.cpp | 4 +- content/xbl/src/nsXBLProtoImplMethod.h | 4 +- content/xbl/src/nsXBLProtoImplProperty.cpp | 10 +- content/xbl/src/nsXBLProtoImplProperty.h | 10 +- content/xbl/src/nsXBLPrototypeBinding.cpp | 10 +- content/xbl/src/nsXBLPrototypeHandler.cpp | 60 ++-- content/xbl/src/nsXBLPrototypeHandler.h | 32 +- content/xbl/src/nsXBLService.cpp | 6 +- content/xbl/src/nsXBLWindowKeyHandler.cpp | 2 +- content/xml/document/src/nsXMLContentSink.cpp | 50 +-- content/xml/document/src/nsXMLContentSink.h | 16 +- .../document/src/nsXMLFragmentContentSink.cpp | 28 +- content/xslt/src/base/txDouble.cpp | 8 +- content/xslt/src/xml/txXMLUtils.cpp | 28 +- content/xslt/src/xml/txXMLUtils.h | 10 +- content/xslt/src/xpath/txCoreFunctionCall.cpp | 4 +- content/xslt/src/xpath/txExprLexer.h | 2 +- content/xslt/src/xpath/txExprParser.cpp | 4 +- content/xslt/src/xpath/txFunctionCall.cpp | 4 +- content/xslt/src/xpath/txLiteralExpr.cpp | 2 +- content/xslt/src/xpath/txLocationStep.cpp | 2 +- content/xslt/src/xpath/txNameTest.cpp | 2 +- .../xslt/src/xpath/txNamedAttributeStep.cpp | 4 +- content/xslt/src/xpath/txNodeTypeTest.cpp | 6 +- content/xslt/src/xpath/txPathExpr.cpp | 2 +- content/xslt/src/xpath/txPredicateList.cpp | 4 +- .../xslt/src/xpath/txPredicatedNodeTest.cpp | 4 +- content/xslt/src/xpath/txRelationalExpr.cpp | 6 +- content/xslt/src/xpath/txRootExpr.cpp | 2 +- content/xslt/src/xpath/txUnaryExpr.cpp | 2 +- content/xslt/src/xpath/txVariableRefExpr.cpp | 4 +- .../src/xpath/txXPCOMExtensionFunction.cpp | 4 +- .../xslt/src/xslt/txDocumentFunctionCall.cpp | 2 +- content/xslt/src/xslt/txExecutionState.cpp | 2 +- .../src/xslt/txFormatNumberFunctionCall.cpp | 10 +- content/xslt/src/xslt/txInstructions.cpp | 8 +- .../src/xslt/txMozillaStylesheetCompiler.cpp | 32 +- content/xslt/src/xslt/txMozillaXMLOutput.cpp | 2 +- .../xslt/src/xslt/txMozillaXSLTProcessor.cpp | 6 +- .../xslt/src/xslt/txMozillaXSLTProcessor.h | 4 +- content/xslt/src/xslt/txPatternParser.cpp | 2 +- .../src/xslt/txStylesheetCompileHandlers.cpp | 4 +- .../xslt/src/xslt/txStylesheetCompiler.cpp | 12 +- content/xslt/src/xslt/txStylesheetCompiler.h | 16 +- content/xslt/src/xslt/txXSLTFunctions.h | 18 +- content/xslt/src/xslt/txXSLTNumber.cpp | 4 +- content/xslt/src/xslt/txXSLTNumber.h | 2 +- .../xslt/src/xslt/txXSLTNumberCounters.cpp | 14 +- content/xslt/src/xslt/txXSLTPatterns.cpp | 22 +- content/xul/content/src/nsXULElement.cpp | 2 +- content/xul/content/src/nsXULElement.h | 2 +- content/xul/document/src/XULDocument.cpp | 8 +- .../document/src/nsXULCommandDispatcher.cpp | 8 +- content/xul/document/src/nsXULContentSink.cpp | 50 +-- content/xul/document/src/nsXULContentSink.h | 16 +- content/xul/document/src/nsXULControllers.cpp | 6 +- .../xul/document/src/nsXULPrototypeCache.cpp | 2 +- .../xul/templates/src/nsXULContentBuilder.cpp | 8 +- .../xul/templates/src/nsXULContentUtils.cpp | 8 +- .../templates/src/nsXULTemplateBuilder.cpp | 30 +- .../src/nsXULTemplateQueryProcessorRDF.cpp | 12 +- .../xul/templates/src/nsXULTreeBuilder.cpp | 6 +- docshell/base/nsDefaultURIFixup.cpp | 6 +- docshell/base/nsDocShell.cpp | 46 +-- docshell/base/nsDocShell.h | 14 +- docshell/base/nsDocShellLoadInfo.cpp | 4 +- docshell/base/nsILinkHandler.h | 6 +- docshell/shistory/src/nsSHEntry.cpp | 2 +- docshell/shistory/src/nsSHistory.cpp | 4 +- dom/audiochannel/AudioChannelService.cpp | 2 +- dom/base/Navigator.cpp | 6 +- dom/base/URL.cpp | 4 +- dom/base/nsDOMClassInfo.cpp | 16 +- dom/base/nsDOMClassInfo.h | 2 +- dom/base/nsDOMScriptObjectFactory.cpp | 2 +- dom/base/nsFocusManager.cpp | 2 +- dom/base/nsGlobalWindow.cpp | 12 +- dom/base/nsGlobalWindow.h | 2 +- dom/base/nsIScriptTimeoutHandler.h | 2 +- dom/base/nsJSEnvironment.cpp | 16 +- dom/base/nsJSTimeoutHandler.cpp | 4 +- dom/base/nsLocation.cpp | 10 +- dom/base/nsPluginArray.cpp | 2 +- dom/base/nsScriptNameSpaceManager.cpp | 10 +- dom/base/nsScriptNameSpaceManager.h | 10 +- dom/base/nsWindowMemoryReporter.cpp | 2 +- dom/bindings/BindingUtils.h | 2 +- dom/bluetooth/BluetoothHidManager.cpp | 2 +- dom/bluetooth/BluetoothService.cpp | 2 +- dom/bluetooth/ObexBase.h | 2 +- .../bluedroid/BluetoothA2dpManager.cpp | 2 +- .../bluedroid/BluetoothHfpManager.cpp | 2 +- .../bluedroid/BluetoothOppManager.cpp | 14 +- dom/bluetooth/bluedroid/BluetoothOppManager.h | 2 +- dom/bluetooth/bluez/BluetoothA2dpManager.cpp | 2 +- dom/bluetooth/bluez/BluetoothHfpManager.cpp | 2 +- dom/bluetooth/bluez/BluetoothOppManager.cpp | 14 +- dom/bluetooth/bluez/BluetoothOppManager.h | 2 +- dom/camera/DOMCameraManager.cpp | 2 +- dom/devicestorage/nsDeviceStorage.cpp | 24 +- dom/encoding/TextDecoder.cpp | 4 +- dom/encoding/TextEncoder.cpp | 2 +- dom/file/FileService.cpp | 2 +- dom/fmradio/FMRadioService.cpp | 2 +- dom/gamepad/GamepadService.cpp | 2 +- dom/indexedDB/CheckPermissionsHelper.cpp | 2 +- dom/indexedDB/IDBFactory.cpp | 2 +- dom/indexedDB/IDBObjectStore.cpp | 2 +- dom/indexedDB/IndexedDatabaseManager.cpp | 2 +- dom/indexedDB/Key.cpp | 16 +- dom/indexedDB/KeyPath.cpp | 2 +- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 6 +- dom/ipc/PreallocatedProcessManager.cpp | 2 +- dom/ipc/ProcessPriorityManager.cpp | 6 +- dom/ipc/TabChild.cpp | 10 +- dom/media/MediaManager.cpp | 2 +- dom/media/MediaPermissionGonk.cpp | 2 +- .../src/MobileMessageManager.cpp | 2 +- dom/mobilemessage/src/gonk/SmsService.cpp | 2 +- dom/mobilemessage/src/ipc/SmsIPCService.cpp | 2 +- dom/mobilemessage/src/ipc/SmsParent.cpp | 2 +- dom/plugins/base/nsIPluginInstanceOwner.idl | 2 +- dom/plugins/base/nsNPAPIPlugin.cpp | 2 +- dom/plugins/base/nsPluginHost.cpp | 2 +- dom/plugins/base/nsPluginInstanceOwner.cpp | 2 +- dom/plugins/base/nsPluginInstanceOwner.h | 2 +- .../base/nsPluginStreamListenerPeer.cpp | 2 +- dom/plugins/base/nsPluginTags.cpp | 12 +- dom/plugins/ipc/PluginHangUIParent.cpp | 2 +- dom/plugins/ipc/PluginInstanceChild.cpp | 4 +- dom/plugins/ipc/PluginInstanceParent.cpp | 2 +- dom/plugins/ipc/PluginModuleChild.cpp | 2 +- dom/plugins/ipc/PluginModuleParent.cpp | 2 +- dom/power/WakeLock.cpp | 2 +- dom/quota/CheckQuotaHelper.cpp | 2 +- dom/quota/QuotaManager.cpp | 2 +- dom/speakermanager/SpeakerManagerService.cpp | 2 +- dom/src/geolocation/nsGeolocation.cpp | 4 +- dom/src/geolocation/nsGeolocation.h | 2 +- dom/src/json/nsJSON.cpp | 24 +- dom/src/json/nsJSON.h | 10 +- dom/src/notification/DesktopNotification.h | 2 +- dom/src/notification/Notification.cpp | 2 +- dom/src/offline/nsDOMOfflineResourceList.cpp | 2 +- dom/src/storage/DOMStorageObserver.cpp | 2 +- dom/system/OSFileConstants.cpp | 2 +- dom/system/gonk/AudioManager.cpp | 2 +- dom/system/gonk/AutoMounterSetting.cpp | 2 +- dom/system/gonk/SystemWorkerManager.cpp | 2 +- dom/system/gonk/TimeZoneSettingObserver.cpp | 2 +- dom/system/gonk/VolumeServiceTest.cpp | 2 +- dom/system/gonk/nsVolumeMountLock.cpp | 2 +- dom/telephony/ipc/TelephonyIPCProvider.cpp | 2 +- dom/wifi/WifiUtils.cpp | 4 +- dom/workers/RuntimeService.cpp | 2 +- editor/composer/src/nsEditingSession.cpp | 2 +- editor/composer/src/nsEditorSpellCheck.cpp | 28 +- .../base/ChangeCSSInlineStyleTxn.cpp | 16 +- editor/libeditor/base/nsEditor.cpp | 2 +- editor/libeditor/html/nsHTMLCSSUtils.cpp | 40 +-- editor/libeditor/html/nsHTMLDataTransfer.cpp | 6 +- editor/libeditor/html/nsHTMLEditRules.cpp | 2 +- editor/libeditor/html/nsHTMLEditor.cpp | 34 +-- editor/libeditor/html/nsHTMLEditor.h | 2 +- editor/libeditor/html/nsHTMLURIRefObject.cpp | 2 +- editor/libeditor/html/nsWSRunObject.cpp | 18 +- editor/libeditor/html/nsWSRunObject.h | 8 +- editor/libeditor/text/nsInternetCiter.cpp | 24 +- editor/libeditor/text/nsPlaintextEditor.cpp | 4 +- editor/libeditor/text/nsTextEditRules.cpp | 2 +- editor/txtsvc/src/nsTextServicesDocument.cpp | 2 +- .../webBrowser/nsDocShellTreeOwner.cpp | 12 +- .../browser/webBrowser/nsDocShellTreeOwner.h | 2 +- embedding/browser/webBrowser/nsWebBrowser.cpp | 14 +- .../appstartup/src/nsAppStartupNotifier.cpp | 2 +- .../commandhandler/src/nsCommandGroup.cpp | 6 +- .../commandhandler/src/nsCommandGroup.h | 2 +- embedding/components/find/src/nsFind.cpp | 28 +- .../components/find/src/nsWebBrowserFind.cpp | 4 +- .../printingui/src/mac/nsPrintProgress.cpp | 4 +- .../src/mac/nsPrintProgressParams.cpp | 8 +- .../src/mac/nsPrintingPromptServiceX.mm | 4 +- .../printingui/src/os2/nsPrintProgress.cpp | 4 +- .../src/os2/nsPrintProgressParams.cpp | 8 +- .../src/os2/nsPrintingPromptService.cpp | 4 +- .../src/unixshared/nsPrintProgress.cpp | 4 +- .../src/unixshared/nsPrintProgressParams.cpp | 8 +- .../unixshared/nsPrintingPromptService.cpp | 4 +- .../printingui/src/win/nsPrintProgress.cpp | 4 +- .../src/win/nsPrintProgressParams.cpp | 8 +- .../src/win/nsPrintingPromptService.cpp | 4 +- .../src/nsWebBrowserPersist.cpp | 28 +- .../src/nsWebBrowserPersist.h | 10 +- .../windowwatcher/public/nsPromptUtils.h | 2 +- .../windowwatcher/src/nsDialogParamBlock.cpp | 4 +- .../windowwatcher/src/nsWindowWatcher.cpp | 4 +- embedding/tests/winEmbed/WebBrowserChrome.cpp | 12 +- embedding/tests/winEmbed/WebBrowserChrome.h | 4 +- embedding/tests/winEmbed/winEmbed.cpp | 4 +- extensions/auth/nsAuthGSSAPI.cpp | 6 +- extensions/auth/nsAuthSASL.cpp | 6 +- extensions/auth/nsAuthSSPI.cpp | 6 +- extensions/auth/nsAuthSambaNTLM.cpp | 6 +- extensions/auth/nsHttpNegotiateAuth.cpp | 6 +- extensions/cookie/nsCookiePermission.cpp | 2 +- extensions/cookie/nsPermissionManager.cpp | 8 +- extensions/cookie/nsPermissionManager.h | 4 +- extensions/cookie/nsPopupWindowManager.cpp | 2 +- extensions/gio/nsGIOProtocolHandler.cpp | 10 +- .../gnomevfs/nsGnomeVFSProtocolHandler.cpp | 8 +- extensions/permissions/nsContentBlocker.cpp | 2 +- .../pref/autoconfig/src/nsAutoConfig.cpp | 4 +- .../pref/autoconfig/src/nsReadConfig.cpp | 2 +- extensions/spellcheck/hunspell/src/csutil.cpp | 6 +- .../spellcheck/hunspell/src/mozHunspell.cpp | 30 +- .../spellcheck/hunspell/src/mozHunspell.h | 2 +- .../spellcheck/src/mozEnglishWordUtils.cpp | 32 +- .../spellcheck/src/mozEnglishWordUtils.h | 2 +- .../spellcheck/src/mozGenericWordUtils.cpp | 8 +- .../spellcheck/src/mozInlineSpellChecker.cpp | 2 +- .../spellcheck/src/mozInlineSpellWordUtil.cpp | 8 +- .../spellcheck/src/mozPersonalDictionary.cpp | 18 +- extensions/spellcheck/src/mozSpellChecker.cpp | 8 +- .../spellcheck/src/mozSpellI18NManager.cpp | 2 +- gfx/src/gfxCrashReporterUtils.cpp | 2 +- gfx/src/nsColor.cpp | 12 +- gfx/src/nsDeviceContext.cpp | 6 +- gfx/src/nsDeviceContext.h | 4 +- gfx/src/nsFont.cpp | 16 +- gfx/src/nsFontMetrics.cpp | 12 +- gfx/src/nsFontMetrics.h | 10 +- gfx/src/nsRenderingContext.cpp | 10 +- gfx/src/nsRenderingContext.h | 10 +- gfx/src/nsThebesFontEnumerator.cpp | 16 +- gfx/tests/gtest/gfxWordCacheTest.cpp | 2 +- gfx/thebes/gfxCoreTextShaper.cpp | 2 +- gfx/thebes/gfxCoreTextShaper.h | 2 +- gfx/thebes/gfxDWriteFontList.cpp | 10 +- gfx/thebes/gfxDWriteShaper.cpp | 2 +- gfx/thebes/gfxDWriteShaper.h | 2 +- gfx/thebes/gfxFT2Fonts.cpp | 10 +- gfx/thebes/gfxFT2Fonts.h | 4 +- gfx/thebes/gfxFont.cpp | 76 ++--- gfx/thebes/gfxFont.h | 38 +-- gfx/thebes/gfxFontUtils.cpp | 18 +- gfx/thebes/gfxFontUtils.h | 4 +- gfx/thebes/gfxGDIFont.cpp | 4 +- gfx/thebes/gfxGDIFont.h | 2 +- gfx/thebes/gfxGDIFontList.cpp | 10 +- gfx/thebes/gfxGDIShaper.cpp | 2 +- gfx/thebes/gfxGDIShaper.h | 2 +- gfx/thebes/gfxGraphiteShaper.cpp | 4 +- gfx/thebes/gfxGraphiteShaper.h | 4 +- gfx/thebes/gfxHarfBuzzShaper.cpp | 6 +- gfx/thebes/gfxHarfBuzzShaper.h | 4 +- gfx/thebes/gfxMacFont.cpp | 4 +- gfx/thebes/gfxMacFont.h | 4 +- gfx/thebes/gfxMacPlatformFontList.mm | 2 +- gfx/thebes/gfxOS2Fonts.cpp | 6 +- gfx/thebes/gfxOS2Fonts.h | 2 +- gfx/thebes/gfxPangoFonts.cpp | 6 +- gfx/thebes/gfxPlatform.cpp | 10 +- gfx/thebes/gfxPlatform.h | 2 +- gfx/thebes/gfxPlatformFontList.cpp | 2 +- gfx/thebes/gfxSVGGlyphs.cpp | 2 +- gfx/thebes/gfxScriptItemizer.cpp | 4 +- gfx/thebes/gfxScriptItemizer.h | 6 +- gfx/thebes/gfxUniscribeShaper.cpp | 16 +- gfx/thebes/gfxUniscribeShaper.h | 2 +- gfx/thebes/gfxUserFontSet.cpp | 2 +- gfx/thebes/gfxWindowsPlatform.cpp | 2 +- hal/HalWakeLock.cpp | 4 +- hal/cocoa/CocoaBattery.cpp | 2 +- hal/gonk/GonkHal.cpp | 2 +- hal/windows/WindowsGamepad.cpp | 2 +- image/src/RasterImage.cpp | 2 +- image/src/SVGDocumentWrapper.cpp | 2 +- image/src/SurfaceCache.cpp | 2 +- image/src/imgLoader.cpp | 6 +- intl/chardet/tools/GenCyrillicClass.cpp | 2 +- intl/hyphenation/src/nsHyphenationManager.cpp | 2 +- intl/hyphenation/src/nsHyphenator.cpp | 6 +- intl/locale/src/mac/nsDateTimeFormatMac.cpp | 2 +- intl/locale/src/nsCollation.cpp | 8 +- intl/locale/src/nsLocale.cpp | 14 +- intl/locale/src/nsLocaleService.cpp | 2 +- intl/locale/src/nsScriptableDateFormat.cpp | 16 +- intl/locale/src/os2/nsCollationOS2.cpp | 2 +- intl/locale/src/os2/nsDateTimeFormatOS2.cpp | 2 +- intl/locale/src/unix/nsDateTimeFormatUnix.cpp | 2 +- .../src/windows/nsDateTimeFormatWin.cpp | 8 +- intl/locale/src/windows/nsDateTimeFormatWin.h | 4 +- intl/locale/src/windows/nsWin32Locale.cpp | 4 +- intl/lwbrk/public/nsILineBreaker.h | 10 +- intl/lwbrk/public/nsIWordBreaker.h | 8 +- intl/lwbrk/src/nsCarbonBreaker.cpp | 2 +- intl/lwbrk/src/nsComplexBreaker.h | 2 +- intl/lwbrk/src/nsJISx4051LineBreaker.cpp | 68 ++--- intl/lwbrk/src/nsJISx4051LineBreaker.h | 8 +- intl/lwbrk/src/nsPangoBreaker.cpp | 2 +- intl/lwbrk/src/nsRuleBreaker.cpp | 2 +- intl/lwbrk/src/nsSampleWordBreaker.cpp | 10 +- intl/lwbrk/src/nsSampleWordBreaker.h | 10 +- intl/lwbrk/src/nsSemanticUnitScanner.cpp | 2 +- intl/lwbrk/src/nsUniscribeBreaker.cpp | 2 +- intl/lwbrk/src/th_char.h | 2 +- intl/strres/src/nsStringBundle.cpp | 62 ++-- intl/strres/src/nsStringBundle.h | 6 +- intl/strres/src/nsStringBundleService.h | 4 +- intl/uconv/public/nsIUnicodeDecoder.h | 4 +- intl/uconv/public/nsIUnicodeEncoder.h | 10 +- intl/uconv/src/nsCharsetConverterManager.cpp | 6 +- intl/uconv/src/nsConverterInputStream.cpp | 10 +- intl/uconv/src/nsConverterInputStream.h | 6 +- intl/uconv/src/nsConverterOutputStream.cpp | 4 +- intl/uconv/src/nsReplacementToUnicode.cpp | 2 +- intl/uconv/src/nsReplacementToUnicode.h | 2 +- intl/uconv/src/nsScriptableUConv.cpp | 4 +- intl/uconv/src/nsTextToSubURI.cpp | 12 +- intl/uconv/src/nsUTF8ConverterService.cpp | 2 +- intl/uconv/src/nsUTF8ToUnicode.cpp | 20 +- intl/uconv/src/nsUTF8ToUnicode.h | 2 +- intl/uconv/src/nsUTF8ToUnicodeSSE2.cpp | 6 +- intl/uconv/src/nsUnicodeToUTF8.cpp | 22 +- intl/uconv/src/nsUnicodeToUTF8.h | 8 +- intl/uconv/tests/TestUConv.cpp | 16 +- intl/uconv/tests/convperf.cpp | 14 +- intl/uconv/tests/nsTestUConv.cpp | 46 +-- intl/uconv/tests/nsconv.cpp | 2 +- intl/uconv/ucvcn/gbku.h | 8 +- intl/uconv/ucvcn/nsGBKConvUtil.cpp | 6 +- intl/uconv/ucvcn/nsGBKConvUtil.h | 4 +- intl/uconv/ucvcn/nsGBKToUnicode.cpp | 12 +- intl/uconv/ucvcn/nsGBKToUnicode.h | 10 +- intl/uconv/ucvcn/nsHZToUnicode.cpp | 2 +- intl/uconv/ucvcn/nsHZToUnicode.h | 2 +- intl/uconv/ucvcn/nsISO2022CNToUnicode.cpp | 146 ++++----- intl/uconv/ucvcn/nsISO2022CNToUnicode.h | 6 +- intl/uconv/ucvcn/nsUnicodeToGB2312V2.cpp | 4 +- intl/uconv/ucvcn/nsUnicodeToGB2312V2.h | 4 +- intl/uconv/ucvcn/nsUnicodeToGBK.cpp | 22 +- intl/uconv/ucvcn/nsUnicodeToGBK.h | 14 +- intl/uconv/ucvcn/nsUnicodeToHZ.cpp | 4 +- intl/uconv/ucvcn/nsUnicodeToHZ.h | 4 +- intl/uconv/ucvja/nsJapaneseToUnicode.cpp | 74 ++--- intl/uconv/ucvja/nsJapaneseToUnicode.h | 8 +- intl/uconv/ucvja/nsUnicodeToISO2022JP.cpp | 18 +- intl/uconv/ucvja/nsUnicodeToISO2022JP.h | 4 +- intl/uconv/ucvko/nsISO2022KRToUnicode.cpp | 30 +- intl/uconv/ucvko/nsISO2022KRToUnicode.h | 2 +- intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp | 26 +- intl/uconv/ucvlatin/nsUTF16ToUnicode.h | 12 +- intl/uconv/ucvlatin/nsUTF7ToUnicode.cpp | 24 +- intl/uconv/ucvlatin/nsUTF7ToUnicode.h | 6 +- intl/uconv/ucvlatin/nsUnicodeToTSCII.cpp | 22 +- intl/uconv/ucvlatin/nsUnicodeToTSCII.h | 14 +- intl/uconv/ucvlatin/nsUnicodeToUTF16.cpp | 22 +- intl/uconv/ucvlatin/nsUnicodeToUTF16.h | 12 +- intl/uconv/ucvlatin/nsUnicodeToUTF7.cpp | 28 +- intl/uconv/ucvlatin/nsUnicodeToUTF7.h | 10 +- intl/uconv/util/nsUCSupport.cpp | 38 +-- intl/uconv/util/nsUCSupport.h | 32 +- intl/uconv/util/nsUnicodeDecodeHelper.cpp | 24 +- intl/uconv/util/nsUnicodeDecodeHelper.h | 8 +- intl/uconv/util/nsUnicodeEncodeHelper.cpp | 18 +- intl/uconv/util/nsUnicodeEncodeHelper.h | 4 +- intl/unicharutil/public/nsICaseConversion.h | 14 +- intl/unicharutil/src/normalization_data.h | 8 +- intl/unicharutil/src/nsCaseConversionImp2.cpp | 18 +- intl/unicharutil/src/nsCaseConversionImp2.h | 12 +- intl/unicharutil/src/nsEntityConverter.cpp | 12 +- intl/unicharutil/src/nsEntityConverter.h | 8 +- intl/unicharutil/src/nsSaveAsCharset.cpp | 6 +- intl/unicharutil/src/nsSaveAsCharset.h | 4 +- intl/unicharutil/src/nsUnicodeNormalizer.cpp | 8 +- intl/unicharutil/tests/NormalizationTest.cpp | 12 +- intl/unicharutil/tests/UnicharSelfTest.cpp | 48 +-- intl/unicharutil/util/nsBidiUtils.cpp | 6 +- intl/unicharutil/util/nsBidiUtils.h | 4 +- intl/unicharutil/util/nsSpecialCasingData.h | 6 +- intl/unicharutil/util/nsUnicharUtils.cpp | 32 +- intl/unicharutil/util/nsUnicharUtils.h | 14 +- intl/unicharutil/util/nsUnicodeProperties.h | 12 +- ipc/glue/IPCMessageUtils.h | 6 +- ipc/glue/WindowsMessageLoop.cpp | 6 +- js/jsd/jsd_xpc.cpp | 8 +- js/src/ctypes/Library.cpp | 2 +- js/xpconnect/loader/mozJSComponentLoader.cpp | 4 +- js/xpconnect/src/XPCComponents.cpp | 36 +-- js/xpconnect/src/XPCConvert.cpp | 24 +- js/xpconnect/src/XPCJSID.cpp | 6 +- js/xpconnect/src/XPCJSRuntime.cpp | 4 +- js/xpconnect/src/XPCLocale.cpp | 10 +- js/xpconnect/src/XPCQuickStubs.cpp | 4 +- js/xpconnect/src/XPCQuickStubs.h | 2 +- js/xpconnect/src/XPCShellImpl.cpp | 4 +- js/xpconnect/src/XPCVariant.cpp | 12 +- js/xpconnect/src/XPCWrappedJSClass.cpp | 8 +- js/xpconnect/src/nsScriptError.cpp | 2 +- js/xpconnect/src/nsXPConnect.cpp | 8 +- js/xpconnect/src/xpcprivate.h | 8 +- .../components/native/xpctest_params.cpp | 20 +- layout/base/nsBidi.cpp | 14 +- layout/base/nsBidi.h | 24 +- layout/base/nsBidiPresUtils.cpp | 64 ++-- layout/base/nsBidiPresUtils.h | 24 +- layout/base/nsCSSFrameConstructor.cpp | 4 +- layout/base/nsCaret.cpp | 2 +- layout/base/nsCounterManager.cpp | 2 +- layout/base/nsDocumentViewer.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 6 +- layout/base/nsLayoutUtils.h | 6 +- layout/base/nsPresContext.cpp | 2 +- layout/base/nsPresShell.cpp | 2 +- layout/build/nsLayoutModule.cpp | 2 +- layout/forms/nsComboboxControlFrame.cpp | 2 +- layout/forms/nsListControlFrame.cpp | 2 +- layout/generic/MathVariantTextRunFactory.cpp | 2 +- layout/generic/nsBlockFrame.cpp | 6 +- layout/generic/nsBulletFrame.cpp | 118 ++++---- layout/generic/nsFrame.cpp | 2 +- layout/generic/nsFrameSetFrame.cpp | 4 +- layout/generic/nsFrameUtil.cpp | 12 +- layout/generic/nsImageFrame.cpp | 6 +- layout/generic/nsImageFrame.h | 2 +- layout/generic/nsPageFrame.cpp | 8 +- layout/generic/nsTextFrame.cpp | 52 ++-- layout/generic/nsTextFrameUtils.cpp | 18 +- layout/generic/nsTextFrameUtils.h | 6 +- layout/generic/nsTextRunTransformations.cpp | 8 +- layout/generic/nsTextRunTransformations.h | 6 +- layout/inspector/inCSSValueSearch.cpp | 14 +- layout/inspector/inDOMUtils.cpp | 12 +- layout/inspector/inDOMView.cpp | 6 +- layout/mathml/nsMathMLChar.cpp | 36 +-- layout/mathml/nsMathMLChar.h | 6 +- layout/mathml/nsMathMLContainerFrame.cpp | 12 +- layout/mathml/nsMathMLContainerFrame.h | 6 +- layout/mathml/nsMathMLFrame.cpp | 4 +- layout/mathml/nsMathMLOperators.cpp | 14 +- layout/mathml/nsMathMLmencloseFrame.cpp | 6 +- layout/mathml/nsMathMLmfencedFrame.cpp | 6 +- layout/mathml/nsMathMLmoFrame.cpp | 8 +- layout/mathml/nsMathMLmpaddedFrame.cpp | 2 +- layout/mathml/nsMathMLmrootFrame.cpp | 4 +- layout/mathml/nsMathMLmtableFrame.cpp | 10 +- layout/printing/nsPrintData.h | 2 +- layout/printing/nsPrintEngine.cpp | 18 +- layout/printing/nsPrintEngine.h | 4 +- layout/style/Declaration.cpp | 78 ++--- layout/style/ErrorReporter.cpp | 20 +- layout/style/ErrorReporter.h | 8 +- layout/style/Loader.cpp | 2 +- layout/style/StyleRule.cpp | 92 +++--- layout/style/StyleRule.h | 14 +- layout/style/nsCSSParser.cpp | 84 +++--- layout/style/nsCSSRuleProcessor.cpp | 24 +- layout/style/nsCSSRules.cpp | 2 +- layout/style/nsCSSScanner.cpp | 14 +- layout/style/nsCSSScanner.h | 6 +- layout/style/nsCSSValue.cpp | 38 +-- layout/style/nsCSSValue.h | 22 +- layout/style/nsComputedDOMStyle.cpp | 6 +- layout/style/nsDOMCSSValueList.cpp | 2 +- layout/style/nsLayoutStylesheetCache.cpp | 2 +- layout/style/nsROCSSPrimitiveValue.cpp | 4 +- layout/style/nsROCSSPrimitiveValue.h | 2 +- layout/style/nsRuleNode.cpp | 2 +- layout/style/nsStyleAnimation.h | 6 +- layout/style/nsStyleStruct.cpp | 8 +- layout/style/nsStyleStruct.h | 8 +- layout/style/nsStyleUtil.cpp | 38 +-- layout/style/nsStyleUtil.h | 2 +- layout/xul/nsBoxObject.cpp | 10 +- layout/xul/nsMenuBarFrame.cpp | 4 +- layout/xul/nsMenuPopupFrame.cpp | 2 +- layout/xul/nsPopupBoxObject.cpp | 6 +- layout/xul/nsTextBoxFrame.cpp | 12 +- layout/xul/nsXULPopupManager.cpp | 2 +- layout/xul/tree/nsTreeBodyFrame.cpp | 6 +- layout/xul/tree/nsTreeColumns.cpp | 2 +- layout/xul/tree/nsTreeContentView.cpp | 6 +- .../src/peerconnection/PeerConnectionCtx.cpp | 2 +- mfbt/HashFunctions.h | 2 +- modules/libjar/nsJAR.cpp | 2 +- modules/libpref/public/Preferences.h | 2 +- modules/libpref/src/Preferences.cpp | 6 +- modules/libpref/src/nsPrefBranch.cpp | 10 +- modules/libpref/src/nsPrefBranch.h | 8 +- modules/libpref/src/prefread.h | 2 +- netwerk/base/src/Seer.cpp | 2 +- netwerk/base/src/nsAutodialQt.cpp | 2 +- netwerk/base/src/nsAutodialQt.h | 2 +- netwerk/base/src/nsAutodialWin.cpp | 2 +- netwerk/base/src/nsAutodialWin.h | 2 +- netwerk/base/src/nsIOService.cpp | 2 +- netwerk/base/src/nsIncrementalDownload.cpp | 2 +- netwerk/base/src/nsNativeConnectionHelper.cpp | 2 +- netwerk/base/src/nsNativeConnectionHelper.h | 2 +- netwerk/base/src/nsProtocolProxyService.cpp | 2 +- .../base/src/nsSocketTransportService2.cpp | 2 +- netwerk/base/src/nsStandardURL.cpp | 2 +- netwerk/base/src/nsStreamTransportService.cpp | 2 +- netwerk/base/src/nsURLHelper.cpp | 2 +- netwerk/base/src/nsURLHelperOS2.cpp | 2 +- netwerk/base/src/nsURLHelperOSX.cpp | 4 +- netwerk/base/src/nsURLHelperWin.cpp | 2 +- netwerk/cache/nsApplicationCacheService.cpp | 2 +- netwerk/cache/nsCacheService.cpp | 2 +- netwerk/cache2/CacheObserver.cpp | 2 +- netwerk/cookie/CookieServiceChild.cpp | 2 +- netwerk/cookie/nsCookieService.cpp | 6 +- netwerk/cookie/nsCookieService.h | 2 +- netwerk/dns/ChildDNSService.cpp | 2 +- netwerk/dns/nsDNSService2.cpp | 2 +- netwerk/dns/nsIDNService.cpp | 22 +- netwerk/dns/nsIDNService.h | 2 +- .../protocol/ftp/nsFtpConnectionThread.cpp | 4 +- netwerk/protocol/ftp/nsFtpProtocolHandler.cpp | 2 +- netwerk/protocol/http/HttpChannelParent.cpp | 2 +- netwerk/protocol/http/nsHttpAuthCache.cpp | 22 +- netwerk/protocol/http/nsHttpAuthCache.h | 30 +- netwerk/protocol/http/nsHttpBasicAuth.cpp | 6 +- .../http/nsHttpChannelAuthProvider.cpp | 22 +- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 2 +- netwerk/protocol/http/nsHttpDigestAuth.cpp | 6 +- netwerk/protocol/http/nsHttpHandler.cpp | 2 +- netwerk/protocol/http/nsHttpNTLMAuth.cpp | 6 +- netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp | 4 +- netwerk/sctp/datachannel/DataChannel.cpp | 2 +- .../converters/mozTXTToHTMLConv.cpp | 88 +++--- .../streamconv/converters/mozTXTToHTMLConv.h | 34 +-- netwerk/streamconv/converters/nsDirIndex.cpp | 4 +- .../converters/nsDirIndexParser.cpp | 12 +- .../streamconv/converters/nsIndexedToHTML.cpp | 20 +- .../streamconv/converters/nsTXTToHTMLConv.cpp | 10 +- netwerk/system/mac/nsNetworkLinkService.mm | 2 +- netwerk/system/qt/nsQtNetworkLinkService.cpp | 2 +- netwerk/system/win32/nsNotifyAddrListener.cpp | 2 +- netwerk/test/TestHttp.cpp | 2 +- netwerk/test/TestIDN.cpp | 2 +- netwerk/test/TestIncrementalDownload.cpp | 2 +- netwerk/test/TestPageLoad.cpp | 2 +- netwerk/test/TestProtocols.cpp | 28 +- netwerk/test/TestStreamChannel.cpp | 2 +- netwerk/test/TestThreadedIO.cpp | 2 +- netwerk/wifi/nsWifiMonitor.cpp | 2 +- netwerk/wifi/nsWifiMonitorGonk.cpp | 2 +- parser/expat/expat_config.h | 4 +- parser/expat/lib/expat_external.h | 2 +- parser/expat/lib/xmlparse.c | 2 +- parser/html/nsHtml5ArrayCopy.h | 8 +- parser/html/nsHtml5Atom.cpp | 12 +- parser/html/nsHtml5AttributeName.cpp | 4 +- parser/html/nsHtml5AttributeName.h | 4 +- parser/html/nsHtml5DependentUTF16Buffer.cpp | 4 +- parser/html/nsHtml5ElementName.cpp | 4 +- parser/html/nsHtml5ElementName.h | 4 +- parser/html/nsHtml5Highlighter.cpp | 36 +-- parser/html/nsHtml5Highlighter.h | 24 +- parser/html/nsHtml5MetaScanner.cpp | 22 +- parser/html/nsHtml5MetaScanner.h | 10 +- parser/html/nsHtml5Module.cpp | 2 +- parser/html/nsHtml5NamedCharacters.cpp | 14 +- parser/html/nsHtml5NamedCharacters.h | 6 +- parser/html/nsHtml5NamedCharactersInclude.h | 2 +- parser/html/nsHtml5OwningUTF16Buffer.cpp | 4 +- parser/html/nsHtml5OwningUTF16Buffer.h | 2 +- parser/html/nsHtml5Portability.cpp | 26 +- parser/html/nsHtml5Portability.h | 10 +- parser/html/nsHtml5SpeculativeLoad.h | 2 +- parser/html/nsHtml5StreamParser.cpp | 8 +- parser/html/nsHtml5StreamParser.h | 2 +- parser/html/nsHtml5Tokenizer.cpp | 136 ++++----- parser/html/nsHtml5Tokenizer.h | 80 ++--- parser/html/nsHtml5TokenizerCppSupplement.h | 20 +- parser/html/nsHtml5TokenizerHSupplement.h | 16 +- parser/html/nsHtml5TreeBuilder.cpp | 14 +- parser/html/nsHtml5TreeBuilder.h | 18 +- parser/html/nsHtml5TreeBuilderCppSupplement.h | 32 +- parser/html/nsHtml5TreeBuilderHSupplement.h | 2 +- parser/html/nsHtml5TreeOperation.cpp | 22 +- parser/html/nsHtml5TreeOperation.h | 18 +- parser/html/nsHtml5UTF16Buffer.cpp | 2 +- parser/html/nsHtml5UTF16Buffer.h | 4 +- parser/html/nsHtml5UTF16BufferCppSupplement.h | 4 +- parser/html/nsHtml5UTF16BufferHSupplement.h | 2 +- parser/htmlparser/public/nsHTMLTags.h | 6 +- parser/htmlparser/public/nsIParserService.h | 4 +- parser/htmlparser/public/nsParserConstants.h | 58 ++-- parser/htmlparser/public/nsScannerString.h | 38 +-- parser/htmlparser/src/nsExpatDriver.cpp | 124 ++++---- parser/htmlparser/src/nsExpatDriver.h | 66 ++-- parser/htmlparser/src/nsHTMLTags.cpp | 284 +++++++++--------- parser/htmlparser/src/nsParser.cpp | 44 +-- parser/htmlparser/src/nsParserService.cpp | 2 +- parser/htmlparser/src/nsParserService.h | 4 +- parser/htmlparser/src/nsScanner.cpp | 70 ++--- parser/htmlparser/src/nsScanner.h | 20 +- parser/htmlparser/src/nsScannerString.cpp | 24 +- parser/xml/src/nsSAXXMLReader.cpp | 66 ++-- parser/xml/src/nsSAXXMLReader.h | 2 +- rdf/base/idl/nsIRDFLiteral.idl | 2 +- rdf/base/src/nsContainerEnumerator.cpp | 2 +- rdf/base/src/nsRDFContainer.cpp | 6 +- rdf/base/src/nsRDFContentSink.cpp | 100 +++--- rdf/base/src/nsRDFService.cpp | 48 +-- rdf/base/src/nsRDFXMLSerializer.cpp | 14 +- rdf/base/src/rdfTriplesSerializer.cpp | 2 +- rdf/datasource/src/nsFileSystemDataSource.cpp | 12 +- rdf/datasource/src/nsLocalStore.cpp | 2 +- .../boot/src/nsSecureBrowserUIImpl.cpp | 4 +- .../boot/src/nsSecurityWarningDialogs.cpp | 6 +- .../boot/src/nsSecurityWarningDialogs.h | 8 +- .../boot/src/nsSiteSecurityService.cpp | 2 +- security/manager/pki/src/nsASN1Tree.cpp | 6 +- .../manager/pki/src/nsFormSigningDialog.cpp | 4 +- security/manager/pki/src/nsNSSDialogs.cpp | 18 +- security/manager/pki/src/nsPKIParamBlock.cpp | 4 +- .../manager/ssl/src/PSMContentDownloader.h | 8 +- security/manager/ssl/src/SharedSSLState.cpp | 2 +- .../manager/ssl/src/TransportSecurityInfo.cpp | 14 +- .../manager/ssl/src/TransportSecurityInfo.h | 2 +- .../manager/ssl/src/nsCertOverrideService.cpp | 4 +- security/manager/ssl/src/nsCertPicker.cpp | 12 +- security/manager/ssl/src/nsCertTree.cpp | 10 +- .../ssl/src/nsCertVerificationThread.cpp | 4 +- .../manager/ssl/src/nsClientAuthRemember.cpp | 2 +- security/manager/ssl/src/nsCrypto.cpp | 8 +- security/manager/ssl/src/nsKeygenHandler.cpp | 8 +- security/manager/ssl/src/nsNSSCallbacks.cpp | 6 +- security/manager/ssl/src/nsNSSCertHelper.cpp | 16 +- security/manager/ssl/src/nsNSSCertificate.cpp | 46 +-- .../manager/ssl/src/nsNSSCertificateDB.cpp | 14 +- security/manager/ssl/src/nsNSSCertificateDB.h | 2 +- .../ssl/src/nsNSSCertificateFakeTransport.cpp | 4 +- security/manager/ssl/src/nsNSSComponent.cpp | 8 +- security/manager/ssl/src/nsNSSComponent.h | 8 +- security/manager/ssl/src/nsNSSErrors.cpp | 2 +- security/manager/ssl/src/nsNSSIOLayer.cpp | 14 +- security/manager/ssl/src/nsNTLMAuthModule.cpp | 14 +- security/manager/ssl/src/nsPK11TokenDB.cpp | 20 +- security/manager/ssl/src/nsPKCS11Slot.cpp | 22 +- security/manager/ssl/src/nsPKCS12Blob.cpp | 8 +- security/manager/ssl/src/nsPKCS12Blob.h | 4 +- .../manager/ssl/src/nsUsageArrayHelper.cpp | 4 +- security/manager/ssl/src/nsUsageArrayHelper.h | 4 +- security/manager/ssl/src/nsVerificationJob.h | 2 +- startupcache/StartupCache.cpp | 2 +- storage/public/mozIStorageStatement.idl | 4 +- storage/public/mozIStorageValueArray.idl | 4 +- storage/src/FileSystemModule.cpp | 6 +- storage/src/SQLCollations.cpp | 16 +- storage/src/SQLCollations.h | 16 +- storage/src/StorageBaseStatementInternal.cpp | 6 +- storage/src/StorageBaseStatementInternal.h | 4 +- storage/src/VacuumManager.cpp | 2 +- storage/src/Variant_inl.h | 6 +- storage/src/mozStorageArgValueArray.cpp | 6 +- storage/src/mozStorageRow.cpp | 4 +- storage/src/mozStorageSQLFunctions.cpp | 32 +- storage/src/mozStorageService.cpp | 2 +- storage/src/mozStorageStatement.cpp | 8 +- storage/test/test_AsXXX_helpers.cpp | 6 +- toolkit/components/alerts/nsXULAlerts.cpp | 2 +- .../autocomplete/nsAutoCompleteController.cpp | 10 +- .../components/commandlines/nsCommandLine.cpp | 6 +- toolkit/components/ctypes/ctypes.cpp | 2 +- .../components/ctypes/tests/jsctypes-test.cpp | 6 +- .../components/ctypes/tests/jsctypes-test.h | 4 +- .../diskspacewatcher/DiskSpaceWatcher.cpp | 6 +- .../downloads/nsDownloadManager.cpp | 16 +- .../components/downloads/nsDownloadManager.h | 10 +- .../components/downloads/nsDownloadProxy.h | 2 +- toolkit/components/filepicker/nsFileView.cpp | 12 +- .../FinalizationWitnessService.cpp | 2 +- toolkit/components/intl/nsCharsetMenu.cpp | 20 +- .../maintenanceservice/workmonitor.cpp | 2 +- toolkit/components/places/Database.cpp | 2 +- toolkit/components/places/Helpers.cpp | 2 +- toolkit/components/places/History.cpp | 4 +- .../components/places/nsAnnotationService.cpp | 2 +- toolkit/components/places/nsNavBookmarks.cpp | 2 +- toolkit/components/places/nsNavHistory.cpp | 14 +- toolkit/components/places/nsNavHistory.h | 4 +- .../components/places/nsNavHistoryQuery.cpp | 6 +- .../places/tests/cpp/places_test_harness.h | 4 +- .../places/tests/cpp/test_IHistory.cpp | 4 +- .../components/remote/nsXRemoteService.cpp | 2 +- toolkit/components/startup/nsAppStartup.cpp | 2 +- toolkit/components/startup/nsUserInfoMac.mm | 2 +- toolkit/components/startup/nsUserInfoOS2.cpp | 2 +- toolkit/components/startup/nsUserInfoUnix.cpp | 2 +- toolkit/components/startup/nsUserInfoWin.cpp | 2 +- .../statusfilter/nsBrowserStatusFilter.cpp | 2 +- .../typeaheadfind/nsTypeAheadFind.cpp | 2 +- .../nsUrlClassifierDBService.cpp | 2 +- .../nsUrlClassifierStreamUpdater.cpp | 2 +- toolkit/crashreporter/mac_utils.mm | 4 +- toolkit/crashreporter/nsExceptionHandler.cpp | 2 +- toolkit/mozapps/update/updater/updater.cpp | 2 +- .../system/dbus/nsNetworkManagerListener.cpp | 2 +- toolkit/system/gnome/nsAlertsIconListener.cpp | 2 +- toolkit/xre/ProfileReset.cpp | 4 +- toolkit/xre/nsAppRunner.cpp | 16 +- toolkit/xre/nsNativeAppSupportOS2.cpp | 6 +- toolkit/xre/nsNativeAppSupportWin.cpp | 14 +- toolkit/xre/nsWindowsRestart.cpp | 4 +- toolkit/xre/nsXREDirProvider.cpp | 6 +- tools/profiler/JSCustomObjectBuilder.cpp | 2 +- tools/profiler/nsProfiler.cpp | 2 +- uriloader/base/nsDocLoader.cpp | 4 +- uriloader/base/nsDocLoader.h | 2 +- .../exthandler/mac/nsLocalHandlerAppMac.h | 2 +- .../exthandler/mac/nsOSHelperAppService.h | 2 +- .../exthandler/mac/nsOSHelperAppService.mm | 8 +- .../exthandler/nsExternalHelperAppService.cpp | 38 +-- .../exthandler/nsExternalHelperAppService.h | 2 +- uriloader/exthandler/nsLocalHandlerApp.h | 2 +- uriloader/exthandler/nsMIMEInfoImpl.cpp | 2 +- uriloader/exthandler/os2/nsMIMEInfoOS2.cpp | 2 +- .../exthandler/os2/nsOSHelperAppService.cpp | 10 +- uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 2 +- .../exthandler/unix/nsOSHelperAppService.cpp | 12 +- .../exthandler/unix/nsOSHelperAppService.h | 2 +- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 2 +- .../exthandler/win/nsOSHelperAppService.cpp | 14 +- .../exthandler/win/nsOSHelperAppService.h | 4 +- .../prefetch/nsOfflineCacheUpdateService.cpp | 4 +- uriloader/prefetch/nsPrefetchService.cpp | 4 +- widget/ContentEvents.h | 4 +- widget/LookAndFeel.h | 2 +- widget/android/AndroidBridge.cpp | 4 +- widget/android/AndroidBridge.h | 4 +- widget/android/AndroidJavaWrappers.cpp | 2 +- widget/android/nsAppShell.cpp | 4 +- widget/android/nsClipboard.cpp | 2 +- widget/android/nsDeviceContextAndroid.cpp | 2 +- widget/android/nsDeviceContextAndroid.h | 2 +- widget/android/nsLookAndFeel.cpp | 4 +- widget/android/nsLookAndFeel.h | 2 +- widget/android/nsWindow.cpp | 4 +- widget/cocoa/TextInputHandler.h | 4 +- widget/cocoa/TextInputHandler.mm | 22 +- widget/cocoa/nsClipboard.mm | 8 +- widget/cocoa/nsDeviceContextSpecX.h | 2 +- widget/cocoa/nsDeviceContextSpecX.mm | 2 +- widget/cocoa/nsDragService.mm | 8 +- widget/cocoa/nsLookAndFeel.h | 2 +- widget/cocoa/nsPrintDialogX.mm | 6 +- widget/gonk/GonkMemoryPressureMonitoring.cpp | 2 +- widget/gonk/nsAppShell.cpp | 12 +- widget/gonk/nsLookAndFeel.cpp | 4 +- widget/gonk/nsLookAndFeel.h | 2 +- widget/gtk/nsClipboard.cpp | 26 +- widget/gtk/nsDeviceContextSpecG.cpp | 12 +- widget/gtk/nsDeviceContextSpecG.h | 2 +- widget/gtk/nsDragService.cpp | 18 +- widget/gtk/nsLookAndFeel.cpp | 4 +- widget/gtk/nsLookAndFeel.h | 4 +- widget/gtk/nsNativeThemeGTK.cpp | 2 +- widget/gtk/nsPrintDialogGTK.cpp | 4 +- widget/gtk/nsPrintSettingsGTK.cpp | 12 +- widget/gtk/nsPrintSettingsGTK.h | 12 +- widget/gtk/nsWindow.cpp | 2 +- widget/nsIDeviceContextSpec.h | 2 +- widget/os2/nsClipboard.cpp | 4 +- widget/os2/nsDeviceContextSpecOS2.cpp | 18 +- widget/os2/nsDeviceContextSpecOS2.h | 2 +- widget/os2/nsDragService.cpp | 6 +- widget/os2/nsFilePicker.cpp | 6 +- widget/os2/nsFilePicker.h | 2 +- widget/os2/nsOS2Uni.cpp | 4 +- widget/os2/nsOS2Uni.h | 4 +- widget/os2/nsRwsService.cpp | 12 +- widget/os2/os2FrameWindow.cpp | 2 +- widget/qt/nsDeviceContextSpecQt.cpp | 12 +- widget/qt/nsDeviceContextSpecQt.h | 2 +- widget/qt/nsLookAndFeel.cpp | 2 +- widget/qt/nsPrintSettingsQt.cpp | 18 +- widget/qt/nsPrintSettingsQt.h | 12 +- widget/shared/SharedWidgetUtils.cpp | 2 +- widget/shared/WidgetUtils.h | 2 +- widget/tests/TestWinTSF.cpp | 8 +- widget/windows/GfxInfo.cpp | 6 +- widget/windows/JumpListBuilder.cpp | 2 +- widget/windows/KeyboardLayout.cpp | 54 ++-- widget/windows/KeyboardLayout.h | 20 +- widget/windows/nsClipboard.cpp | 30 +- widget/windows/nsColorPicker.cpp | 2 +- widget/windows/nsDataObj.cpp | 34 +-- widget/windows/nsDataObjCollection.cpp | 20 +- widget/windows/nsDeviceContextSpecWin.cpp | 18 +- widget/windows/nsDeviceContextSpecWin.h | 2 +- widget/windows/nsFilePicker.cpp | 10 +- widget/windows/nsFilePicker.h | 2 +- widget/windows/nsIMM32Handler.cpp | 2 +- widget/windows/nsLookAndFeel.cpp | 6 +- widget/windows/nsLookAndFeel.h | 2 +- widget/windows/nsPrintSettingsWin.cpp | 12 +- widget/windows/nsTextStore.cpp | 2 +- widget/windows/nsWindow.cpp | 2 +- widget/windows/tests/TestWinDND.cpp | 16 +- widget/windows/winrt/MetroAppShell.cpp | 4 +- widget/windows/winrt/MetroUtils.cpp | 2 +- widget/windows/winrt/MetroUtils.h | 4 +- widget/windows/winrt/MetroWidget.cpp | 4 +- .../windows/winrt/UIAAccessibilityBridge.cpp | 2 +- widget/windows/winrt/nsMetroFilePicker.cpp | 8 +- widget/xpwidgets/GfxInfoBase.cpp | 4 +- widget/xpwidgets/nsBaseAppShell.cpp | 2 +- widget/xpwidgets/nsBaseWidget.cpp | 4 +- .../xpwidgets/nsClipboardPrivacyHandler.cpp | 2 +- widget/xpwidgets/nsIdleService.cpp | 2 +- widget/xpwidgets/nsPrimitiveHelpers.cpp | 20 +- widget/xpwidgets/nsPrimitiveHelpers.h | 4 +- widget/xpwidgets/nsPrintOptionsImpl.cpp | 22 +- widget/xpwidgets/nsPrintSettingsImpl.cpp | 64 ++-- widget/xpwidgets/nsPrintSettingsImpl.h | 4 +- widget/xpwidgets/nsXPLookAndFeel.cpp | 6 +- widget/xpwidgets/nsXPLookAndFeel.h | 4 +- xpcom/base/AvailableMemoryTracker.cpp | 2 +- xpcom/base/nsConsoleMessage.cpp | 4 +- xpcom/base/nsConsoleMessage.h | 2 +- xpcom/base/nsConsoleService.cpp | 2 +- xpcom/base/nsMemoryImpl.cpp | 4 +- xpcom/base/nsMemoryImpl.h | 6 +- xpcom/base/nsMemoryInfoDumper.cpp | 2 +- xpcom/base/nsMemoryReporterManager.cpp | 4 +- xpcom/base/nsrootidl.idl | 4 +- xpcom/build/nsXPCOMPrivate.h | 12 +- xpcom/build/nsXPCOMStrings.cpp | 16 +- xpcom/components/ManifestParser.cpp | 2 +- xpcom/ds/CharTokenizer.h | 2 +- xpcom/ds/nsAtomTable.cpp | 36 +-- xpcom/ds/nsCRT.cpp | 12 +- xpcom/ds/nsCRT.h | 18 +- xpcom/ds/nsCharSeparatedTokenizer.h | 16 +- xpcom/ds/nsExpirationTracker.h | 2 +- xpcom/ds/nsHashtable.cpp | 16 +- xpcom/ds/nsHashtable.h | 6 +- xpcom/ds/nsIAtom.idl | 6 +- xpcom/ds/nsObserverList.cpp | 2 +- xpcom/ds/nsObserverList.h | 2 +- xpcom/ds/nsObserverService.cpp | 2 +- xpcom/ds/nsPersistentProperties.cpp | 48 +-- xpcom/ds/nsStaticNameTable.cpp | 2 +- xpcom/ds/nsStringEnumerator.h | 2 +- xpcom/ds/nsSupportsPrimitives.cpp | 2 +- xpcom/ds/nsVariant.cpp | 50 +-- xpcom/ds/nsVariant.h | 16 +- xpcom/ds/nsWhitespaceTokenizer.h | 12 +- xpcom/ds/nsWindowsRegKey.cpp | 2 +- xpcom/glue/nsCRTGlue.cpp | 28 +- xpcom/glue/nsCRTGlue.h | 30 +- xpcom/glue/nsCategoryCache.cpp | 2 +- xpcom/glue/nsHashKeys.h | 14 +- xpcom/glue/nsStringAPI.cpp | 32 +- xpcom/glue/nsStringAPI.h | 22 +- xpcom/glue/nsTextFormatter.cpp | 94 +++--- xpcom/glue/nsTextFormatter.h | 16 +- xpcom/glue/nsVersionComparator.cpp | 2 +- xpcom/glue/nsVersionComparator.h | 8 +- xpcom/glue/standalone/nsXPCOMGlue.cpp | 12 +- xpcom/io/SpecialSystemDirectory.cpp | 2 +- xpcom/io/nsAnonymousTemporaryFile.cpp | 2 +- xpcom/io/nsBinaryStream.cpp | 36 +-- xpcom/io/nsEscape.cpp | 12 +- xpcom/io/nsEscape.h | 4 +- xpcom/io/nsIBinaryOutputStream.idl | 2 +- xpcom/io/nsIConverterInputStream.idl | 4 +- xpcom/io/nsIConverterOutputStream.idl | 2 +- xpcom/io/nsIUnicharInputStream.idl | 4 +- xpcom/io/nsIUnicharOutputStream.idl | 2 +- xpcom/io/nsLinebreakConverter.cpp | 8 +- xpcom/io/nsLinebreakConverter.h | 4 +- xpcom/io/nsLocalFile.h | 20 +- xpcom/io/nsLocalFileCommon.cpp | 18 +- xpcom/io/nsLocalFileOS2.cpp | 2 +- xpcom/io/nsLocalFileUnix.cpp | 4 +- xpcom/io/nsLocalFileWin.cpp | 24 +- xpcom/io/nsLocalFileWin.h | 2 +- xpcom/io/nsNativeCharsetUtils.cpp | 42 +-- xpcom/io/nsUnicharInputStream.cpp | 14 +- xpcom/io/nsWildCard.cpp | 4 +- xpcom/io/nsWildCard.h | 4 +- xpcom/reflect/xptcall/public/xptcall.h | 2 +- .../src/md/unix/xptcstubs_alpha_openbsd.cpp | 2 +- .../src/md/unix/xptcstubs_linux_alpha.cpp | 2 +- xpcom/sample/nsSample.cpp | 12 +- xpcom/sample/nsSample.h | 2 +- xpcom/string/public/nsCharTraits.h | 20 +- xpcom/string/public/nsReadableUtils.h | 54 ++-- xpcom/string/public/nsString.h | 20 +- xpcom/string/public/nsStringFwd.h | 2 +- xpcom/string/public/nsTString.h | 12 +- xpcom/string/public/nsUTF8Utils.h | 38 +-- xpcom/string/public/nsXPCOMStrings.h | 20 +- .../public/string-template-def-unichar.h | 2 +- xpcom/string/src/nsReadableUtils.cpp | 54 ++-- xpcom/string/src/nsStringObsolete.cpp | 98 +++--- xpcom/string/src/nsSubstring.cpp | 8 +- xpcom/string/src/nsTStringObsolete.cpp | 4 +- xpcom/string/src/nsUTF8UtilsSSE2.cpp | 6 +- xpcom/tests/CvtURL.cpp | 2 +- xpcom/tests/TestCRT.cpp | 4 +- xpcom/tests/TestEncoding.cpp | 8 +- xpcom/tests/TestObserverService.cpp | 2 +- xpcom/tests/TestStringAPI.cpp | 20 +- xpcom/tests/TestStrings.cpp | 2 +- xpcom/tests/TestTextFormatter.cpp | 8 +- xpcom/tests/TestXPIDLString.cpp | 2 +- xpcom/tests/UTFStrings.h | 2 +- xpcom/tests/external/TestMinStringAPI.cpp | 6 +- xpcom/threads/LazyIdleThread.cpp | 2 +- xpcom/threads/TimerThread.cpp | 2 +- xpcom/threads/nsProcess.h | 2 +- xpcom/threads/nsProcessCommon.cpp | 8 +- xpfe/appshell/src/nsAppShellService.cpp | 4 +- .../src/nsAppShellWindowEnumerator.cpp | 18 +- .../appshell/src/nsAppShellWindowEnumerator.h | 18 +- xpfe/appshell/src/nsChromeTreeOwner.cpp | 8 +- xpfe/appshell/src/nsContentTreeOwner.cpp | 12 +- xpfe/appshell/src/nsWebShellWindow.cpp | 2 +- xpfe/appshell/src/nsWindowMediator.cpp | 18 +- xpfe/appshell/src/nsWindowMediator.h | 2 +- xpfe/appshell/src/nsXULWindow.cpp | 6 +- .../directory/nsDirectoryViewer.cpp | 2 +- .../windowds/nsWindowDataSource.cpp | 4 +- xulrunner/app/nsXULRunnerApp.cpp | 2 +- 1063 files changed, 5572 insertions(+), 5572 deletions(-) diff --git a/accessible/src/atk/nsMaiInterfaceText.cpp b/accessible/src/atk/nsMaiInterfaceText.cpp index 339085b84743..912550b7055c 100644 --- a/accessible/src/atk/nsMaiInterfaceText.cpp +++ b/accessible/src/atk/nsMaiInterfaceText.cpp @@ -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(text->CharAt(aOffset)); } diff --git a/accessible/src/base/DocManager.cpp b/accessible/src/base/DocManager.cpp index 05f13aa3bc85..91ebd3f564d1 100644 --- a/accessible/src/base/DocManager.cpp +++ b/accessible/src/base/DocManager.cpp @@ -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; diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index c0db9c178218..a1bea81d2a02 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -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); } diff --git a/accessible/src/base/nsCoreUtils.h b/accessible/src/base/nsCoreUtils.h index 3a348105e051..8f12ceb0935f 100644 --- a/accessible/src/base/nsCoreUtils.h +++ b/accessible/src/base/nsCoreUtils.h @@ -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; diff --git a/accessible/src/base/nsTextEquivUtils.cpp b/accessible/src/base/nsTextEquivUtils.cpp index b486fa015c00..e6651e96c019 100644 --- a/accessible/src/base/nsTextEquivUtils.cpp +++ b/accessible/src/base/nsTextEquivUtils.cpp @@ -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; } diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index e16d9d1f48e2..16593d83a6fd 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -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 diff --git a/accessible/src/generic/HyperTextAccessible.h b/accessible/src/generic/HyperTextAccessible.h index 2644cd0d3d3f..b662776e2fd0 100644 --- a/accessible/src/generic/HyperTextAccessible.h +++ b/accessible/src/generic/HyperTextAccessible.h @@ -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; } /** diff --git a/accessible/src/html/HTMLElementAccessibles.cpp b/accessible/src/html/HTMLElementAccessibles.cpp index 99ab04d9d0cb..f601aa032e36 100644 --- a/accessible/src/html/HTMLElementAccessibles.cpp +++ b/accessible/src/html/HTMLElementAccessibles.cpp @@ -47,7 +47,7 @@ HTMLBRAccessible::NativeState() ENameValueFlag HTMLBRAccessible::NativeName(nsString& aName) { - aName = static_cast('\n'); // Newline char + aName = static_cast('\n'); // Newline char return eNameOK; } diff --git a/accessible/src/xpcom/xpcAccessibleHyperText.cpp b/accessible/src/xpcom/xpcAccessibleHyperText.cpp index ef9050a0b5fb..7de17843b7ea 100644 --- a/accessible/src/xpcom/xpcAccessibleHyperText.cpp +++ b/accessible/src/xpcom/xpcAccessibleHyperText.cpp @@ -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'; diff --git a/b2g/app/nsBrowserApp.cpp b/b2g/app/nsBrowserApp.cpp index 38354a665841..543604663647 100644 --- a/b2g/app/nsBrowserApp.cpp +++ b/b2g/app/nsBrowserApp.cpp @@ -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 diff --git a/browser/components/shell/src/nsMacShellService.cpp b/browser/components/shell/src/nsMacShellService.cpp index 4abeb139948e..4af703ce0fc6 100644 --- a/browser/components/shell/src/nsMacShellService.cpp +++ b/browser/components/shell/src/nsMacShellService.cpp @@ -230,7 +230,7 @@ NS_IMETHODIMP nsMacShellService::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { return NS_OK; } diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/src/nsWindowsShellService.cpp index 1e9c9d9bcb29..5b2bf01a1a8b 100644 --- a/browser/components/shell/src/nsWindowsShellService.cpp +++ b/browser/components/shell/src/nsWindowsShellService.cpp @@ -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 diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 92027b27329a..1898bd182136 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -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); diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index 8a646b2f8b06..669e79fec094 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -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; diff --git a/chrome/src/nsChromeRegistryChrome.h b/chrome/src/nsChromeRegistryChrome.h index 5692be66e9fc..90eba76b5057 100644 --- a/chrome/src/nsChromeRegistryChrome.h +++ b/chrome/src/nsChromeRegistryChrome.h @@ -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, diff --git a/chrome/src/nsChromeRegistryContent.cpp b/chrome/src/nsChromeRegistryContent.cpp index 969098788547..7452b45da3b2 100644 --- a/chrome/src/nsChromeRegistryContent.cpp +++ b/chrome/src/nsChromeRegistryContent.cpp @@ -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(); } diff --git a/chrome/src/nsChromeRegistryContent.h b/chrome/src/nsChromeRegistryContent.h index e4c55d3fdfb9..c2d3ae788d32 100644 --- a/chrome/src/nsChromeRegistryContent.h +++ b/chrome/src/nsChromeRegistryContent.h @@ -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, diff --git a/content/base/public/DirectionalityUtils.h b/content/base/public/DirectionalityUtils.h index 85a7e78031b8..5e36505eff23 100644 --- a/content/base/public/DirectionalityUtils.h +++ b/content/base/public/DirectionalityUtils.h @@ -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); /** diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 9a799cdf35bb..5dee7c7daa8f 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -189,14 +189,14 @@ public: virtual already_AddRefed 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; diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 2b6174334e55..92e84234ed65 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -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& aSrcStart, const nsReadingIterator& aSrcEnd, nsAString& aDest); + static uint32_t CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAString& aDest); static const nsDependentSubstring TrimCharsInSet(const char* aSet, const nsAString& aValue); - template + template 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 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); diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index fa6c11ffe958..b8ee860afe05 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -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; /** diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index a548eabab8e2..9797a87e8d9b 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -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, diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 8f987c002d81..ef09fa1f2847 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -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'; } diff --git a/content/base/public/nsLineBreaker.h b/content/base/public/nsLineBreaker.h index e6456b71a502..ac83cf959765 100644 --- a/content/base/public/nsLineBreaker.h +++ b/content/base/public/nsLineBreaker.h @@ -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 mCurrentWord; + nsAutoTArray mCurrentWord; // All the items that contribute to mCurrentWord nsAutoTArray mTextItems; nsIAtom* mCurrentWordLanguage; diff --git a/content/base/src/DOMImplementation.cpp b/content/base/src/DOMImplementation.cpp index fd69fae7d67f..7078679442d7 100644 --- a/content/base/src/DOMImplementation.cpp +++ b/content/base/src/DOMImplementation.cpp @@ -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); diff --git a/content/base/src/DOMParser.cpp b/content/base/src/DOMParser.cpp index c2686ce7dd2b..0dfb96f0e75b 100644 --- a/content/base/src/DOMParser.cpp +++ b/content/base/src/DOMParser.cpp @@ -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) { diff --git a/content/base/src/DirectionalityUtils.cpp b/content/base/src/DirectionalityUtils.cpp index e9f8841724e4..92020973eb74 100644 --- a/content/base/src/DirectionalityUtils.cpp +++ b/content/base/src/DirectionalityUtils.cpp @@ -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)) { diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index b658ee180cbf..7f014cec6fb2 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -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("\""); diff --git a/content/base/src/EventSource.cpp b/content/base/src/EventSource.cpp index 0eb29f1af2cb..80945ac9ea17 100644 --- a/content/base/src/EventSource.cpp +++ b/content/base/src/EventSource.cpp @@ -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 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; diff --git a/content/base/src/EventSource.h b/content/base/src/EventSource.h index 604a91b2e404..fa6bafda12bb 100644 --- a/content/base/src/EventSource.h +++ b/content/base/src/EventSource.h @@ -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); diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index b10f0b703309..c012ffab9507 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -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("<"); @@ -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("<") - 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; diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index d5389a7490b2..2912d0cb05f7 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -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); } } diff --git a/content/base/src/WebSocket.cpp b/content/base/src/WebSocket.cpp index 4eb3d779bc11..82af4842b8e3 100644 --- a/content/base/src/WebSocket.cpp +++ b/content/base/src/WebSocket.cpp @@ -49,7 +49,7 @@ namespace mozilla { namespace dom { -#define UTF_8_REPLACEMENT_CHAR static_cast(0xFFFD) +#define UTF_8_REPLACEMENT_CHAR static_cast(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(0x0021) || - aProtocolArray[index][i] > static_cast(0x007E)) + if (aProtocolArray[index][i] < static_cast(0x0021) || + aProtocolArray[index][i] > static_cast(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(0x0021) || - mResource[i] > static_cast(0x007E)) { + if (mResource[i] < static_cast(0x0021) || + mResource[i] > static_cast(0x007E)) { return NS_ERROR_DOM_SYNTAX_ERR; } } @@ -1332,7 +1332,7 @@ WebSocket::Close(const Optional& aCode, NS_IMETHODIMP WebSocket::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if ((mReadyState == WebSocket::CLOSING) || (mReadyState == WebSocket::CLOSED)) { diff --git a/content/base/src/WebSocket.h b/content/base/src/WebSocket.h index 602c6cdf98a2..552d62b3d42e 100644 --- a/content/base/src/WebSocket.h +++ b/content/base/src/WebSocket.h @@ -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, diff --git a/content/base/src/nsAttrValue.cpp b/content/base/src/nsAttrValue.cpp index 620d6e0394f0..cf3d5da6cd0a 100644 --- a/content/base/src/nsAttrValue.cpp +++ b/content/base/src/nsAttrValue.cpp @@ -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(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(GetPtr()); if (str) { - uint32_t len = str->StorageSize()/sizeof(PRUnichar) - 1; - return HashString(static_cast(str->Data()), len); + uint32_t len = str->StorageSize()/sizeof(char16_t) - 1; + return HashString(static_cast(str->Data()), len); } return 0; @@ -1064,8 +1064,8 @@ nsAttrValue::Equals(const nsAString& aValue, { nsStringBuffer* str = static_cast(GetPtr()); if (str) { - nsDependentString dep(static_cast(str->Data()), - str->StorageSize()/sizeof(PRUnichar) - 1); + nsDependentString dep(static_cast(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(GetPtr()); if (str) { - nsDependentString dep(static_cast(str->Data()), - str->StorageSize()/sizeof(PRUnichar) - 1); + nsDependentString dep(static_cast(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 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(buf->Data()); + char16_t *data = static_cast(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) { diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index a752cd247eb7..8a85e701130d 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -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(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; diff --git a/content/base/src/nsCCUncollectableMarker.cpp b/content/base/src/nsCCUncollectableMarker.cpp index 00014cb1dd5a..3c01238d58dd 100644 --- a/content/base/src/nsCCUncollectableMarker.cpp +++ b/content/base/src/nsCCUncollectableMarker.cpp @@ -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(); diff --git a/content/base/src/nsCSPService.cpp b/content/base/src/nsCSPService.cpp index 5f63d900fbf6..ef64dee6a6e3 100644 --- a/content/base/src/nsCSPService.cpp +++ b/content/base/src/nsCSPService.cpp @@ -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, diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index 993c480dbfe3..77226000e573 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -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) { diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 799793bacb68..b3d8cc4703b5 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -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(chunkEnd), reinterpret_cast(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 sink_traits; + typedef NormalizeNewlinesCharTraits sink_traits; sink_traits dest_traits(aDest); CopyNormalizeNewlines normalizer(&dest_traits,aLastCharCR); - nsReadingIterator fromBegin, fromEnd; + nsReadingIterator 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& aSrcStart, const nsReadingIterator& aSrcEnd, nsAString& aDest) +nsContentUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAString& aDest) { - typedef nsWritingIterator WritingIterator; + typedef nsWritingIterator WritingIterator; typedef NormalizeNewlinesCharTraits 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 +template 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(begin), reinterpret_cast(end), @@ -2438,7 +2438,7 @@ nsContentUtils::CheckQName(const nsAString& aQualifiedName, if (!result) { if (aColon) { - *aColon = reinterpret_cast(colon); + *aColon = reinterpret_cast(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 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(aBuf->Data())); + uint32_t stringLen = NS_strlen(static_cast(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); diff --git a/content/base/src/nsCopySupport.cpp b/content/base/src/nsCopySupport.cpp index beafc0e0f841..450d77b2b702 100644 --- a/content/base/src/nsCopySupport.cpp +++ b/content/base/src/nsCopySupport.cpp @@ -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, diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index 3985e9d98a3d..d4549af487af 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -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; } diff --git a/content/base/src/nsDOMFileReader.cpp b/content/base/src/nsDOMFileReader.cpp index 70402b54af74..637ef74f4920 100644 --- a/content/base/src/nsDOMFileReader.cpp +++ b/content/base/src/nsDOMFileReader.cpp @@ -296,8 +296,8 @@ ReadFuncBinaryString(nsIInputStream* in, uint32_t count, uint32_t *writeCount) { - PRUnichar* dest = static_cast(closure) + toOffset; - PRUnichar* end = dest + count; + char16_t* dest = static_cast(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); diff --git a/content/base/src/nsDOMTokenList.cpp b/content/base/src/nsDOMTokenList.cpp index 08688dc42acf..d53ff253193e 100644 --- a/content/base/src/nsDOMTokenList.cpp +++ b/content/base/src/nsDOMTokenList.cpp @@ -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)); diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 0d06339a1c36..32ef2e285e85 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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 subject(do_QueryInterface(aSubject)); diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 8607143debee..bb09a62443ab 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -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, diff --git a/content/base/src/nsDocumentEncoder.cpp b/content/base/src/nsDocumentEncoder.cpp index 00013e79c44a..8a6f658c290e 100644 --- a/content/base/src/nsDocumentEncoder.cpp +++ b/content/base/src/nsDocumentEncoder.cpp @@ -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(mCachedBuffer->Data())[0] = PRUnichar(0); + static_cast(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; diff --git a/content/base/src/nsFormData.cpp b/content/base/src/nsFormData.cpp index a645c7c7b779..667c33f82b29 100644 --- a/content/base/src/nsFormData.cpp +++ b/content/base/src/nsFormData.cpp @@ -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); diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 2b3dd3afdb9d..e797585130d5 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -484,7 +484,7 @@ static bool JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData) { nsAString* result = static_cast(aData); - result->Append(static_cast(aBuf), + result->Append(static_cast(aBuf), static_cast(aLen)); return true; } diff --git a/content/base/src/nsFrameMessageManager.h b/content/base/src/nsFrameMessageManager.h index c091e90d7b8a..cd650b8ff3d1 100644 --- a/content/base/src/nsFrameMessageManager.h +++ b/content/base/src/nsFrameMessageManager.h @@ -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; diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index b37a830a1e37..3bbef3be7f4b 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -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("&"); } 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("&"); } 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) { diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 9c2136bb340f..d64a502230a2 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -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); diff --git a/content/base/src/nsHTMLContentSerializer.cpp b/content/base/src/nsHTMLContentSerializer.cpp index 7baa2ab66134..1d5f4a7b7703 100644 --- a/content/base/src/nsHTMLContentSerializer.cpp +++ b/content/base/src/nsHTMLContentSerializer.cpp @@ -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 done_reading; + nsReadingIterator done_reading; aStr.EndReading(done_reading); // for each chunk of |aString|... uint32_t advanceLength = 0; - nsReadingIterator iter; + nsReadingIterator 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) { diff --git a/content/base/src/nsLineBreaker.cpp b/content/base/src/nsLineBreaker.cpp index 8eb6dc5c9464..909a7bfecf42 100644 --- a/content/base/src/nsLineBreaker.cpp +++ b/content/base/src/nsLineBreaker.cpp @@ -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; diff --git a/content/base/src/nsMixedContentBlocker.cpp b/content/base/src/nsMixedContentBlocker.cpp index ba5e900c6d9a..eff0f3d7bd7b 100644 --- a/content/base/src/nsMixedContentBlocker.cpp +++ b/content/base/src/nsMixedContentBlocker.cpp @@ -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)); diff --git a/content/base/src/nsPlainTextSerializer.cpp b/content/base/src/nsPlainTextSerializer.cpp index fc19a7eb6824..ce8c31f723a3 100644 --- a/content/base/src/nsPlainTextSerializer.cpp +++ b/content/base/src/nsPlainTextSerializer.cpp @@ -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
-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; diff --git a/content/base/src/nsPlainTextSerializer.h b/content/base/src/nsPlainTextSerializer.h index fa900dcd52dc..6e961eec0950 100644 --- a/content/base/src/nsPlainTextSerializer.h +++ b/content/base/src/nsPlainTextSerializer.h @@ -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(); diff --git a/content/base/src/nsReferencedElement.cpp b/content/base/src/nsReferencedElement.cpp index f89382f49b40..84eaff5f1379 100644 --- a/content/base/src/nsReferencedElement.cpp +++ b/content/base/src/nsReferencedElement.cpp @@ -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"); diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index cbba8f7aa49b..5f342bd11d90 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -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(aData), (int32_t *) &aLength, ustr, diff --git a/content/base/src/nsTextFragment.cpp b/content/base/src/nsTextFragment.cpp index 0d0483cb0a90..f39d680de342 100644 --- a/content/base/src/nsTextFragment.cpp +++ b/content/base/src/nsTextFragment.cpp @@ -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(moz_malloc(m2bSize)); + m2b = static_cast(moz_malloc(m2bSize)); if (m2b) { memcpy(m2b, aOther.m2b, m2bSize); } else { // allocate a buffer for a single REPLACEMENT CHARACTER - m2b = static_cast(moz_xmalloc(sizeof(PRUnichar))); + m2b = static_cast(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 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)) { diff --git a/content/base/src/nsTextFragment.h b/content/base/src/nsTextFragment.h index 2ae5c2bbeea4..918640604caa 100644 --- a/content/base/src/nsTextFragment.h +++ b/content/base/src/nsTextFragment.h @@ -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(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 }; diff --git a/content/base/src/nsTextFragmentSSE2.cpp b/content/base/src/nsTextFragmentSSE2.cpp index efdf567c72c9..25ead337cc44 100644 --- a/content/base/src/nsTextFragmentSSE2.cpp +++ b/content/base/src/nsTextFragmentSSE2.cpp @@ -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 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; diff --git a/content/base/src/nsTextNode.cpp b/content/base/src/nsTextNode.cpp index 41e345c66af4..b6bd1ae7e0e1 100644 --- a/content/base/src/nsTextNode.cpp +++ b/content/base/src/nsTextNode.cpp @@ -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 = { diff --git a/content/base/src/nsTextNode.h b/content/base/src/nsTextNode.h index e0e3e0f62856..4008d2e18b85 100644 --- a/content/base/src/nsTextNode.h +++ b/content/base/src/nsTextNode.h @@ -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; } diff --git a/content/base/src/nsTreeSanitizer.cpp b/content/base/src/nsTreeSanitizer.cpp index 6976c3a7144c..8c4dde3e12eb 100644 --- a/content/base/src/nsTreeSanitizer.cpp +++ b/content/base/src/nsTreeSanitizer.cpp @@ -1228,7 +1228,7 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement, // 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' diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index 49115fa3fc26..106afe91be85 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -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(" done_reading; + nsReadingIterator done_reading; aStr.EndReading(done_reading); // for each chunk of |aString|... uint32_t advanceLength = 0; - nsReadingIterator iter; + nsReadingIterator 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); diff --git a/content/base/src/nsXMLContentSerializer.h b/content/base/src/nsXMLContentSerializer.h index f8bbed403694..9e0eaf6780b2 100644 --- a/content/base/src/nsXMLContentSerializer.h +++ b/content/base/src/nsXMLContentSerializer.h @@ -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); /** diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index a043694a1c69..4ab44595637c 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -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); diff --git a/content/canvas/public/nsICanvasRenderingContextInternal.h b/content/canvas/public/nsICanvasRenderingContextInternal.h index e70f15f830aa..3f496534b65a 100644 --- a/content/canvas/public/nsICanvasRenderingContextInternal.h +++ b/content/canvas/public/nsICanvasRenderingContextInternal.h @@ -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, diff --git a/content/canvas/src/CanvasImageCache.cpp b/content/canvas/src/CanvasImageCache.cpp index a072abac9ce9..84a27ae26b36 100644 --- a/content/canvas/src/CanvasImageCache.cpp +++ b/content/canvas/src/CanvasImageCache.cpp @@ -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; diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index ed56d6d2e980..8c85eb7a44af 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -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, diff --git a/content/canvas/src/CanvasRenderingContext2D.h b/content/canvas/src/CanvasRenderingContext2D.h index 6ea641a14832..d632da4436f3 100644 --- a/content/canvas/src/CanvasRenderingContext2D.h +++ b/content/canvas/src/CanvasRenderingContext2D.h @@ -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; diff --git a/content/canvas/src/ImageEncoder.cpp b/content/canvas/src/ImageEncoder.cpp index 39b422896f54..a96e040306a6 100644 --- a/content/canvas/src/ImageEncoder.cpp +++ b/content/canvas/src/ImageEncoder.cpp @@ -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 = diff --git a/content/canvas/src/ImageEncoder.h b/content/canvas/src/ImageEncoder.h index a0d30346bf63..cdf0f3aaa3f4 100644 --- a/content/canvas/src/ImageEncoder.h +++ b/content/canvas/src/ImageEncoder.h @@ -61,7 +61,7 @@ public: uint8_t* aImageBuffer, int32_t aFormat, imgIEncoder* aEncoder, - const PRUnichar* aEncoderOptions, + const char16_t* aEncoderOptions, nsIInputStream** aStream); private: diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 162772a7f413..922e81688016 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -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?"); diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index f1e9a3476bd2..e7830532ca01 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -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 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); diff --git a/content/canvas/src/WebGLValidateStrings.h b/content/canvas/src/WebGLValidateStrings.h index c7ccec3f464a..38e034847130 100644 --- a/content/canvas/src/WebGLValidateStrings.h +++ b/content/canvas/src/WebGLValidateStrings.h @@ -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& result() + const nsTArray& 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 m_result; + nsTArray 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. diff --git a/content/events/src/nsContentEventHandler.cpp b/content/events/src/nsContentEventHandler.cpp index bea125e50ccb..571602de7756 100644 --- a/content/events/src/nsContentEventHandler.cpp +++ b/content/events/src/nsContentEventHandler.cpp @@ -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; diff --git a/content/events/src/nsDOMDataTransfer.cpp b/content/events/src/nsDOMDataTransfer.cpp index f114dba69b1a..cd4275e873f1 100644 --- a/content/events/src/nsDOMDataTransfer.cpp +++ b/content/events/src/nsDOMDataTransfer.cpp @@ -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)) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 0466d203e1db..558024223c84 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -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(); diff --git a/content/html/content/public/HTMLMediaElement.h b/content/html/content/public/HTMLMediaElement.h index bca96f99b595..abe169843e8f 100644 --- a/content/html/content/public/HTMLMediaElement.h +++ b/content/html/content/public/HTMLMediaElement.h @@ -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); /** diff --git a/content/html/content/src/HTMLFormElement.cpp b/content/html/content/src/HTMLFormElement.cpp index 4ae6ca35a727..a6e85e75c70e 100644 --- a/content/html/content/src/HTMLFormElement.cpp +++ b/content/html/content/src/HTMLFormElement.cpp @@ -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; diff --git a/content/html/content/src/HTMLFrameSetElement.cpp b/content/html/content/src/HTMLFrameSetElement.cpp index 1ef25a9940ed..5cfaba53e95e 100644 --- a/content/html/content/src/HTMLFrameSetElement.cpp +++ b/content/html/content/src/HTMLFrameSetElement.cpp @@ -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--; diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp index 9c557e2e7dce..4177279bbd14 100644 --- a/content/html/content/src/HTMLInputElement.cpp +++ b/content/html/content/src/HTMLInputElement.cpp @@ -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 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(NS_Alloc(*aLength * sizeof(PRUnichar*))); + char16_t** ret = + static_cast(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(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. diff --git a/content/html/content/src/HTMLInputElement.h b/content/html/content/src/HTMLInputElement.h index 9d652da81627..2e4db8fa4d48 100644 --- a/content/html/content/src/HTMLInputElement.h +++ b/content/html/content/src/HTMLInputElement.h @@ -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 */ diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index 746454824ee6..95fe7f24cfde 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -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); diff --git a/content/html/content/src/HTMLTextAreaElement.cpp b/content/html/content/src/HTMLTextAreaElement.cpp index 9341f1a6b7e2..4bae1beb55cf 100644 --- a/content/html/content/src/HTMLTextAreaElement.cpp +++ b/content/html/content/src/HTMLTextAreaElement.cpp @@ -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); diff --git a/content/html/content/src/nsDOMStringMap.cpp b/content/html/content/src/nsDOMStringMap.cpp index ff57ad2fbd3a..cf4597c3af04 100644 --- a/content/html/content/src/nsDOMStringMap.cpp +++ b/content/html/content/src/nsDOMStringMap.cpp @@ -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. diff --git a/content/html/content/src/nsFormSubmission.cpp b/content/html/content/src/nsFormSubmission.cpp index df67b79f103d..56dc62eb0bf7 100644 --- a/content/html/content/src/nsFormSubmission.cpp +++ b/content/html/content/src/nsFormSubmission.cpp @@ -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); } diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 1c85d8ae398d..881751969e22 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -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 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 attrURI; nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI), diff --git a/content/html/content/src/nsHTMLDNSPrefetch.cpp b/content/html/content/src/nsHTMLDNSPrefetch.cpp index eb55e5e7d41f..229fde83e7af 100644 --- a/content/html/content/src/nsHTMLDNSPrefetch.cpp +++ b/content/html/content/src/nsHTMLDNSPrefetch.cpp @@ -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(); diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index 5bff5b9bba43..daf92d49da08 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -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); } diff --git a/content/html/document/src/ImageDocument.cpp b/content/html/document/src/ImageDocument.cpp index a8c3324a437e..a037b5ebf19f 100644 --- a/content/html/document/src/ImageDocument.cpp +++ b/content/html/document/src/ImageDocument.cpp @@ -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)); diff --git a/content/html/document/src/MediaDocument.cpp b/content/html/document/src/MediaDocument.cpp index ce8fb21c0225..d6069e2d2c4d 100644 --- a/content/html/document/src/MediaDocument.cpp +++ b/content/html/document/src/MediaDocument.cpp @@ -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)); diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 280f2c5410d0..ff91acca21b4 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -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; diff --git a/content/mathml/content/src/nsMathMLElement.cpp b/content/mathml/content/src/nsMathMLElement.cpp index 2ca68d1eb8b0..152cf73e14c9 100644 --- a/content/mathml/content/src/nsMathMLElement.cpp +++ b/content/mathml/content/src/nsMathMLElement.cpp @@ -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 { diff --git a/content/media/Latency.cpp b/content/media/Latency.cpp index 208701eaf862..153ac3bbf75d 100644 --- a/content/media/Latency.cpp +++ b/content/media/Latency.cpp @@ -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) { diff --git a/content/media/MediaCache.cpp b/content/media/MediaCache.cpp index 005d88cc7841..db265ee387c6 100644 --- a/content/media/MediaCache.cpp +++ b/content/media/MediaCache.cpp @@ -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(); diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index cc6c13b66f65..e42a1b5589ab 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -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) { diff --git a/content/media/MediaRecorder.cpp b/content/media/MediaRecorder.cpp index 7b5abe337e6e..3f38ec40a7bc 100644 --- a/content/media/MediaRecorder.cpp +++ b/content/media/MediaRecorder.cpp @@ -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()); diff --git a/content/media/MediaShutdownManager.cpp b/content/media/MediaShutdownManager.cpp index e98ead85e76b..121f6ea98a2e 100644 --- a/content/media/MediaShutdownManager.cpp +++ b/content/media/MediaShutdownManager.cpp @@ -153,7 +153,7 @@ MediaShutdownManager::Unregister(MediaDecoder* aDecoder) NS_IMETHODIMP MediaShutdownManager::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) { diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 8090f717cfa9..b09fde2ae875 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -2418,7 +2418,7 @@ static bool gShutdownObserverRegistered = false; NS_IMETHODIMP MediaStreamGraphShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { if (gGraph) { diff --git a/content/media/webrtc/LoadMonitor.cpp b/content/media/webrtc/LoadMonitor.cpp index a265e5684207..e342168b9c02 100644 --- a/content/media/webrtc/LoadMonitor.cpp +++ b/content/media/webrtc/LoadMonitor.cpp @@ -63,7 +63,7 @@ LoadMonitor::~LoadMonitor() NS_IMETHODIMP LoadMonitor::Observe(nsISupports* /* aSubject */, const char* aTopic, - const PRUnichar* /* aData */) + const char16_t* /* aData */) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); MOZ_ASSERT(!strcmp("xpcom-shutdown-threads", aTopic), "Bad topic!"); diff --git a/content/media/webspeech/recognition/SpeechRecognition.cpp b/content/media/webspeech/recognition/SpeechRecognition.cpp index 24d78035afe3..13884df2dbc7 100644 --- a/content/media/webspeech/recognition/SpeechRecognition.cpp +++ b/content/media/webspeech/recognition/SpeechRecognition.cpp @@ -561,7 +561,7 @@ SpeechRecognition::StopRecording() NS_IMETHODIMP SpeechRecognition::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(NS_IsMainThread(), "Observer invoked off the main thread"); diff --git a/content/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp b/content/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp index 77e2d6cf2310..edf0ec80863f 100644 --- a/content/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp +++ b/content/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp @@ -58,7 +58,7 @@ FakeSpeechRecognitionService::Abort() } NS_IMETHODIMP -FakeSpeechRecognitionService::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) +FakeSpeechRecognitionService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { MOZ_ASSERT(mRecognition->mTestConfig.mFakeRecognitionService, "Got request to fake recognition service event, but " diff --git a/content/media/wmf/WMFUtils.cpp b/content/media/wmf/WMFUtils.cpp index a1777a503912..c6cb6dc421bf 100644 --- a/content/media/wmf/WMFUtils.cpp +++ b/content/media/wmf/WMFUtils.cpp @@ -196,7 +196,7 @@ nsCString GetGUIDName(const GUID& guid) if (FAILED(hr)) { return nsDependentCString("GuidUnknown"); } - nsCString name_u8(NS_ConvertUTF16toUTF8(nsDependentString((PRUnichar*)(name)))); + nsCString name_u8(NS_ConvertUTF16toUTF8(nsDependentString((char16_t*)(name)))); CoTaskMemFree(name); return name_u8; } diff --git a/content/smil/nsSMILParserUtils.cpp b/content/smil/nsSMILParserUtils.cpp index a60805036eee..09ecb0ca5a70 100644 --- a/content/smil/nsSMILParserUtils.cpp +++ b/content/smil/nsSMILParserUtils.cpp @@ -32,8 +32,8 @@ const uint32_t MSEC_PER_HOUR = 1000 * 60 * 60; #define WALLCLOCK_PREFIX NS_LITERAL_STRING("wallclock(") inline bool -SkipWhitespace(RangedPtr& aIter, - const RangedPtr& aEnd) +SkipWhitespace(RangedPtr& aIter, + const RangedPtr& aEnd) { while (aIter != aEnd) { if (!IsSVGWhitespace(*aIter)) { @@ -45,8 +45,8 @@ SkipWhitespace(RangedPtr& aIter, } inline bool -ParseColon(RangedPtr& aIter, - const RangedPtr& aEnd) +ParseColon(RangedPtr& aIter, + const RangedPtr& aEnd) { if (aIter == aEnd || *aIter != ':') { return false; @@ -59,15 +59,15 @@ ParseColon(RangedPtr& aIter, * Exactly two digits in the range 00 - 59 are expected. */ bool -ParseSecondsOrMinutes(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseSecondsOrMinutes(RangedPtr& aIter, + const RangedPtr& aEnd, uint32_t& aValue) { if (aIter == aEnd || !SVGContentUtils::IsDigit(*aIter)) { return false; } - RangedPtr iter(aIter); + RangedPtr iter(aIter); if (++iter == aEnd || !SVGContentUtils::IsDigit(*iter)) { return false; @@ -88,8 +88,8 @@ ParseSecondsOrMinutes(RangedPtr& aIter, } inline bool -ParseClockMetric(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseClockMetric(RangedPtr& aIter, + const RangedPtr& aEnd, uint32_t& aMultiplier) { if (aIter == aEnd) { @@ -132,8 +132,8 @@ ParseClockMetric(RangedPtr& aIter, * See http://www.w3.org/TR/SVG/animate.html#ClockValueSyntax */ bool -ParseClockValue(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseClockValue(RangedPtr& aIter, + const RangedPtr& aEnd, nsSMILTimeValue* aResult) { if (aIter == aEnd) { @@ -151,7 +151,7 @@ ParseClockValue(RangedPtr& aIter, int32_t clockType = TIMECOUNT_VALUE; - RangedPtr iter(aIter); + RangedPtr iter(aIter); // Determine which type of clock value we have by counting the number // of colons in the string. @@ -225,11 +225,11 @@ ParseClockValue(RangedPtr& aIter, } bool -ParseOffsetValue(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseOffsetValue(RangedPtr& aIter, + const RangedPtr& aEnd, nsSMILTimeValue* aResult) { - RangedPtr iter(aIter); + RangedPtr iter(aIter); int32_t sign; if (!SVGContentUtils::ParseOptionalSign(iter, aEnd, sign) || @@ -248,15 +248,15 @@ bool ParseOffsetValue(const nsAString& aSpec, nsSMILTimeValue* aResult) { - RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); - const RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); + RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); + const RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); return ParseOffsetValue(iter, end, aResult) && iter == end; } bool -ParseOptionalOffset(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseOptionalOffset(RangedPtr& aIter, + const RangedPtr& aEnd, nsSMILTimeValue* aResult) { if (aIter == aEnd) { @@ -282,8 +282,8 @@ ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult) ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(), "Case variations for accesskey prefix differ in length"); - RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); - RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); + RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); + RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); iter += ACCESSKEY_PREFIX_LC.Length(); @@ -319,8 +319,8 @@ ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult) } void -MoveToNextToken(RangedPtr& aIter, - const RangedPtr& aEnd, +MoveToNextToken(RangedPtr& aIter, + const RangedPtr& aEnd, bool aBreakOnDot, bool& aIsAnyCharEscaped) { @@ -365,9 +365,9 @@ ConvertTokenToAtom(const nsAString& aToken, nsAutoString token(aToken); - const PRUnichar* read = token.BeginReading(); - const PRUnichar* const end = token.EndReading(); - PRUnichar* write = token.BeginWriting(); + const char16_t* read = token.BeginReading(); + const char16_t* const end = token.EndReading(); + char16_t* write = token.BeginWriting(); bool escape = false; while (read != end) { @@ -404,14 +404,14 @@ ParseElementBaseTimeValueSpec(const nsAString& aSpec, // defined (for SMIL Animation) so we don't support it here. // - RangedPtr start(SVGContentUtils::GetStartRangedPtr(aSpec)); - RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); + RangedPtr start(SVGContentUtils::GetStartRangedPtr(aSpec)); + RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); if (start == end) { return false; } - RangedPtr tokenEnd(start); + RangedPtr tokenEnd(start); bool requiresUnescaping; MoveToNextToken(tokenEnd, end, true, requiresUnescaping); @@ -697,8 +697,8 @@ bool nsSMILParserUtils::ParseClockValue(const nsAString& aSpec, nsSMILTimeValue* aResult) { - RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); - RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); + RangedPtr iter(SVGContentUtils::GetStartRangedPtr(aSpec)); + RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); return ::ParseClockValue(iter, end, aResult) && iter == end; } diff --git a/content/svg/content/src/SVGContentUtils.cpp b/content/svg/content/src/SVGContentUtils.cpp index aaa014f33c27..6cc327d6c6dd 100644 --- a/content/svg/content/src/SVGContentUtils.cpp +++ b/content/svg/content/src/SVGContentUtils.cpp @@ -139,7 +139,7 @@ SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext) nsresult SVGContentUtils::ReportToConsole(nsIDocument* doc, const char* aWarning, - const PRUnichar **aParams, + const char16_t **aParams, uint32_t aParamsLength) { return nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, @@ -370,8 +370,8 @@ SVGContentUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight } static bool -ParseNumber(RangedPtr& aIter, - const RangedPtr& aEnd, +ParseNumber(RangedPtr& aIter, + const RangedPtr& aEnd, double& aValue) { int32_t sign; @@ -425,7 +425,7 @@ ParseNumber(RangedPtr& aIter, if (aIter != aEnd && (*aIter == 'e' || *aIter == 'E')) { - RangedPtr expIter(aIter); + RangedPtr expIter(aIter); ++expIter; if (expIter != aEnd) { @@ -459,11 +459,11 @@ ParseNumber(RangedPtr& aIter, template bool -SVGContentUtils::ParseNumber(RangedPtr& aIter, - const RangedPtr& aEnd, +SVGContentUtils::ParseNumber(RangedPtr& aIter, + const RangedPtr& aEnd, floatType& aValue) { - RangedPtr iter(aIter); + RangedPtr iter(aIter); double value; if (!::ParseNumber(iter, aEnd, value)) { @@ -479,25 +479,25 @@ SVGContentUtils::ParseNumber(RangedPtr& aIter, } template bool -SVGContentUtils::ParseNumber(RangedPtr& aIter, - const RangedPtr& aEnd, +SVGContentUtils::ParseNumber(RangedPtr& aIter, + const RangedPtr& aEnd, float& aValue); template bool -SVGContentUtils::ParseNumber(RangedPtr& aIter, - const RangedPtr& aEnd, +SVGContentUtils::ParseNumber(RangedPtr& aIter, + const RangedPtr& aEnd, double& aValue); -RangedPtr +RangedPtr SVGContentUtils::GetStartRangedPtr(const nsAString& aString) { - return RangedPtr(aString.Data(), aString.Length()); + return RangedPtr(aString.Data(), aString.Length()); } -RangedPtr +RangedPtr SVGContentUtils::GetEndRangedPtr(const nsAString& aString) { - return RangedPtr(aString.Data() + aString.Length(), + return RangedPtr(aString.Data() + aString.Length(), aString.Data(), aString.Length()); } @@ -506,8 +506,8 @@ bool SVGContentUtils::ParseNumber(const nsAString& aString, floatType& aValue) { - RangedPtr iter = GetStartRangedPtr(aString); - const RangedPtr end = GetEndRangedPtr(aString); + RangedPtr iter = GetStartRangedPtr(aString); + const RangedPtr end = GetEndRangedPtr(aString); return ParseNumber(iter, end, aValue) && iter == end; } @@ -521,11 +521,11 @@ SVGContentUtils::ParseNumber(const nsAString& aString, /* static */ bool -SVGContentUtils::ParseInteger(RangedPtr& aIter, - const RangedPtr& aEnd, +SVGContentUtils::ParseInteger(RangedPtr& aIter, + const RangedPtr& aEnd, int32_t& aValue) { - RangedPtr iter(aIter); + RangedPtr iter(aIter); int32_t sign; if (!ParseOptionalSign(iter, aEnd, sign)) { @@ -557,8 +557,8 @@ bool SVGContentUtils::ParseInteger(const nsAString& aString, int32_t& aValue) { - RangedPtr iter = GetStartRangedPtr(aString); - const RangedPtr end = GetEndRangedPtr(aString); + RangedPtr iter = GetStartRangedPtr(aString); + const RangedPtr end = GetEndRangedPtr(aString); return ParseInteger(iter, end, aValue) && iter == end; } diff --git a/content/svg/content/src/SVGContentUtils.h b/content/svg/content/src/SVGContentUtils.h index bd483f68ddaa..b5918d45f298 100644 --- a/content/svg/content/src/SVGContentUtils.h +++ b/content/svg/content/src/SVGContentUtils.h @@ -42,10 +42,10 @@ IsSVGWhitespace(char aChar) } inline bool -IsSVGWhitespace(PRUnichar aChar) +IsSVGWhitespace(char16_t aChar) { - return aChar == PRUnichar('\x20') || aChar == PRUnichar('\x9') || - aChar == PRUnichar('\xD') || aChar == PRUnichar('\xA'); + return aChar == char16_t('\x20') || aChar == char16_t('\x9') || + aChar == char16_t('\xD') || aChar == char16_t('\xA'); } /** @@ -99,7 +99,7 @@ public: */ static nsresult ReportToConsole(nsIDocument* doc, const char* aWarning, - const PRUnichar **aParams, + const char16_t **aParams, uint32_t aParamsLength); static mozilla::gfx::Matrix GetCTM(nsSVGElement *aElement, bool aScreenCTM); @@ -139,16 +139,16 @@ public: float aViewboxWidth, float aViewboxHeight, const SVGPreserveAspectRatio &aPreserveAspectRatio); - static mozilla::RangedPtr + static mozilla::RangedPtr GetStartRangedPtr(const nsAString& aString); - static mozilla::RangedPtr + static mozilla::RangedPtr GetEndRangedPtr(const nsAString& aString); /** * True if 'aCh' is a decimal digit. */ - static inline bool IsDigit(PRUnichar aCh) + static inline bool IsDigit(char16_t aCh) { return aCh >= '0' && aCh <= '9'; } @@ -156,7 +156,7 @@ public: /** * Assuming that 'aCh' is a decimal digit, return its numeric value. */ - static inline uint32_t DecimalDigitValue(PRUnichar aCh) + static inline uint32_t DecimalDigitValue(char16_t aCh) { MOZ_ASSERT(IsDigit(aCh), "Digit expected"); return aCh - '0'; @@ -170,8 +170,8 @@ public: * at aEnd, or if we reach aEnd right after the sign character). */ static inline bool - ParseOptionalSign(mozilla::RangedPtr& aIter, - const mozilla::RangedPtr& aEnd, + ParseOptionalSign(mozilla::RangedPtr& aIter, + const mozilla::RangedPtr& aEnd, int32_t& aSignMultiplier) { if (aIter == aEnd) { @@ -179,7 +179,7 @@ public: } aSignMultiplier = *aIter == '-' ? -1 : 1; - mozilla::RangedPtr iter(aIter); + mozilla::RangedPtr iter(aIter); if (*iter == '-' || *iter == '+') { ++iter; @@ -200,8 +200,8 @@ public: */ template static bool - ParseNumber(mozilla::RangedPtr& aIter, - const mozilla::RangedPtr& aEnd, + ParseNumber(mozilla::RangedPtr& aIter, + const mozilla::RangedPtr& aEnd, floatType& aValue); /** @@ -221,8 +221,8 @@ public: * If parsing succeeds, aIter is updated so that it points to the character * after the end of the number, otherwise it is left unchanged */ - static bool ParseInteger(mozilla::RangedPtr& aIter, - const mozilla::RangedPtr& aEnd, + static bool ParseInteger(mozilla::RangedPtr& aIter, + const mozilla::RangedPtr& aEnd, int32_t& aValue); /** diff --git a/content/svg/content/src/SVGFragmentIdentifier.cpp b/content/svg/content/src/SVGFragmentIdentifier.cpp index c7996cb55fed..fd3a60f57b48 100644 --- a/content/svg/content/src/SVGFragmentIdentifier.cpp +++ b/content/svg/content/src/SVGFragmentIdentifier.cpp @@ -24,7 +24,7 @@ IsMatchingParameter(const nsAString& aString, const nsAString& aParameterName) } inline bool -IgnoreWhitespace(PRUnichar aChar) +IgnoreWhitespace(char16_t aChar) { return false; } diff --git a/content/svg/content/src/SVGLength.cpp b/content/svg/content/src/SVGLength.cpp index 5b15b6acde93..076aae7f4e51 100644 --- a/content/svg/content/src/SVGLength.cpp +++ b/content/svg/content/src/SVGLength.cpp @@ -22,8 +22,8 @@ static uint16_t GetUnitTypeForString(const nsAString& unitStr); void SVGLength::GetValueAsString(nsAString &aValue) const { - PRUnichar buf[24]; - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + char16_t buf[24]; + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("%g"), (double)mValue); aValue.Assign(buf); @@ -36,9 +36,9 @@ SVGLength::GetValueAsString(nsAString &aValue) const bool SVGLength::SetValueFromString(const nsAString &aString) { - RangedPtr iter = + RangedPtr iter = SVGContentUtils::GetStartRangedPtr(aString); - const RangedPtr end = + const RangedPtr end = SVGContentUtils::GetEndRangedPtr(aString); float value; diff --git a/content/svg/content/src/SVGNumberList.cpp b/content/svg/content/src/SVGNumberList.cpp index 9fbbe1d4412e..5ad1c45b2adc 100644 --- a/content/svg/content/src/SVGNumberList.cpp +++ b/content/svg/content/src/SVGNumberList.cpp @@ -28,7 +28,7 @@ void SVGNumberList::GetValueAsString(nsAString& aValue) const { aValue.Truncate(); - PRUnichar buf[24]; + char16_t buf[24]; uint32_t last = mNumbers.Length() - 1; for (uint32_t i = 0; i < mNumbers.Length(); ++i) { // Would like to use aValue.AppendPrintf("%f", mNumbers[i]), but it's not diff --git a/content/svg/content/src/SVGPathSegUtils.cpp b/content/svg/content/src/SVGPathSegUtils.cpp index d87f30cad3c9..bcc886827728 100644 --- a/content/svg/content/src/SVGPathSegUtils.cpp +++ b/content/svg/content/src/SVGPathSegUtils.cpp @@ -29,7 +29,7 @@ SVGPathSegUtils::GetValueAsString(const float* aSeg, nsAString& aValue) "Add another case to the switch below."); uint32_t type = DecodeType(aSeg[0]); - PRUnichar typeAsChar = GetPathSegTypeAsLetter(type); + char16_t typeAsChar = GetPathSegTypeAsLetter(type); // Special case arcs: if (IsArcType(type)) { @@ -80,7 +80,7 @@ SVGPathSegUtils::GetValueAsString(const float* aSeg, nsAString& aValue) // of the output string is one too long. We need to manually remove that '\0' // until nsTextFormatter is fixed. // - if (aValue[aValue.Length() - 1] == PRUnichar('\0')) { + if (aValue[aValue.Length() - 1] == char16_t('\0')) { aValue.SetLength(aValue.Length() - 1); } } diff --git a/content/svg/content/src/SVGPathSegUtils.h b/content/svg/content/src/SVGPathSegUtils.h index 521257cb67cf..9a33a4dc5b3f 100644 --- a/content/svg/content/src/SVGPathSegUtils.h +++ b/content/svg/content/src/SVGPathSegUtils.h @@ -127,30 +127,30 @@ public: return type; } - static PRUnichar GetPathSegTypeAsLetter(uint32_t aType) { + static char16_t GetPathSegTypeAsLetter(uint32_t aType) { NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); - static const PRUnichar table[] = { - PRUnichar('x'), // 0 == PATHSEG_UNKNOWN - PRUnichar('z'), // 1 == PATHSEG_CLOSEPATH - PRUnichar('M'), // 2 == PATHSEG_MOVETO_ABS - PRUnichar('m'), // 3 == PATHSEG_MOVETO_REL - PRUnichar('L'), // 4 == PATHSEG_LINETO_ABS - PRUnichar('l'), // 5 == PATHSEG_LINETO_REL - PRUnichar('C'), // 6 == PATHSEG_CURVETO_CUBIC_ABS - PRUnichar('c'), // 7 == PATHSEG_CURVETO_CUBIC_REL - PRUnichar('Q'), // 8 == PATHSEG_CURVETO_QUADRATIC_ABS - PRUnichar('q'), // 9 == PATHSEG_CURVETO_QUADRATIC_REL - PRUnichar('A'), // 10 == PATHSEG_ARC_ABS - PRUnichar('a'), // 11 == PATHSEG_ARC_REL - PRUnichar('H'), // 12 == PATHSEG_LINETO_HORIZONTAL_ABS - PRUnichar('h'), // 13 == PATHSEG_LINETO_HORIZONTAL_REL - PRUnichar('V'), // 14 == PATHSEG_LINETO_VERTICAL_ABS - PRUnichar('v'), // 15 == PATHSEG_LINETO_VERTICAL_REL - PRUnichar('S'), // 16 == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS - PRUnichar('s'), // 17 == PATHSEG_CURVETO_CUBIC_SMOOTH_REL - PRUnichar('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS - PRUnichar('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL + static const char16_t table[] = { + char16_t('x'), // 0 == PATHSEG_UNKNOWN + char16_t('z'), // 1 == PATHSEG_CLOSEPATH + char16_t('M'), // 2 == PATHSEG_MOVETO_ABS + char16_t('m'), // 3 == PATHSEG_MOVETO_REL + char16_t('L'), // 4 == PATHSEG_LINETO_ABS + char16_t('l'), // 5 == PATHSEG_LINETO_REL + char16_t('C'), // 6 == PATHSEG_CURVETO_CUBIC_ABS + char16_t('c'), // 7 == PATHSEG_CURVETO_CUBIC_REL + char16_t('Q'), // 8 == PATHSEG_CURVETO_QUADRATIC_ABS + char16_t('q'), // 9 == PATHSEG_CURVETO_QUADRATIC_REL + char16_t('A'), // 10 == PATHSEG_ARC_ABS + char16_t('a'), // 11 == PATHSEG_ARC_REL + char16_t('H'), // 12 == PATHSEG_LINETO_HORIZONTAL_ABS + char16_t('h'), // 13 == PATHSEG_LINETO_HORIZONTAL_REL + char16_t('V'), // 14 == PATHSEG_LINETO_VERTICAL_ABS + char16_t('v'), // 15 == PATHSEG_LINETO_VERTICAL_REL + char16_t('S'), // 16 == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS + char16_t('s'), // 17 == PATHSEG_CURVETO_CUBIC_SMOOTH_REL + char16_t('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS + char16_t('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); diff --git a/content/svg/content/src/SVGPointList.cpp b/content/svg/content/src/SVGPointList.cpp index 782dae9eb800..98453315809c 100644 --- a/content/svg/content/src/SVGPointList.cpp +++ b/content/svg/content/src/SVGPointList.cpp @@ -27,7 +27,7 @@ void SVGPointList::GetValueAsString(nsAString& aValue) const { aValue.Truncate(); - PRUnichar buf[50]; + char16_t buf[50]; uint32_t last = mItems.Length() - 1; for (uint32_t i = 0; i < mItems.Length(); ++i) { // Would like to use aValue.AppendPrintf("%f,%f", item.mX, item.mY), @@ -62,9 +62,9 @@ SVGPointList::SetValueFromString(const nsAString& aValue) const nsAString& token = tokenizer.nextToken(); - RangedPtr iter = + RangedPtr iter = SVGContentUtils::GetStartRangedPtr(token); - const RangedPtr end = + const RangedPtr end = SVGContentUtils::GetEndRangedPtr(token); float x; diff --git a/content/svg/content/src/SVGTransformListParser.cpp b/content/svg/content/src/SVGTransformListParser.cpp index 24cfd746a0ba..8d34181c8308 100644 --- a/content/svg/content/src/SVGTransformListParser.cpp +++ b/content/svg/content/src/SVGTransformListParser.cpp @@ -54,7 +54,7 @@ SVGTransformListParser::ParseTransforms() bool SVGTransformListParser::ParseTransform() { - RangedPtr start(mIter); + RangedPtr start(mIter); while (IsAlpha(*mIter)) { ++mIter; if (mIter == mEnd) { diff --git a/content/svg/content/src/nsSVGAngle.cpp b/content/svg/content/src/nsSVGAngle.cpp index f61eb553548b..ebee0c603211 100644 --- a/content/svg/content/src/nsSVGAngle.cpp +++ b/content/svg/content/src/nsSVGAngle.cpp @@ -82,8 +82,8 @@ GetUnitTypeForString(const nsAString& unitStr) static void GetValueString(nsAString &aValueAsString, float aValue, uint16_t aUnitType) { - PRUnichar buf[24]; - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + char16_t buf[24]; + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("%g"), (double)aValue); aValueAsString.Assign(buf); @@ -98,9 +98,9 @@ GetValueFromString(const nsAString& aString, float& aValue, uint16_t* aUnitType) { - RangedPtr iter = + RangedPtr iter = SVGContentUtils::GetStartRangedPtr(aString); - const RangedPtr end = + const RangedPtr end = SVGContentUtils::GetEndRangedPtr(aString); if (!SVGContentUtils::ParseNumber(iter, end, aValue)) { diff --git a/content/svg/content/src/nsSVGDataParser.h b/content/svg/content/src/nsSVGDataParser.h index 0dc87ce6b8a3..7f60567b928b 100644 --- a/content/svg/content/src/nsSVGDataParser.h +++ b/content/svg/content/src/nsSVGDataParser.h @@ -19,7 +19,7 @@ public: nsSVGDataParser(const nsAString& aValue); protected: - static bool IsAlpha(PRUnichar aCh) { + static bool IsAlpha(char16_t aCh) { // Exclude non-ascii characters before calling isalpha return (aCh & 0x7f) == aCh && isalpha(aCh); } @@ -30,8 +30,8 @@ protected: // Returns true if there are more characters to read, false otherwise. bool SkipWsp(); - mozilla::RangedPtr mIter; - const mozilla::RangedPtr mEnd; + mozilla::RangedPtr mIter; + const mozilla::RangedPtr mEnd; }; diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 2561edd73d87..8ecdbdf998f0 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -2500,7 +2500,7 @@ nsSVGElement::ReportAttributeParseFailure(nsIDocument* aDocument, const nsAString& aValue) { const nsAFlatString& attributeValue = PromiseFlatString(aValue); - const PRUnichar *strings[] = { aAttribute->GetUTF16String(), + const char16_t *strings[] = { aAttribute->GetUTF16String(), attributeValue.get() }; return SVGContentUtils::ReportToConsole(aDocument, "AttributeParseWarning", diff --git a/content/svg/content/src/nsSVGLength2.cpp b/content/svg/content/src/nsSVGLength2.cpp index 42bdf69daee1..dd6bb423dd76 100644 --- a/content/svg/content/src/nsSVGLength2.cpp +++ b/content/svg/content/src/nsSVGLength2.cpp @@ -110,8 +110,8 @@ GetUnitTypeForString(const nsAString& unitStr) static void GetValueString(nsAString &aValueAsString, float aValue, uint16_t aUnitType) { - PRUnichar buf[24]; - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + char16_t buf[24]; + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("%g"), (double)aValue); aValueAsString.Assign(buf); @@ -126,9 +126,9 @@ GetValueFromString(const nsAString& aString, float& aValue, uint16_t* aUnitType) { - RangedPtr iter = + RangedPtr iter = SVGContentUtils::GetStartRangedPtr(aString); - const RangedPtr end = + const RangedPtr end = SVGContentUtils::GetEndRangedPtr(aString); if (!SVGContentUtils::ParseNumber(iter, end, aValue)) { diff --git a/content/svg/content/src/nsSVGNumber2.cpp b/content/svg/content/src/nsSVGNumber2.cpp index 7f531cf72653..397a673360a8 100644 --- a/content/svg/content/src/nsSVGNumber2.cpp +++ b/content/svg/content/src/nsSVGNumber2.cpp @@ -25,9 +25,9 @@ GetValueFromString(const nsAString& aString, bool aPercentagesAllowed, float& aValue) { - RangedPtr iter = + RangedPtr iter = SVGContentUtils::GetStartRangedPtr(aString); - const RangedPtr end = + const RangedPtr end = SVGContentUtils::GetEndRangedPtr(aString); if (!SVGContentUtils::ParseNumber(iter, end, aValue)) { diff --git a/content/svg/content/src/nsSVGPathDataParser.cpp b/content/svg/content/src/nsSVGPathDataParser.cpp index 03dceb05ea56..2c4815b39c34 100644 --- a/content/svg/content/src/nsSVGPathDataParser.cpp +++ b/content/svg/content/src/nsSVGPathDataParser.cpp @@ -14,7 +14,7 @@ using namespace mozilla; using namespace mozilla::gfx; -static inline PRUnichar ToUpper(PRUnichar aCh) +static inline char16_t ToUpper(char16_t aCh) { return aCh >= 'a' && aCh <= 'z' ? aCh - 'a' + 'A' : aCh; } @@ -74,7 +74,7 @@ bool nsSVGPathDataParser::ParseSubPathElements() { while (SkipWsp() && !IsStartOfSubPath()) { - PRUnichar commandType = ToUpper(*mIter); + char16_t commandType = ToUpper(*mIter); // Upper case commands have absolute co-ordinates, // lower case commands have relative co-ordinates. @@ -91,7 +91,7 @@ nsSVGPathDataParser::ParseSubPathElements() } bool -nsSVGPathDataParser::ParseSubPathElement(PRUnichar aCommandType, +nsSVGPathDataParser::ParseSubPathElement(char16_t aCommandType, bool aAbsCoords) { switch (aCommandType) { diff --git a/content/svg/content/src/nsSVGPathDataParser.h b/content/svg/content/src/nsSVGPathDataParser.h index f295964e0fc8..738fb35f8465 100644 --- a/content/svg/content/src/nsSVGPathDataParser.h +++ b/content/svg/content/src/nsSVGPathDataParser.h @@ -43,7 +43,7 @@ private: bool ParseSubPath(); bool ParseSubPathElements(); - bool ParseSubPathElement(PRUnichar aCommandType, + bool ParseSubPathElement(char16_t aCommandType, bool aAbsCoords); bool ParseMoveto(); diff --git a/content/svg/content/src/nsSVGTransform.cpp b/content/svg/content/src/nsSVGTransform.cpp index 86775690383b..0af0b726ecce 100644 --- a/content/svg/content/src/nsSVGTransform.cpp +++ b/content/svg/content/src/nsSVGTransform.cpp @@ -18,47 +18,47 @@ namespace mozilla { void nsSVGTransform::GetValueAsString(nsAString& aValue) const { - PRUnichar buf[256]; + char16_t buf[256]; switch (mType) { case SVG_TRANSFORM_TRANSLATE: // The spec say that if Y is not provided, it is assumed to be zero. if (mMatrix.y0 != 0) - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("translate(%g, %g)"), mMatrix.x0, mMatrix.y0); else - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("translate(%g)"), mMatrix.x0); break; case SVG_TRANSFORM_ROTATE: if (mOriginX != 0.0f || mOriginY != 0.0f) - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("rotate(%g, %g, %g)"), mAngle, mOriginX, mOriginY); else - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("rotate(%g)"), mAngle); break; case SVG_TRANSFORM_SCALE: if (mMatrix.xx != mMatrix.yy) - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("scale(%g, %g)"), mMatrix.xx, mMatrix.yy); else - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("scale(%g)"), mMatrix.xx); break; case SVG_TRANSFORM_SKEWX: - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("skewX(%g)"), mAngle); break; case SVG_TRANSFORM_SKEWY: - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("skewY(%g)"), mAngle); break; case SVG_TRANSFORM_MATRIX: - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("matrix(%g, %g, %g, %g, %g, %g)"), mMatrix.xx, mMatrix.yx, mMatrix.xy, mMatrix.yy, diff --git a/content/svg/content/src/nsSVGViewBox.cpp b/content/svg/content/src/nsSVGViewBox.cpp index afb9f2f872d0..27a0b5c36291 100644 --- a/content/svg/content/src/nsSVGViewBox.cpp +++ b/content/svg/content/src/nsSVGViewBox.cpp @@ -180,8 +180,8 @@ nsSVGViewBox::GetBaseValueString(nsAString& aValue) const aValue.AssignLiteral("none"); return; } - PRUnichar buf[200]; - nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), + char16_t buf[200]; + nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t), MOZ_UTF16("%g %g %g %g"), (double)mBaseVal.x, (double)mBaseVal.y, (double)mBaseVal.width, (double)mBaseVal.height); diff --git a/content/xbl/src/nsXBLContentSink.cpp b/content/xbl/src/nsXBLContentSink.cpp index 10b49451866f..50d62357e879 100644 --- a/content/xbl/src/nsXBLContentSink.cpp +++ b/content/xbl/src/nsXBLContentSink.cpp @@ -145,10 +145,10 @@ nsXBLContentSink::FlushText(bool aReleaseTextNode) bool isWS = true; if (mTextLength > 0) { - const PRUnichar* cp = mText; - const PRUnichar* end = mText + mTextLength; + const char16_t* cp = mText; + const char16_t* end = mText + mTextLength; while (cp < end) { - PRUnichar ch = *cp++; + char16_t ch = *cp++; if (!dom::IsSpaceCharacter(ch)) { isWS = false; break; @@ -168,8 +168,8 @@ nsXBLContentSink::FlushText(bool aReleaseTextNode) } NS_IMETHODIMP -nsXBLContentSink::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +nsXBLContentSink::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { @@ -210,7 +210,7 @@ nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName, nsAutoString elementName; aElementName->ToString(elementName); - const PRUnichar* params[] = { elementName.get() }; + const char16_t* params[] = { elementName.get() }; return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag, NS_LITERAL_CSTRING("XBL Content Sink"), @@ -248,8 +248,8 @@ nsXBLContentSink::AddField(nsXBLProtoImplField* aField) } NS_IMETHODIMP -nsXBLContentSink::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +nsXBLContentSink::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -271,7 +271,7 @@ nsXBLContentSink::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -nsXBLContentSink::HandleEndElement(const PRUnichar *aName) +nsXBLContentSink::HandleEndElement(const char16_t *aName) { FlushText(); @@ -357,7 +357,7 @@ nsXBLContentSink::HandleEndElement(const PRUnichar *aName) } NS_IMETHODIMP -nsXBLContentSink::HandleCDataSection(const PRUnichar *aData, +nsXBLContentSink::HandleCDataSection(const char16_t *aData, uint32_t aLength) { if (mState == eXBL_InHandlers || mState == eXBL_InImplementation) @@ -371,7 +371,7 @@ nsXBLContentSink::HandleCDataSection(const PRUnichar *aData, PR_END_MACRO bool -nsXBLContentSink::OnOpenContainer(const PRUnichar **aAtts, +nsXBLContentSink::OnOpenContainer(const char16_t **aAtts, uint32_t aAttsCount, int32_t aNameSpaceID, nsIAtom* aTagName, @@ -581,7 +581,7 @@ nsXBLContentSink::ConstructBinding(uint32_t aLineNumber) } static bool -FindValue(const PRUnichar **aAtts, nsIAtom *aAtom, const PRUnichar **aResult) +FindValue(const char16_t **aAtts, nsIAtom *aAtom, const char16_t **aResult) { nsCOMPtr prefix, localName; for (; *aAtts; aAtts += 2) { @@ -601,20 +601,20 @@ FindValue(const PRUnichar **aAtts, nsIAtom *aAtom, const PRUnichar **aResult) } void -nsXBLContentSink::ConstructHandler(const PRUnichar **aAtts, uint32_t aLineNumber) +nsXBLContentSink::ConstructHandler(const char16_t **aAtts, uint32_t aLineNumber) { - const PRUnichar* event = nullptr; - const PRUnichar* modifiers = nullptr; - const PRUnichar* button = nullptr; - const PRUnichar* clickcount = nullptr; - const PRUnichar* keycode = nullptr; - const PRUnichar* charcode = nullptr; - const PRUnichar* phase = nullptr; - const PRUnichar* command = nullptr; - const PRUnichar* action = nullptr; - const PRUnichar* group = nullptr; - const PRUnichar* preventdefault = nullptr; - const PRUnichar* allowuntrusted = nullptr; + const char16_t* event = nullptr; + const char16_t* modifiers = nullptr; + const char16_t* button = nullptr; + const char16_t* clickcount = nullptr; + const char16_t* keycode = nullptr; + const char16_t* charcode = nullptr; + const char16_t* phase = nullptr; + const char16_t* command = nullptr; + const char16_t* action = nullptr; + const char16_t* group = nullptr; + const char16_t* preventdefault = nullptr; + const char16_t* allowuntrusted = nullptr; nsCOMPtr prefix, localName; for (; *aAtts; aAtts += 2) { @@ -695,20 +695,20 @@ nsXBLContentSink::ConstructHandler(const PRUnichar **aAtts, uint32_t aLineNumber } void -nsXBLContentSink::ConstructResource(const PRUnichar **aAtts, +nsXBLContentSink::ConstructResource(const char16_t **aAtts, nsIAtom* aResourceType) { if (!mBinding) return; - const PRUnichar* src = nullptr; + const char16_t* src = nullptr; if (FindValue(aAtts, nsGkAtoms::src, &src)) { mBinding->AddResource(aResourceType, nsDependentString(src)); } } void -nsXBLContentSink::ConstructImplementation(const PRUnichar **aAtts) +nsXBLContentSink::ConstructImplementation(const char16_t **aAtts) { mImplementation = nullptr; mImplMember = nullptr; @@ -717,7 +717,7 @@ nsXBLContentSink::ConstructImplementation(const PRUnichar **aAtts) if (!mBinding) return; - const PRUnichar* name = nullptr; + const char16_t* name = nullptr; nsCOMPtr prefix, localName; for (; *aAtts; aAtts += 2) { @@ -746,10 +746,10 @@ nsXBLContentSink::ConstructImplementation(const PRUnichar **aAtts) } void -nsXBLContentSink::ConstructField(const PRUnichar **aAtts, uint32_t aLineNumber) +nsXBLContentSink::ConstructField(const char16_t **aAtts, uint32_t aLineNumber) { - const PRUnichar* name = nullptr; - const PRUnichar* readonly = nullptr; + const char16_t* name = nullptr; + const char16_t* readonly = nullptr; nsCOMPtr prefix, localName; for (; *aAtts; aAtts += 2) { @@ -782,12 +782,12 @@ nsXBLContentSink::ConstructField(const PRUnichar **aAtts, uint32_t aLineNumber) } void -nsXBLContentSink::ConstructProperty(const PRUnichar **aAtts, uint32_t aLineNumber) +nsXBLContentSink::ConstructProperty(const char16_t **aAtts, uint32_t aLineNumber) { - const PRUnichar* name = nullptr; - const PRUnichar* readonly = nullptr; - const PRUnichar* onget = nullptr; - const PRUnichar* onset = nullptr; + const char16_t* name = nullptr; + const char16_t* readonly = nullptr; + const char16_t* onget = nullptr; + const char16_t* onset = nullptr; bool exposeToUntrustedContent = false; nsCOMPtr prefix, localName; @@ -832,12 +832,12 @@ nsXBLContentSink::ConstructProperty(const PRUnichar **aAtts, uint32_t aLineNumbe } void -nsXBLContentSink::ConstructMethod(const PRUnichar **aAtts) +nsXBLContentSink::ConstructMethod(const char16_t **aAtts) { mMethod = nullptr; - const PRUnichar* name = nullptr; - const PRUnichar* expose = nullptr; + const char16_t* name = nullptr; + const char16_t* expose = nullptr; if (FindValue(aAtts, nsGkAtoms::name, &name)) { mMethod = new nsXBLProtoImplMethod(name); if (FindValue(aAtts, nsGkAtoms::exposeToUntrustedContent, &expose) && @@ -853,19 +853,19 @@ nsXBLContentSink::ConstructMethod(const PRUnichar **aAtts) } void -nsXBLContentSink::ConstructParameter(const PRUnichar **aAtts) +nsXBLContentSink::ConstructParameter(const char16_t **aAtts) { if (!mMethod) return; - const PRUnichar* name = nullptr; + const char16_t* name = nullptr; if (FindValue(aAtts, nsGkAtoms::name, &name)) { mMethod->AddParameter(nsDependentString(name)); } } nsresult -nsXBLContentSink::CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, +nsXBLContentSink::CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, FromParser aFromParser) @@ -898,7 +898,7 @@ nsXBLContentSink::CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, } nsresult -nsXBLContentSink::AddAttributes(const PRUnichar** aAtts, +nsXBLContentSink::AddAttributes(const char16_t** aAtts, nsIContent* aContent) { if (aContent->IsXUL()) @@ -909,7 +909,7 @@ nsXBLContentSink::AddAttributes(const PRUnichar** aAtts, #ifdef MOZ_XUL nsresult -nsXBLContentSink::AddAttributesToXULPrototype(const PRUnichar **aAtts, +nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts, uint32_t aAttsCount, nsXULPrototypeElement* aElement) { diff --git a/content/xbl/src/nsXBLContentSink.h b/content/xbl/src/nsXBLContentSink.h index d0dd382aaca9..37d46fadadc5 100644 --- a/content/xbl/src/nsXBLContentSink.h +++ b/content/xbl/src/nsXBLContentSink.h @@ -66,22 +66,22 @@ public: nsISupports* aContainer); // nsIContentSink overrides - NS_IMETHOD HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, + NS_IMETHOD HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) MOZ_OVERRIDE; - NS_IMETHOD HandleEndElement(const PRUnichar *aName) MOZ_OVERRIDE; + NS_IMETHOD HandleEndElement(const char16_t *aName) MOZ_OVERRIDE; - NS_IMETHOD HandleCDataSection(const PRUnichar *aData, + NS_IMETHOD HandleCDataSection(const char16_t *aData, uint32_t aLength) MOZ_OVERRIDE; protected: // nsXMLContentSink overrides virtual void MaybeStartLayout(bool aIgnorePendingSheets) MOZ_OVERRIDE; - bool OnOpenContainer(const PRUnichar **aAtts, + bool OnOpenContainer(const char16_t **aAtts, uint32_t aAttsCount, int32_t aNameSpaceID, nsIAtom* aTagName, @@ -89,37 +89,37 @@ protected: bool NotifyForDocElement() MOZ_OVERRIDE { return false; } - nsresult CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, + nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, mozilla::dom::FromParser aFromParser) MOZ_OVERRIDE; - nsresult AddAttributes(const PRUnichar** aAtts, + nsresult AddAttributes(const char16_t** aAtts, nsIContent* aContent) MOZ_OVERRIDE; #ifdef MOZ_XUL - nsresult AddAttributesToXULPrototype(const PRUnichar **aAtts, + nsresult AddAttributesToXULPrototype(const char16_t **aAtts, uint32_t aAttsCount, nsXULPrototypeElement* aElement); #endif // Our own helpers for constructing XBL prototype objects. nsresult ConstructBinding(uint32_t aLineNumber); - void ConstructHandler(const PRUnichar **aAtts, uint32_t aLineNumber); - void ConstructResource(const PRUnichar **aAtts, nsIAtom* aResourceType); - void ConstructImplementation(const PRUnichar **aAtts); - void ConstructProperty(const PRUnichar **aAtts, uint32_t aLineNumber); - void ConstructMethod(const PRUnichar **aAtts); - void ConstructParameter(const PRUnichar **aAtts); - void ConstructField(const PRUnichar **aAtts, uint32_t aLineNumber); + void ConstructHandler(const char16_t **aAtts, uint32_t aLineNumber); + void ConstructResource(const char16_t **aAtts, nsIAtom* aResourceType); + void ConstructImplementation(const char16_t **aAtts); + void ConstructProperty(const char16_t **aAtts, uint32_t aLineNumber); + void ConstructMethod(const char16_t **aAtts); + void ConstructParameter(const char16_t **aAtts); + void ConstructField(const char16_t **aAtts, uint32_t aLineNumber); // nsXMLContentSink overrides nsresult FlushText(bool aReleaseTextNode = true) MOZ_OVERRIDE; // nsIExpatSink overrides - NS_IMETHOD ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, + NS_IMETHOD ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) MOZ_OVERRIDE; diff --git a/content/xbl/src/nsXBLProtoImpl.cpp b/content/xbl/src/nsXBLProtoImpl.cpp index 267d8f15df80..0f30f20cd714 100644 --- a/content/xbl/src/nsXBLProtoImpl.cpp +++ b/content/xbl/src/nsXBLProtoImpl.cpp @@ -300,7 +300,7 @@ nsXBLProtoImpl::ResolveAllFields(JSContext *cx, JS::Handle obj) const { for (nsXBLProtoImplField* f = mFields; f; f = f->GetNext()) { // Using OBJ_LOOKUP_PROPERTY is a pain, since what we have is a - // PRUnichar* for the property name. Let's just use the public API and + // char16_t* for the property name. Let's just use the public API and // all. nsDependentString name(f->GetName()); JS::Rooted dummy(cx); @@ -504,7 +504,7 @@ nsXBLProtoImpl::Write(nsIObjectOutputStream* aStream, nsresult NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding, - const PRUnichar* aClassName, + const char16_t* aClassName, nsXBLProtoImpl** aResult) { nsXBLProtoImpl* impl = new nsXBLProtoImpl(); diff --git a/content/xbl/src/nsXBLProtoImpl.h b/content/xbl/src/nsXBLProtoImpl.h index bd383dd3a70e..7c75c24c58cc 100644 --- a/content/xbl/src/nsXBLProtoImpl.h +++ b/content/xbl/src/nsXBLProtoImpl.h @@ -115,7 +115,7 @@ public: nsresult NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding, - const PRUnichar* aClassName, + const char16_t* aClassName, nsXBLProtoImpl** aResult); #endif // nsXBLProtoImpl_h__ diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 9591a63ebb5c..ac8b8a81fa6a 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -24,7 +24,7 @@ using namespace mozilla; using namespace mozilla::dom; -nsXBLProtoImplField::nsXBLProtoImplField(const PRUnichar* aName, const PRUnichar* aReadOnly) +nsXBLProtoImplField::nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly) : mNext(nullptr), mFieldText(nullptr), mFieldTextLength(0), @@ -70,7 +70,7 @@ nsXBLProtoImplField::AppendFieldText(const nsAString& aText) if (mFieldText) { nsDependentString fieldTextStr(mFieldText, mFieldTextLength); nsAutoString newFieldText = fieldTextStr + aText; - PRUnichar* temp = mFieldText; + char16_t* temp = mFieldText; mFieldText = ToNewUnicode(newFieldText); mFieldTextLength = newFieldText.Length(); nsMemory::Free(temp); diff --git a/content/xbl/src/nsXBLProtoImplField.h b/content/xbl/src/nsXBLProtoImplField.h index 1f8b076ffbde..a3b7ae252bd0 100644 --- a/content/xbl/src/nsXBLProtoImplField.h +++ b/content/xbl/src/nsXBLProtoImplField.h @@ -20,7 +20,7 @@ class nsIURI; class nsXBLProtoImplField { public: - nsXBLProtoImplField(const PRUnichar* aName, const PRUnichar* aReadOnly); + nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly); nsXBLProtoImplField(const bool aIsReadOnly); ~nsXBLProtoImplField(); @@ -43,7 +43,7 @@ public: nsresult Read(nsIObjectInputStream* aStream); nsresult Write(nsIObjectOutputStream* aStream); - const PRUnichar* GetName() const { return mName; } + const char16_t* GetName() const { return mName; } unsigned AccessorAttributes() const { return JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER | @@ -54,8 +54,8 @@ public: protected: nsXBLProtoImplField* mNext; - PRUnichar* mName; - PRUnichar* mFieldText; + char16_t* mName; + char16_t* mFieldText; uint32_t mFieldTextLength; uint32_t mLineNumber; unsigned mJSAttributes; diff --git a/content/xbl/src/nsXBLProtoImplMember.h b/content/xbl/src/nsXBLProtoImplMember.h index f8c78c43ecd9..8130ac0377b4 100644 --- a/content/xbl/src/nsXBLProtoImplMember.h +++ b/content/xbl/src/nsXBLProtoImplMember.h @@ -18,7 +18,7 @@ class nsIObjectOutputStream; struct nsXBLTextWithLineNumber { - PRUnichar* mText; + char16_t* mText; uint32_t mLineNumber; nsXBLTextWithLineNumber() : @@ -37,7 +37,7 @@ struct nsXBLTextWithLineNumber void AppendText(const nsAString& aText) { if (mText) { - PRUnichar* temp = mText; + char16_t* temp = mText; mText = ToNewUnicode(nsDependentString(temp) + aText); nsMemory::Free(temp); } else { @@ -45,7 +45,7 @@ struct nsXBLTextWithLineNumber } } - PRUnichar* GetText() { + char16_t* GetText() { return mText; } @@ -61,7 +61,7 @@ struct nsXBLTextWithLineNumber class nsXBLProtoImplMember { public: - nsXBLProtoImplMember(const PRUnichar* aName) + nsXBLProtoImplMember(const char16_t* aName) : mNext(nullptr) , mExposeToUntrustedContent(false) { @@ -76,7 +76,7 @@ public: void SetNext(nsXBLProtoImplMember* aNext) { mNext = aNext; } bool ShouldExposeToUntrustedContent() { return mExposeToUntrustedContent; } void SetExposeToUntrustedContent(bool aExpose) { mExposeToUntrustedContent = aExpose; } - const PRUnichar* GetName() { return mName; } + const char16_t* GetName() { return mName; } virtual nsresult InstallMember(JSContext* aCx, JS::Handle aTargetClassObject) = 0; @@ -92,7 +92,7 @@ public: protected: nsXBLProtoImplMember* mNext; // The members of an implementation are chained. - PRUnichar* mName; // The name of the field, method, or property. + char16_t* mName; // The name of the field, method, or property. bool mExposeToUntrustedContent; // If this binding is installed on an element // in an untrusted scope, should this diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index a38f998e5c78..708e94ad020a 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -23,7 +23,7 @@ using namespace mozilla; -nsXBLProtoImplMethod::nsXBLProtoImplMethod(const PRUnichar* aName) : +nsXBLProtoImplMethod::nsXBLProtoImplMethod(const char16_t* aName) : nsXBLProtoImplMember(aName), mMethod() { @@ -176,7 +176,7 @@ nsXBLProtoImplMethod::CompileMember(const nsCString& aClassStr, // Get the body nsDependentString body; - PRUnichar *bodyText = uncompiledMethod->mBodyText.GetText(); + char16_t *bodyText = uncompiledMethod->mBodyText.GetText(); if (bodyText) body.Rebind(bodyText); diff --git a/content/xbl/src/nsXBLProtoImplMethod.h b/content/xbl/src/nsXBLProtoImplMethod.h index c74e09ba10b9..27cab3e0b278 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.h +++ b/content/xbl/src/nsXBLProtoImplMethod.h @@ -81,7 +81,7 @@ struct nsXBLUncompiledMethod { class nsXBLProtoImplMethod: public nsXBLProtoImplMember { public: - nsXBLProtoImplMethod(const PRUnichar* aName); + nsXBLProtoImplMethod(const char16_t* aName); virtual ~nsXBLProtoImplMethod(); void AppendBodyText(const nsAString& aBody); @@ -135,7 +135,7 @@ protected: class nsXBLProtoImplAnonymousMethod : public nsXBLProtoImplMethod { public: - nsXBLProtoImplAnonymousMethod(const PRUnichar* aName) : + nsXBLProtoImplAnonymousMethod(const char16_t* aName) : nsXBLProtoImplMethod(aName) {} diff --git a/content/xbl/src/nsXBLProtoImplProperty.cpp b/content/xbl/src/nsXBLProtoImplProperty.cpp index 0a7542a7b908..1924d8e36443 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.cpp +++ b/content/xbl/src/nsXBLProtoImplProperty.cpp @@ -18,10 +18,10 @@ using namespace mozilla; -nsXBLProtoImplProperty::nsXBLProtoImplProperty(const PRUnichar* aName, - const PRUnichar* aGetter, - const PRUnichar* aSetter, - const PRUnichar* aReadOnly, +nsXBLProtoImplProperty::nsXBLProtoImplProperty(const char16_t* aName, + const char16_t* aGetter, + const char16_t* aSetter, + const char16_t* aReadOnly, uint32_t aLineNumber) : nsXBLProtoImplMember(aName), mJSAttributes(JSPROP_ENUMERATE) @@ -47,7 +47,7 @@ nsXBLProtoImplProperty::nsXBLProtoImplProperty(const PRUnichar* aName, } } -nsXBLProtoImplProperty::nsXBLProtoImplProperty(const PRUnichar* aName, +nsXBLProtoImplProperty::nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly) : nsXBLProtoImplMember(aName), mJSAttributes(JSPROP_ENUMERATE) diff --git a/content/xbl/src/nsXBLProtoImplProperty.h b/content/xbl/src/nsXBLProtoImplProperty.h index 875db3e2af20..113aa5c45a53 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.h +++ b/content/xbl/src/nsXBLProtoImplProperty.h @@ -17,13 +17,13 @@ class nsXBLProtoImplProperty: public nsXBLProtoImplMember { public: - nsXBLProtoImplProperty(const PRUnichar* aName, - const PRUnichar* aGetter, - const PRUnichar* aSetter, - const PRUnichar* aReadOnly, + nsXBLProtoImplProperty(const char16_t* aName, + const char16_t* aGetter, + const char16_t* aSetter, + const char16_t* aReadOnly, uint32_t aLineNumber); - nsXBLProtoImplProperty(const PRUnichar* aName, const bool aIsReadOnly); + nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly); virtual ~nsXBLProtoImplProperty(); diff --git a/content/xbl/src/nsXBLPrototypeBinding.cpp b/content/xbl/src/nsXBLPrototypeBinding.cpp index 385c3dd3ba4b..a6f2ed7b9e16 100644 --- a/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -360,8 +360,8 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute, // children of the real element and get the text nodes' values. if (aAttribute == nsGkAtoms::text && aNameSpaceID == kNameSpaceID_XBL) { nsContentUtils::GetNodeTextContent(aChangedElement, false, value); - value.StripChar(PRUnichar('\n')); - value.StripChar(PRUnichar('\r')); + value.StripChar(char16_t('\n')); + value.StripChar(char16_t('\r')); nsAutoString stripVal(value); stripVal.StripWhitespace(); if (stripVal.IsEmpty()) @@ -513,8 +513,8 @@ bool SetAttrs(nsHashKey* aKey, void* aData, void* aClosure) if (src == nsGkAtoms::text && srcNs == kNameSpaceID_XBL) { nsContentUtils::GetNodeTextContent(changeData->mBoundElement, false, value); - value.StripChar(PRUnichar('\n')); - value.StripChar(PRUnichar('\r')); + value.StripChar(char16_t('\n')); + value.StripChar(char16_t('\r')); nsAutoString stripVal(value); stripVal.StripWhitespace(); @@ -1685,7 +1685,7 @@ nsXBLPrototypeBinding::ResolveBaseBinding() nsCOMPtr tagName = do_GetAtom(display); // Check the white list if (!CheckTagNameWhiteList(nameSpaceID, tagName)) { - const PRUnichar* params[] = { display.get() }; + const char16_t* params[] = { display.get() }; nsContentUtils::ReportToConsole(nsIScriptError::errorFlag, NS_LITERAL_CSTRING("XBL"), nullptr, nsContentUtils::eXBL_PROPERTIES, diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 7621c60491ac..5eb6a4a85e5e 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -71,18 +71,18 @@ const int32_t nsXBLPrototypeHandler::cOSMask = (1<<9); const int32_t nsXBLPrototypeHandler::cAllModifiers = cShiftMask | cAltMask | cControlMask | cMetaMask | cOSMask; -nsXBLPrototypeHandler::nsXBLPrototypeHandler(const PRUnichar* aEvent, - const PRUnichar* aPhase, - const PRUnichar* aAction, - const PRUnichar* aCommand, - const PRUnichar* aKeyCode, - const PRUnichar* aCharCode, - const PRUnichar* aModifiers, - const PRUnichar* aButton, - const PRUnichar* aClickCount, - const PRUnichar* aGroup, - const PRUnichar* aPreventDefault, - const PRUnichar* aAllowUntrusted, +nsXBLPrototypeHandler::nsXBLPrototypeHandler(const char16_t* aEvent, + const char16_t* aPhase, + const char16_t* aAction, + const char16_t* aCommand, + const char16_t* aKeyCode, + const char16_t* aCharCode, + const char16_t* aModifiers, + const char16_t* aButton, + const char16_t* aClickCount, + const char16_t* aGroup, + const char16_t* aPreventDefault, + const char16_t* aAllowUntrusted, nsXBLPrototypeBinding* aBinding, uint32_t aLineNumber) : mHandlerText(nullptr), @@ -147,7 +147,7 @@ nsXBLPrototypeHandler::AppendHandlerText(const nsAString& aText) { if (mHandlerText) { // Append our text to the existing text. - PRUnichar* temp = mHandlerText; + char16_t* temp = mHandlerText; mHandlerText = ToNewUnicode(nsDependentString(temp) + aText); nsMemory::Free(temp); } @@ -626,7 +626,7 @@ nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent, else aKeyEvent->GetCharCode(&code); if (IS_IN_BMP(code)) - code = ToLowerCase(PRUnichar(code)); + code = ToLowerCase(char16_t(code)); } else aKeyEvent->GetKeyCode(&code); @@ -728,18 +728,18 @@ nsXBLPrototypeHandler::GetEventType(nsAString& aEvent) void nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, - const PRUnichar* aEvent, - const PRUnichar* aPhase, - const PRUnichar* aAction, - const PRUnichar* aCommand, - const PRUnichar* aKeyCode, - const PRUnichar* aCharCode, - const PRUnichar* aModifiers, - const PRUnichar* aButton, - const PRUnichar* aClickCount, - const PRUnichar* aGroup, - const PRUnichar* aPreventDefault, - const PRUnichar* aAllowUntrusted) + const char16_t* aEvent, + const char16_t* aPhase, + const char16_t* aAction, + const char16_t* aCommand, + const char16_t* aKeyCode, + const char16_t* aCharCode, + const char16_t* aModifiers, + const char16_t* aButton, + const char16_t* aClickCount, + const char16_t* aGroup, + const char16_t* aPreventDefault, + const char16_t* aAllowUntrusted) { mType = 0; @@ -845,12 +845,12 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, mDetail = key[0]; const uint8_t GTK2Modifiers = cShift | cControl | cShiftMask | cControlMask; if ((mKeyMask & GTK2Modifiers) == GTK2Modifiers && - modifiers.First() != PRUnichar(',') && + modifiers.First() != char16_t(',') && (mDetail == 'u' || mDetail == 'U')) ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "GTK2Conflict"); const uint8_t WinModifiers = cControl | cAlt | cControlMask | cAltMask; if ((mKeyMask & WinModifiers) == WinModifiers && - modifiers.First() != PRUnichar(',') && + modifiers.First() != char16_t(',') && (('A' <= mDetail && mDetail <= 'Z') || ('a' <= mDetail && mDetail <= 'z'))) ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "WinConflict"); @@ -885,7 +885,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, } void -nsXBLPrototypeHandler::ReportKeyConflict(const PRUnichar* aKey, const PRUnichar* aModifiers, nsIContent* aKeyElement, const char *aMessageName) +nsXBLPrototypeHandler::ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, nsIContent* aKeyElement, const char *aMessageName) { nsCOMPtr doc; if (mPrototypeBinding) { @@ -897,7 +897,7 @@ nsXBLPrototypeHandler::ReportKeyConflict(const PRUnichar* aKey, const PRUnichar* doc = aKeyElement->OwnerDoc(); } - const PRUnichar* params[] = { aKey, aModifiers }; + const char16_t* params[] = { aKey, aModifiers }; nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XBL Prototype Handler"), doc, nsContentUtils::eXBL_PROPERTIES, diff --git a/content/xbl/src/nsXBLPrototypeHandler.h b/content/xbl/src/nsXBLPrototypeHandler.h index be6d0a498993..0e21b19f8f06 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.h +++ b/content/xbl/src/nsXBLPrototypeHandler.h @@ -49,13 +49,13 @@ class nsXBLPrototypeHandler { public: // This constructor is used by XBL handlers (both the JS and command shorthand variety) - nsXBLPrototypeHandler(const PRUnichar* aEvent, const PRUnichar* aPhase, - const PRUnichar* aAction, const PRUnichar* aCommand, - const PRUnichar* aKeyCode, const PRUnichar* aCharCode, - const PRUnichar* aModifiers, const PRUnichar* aButton, - const PRUnichar* aClickCount, const PRUnichar* aGroup, - const PRUnichar* aPreventDefault, - const PRUnichar* aAllowUntrusted, + nsXBLPrototypeHandler(const char16_t* aEvent, const char16_t* aPhase, + const char16_t* aAction, const char16_t* aCommand, + const char16_t* aKeyCode, const char16_t* aCharCode, + const char16_t* aModifiers, const char16_t* aButton, + const char16_t* aClickCount, const char16_t* aGroup, + const char16_t* aPreventDefault, + const char16_t* aAllowUntrusted, nsXBLPrototypeBinding* aBinding, uint32_t aLineNumber); @@ -152,15 +152,15 @@ protected: inline int32_t GetMatchingKeyCode(const nsAString& aKeyName); void ConstructPrototype(nsIContent* aKeyElement, - const PRUnichar* aEvent=nullptr, const PRUnichar* aPhase=nullptr, - const PRUnichar* aAction=nullptr, const PRUnichar* aCommand=nullptr, - const PRUnichar* aKeyCode=nullptr, const PRUnichar* aCharCode=nullptr, - const PRUnichar* aModifiers=nullptr, const PRUnichar* aButton=nullptr, - const PRUnichar* aClickCount=nullptr, const PRUnichar* aGroup=nullptr, - const PRUnichar* aPreventDefault=nullptr, - const PRUnichar* aAllowUntrusted=nullptr); + const char16_t* aEvent=nullptr, const char16_t* aPhase=nullptr, + const char16_t* aAction=nullptr, const char16_t* aCommand=nullptr, + const char16_t* aKeyCode=nullptr, const char16_t* aCharCode=nullptr, + const char16_t* aModifiers=nullptr, const char16_t* aButton=nullptr, + const char16_t* aClickCount=nullptr, const char16_t* aGroup=nullptr, + const char16_t* aPreventDefault=nullptr, + const char16_t* aAllowUntrusted=nullptr); - void ReportKeyConflict(const PRUnichar* aKey, const PRUnichar* aModifiers, nsIContent* aElement, const char *aMessageName); + void ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, nsIContent* aElement, const char *aMessageName); void GetEventType(nsAString& type); bool ModifiersMatchMask(nsIDOMUIEvent* aEvent, bool aIgnoreShiftKey = false); @@ -192,7 +192,7 @@ protected: protected: union { nsIWeakReference* mHandlerElement; // For XUL element handlers. [STRONG] - PRUnichar* mHandlerText; // For XBL handlers (we don't build an + char16_t* mHandlerText; // For XBL handlers (we don't build an // element for the , and instead // we cache the JS text or command name // that we should use. diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 2f198c42f7a8..b32f79a4838c 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -89,7 +89,7 @@ IsAncestorBinding(nsIDocument* aDocument, nsAutoCString spec; aChildBindingURI->GetSpec(spec); NS_ConvertUTF8toUTF16 bindingURI(spec); - const PRUnichar* params[] = { bindingURI.get() }; + const char16_t* params[] = { bindingURI.get() }; nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XBL"), aDocument, nsContentUtils::eXBL_PROPERTIES, @@ -635,7 +635,7 @@ nsXBLService::DetachGlobalKeyHandler(EventTarget* aTarget) } NS_IMETHODIMP -nsXBLService::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aSomeData) +nsXBLService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aSomeData) { if (nsCRT::strcmp(aTopic, "memory-pressure") == 0) FlushMemory(); @@ -762,7 +762,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI, NS_ConvertUTF8toUTF16 protoSpec(spec); baseBindingURI->GetSpec(basespec); NS_ConvertUTF8toUTF16 baseSpecUTF16(basespec); - const PRUnichar* params[] = { protoSpec.get(), baseSpecUTF16.get() }; + const char16_t* params[] = { protoSpec.get(), baseSpecUTF16.get() }; nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XBL"), nullptr, nsContentUtils::eXBL_PROPERTIES, diff --git a/content/xbl/src/nsXBLWindowKeyHandler.cpp b/content/xbl/src/nsXBLWindowKeyHandler.cpp index 0f77ce4e5f9e..381e43c234d8 100644 --- a/content/xbl/src/nsXBLWindowKeyHandler.cpp +++ b/content/xbl/src/nsXBLWindowKeyHandler.cpp @@ -73,7 +73,7 @@ NS_IMPL_ISUPPORTS1(nsXBLSpecialDocInfo, nsIObserver) NS_IMETHODIMP nsXBLSpecialDocInfo::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown"), "wrong topic"); diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index 4df2433a2573..976a262391da 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -451,7 +451,7 @@ nsXMLContentSink::SetParser(nsParserBase* aParser) } nsresult -nsXMLContentSink::CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, +nsXMLContentSink::CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, FromParser aFromParser) @@ -934,8 +934,8 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID, } NS_IMETHODIMP -nsXMLContentSink::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +nsXMLContentSink::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -945,8 +945,8 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName, } nsresult -nsXMLContentSink::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +nsXMLContentSink::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber, @@ -1054,13 +1054,13 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -nsXMLContentSink::HandleEndElement(const PRUnichar *aName) +nsXMLContentSink::HandleEndElement(const char16_t *aName) { return HandleEndElement(aName, true); } nsresult -nsXMLContentSink::HandleEndElement(const PRUnichar *aName, +nsXMLContentSink::HandleEndElement(const char16_t *aName, bool aInterruptable) { nsresult result = NS_OK; @@ -1131,7 +1131,7 @@ nsXMLContentSink::HandleEndElement(const PRUnichar *aName, } NS_IMETHODIMP -nsXMLContentSink::HandleComment(const PRUnichar *aName) +nsXMLContentSink::HandleComment(const char16_t *aName) { FlushText(); @@ -1144,7 +1144,7 @@ nsXMLContentSink::HandleComment(const PRUnichar *aName) } NS_IMETHODIMP -nsXMLContentSink::HandleCDataSection(const PRUnichar *aData, +nsXMLContentSink::HandleCDataSection(const char16_t *aData, uint32_t aLength) { // XSLT doesn't differentiate between text and cdata and wants adjacent @@ -1217,14 +1217,14 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -nsXMLContentSink::HandleCharacterData(const PRUnichar *aData, +nsXMLContentSink::HandleCharacterData(const char16_t *aData, uint32_t aLength) { return HandleCharacterData(aData, aLength, true); } nsresult -nsXMLContentSink::HandleCharacterData(const PRUnichar *aData, uint32_t aLength, +nsXMLContentSink::HandleCharacterData(const char16_t *aData, uint32_t aLength, bool aInterruptable) { nsresult rv = NS_OK; @@ -1236,8 +1236,8 @@ nsXMLContentSink::HandleCharacterData(const PRUnichar *aData, uint32_t aLength, } NS_IMETHODIMP -nsXMLContentSink::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +nsXMLContentSink::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { FlushText(); @@ -1329,8 +1329,8 @@ nsXMLContentSink::ParsePIData(const nsString &aData, nsString &aHref, } NS_IMETHODIMP -nsXMLContentSink::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +nsXMLContentSink::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { mDocument->SetXMLDeclaration(aVersion, aEncoding, aStandalone); @@ -1339,8 +1339,8 @@ nsXMLContentSink::HandleXMLDeclaration(const PRUnichar *aVersion, } NS_IMETHODIMP -nsXMLContentSink::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +nsXMLContentSink::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { @@ -1393,13 +1393,13 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText, MOZ_UTF16("href=\"chrome://global/locale/intl.css\" type=\"text/css\"")); NS_ENSURE_SUCCESS(rv, rv); - const PRUnichar* noAtts[] = { 0, 0 }; + const char16_t* noAtts[] = { 0, 0 }; NS_NAMED_LITERAL_STRING(errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml"); nsAutoString parsererror(errorNs); - parsererror.Append((PRUnichar)0xFFFF); + parsererror.Append((char16_t)0xFFFF); parsererror.AppendLiteral("parsererror"); rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, (uint32_t)-1, @@ -1410,7 +1410,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText, NS_ENSURE_SUCCESS(rv, rv); nsAutoString sourcetext(errorNs); - sourcetext.Append((PRUnichar)0xFFFF); + sourcetext.Append((char16_t)0xFFFF); sourcetext.AppendLiteral("sourcetext"); rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, (uint32_t)-1, @@ -1432,7 +1432,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText, } nsresult -nsXMLContentSink::AddAttributes(const PRUnichar** aAtts, +nsXMLContentSink::AddAttributes(const char16_t** aAtts, nsIContent* aContent) { // Add tag attributes to the content attributes @@ -1454,12 +1454,12 @@ nsXMLContentSink::AddAttributes(const PRUnichar** aAtts, #define NS_ACCUMULATION_BUFFER_SIZE 4096 nsresult -nsXMLContentSink::AddText(const PRUnichar* aText, +nsXMLContentSink::AddText(const char16_t* aText, int32_t aLength) { // Create buffer when we first need it if (0 == mTextSize) { - mText = (PRUnichar *) PR_MALLOC(sizeof(PRUnichar) * NS_ACCUMULATION_BUFFER_SIZE); + mText = (char16_t *) PR_MALLOC(sizeof(char16_t) * NS_ACCUMULATION_BUFFER_SIZE); if (nullptr == mText) { return NS_ERROR_OUT_OF_MEMORY; } @@ -1482,7 +1482,7 @@ nsXMLContentSink::AddText(const PRUnichar* aText, } else { mTextSize += aLength; - mText = (PRUnichar *) PR_REALLOC(mText, sizeof(PRUnichar) * mTextSize); + mText = (char16_t *) PR_REALLOC(mText, sizeof(char16_t) * mTextSize); if (nullptr == mText) { mTextSize = 0; @@ -1495,7 +1495,7 @@ nsXMLContentSink::AddText(const PRUnichar* aText, if (amount > aLength) { amount = aLength; } - memcpy(&mText[mTextLength], &aText[offset], sizeof(PRUnichar) * amount); + memcpy(&mText[mTextLength], &aText[offset], sizeof(char16_t) * amount); mTextLength += amount; offset += amount; aLength -= amount; diff --git a/content/xml/document/src/nsXMLContentSink.h b/content/xml/document/src/nsXMLContentSink.h index 3b26f42e84b0..126ad168199c 100644 --- a/content/xml/document/src/nsXMLContentSink.h +++ b/content/xml/document/src/nsXMLContentSink.h @@ -95,10 +95,10 @@ protected: // stylesheets are all done loading. virtual void MaybeStartLayout(bool aIgnorePendingSheets); - virtual nsresult AddAttributes(const PRUnichar** aNode, nsIContent* aContent); - nsresult AddText(const PRUnichar* aString, int32_t aLength); + virtual nsresult AddAttributes(const char16_t** aNode, nsIContent* aContent); + nsresult AddText(const char16_t* aString, int32_t aLength); - virtual bool OnOpenContainer(const PRUnichar **aAtts, + virtual bool OnOpenContainer(const char16_t **aAtts, uint32_t aAttsCount, int32_t aNameSpaceID, nsIAtom* aTagName, @@ -110,7 +110,7 @@ protected: nsIAtom *aTagName, nsIContent *aContent); virtual bool NotifyForDocElement() { return true; } - virtual nsresult CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, + virtual nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, mozilla::dom::FromParser aFromParser); @@ -156,17 +156,17 @@ protected: bool IsMonolithicContainer(nsINodeInfo* aNodeInfo); - nsresult HandleStartElement(const PRUnichar *aName, const PRUnichar **aAtts, + nsresult HandleStartElement(const char16_t *aName, const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber, bool aInterruptable); - nsresult HandleEndElement(const PRUnichar *aName, bool aInterruptable); - nsresult HandleCharacterData(const PRUnichar *aData, uint32_t aLength, + nsresult HandleEndElement(const char16_t *aName, bool aInterruptable); + nsresult HandleCharacterData(const char16_t *aData, uint32_t aLength, bool aInterruptable); nsCOMPtr mDocElement; nsCOMPtr mCurrentHead; // When set, we're in an XHTML - PRUnichar* mText; + char16_t* mText; XMLContentSinkState mState; diff --git a/content/xml/document/src/nsXMLFragmentContentSink.cpp b/content/xml/document/src/nsXMLFragmentContentSink.cpp index 639dd18a9fbd..602d44670032 100644 --- a/content/xml/document/src/nsXMLFragmentContentSink.cpp +++ b/content/xml/document/src/nsXMLFragmentContentSink.cpp @@ -51,13 +51,13 @@ public: const nsAString & aSystemId, const nsAString & aPublicId, nsISupports* aCatalogData); - NS_IMETHOD HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData); - NS_IMETHOD HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, + NS_IMETHOD HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData); + NS_IMETHOD HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone); - NS_IMETHOD ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, + NS_IMETHOD ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval); @@ -82,7 +82,7 @@ protected: virtual bool SetDocElement(int32_t aNameSpaceID, nsIAtom *aTagName, nsIContent *aContent); - virtual nsresult CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, + virtual nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, mozilla::dom::FromParser aFromParser); @@ -200,7 +200,7 @@ nsXMLFragmentContentSink::SetDocElement(int32_t aNameSpaceID, } nsresult -nsXMLFragmentContentSink::CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, +nsXMLFragmentContentSink::CreateElement(const char16_t** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, FromParser /*aFromParser*/) @@ -256,8 +256,8 @@ nsXMLFragmentContentSink::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -nsXMLFragmentContentSink::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +nsXMLFragmentContentSink::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { FlushText(); @@ -272,8 +272,8 @@ nsXMLFragmentContentSink::HandleProcessingInstruction(const PRUnichar *aTarget, } NS_IMETHODIMP -nsXMLFragmentContentSink::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +nsXMLFragmentContentSink::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { NS_NOTREACHED("fragments shouldn't have XML declarations"); @@ -281,8 +281,8 @@ nsXMLFragmentContentSink::HandleXMLDeclaration(const PRUnichar *aVersion, } NS_IMETHODIMP -nsXMLFragmentContentSink::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +nsXMLFragmentContentSink::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { diff --git a/content/xslt/src/base/txDouble.cpp b/content/xslt/src/base/txDouble.cpp index 991720a86a45..42847618505d 100644 --- a/content/xslt/src/base/txDouble.cpp +++ b/content/xslt/src/base/txDouble.cpp @@ -27,8 +27,8 @@ class txStringToDouble { public: - typedef PRUnichar input_type; - typedef PRUnichar value_type; + typedef char16_t input_type; + typedef char16_t value_type; txStringToDouble(): mState(eWhitestart), mSign(ePositive) {} void @@ -38,7 +38,7 @@ public: return; } uint32_t i = 0; - PRUnichar c; + char16_t c; for ( ; i < aSourceLength; ++i) { c = aSource[i]; switch (mState) { @@ -148,7 +148,7 @@ void txDouble::toString(double aValue, nsAString& aDest) } if (mozilla::IsInfinite(aValue)) { if (aValue < 0) - aDest.Append(PRUnichar('-')); + aDest.Append(char16_t('-')); aDest.AppendLiteral("Infinity"); return; } diff --git a/content/xslt/src/xml/txXMLUtils.cpp b/content/xslt/src/xml/txXMLUtils.cpp index 5fb836c5ac51..359ec5eab00e 100644 --- a/content/xslt/src/xml/txXMLUtils.cpp +++ b/content/xslt/src/xml/txXMLUtils.cpp @@ -21,7 +21,7 @@ txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver, bool aUseDefault) { const nsAFlatString& qName = PromiseFlatString(aQName); - const PRUnichar* colon; + const char16_t* colon; bool valid = XMLUtils::isValidQName(qName, &colon); if (!valid) { return NS_ERROR_FAILURE; @@ -34,7 +34,7 @@ txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver, return NS_ERROR_FAILURE; mNamespaceID = namespaceID; - const PRUnichar *end; + const char16_t *end; qName.EndReading(end); mLocalName = do_GetAtom(Substring(colon + 1, end)); } @@ -52,7 +52,7 @@ txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver, // static nsresult -XMLUtils::splitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix, +XMLUtils::splitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix, nsIAtom **aLocalName, int32_t* aNameSpaceID) { /** @@ -62,9 +62,9 @@ XMLUtils::splitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix, * namespaceURIlocalNameprefix */ - 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 == kExpatSeparatorChar) { if (uriEnd) { @@ -76,7 +76,7 @@ XMLUtils::splitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix, } } - const PRUnichar *nameStart; + const char16_t *nameStart; if (uriEnd) { *aNameSpaceID = txNamespaceManager::getNamespaceID(nsDependentSubstring(aExpatName, @@ -87,7 +87,7 @@ XMLUtils::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(); if (!*aPrefix) { return NS_ERROR_OUT_OF_MEMORY; @@ -115,14 +115,14 @@ XMLUtils::splitQName(const nsAString& aName, nsIAtom** aPrefix, nsIAtom** aLocalName) { const nsAFlatString& qName = PromiseFlatString(aName); - const PRUnichar* colon; + const char16_t* colon; bool valid = XMLUtils::isValidQName(qName, &colon); if (!valid) { return NS_ERROR_FAILURE; } if (colon) { - const PRUnichar *end; + const char16_t *end; qName.EndReading(end); *aPrefix = NS_NewAtom(Substring(qName.get(), colon)).get(); @@ -160,16 +160,16 @@ void XMLUtils::normalizePIValue(nsAString& piValue) nsAutoString origValue(piValue); uint32_t origLength = origValue.Length(); uint32_t conversionLoop = 0; - PRUnichar prevCh = 0; + char16_t prevCh = 0; piValue.Truncate(); while (conversionLoop < origLength) { - PRUnichar ch = origValue.CharAt(conversionLoop); + char16_t ch = origValue.CharAt(conversionLoop); switch (ch) { case '>': { if (prevCh == '?') { - piValue.Append(PRUnichar(' ')); + piValue.Append(char16_t(' ')); } break; } @@ -186,7 +186,7 @@ void XMLUtils::normalizePIValue(nsAString& piValue) //static bool XMLUtils::isValidQName(const nsAFlatString& aQName, - const PRUnichar** aColon) + const char16_t** aColon) { return NS_SUCCEEDED(nsContentUtils::CheckQName(aQName, true, aColon)); } diff --git a/content/xslt/src/xml/txXMLUtils.h b/content/xslt/src/xml/txXMLUtils.h index 866539217dd9..f80d38e7a038 100644 --- a/content/xslt/src/xml/txXMLUtils.h +++ b/content/xslt/src/xml/txXMLUtils.h @@ -82,7 +82,7 @@ public: class XMLUtils { public: - static nsresult splitExpatName(const PRUnichar *aExpatName, + static nsresult splitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix, nsIAtom **aLocalName, int32_t* aNameSpaceID); static nsresult splitQName(const nsAString& aName, nsIAtom** aPrefix, @@ -91,7 +91,7 @@ public: /* * Returns true if the given character is whitespace. */ - static bool isWhitespace(const PRUnichar& aChar) + static bool isWhitespace(const char16_t& aChar) { return (aChar <= ' ' && (aChar == ' ' || aChar == '\r' || @@ -112,12 +112,12 @@ public: * Returns true if the given string is a valid XML QName */ static bool isValidQName(const nsAFlatString& aQName, - const PRUnichar** aColon); + const char16_t** aColon); /** * Returns true if the given character represents an Alpha letter */ - static bool isLetter(PRUnichar aChar) + static bool isLetter(char16_t aChar) { return !!MOZ_XMLIsLetter(reinterpret_cast(&aChar)); } @@ -125,7 +125,7 @@ public: /** * Returns true if the given character is an allowable NCName character */ - static bool isNCNameChar(PRUnichar aChar) + static bool isNCNameChar(char16_t aChar) { return !!MOZ_XMLIsNCNameChar(reinterpret_cast(&aChar)); } diff --git a/content/xslt/src/xpath/txCoreFunctionCall.cpp b/content/xslt/src/xpath/txCoreFunctionCall.cpp index 23ffebe707b9..eb0d136d7111 100644 --- a/content/xslt/src/xpath/txCoreFunctionCall.cpp +++ b/content/xslt/src/xpath/txCoreFunctionCall.cpp @@ -274,7 +274,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) bool addSpace = false; bool first = true; strRes->mValue.SetCapacity(resultStr.Length()); - PRUnichar c; + char16_t c; uint32_t src; for (src = 0; src < resultStr.Length(); src++) { c = resultStr.CharAt(src); @@ -283,7 +283,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) } else { if (addSpace && !first) - strRes->mValue.Append(PRUnichar(' ')); + strRes->mValue.Append(char16_t(' ')); strRes->mValue.Append(c); addSpace = false; diff --git a/content/xslt/src/xpath/txExprLexer.h b/content/xslt/src/xpath/txExprLexer.h index 21de3ec6b826..28e56771d831 100644 --- a/content/xslt/src/xpath/txExprLexer.h +++ b/content/xslt/src/xpath/txExprLexer.h @@ -216,7 +216,7 @@ private: * Returns true if the given character represents a numeric letter (digit) * Implemented in ExprLexerChars.cpp */ - static bool isXPathDigit(PRUnichar ch) + static bool isXPathDigit(char16_t ch) { return (ch >= '0' && ch <= '9'); } diff --git a/content/xslt/src/xpath/txExprParser.cpp b/content/xslt/src/xpath/txExprParser.cpp index 80ad6e2322a4..a80f718a0d63 100644 --- a/content/xslt/src/xpath/txExprParser.cpp +++ b/content/xslt/src/xpath/txExprParser.cpp @@ -50,7 +50,7 @@ txExprParser::createAVT(const nsSubstring& aAttrValue, // Parse literal section literalString.Truncate(); while (iter != end) { - PRUnichar q = *iter; + char16_t q = *iter; if (q == '{' || q == '}') { // Store what we've found so far and set a new |start| to // skip the (first) brace @@ -96,7 +96,7 @@ txExprParser::createAVT(const nsSubstring& aAttrValue, break; } else if (*iter == '\'' || *iter == '"') { - PRUnichar q = *iter; + char16_t q = *iter; while (++iter != end && *iter != q) {} /* do nothing */ if (iter == end) { break; diff --git a/content/xslt/src/xpath/txFunctionCall.cpp b/content/xslt/src/xpath/txFunctionCall.cpp index 7514229c8fd0..a37ebf7bd58f 100644 --- a/content/xslt/src/xpath/txFunctionCall.cpp +++ b/content/xslt/src/xpath/txFunctionCall.cpp @@ -124,10 +124,10 @@ FunctionCall::toString(nsAString& aDest) NS_LITERAL_STRING("(")); for (uint32_t i = 0; i < mParams.Length(); ++i) { if (i != 0) { - aDest.Append(PRUnichar(',')); + aDest.Append(char16_t(',')); } mParams[i]->toString(aDest); } - aDest.Append(PRUnichar(')')); + aDest.Append(char16_t(')')); } #endif diff --git a/content/xslt/src/xpath/txLiteralExpr.cpp b/content/xslt/src/xpath/txLiteralExpr.cpp index f242cbeaa41e..e991a9515e5a 100644 --- a/content/xslt/src/xpath/txLiteralExpr.cpp +++ b/content/xslt/src/xpath/txLiteralExpr.cpp @@ -78,7 +78,7 @@ txLiteralExpr::toString(nsAString& aStr) StringResult* strRes = static_cast(static_cast (mValue)); - PRUnichar ch = '\''; + char16_t ch = '\''; if (strRes->mValue.FindChar(ch) != kNotFound) { ch = '\"'; } diff --git a/content/xslt/src/xpath/txLocationStep.cpp b/content/xslt/src/xpath/txLocationStep.cpp index e5867d512126..1898ce39b470 100644 --- a/content/xslt/src/xpath/txLocationStep.cpp +++ b/content/xslt/src/xpath/txLocationStep.cpp @@ -285,7 +285,7 @@ LocationStep::toString(nsAString& str) str.AppendLiteral("ancestor-or-self::"); break; case ATTRIBUTE_AXIS: - str.Append(PRUnichar('@')); + str.Append(char16_t('@')); break; case DESCENDANT_AXIS: str.AppendLiteral("descendant::"); diff --git a/content/xslt/src/xpath/txNameTest.cpp b/content/xslt/src/xpath/txNameTest.cpp index bc4d1d5515d6..7b3987c83b86 100644 --- a/content/xslt/src/xpath/txNameTest.cpp +++ b/content/xslt/src/xpath/txNameTest.cpp @@ -86,7 +86,7 @@ txNameTest::toString(nsAString& aDest) nsAutoString prefix; mPrefix->ToString(prefix); aDest.Append(prefix); - aDest.Append(PRUnichar(':')); + aDest.Append(char16_t(':')); } nsAutoString localName; mLocalName->ToString(localName); diff --git a/content/xslt/src/xpath/txNamedAttributeStep.cpp b/content/xslt/src/xpath/txNamedAttributeStep.cpp index 1cd6f5df1858..f4c9a5a7c753 100644 --- a/content/xslt/src/xpath/txNamedAttributeStep.cpp +++ b/content/xslt/src/xpath/txNamedAttributeStep.cpp @@ -50,12 +50,12 @@ txNamedAttributeStep::isSensitiveTo(ContextSensitivity aContext) void txNamedAttributeStep::toString(nsAString& aDest) { - aDest.Append(PRUnichar('@')); + aDest.Append(char16_t('@')); if (mPrefix) { nsAutoString prefix; mPrefix->ToString(prefix); aDest.Append(prefix); - aDest.Append(PRUnichar(':')); + aDest.Append(char16_t(':')); } nsAutoString localName; mLocalName->ToString(localName); diff --git a/content/xslt/src/xpath/txNodeTypeTest.cpp b/content/xslt/src/xpath/txNodeTypeTest.cpp index 8785fad54f59..a783b20400ab 100644 --- a/content/xslt/src/xpath/txNodeTypeTest.cpp +++ b/content/xslt/src/xpath/txNodeTypeTest.cpp @@ -72,11 +72,11 @@ txNodeTypeTest::toString(nsAString& aDest) if (mNodeName) { nsAutoString str; mNodeName->ToString(str); - aDest.Append(PRUnichar('\'')); + aDest.Append(char16_t('\'')); aDest.Append(str); - aDest.Append(PRUnichar('\'')); + aDest.Append(char16_t('\'')); } - aDest.Append(PRUnichar(')')); + aDest.Append(char16_t(')')); break; case NODE_TYPE: aDest.Append(NS_LITERAL_STRING("node()")); diff --git a/content/xslt/src/xpath/txPathExpr.cpp b/content/xslt/src/xpath/txPathExpr.cpp index 0a00324d824c..a73aecf6e751 100644 --- a/content/xslt/src/xpath/txPathExpr.cpp +++ b/content/xslt/src/xpath/txPathExpr.cpp @@ -244,7 +244,7 @@ PathExpr::toString(nsAString& dest) dest.AppendLiteral("//"); break; case RELATIVE_OP: - dest.Append(PRUnichar('/')); + dest.Append(char16_t('/')); break; } mItems[i].expr->toString(dest); diff --git a/content/xslt/src/xpath/txPredicateList.cpp b/content/xslt/src/xpath/txPredicateList.cpp index 02b8c8adf3a7..be9c419b50a6 100644 --- a/content/xslt/src/xpath/txPredicateList.cpp +++ b/content/xslt/src/xpath/txPredicateList.cpp @@ -77,9 +77,9 @@ PredicateList::isSensitiveTo(Expr::ContextSensitivity aContext) void PredicateList::toString(nsAString& dest) { for (uint32_t i = 0; i < mPredicates.Length(); ++i) { - dest.Append(PRUnichar('[')); + dest.Append(char16_t('[')); mPredicates[i]->toString(dest); - dest.Append(PRUnichar(']')); + dest.Append(char16_t(']')); } } #endif diff --git a/content/xslt/src/xpath/txPredicatedNodeTest.cpp b/content/xslt/src/xpath/txPredicatedNodeTest.cpp index 5cdf4a6e1fab..d5243abae707 100644 --- a/content/xslt/src/xpath/txPredicatedNodeTest.cpp +++ b/content/xslt/src/xpath/txPredicatedNodeTest.cpp @@ -50,8 +50,8 @@ void txPredicatedNodeTest::toString(nsAString& aDest) { mNodeTest->toString(aDest); - aDest.Append(PRUnichar('[')); + aDest.Append(char16_t('[')); mPredicate->toString(aDest); - aDest.Append(PRUnichar(']')); + aDest.Append(char16_t(']')); } #endif diff --git a/content/xslt/src/xpath/txRelationalExpr.cpp b/content/xslt/src/xpath/txRelationalExpr.cpp index 4a3f431210d0..f1d54edd1292 100644 --- a/content/xslt/src/xpath/txRelationalExpr.cpp +++ b/content/xslt/src/xpath/txRelationalExpr.cpp @@ -181,19 +181,19 @@ RelationalExpr::toString(nsAString& str) str.AppendLiteral("!="); break; case LESS_THAN: - str.Append(PRUnichar('<')); + str.Append(char16_t('<')); break; case LESS_OR_EQUAL: str.AppendLiteral("<="); break; case GREATER_THAN : - str.Append(PRUnichar('>')); + str.Append(char16_t('>')); break; case GREATER_OR_EQUAL: str.AppendLiteral(">="); break; default: - str.Append(PRUnichar('=')); + str.Append(char16_t('=')); break; } diff --git a/content/xslt/src/xpath/txRootExpr.cpp b/content/xslt/src/xpath/txRootExpr.cpp index 44dbbb969a3d..f6ef6abcba46 100644 --- a/content/xslt/src/xpath/txRootExpr.cpp +++ b/content/xslt/src/xpath/txRootExpr.cpp @@ -38,6 +38,6 @@ void RootExpr::toString(nsAString& dest) { if (mSerialize) - dest.Append(PRUnichar('/')); + dest.Append(char16_t('/')); } #endif diff --git a/content/xslt/src/xpath/txUnaryExpr.cpp b/content/xslt/src/xpath/txUnaryExpr.cpp index 8be9fdd5dd9b..acc2c22cb918 100644 --- a/content/xslt/src/xpath/txUnaryExpr.cpp +++ b/content/xslt/src/xpath/txUnaryExpr.cpp @@ -49,7 +49,7 @@ UnaryExpr::toString(nsAString& str) { if (!expr) return; - str.Append(PRUnichar('-')); + str.Append(char16_t('-')); expr->toString(str); } #endif diff --git a/content/xslt/src/xpath/txVariableRefExpr.cpp b/content/xslt/src/xpath/txVariableRefExpr.cpp index 1b5b19d986c3..74eda7d1d335 100644 --- a/content/xslt/src/xpath/txVariableRefExpr.cpp +++ b/content/xslt/src/xpath/txVariableRefExpr.cpp @@ -55,12 +55,12 @@ VariableRefExpr::isSensitiveTo(ContextSensitivity aContext) void VariableRefExpr::toString(nsAString& aDest) { - aDest.Append(PRUnichar('$')); + aDest.Append(char16_t('$')); if (mPrefix) { nsAutoString prefix; mPrefix->ToString(prefix); aDest.Append(prefix); - aDest.Append(PRUnichar(':')); + aDest.Append(char16_t(':')); } nsAutoString lname; mLocalName->ToString(lname); diff --git a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp index a649832ec22c..f682ba8f73b6 100644 --- a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp +++ b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp @@ -180,9 +180,9 @@ LookupFunction(const char *aContractID, nsIAtom* aName, nsIID &aIID, // foo-bar becomes fooBar). Note that if there are any names that already // have uppercase letters they might cause false matches (both fooBar and // foo-bar matching fooBar). - const PRUnichar *name = aName->GetUTF16String(); + const char16_t *name = aName->GetUTF16String(); nsAutoCString methodName; - PRUnichar letter; + char16_t letter; bool upperNext = false; while ((letter = *name)) { if (letter == '-') { diff --git a/content/xslt/src/xslt/txDocumentFunctionCall.cpp b/content/xslt/src/xslt/txDocumentFunctionCall.cpp index 1668b9f0d59c..a0cbea67b5f2 100644 --- a/content/xslt/src/xslt/txDocumentFunctionCall.cpp +++ b/content/xslt/src/xslt/txDocumentFunctionCall.cpp @@ -29,7 +29,7 @@ retrieveNode(txExecutionState* aExecutionState, const nsAString& aUri, nsAutoString absUrl; URIUtils::resolveHref(aUri, aBaseUri, absUrl); - int32_t hash = absUrl.RFindChar(PRUnichar('#')); + int32_t hash = absUrl.RFindChar(char16_t('#')); uint32_t urlEnd, fragStart, fragEnd; if (hash == kNotFound) { urlEnd = absUrl.Length(); diff --git a/content/xslt/src/xslt/txExecutionState.cpp b/content/xslt/src/xslt/txExecutionState.cpp index 8bc72b4ed9be..7bf34805950d 100644 --- a/content/xslt/src/xslt/txExecutionState.cpp +++ b/content/xslt/src/xslt/txExecutionState.cpp @@ -377,7 +377,7 @@ txExecutionState::getEvalContext() const txXPathNode* txExecutionState::retrieveDocument(const nsAString& aUri) { - NS_ASSERTION(aUri.FindChar(PRUnichar('#')) == kNotFound, + NS_ASSERTION(aUri.FindChar(char16_t('#')) == kNotFound, "Remove the fragment."); if (mDisableLoads) { diff --git a/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp b/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp index 2c6311f021fe..ccb16848aeb2 100644 --- a/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp +++ b/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp @@ -17,7 +17,7 @@ #define INVALID_PARAM_VALUE \ NS_LITERAL_STRING("invalid parameter value for function") -const PRUnichar txFormatNumberFunctionCall::FORMAT_QUOTE = '\''; +const char16_t txFormatNumberFunctionCall::FORMAT_QUOTE = '\''; /* * FormatNumberFunctionCall @@ -133,7 +133,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, FormatParseState pState = Prefix; inQuote = false; - PRUnichar c = 0; + char16_t c = 0; while (pos < formatLen && pState != Finished) { c=formatStr.CharAt(pos++); @@ -318,7 +318,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, if (hasFraction || digit != 0 || i < bufIntDigits+minFractionSize) { hasFraction = true; - res.SetCharAt((PRUnichar)(digit + format->mZeroDigit), + res.SetCharAt((char16_t)(digit + format->mZeroDigit), resPos--); } else { @@ -353,14 +353,14 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, res.SetCharAt(format->mGroupingSeparator, resPos--); } - res.SetCharAt((PRUnichar)(digit + format->mZeroDigit), resPos--); + res.SetCharAt((char16_t)(digit + format->mZeroDigit), resPos--); } if (carry) { if (i%groupSize == 0) { res.Insert(format->mGroupingSeparator, resPos + 1); } - res.Insert((PRUnichar)(1 + format->mZeroDigit), resPos + 1); + res.Insert((char16_t)(1 + format->mZeroDigit), resPos + 1); } if (!hasFraction && !intDigits && !carry) { diff --git a/content/xslt/src/xslt/txInstructions.cpp b/content/xslt/src/xslt/txInstructions.cpp index 5e1749b0db8e..f05ff2e6b234 100644 --- a/content/xslt/src/xslt/txInstructions.cpp +++ b/content/xslt/src/xslt/txInstructions.cpp @@ -101,7 +101,7 @@ txAttribute::execute(txExecutionState& aEs) nsresult rv = mName->evaluateToString(aEs.getEvalContext(), name); NS_ENSURE_SUCCESS(rv, rv); - const PRUnichar* colon; + const char16_t* colon; if (!XMLUtils::isValidQName(name, &colon) || TX_StringEqualsAtom(name, nsGkAtoms::xmlns)) { return NS_OK; @@ -210,7 +210,7 @@ txComment::execute(txExecutionState& aEs) while ((pos = handler->mValue.FindChar('-', (uint32_t)pos)) != kNotFound) { ++pos; if ((uint32_t)pos == length || handler->mValue.CharAt(pos) == '-') { - handler->mValue.Insert(PRUnichar(' '), pos++); + handler->mValue.Insert(char16_t(' '), pos++); ++length; } } @@ -590,7 +590,7 @@ txProcessingInstruction::execute(txExecutionState& aEs) // Check name validity (must be valid NCName and a PITarget) // XXX Need to check for NCName and PITarget - const PRUnichar* colon; + const char16_t* colon; if (!XMLUtils::isValidQName(name, &colon)) { // XXX ErrorReport: bad PI-target return NS_ERROR_FAILURE; @@ -827,7 +827,7 @@ txStartElement::execute(txExecutionState& aEs) nsCOMPtr prefix; uint32_t lnameStart = 0; - const PRUnichar* colon; + const char16_t* colon; if (XMLUtils::isValidQName(name, &colon)) { if (colon) { prefix = do_GetAtom(Substring(name.get(), colon)); diff --git a/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp b/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp index 8b67fe12acff..40c5f65af4ab 100644 --- a/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp +++ b/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp @@ -116,8 +116,8 @@ NS_IMPL_ISUPPORTS6(txStylesheetSink, nsIInterfaceRequestor) NS_IMETHODIMP -txStylesheetSink::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +txStylesheetSink::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -136,7 +136,7 @@ txStylesheetSink::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -txStylesheetSink::HandleEndElement(const PRUnichar *aName) +txStylesheetSink::HandleEndElement(const char16_t *aName) { nsresult rv = mCompiler->endElement(); if (NS_FAILED(rv)) { @@ -149,13 +149,13 @@ txStylesheetSink::HandleEndElement(const PRUnichar *aName) } NS_IMETHODIMP -txStylesheetSink::HandleComment(const PRUnichar *aName) +txStylesheetSink::HandleComment(const char16_t *aName) { return NS_OK; } NS_IMETHODIMP -txStylesheetSink::HandleCDataSection(const PRUnichar *aData, +txStylesheetSink::HandleCDataSection(const char16_t *aData, uint32_t aLength) { return HandleCharacterData(aData, aLength); @@ -172,7 +172,7 @@ txStylesheetSink::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -txStylesheetSink::HandleCharacterData(const PRUnichar *aData, +txStylesheetSink::HandleCharacterData(const char16_t *aData, uint32_t aLength) { nsresult rv = mCompiler->characters(Substring(aData, aData + aLength)); @@ -185,23 +185,23 @@ txStylesheetSink::HandleCharacterData(const PRUnichar *aData, } NS_IMETHODIMP -txStylesheetSink::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +txStylesheetSink::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { return NS_OK; } NS_IMETHODIMP -txStylesheetSink::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +txStylesheetSink::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { return NS_OK; } NS_IMETHODIMP -txStylesheetSink::ReportError(const PRUnichar *aErrorText, - const PRUnichar *aSourceText, +txStylesheetSink::ReportError(const char16_t *aErrorText, + const char16_t *aSourceText, nsIScriptError *aError, bool *_retval) { @@ -437,8 +437,8 @@ txCompileObserver::loadURI(const nsAString& aUri, void txCompileObserver::onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, - const PRUnichar *aErrorText, - const PRUnichar *aParam) + const char16_t *aErrorText, + const char16_t *aParam) { if (NS_SUCCEEDED(aResult)) { mProcessor->setStylesheet(aCompiler->getStylesheet()); @@ -680,8 +680,8 @@ txSyncCompileObserver::loadURI(const nsAString& aUri, void txSyncCompileObserver::onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, - const PRUnichar *aErrorText, - const PRUnichar *aParam) + const char16_t *aErrorText, + const char16_t *aParam) { } diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index cbcf6ba252b4..c46a4a505fae 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -856,7 +856,7 @@ txMozillaXMLOutput::createResultDocument(const nsSubstring& aName, int32_t aNsID // Could use mOutputFormat.mVersion.get() when we support // versions > 1.0. - static const PRUnichar kOneDotZero[] = { '1', '.', '0', '\0' }; + static const char16_t kOneDotZero[] = { '1', '.', '0', '\0' }; mDocument->SetXMLDeclaration(kOneDotZero, mOutputFormat.mEncoding.get(), standalone); } diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index 34db180684d6..ddd480060460 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -1040,8 +1040,8 @@ txMozillaXSLTProcessor::setStylesheet(txStylesheet* aStylesheet) void txMozillaXSLTProcessor::reportError(nsresult aResult, - const PRUnichar *aErrorText, - const PRUnichar *aSourceText) + const char16_t *aErrorText, + const char16_t *aSourceText) { if (!mObserver) { return; @@ -1065,7 +1065,7 @@ txMozillaXSLTProcessor::reportError(nsresult aResult, sbs->CreateBundle(XSLT_MSGS_URL, getter_AddRefs(bundle)); if (bundle) { - const PRUnichar* error[] = { errorText.get() }; + const char16_t* error[] = { errorText.get() }; if (mStylesheet) { bundle->FormatStringFromName(MOZ_UTF16("TransformError"), error, 1, diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.h b/content/xslt/src/xslt/txMozillaXSLTProcessor.h index e7536578866e..b7f62cde55ce 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.h +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.h @@ -88,8 +88,8 @@ public: NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED nsresult setStylesheet(txStylesheet* aStylesheet); - void reportError(nsresult aResult, const PRUnichar *aErrorText, - const PRUnichar *aSourceText); + void reportError(nsresult aResult, const char16_t *aErrorText, + const char16_t *aSourceText); nsIDOMNode *GetSourceContentModel() { diff --git a/content/xslt/src/xslt/txPatternParser.cpp b/content/xslt/src/xslt/txPatternParser.cpp index 216f99f479cc..73b812446c3f 100644 --- a/content/xslt/src/xslt/txPatternParser.cpp +++ b/content/xslt/src/xslt/txPatternParser.cpp @@ -246,7 +246,7 @@ nsresult txPatternParser::createKeyPattern(txExprLexer& aLexer, if (aLexer.nextToken()->mType != Token::R_PAREN) return NS_ERROR_XPATH_PARSE_FAILURE; - const PRUnichar* colon; + const char16_t* colon; if (!XMLUtils::isValidQName(PromiseFlatString(key), &colon)) return NS_ERROR_XPATH_PARSE_FAILURE; nsCOMPtr prefix, localName; diff --git a/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp b/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp index 9e7e929dcb4b..8de4de52e326 100644 --- a/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp +++ b/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp @@ -346,7 +346,7 @@ getCharAttr(txStylesheetAttr* aAttributes, nsIAtom* aName, bool aRequired, txStylesheetCompilerState& aState, - PRUnichar& aChar) + char16_t& aChar) { // Don't reset aChar since it contains the default value txStylesheetAttr* attr = nullptr; @@ -1039,7 +1039,7 @@ txFnStartStripSpace(int32_t aNamespaceID, if (NS_FAILED(rv)) { // check for "*" or "prefix:*" uint32_t length = name.Length(); - const PRUnichar* c; + const char16_t* c; name.BeginReading(c); if (length == 2 || c[length-1] != '*') { // these can't work diff --git a/content/xslt/src/xslt/txStylesheetCompiler.cpp b/content/xslt/src/xslt/txStylesheetCompiler.cpp index 9f9424a31223..b23e1b6be733 100644 --- a/content/xslt/src/xslt/txStylesheetCompiler.cpp +++ b/content/xslt/src/xslt/txStylesheetCompiler.cpp @@ -100,8 +100,8 @@ txStylesheetCompiler::startElement(int32_t aNamespaceID, nsIAtom* aLocalName, } nsresult -txStylesheetCompiler::startElement(const PRUnichar *aName, - const PRUnichar **aAttrs, +txStylesheetCompiler::startElement(const char16_t *aName, + const char16_t **aAttrs, int32_t aAttrCount, int32_t aIDOffset) { if (NS_FAILED(mStatus)) { @@ -388,8 +388,8 @@ txStylesheetCompiler::doneLoading() } void -txStylesheetCompiler::cancel(nsresult aError, const PRUnichar *aErrorText, - const PRUnichar *aParam) +txStylesheetCompiler::cancel(nsresult aError, const char16_t *aErrorText, + const char16_t *aParam) { PR_LOG(txLog::xslt, PR_LOG_ALWAYS, ("Compiler::cancel: %s, module: %d, code %d\n", @@ -433,8 +433,8 @@ txStylesheetCompiler::loadURI(const nsAString& aUri, void txStylesheetCompiler::onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, - const PRUnichar *aErrorText, - const PRUnichar *aParam) + const char16_t *aErrorText, + const char16_t *aParam) { if (NS_FAILED(aResult)) { cancel(aResult, aErrorText, aParam); diff --git a/content/xslt/src/xslt/txStylesheetCompiler.h b/content/xslt/src/xslt/txStylesheetCompiler.h index 68eb39ebb2f3..2e4208a97910 100644 --- a/content/xslt/src/xslt/txStylesheetCompiler.h +++ b/content/xslt/src/xslt/txStylesheetCompiler.h @@ -53,16 +53,16 @@ public: txStylesheetCompiler* aCompiler) = 0; virtual void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, - const PRUnichar *aErrorText = nullptr, - const PRUnichar *aParam = nullptr) = 0; + const char16_t *aErrorText = nullptr, + const char16_t *aParam = nullptr) = 0; }; #define TX_DECL_ACOMPILEOBSERVER \ nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri, \ txStylesheetCompiler* aCompiler); \ void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, \ - const PRUnichar *aErrorText = nullptr, \ - const PRUnichar *aParam = nullptr); + const char16_t *aErrorText = nullptr, \ + const char16_t *aParam = nullptr); class txStylesheetCompilerState : public txIParseContext { @@ -200,15 +200,15 @@ public: nsresult startElement(int32_t aNamespaceID, nsIAtom* aLocalName, nsIAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount); - nsresult startElement(const PRUnichar *aName, - const PRUnichar **aAtts, + nsresult startElement(const char16_t *aName, + const char16_t **aAtts, int32_t aAttrCount, int32_t aIDOffset); nsresult endElement(); nsresult characters(const nsAString& aStr); nsresult doneLoading(); - void cancel(nsresult aError, const PRUnichar *aErrorText = nullptr, - const PRUnichar *aParam = nullptr); + void cancel(nsresult aError, const char16_t *aErrorText = nullptr, + const char16_t *aParam = nullptr); txStylesheet* getStylesheet(); diff --git a/content/xslt/src/xslt/txXSLTFunctions.h b/content/xslt/src/xslt/txXSLTFunctions.h index 4809d673954c..6d4e669e007c 100644 --- a/content/xslt/src/xslt/txXSLTFunctions.h +++ b/content/xslt/src/xslt/txXSLTFunctions.h @@ -67,7 +67,7 @@ public: TX_DECL_FUNCTION private: - static const PRUnichar FORMAT_QUOTE; + static const char16_t FORMAT_QUOTE; enum FormatParseState { Prefix, @@ -97,16 +97,16 @@ public: txDecimalFormat(); bool isEqual(txDecimalFormat* other); - PRUnichar mDecimalSeparator; - PRUnichar mGroupingSeparator; + char16_t mDecimalSeparator; + char16_t mGroupingSeparator; nsString mInfinity; - PRUnichar mMinusSign; + char16_t mMinusSign; nsString mNaN; - PRUnichar mPercent; - PRUnichar mPerMille; - PRUnichar mZeroDigit; - PRUnichar mDigit; - PRUnichar mPatternSeparator; + char16_t mPercent; + char16_t mPerMille; + char16_t mZeroDigit; + char16_t mDigit; + char16_t mPatternSeparator; }; /** diff --git a/content/xslt/src/xslt/txXSLTNumber.cpp b/content/xslt/src/xslt/txXSLTNumber.cpp index 488cfdf8cf1c..0175720099d5 100644 --- a/content/xslt/src/xslt/txXSLTNumber.cpp +++ b/content/xslt/src/xslt/txXSLTNumber.cpp @@ -305,7 +305,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator, uint32_t formatLen = format.Length(); uint32_t formatPos = 0; - PRUnichar ch = 0; + char16_t ch = 0; // start with header while (formatPos < formatLen && @@ -424,7 +424,7 @@ txXSLTNumber::getPrevInDocumentOrder(txXPathTreeWalker& aWalker) #define TX_MATCH_CHAR(ch, a) if (ch < a) return false; \ if (ch == a) return true -bool txXSLTNumber::isAlphaNumeric(PRUnichar ch) +bool txXSLTNumber::isAlphaNumeric(char16_t ch) { TX_CHAR_RANGE(ch, 0x0030, 0x0039); TX_CHAR_RANGE(ch, 0x0041, 0x005A); diff --git a/content/xslt/src/xslt/txXSLTNumber.h b/content/xslt/src/xslt/txXSLTNumber.h index a5021d84677c..e6cdd421009c 100644 --- a/content/xslt/src/xslt/txXSLTNumber.h +++ b/content/xslt/src/xslt/txXSLTNumber.h @@ -52,7 +52,7 @@ private: static bool getPrevInDocumentOrder(txXPathTreeWalker& aWalker); - static bool isAlphaNumeric(PRUnichar ch); + static bool isAlphaNumeric(char16_t ch); }; class txFormattedCounter { diff --git a/content/xslt/src/xslt/txXSLTNumberCounters.cpp b/content/xslt/src/xslt/txXSLTNumberCounters.cpp index 3262089d3e03..cb6505ea3724 100644 --- a/content/xslt/src/xslt/txXSLTNumberCounters.cpp +++ b/content/xslt/src/xslt/txXSLTNumberCounters.cpp @@ -26,14 +26,14 @@ private: class txAlphaCounter : public txFormattedCounter { public: - txAlphaCounter(PRUnichar aOffset) : mOffset(aOffset) + txAlphaCounter(char16_t aOffset) : mOffset(aOffset) { } virtual void appendNumber(int32_t aNumber, nsAString& aDest); private: - PRUnichar mOffset; + char16_t mOffset; }; class txRomanCounter : public txFormattedCounter { @@ -60,7 +60,7 @@ txFormattedCounter::getCounterFor(const nsAFlatString& aToken, aCounter = 0; if (length == 1) { - PRUnichar ch = aToken.CharAt(0); + char16_t ch = aToken.CharAt(0); switch (ch) { case 'i': @@ -114,7 +114,7 @@ txDecimalCounter::txDecimalCounter(int32_t aMinLength, int32_t aGroupSize, void txDecimalCounter::appendNumber(int32_t aNumber, nsAString& aDest) { const int32_t bufsize = 10; //must be able to fit an int32_t - PRUnichar buf[bufsize]; + char16_t buf[bufsize]; int32_t pos = bufsize; while (aNumber > 0) { int32_t ch = aNumber % 10; @@ -134,7 +134,7 @@ void txDecimalCounter::appendNumber(int32_t aNumber, nsAString& aDest) // pos will always be zero int32_t extraPos = mMinLength; while (extraPos > bufsize) { - aDest.Append(PRUnichar('0')); + aDest.Append(char16_t('0')); --extraPos; if (extraPos % mGroupSize == 0) { aDest.Append(mGroupSeparator); @@ -163,7 +163,7 @@ void txDecimalCounter::appendNumber(int32_t aNumber, nsAString& aDest) void txAlphaCounter::appendNumber(int32_t aNumber, nsAString& aDest) { - PRUnichar buf[12]; + char16_t buf[12]; buf[11] = 0; int32_t pos = 11; while (aNumber > 0) { @@ -194,7 +194,7 @@ void txRomanCounter::appendNumber(int32_t aNumber, nsAString& aDest) } while (aNumber >= 1000) { - aDest.Append(!mTableOffset ? PRUnichar('m') : PRUnichar('M')); + aDest.Append(!mTableOffset ? char16_t('m') : char16_t('M')); aNumber -= 1000; } diff --git a/content/xslt/src/xslt/txXSLTPatterns.cpp b/content/xslt/src/xslt/txXSLTPatterns.cpp index ae88b5b0fcbd..d4beec9979a7 100644 --- a/content/xslt/src/xslt/txXSLTPatterns.cpp +++ b/content/xslt/src/xslt/txXSLTPatterns.cpp @@ -78,7 +78,7 @@ txUnionPattern::toString(nsAString& aDest) mLocPathPatterns[i]->toString(aDest); } #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif @@ -200,14 +200,14 @@ txLocPathPattern::toString(nsAString& aDest) for (uint32_t i = 0; i < mSteps.Length(); ++i) { if (i != 0) { if (mSteps[i].isChild) - aDest.Append(PRUnichar('/')); + aDest.Append(char16_t('/')); else aDest.AppendLiteral("//"); } mSteps[i].pattern->toString(aDest); } #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif @@ -239,9 +239,9 @@ txRootPattern::toString(nsAString& aDest) aDest.AppendLiteral("txRootPattern{"); #endif if (mSerialize) - aDest.Append(PRUnichar('/')); + aDest.Append(char16_t('/')); #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif @@ -299,14 +299,14 @@ txIdPattern::toString(nsAString& aDest) nsAutoString str; mIds[k]->ToString(str); aDest.Append(str); - aDest.Append(PRUnichar(' ')); + aDest.Append(char16_t(' ')); } nsAutoString str; mIds[count]->ToString(str); aDest.Append(str); aDest.Append(NS_LITERAL_STRING("')")); #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif @@ -354,7 +354,7 @@ txKeyPattern::toString(nsAString& aDest) if (mPrefix) { mPrefix->ToString(tmp); aDest.Append(tmp); - aDest.Append(PRUnichar(':')); + aDest.Append(char16_t(':')); } mName.mLocalName->ToString(tmp); aDest.Append(tmp); @@ -362,7 +362,7 @@ txKeyPattern::toString(nsAString& aDest) aDest.Append(mValue); aDest.Append(NS_LITERAL_STRING("')")); #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif @@ -514,13 +514,13 @@ txStepPattern::toString(nsAString& aDest) aDest.AppendLiteral("txStepPattern{"); #endif if (mIsAttr) - aDest.Append(PRUnichar('@')); + aDest.Append(char16_t('@')); if (mNodeTest) mNodeTest->toString(aDest); PredicateList::toString(aDest); #ifdef DEBUG - aDest.Append(PRUnichar('}')); + aDest.Append(char16_t('}')); #endif } #endif diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 4a036704d3a7..af263d880df0 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2614,7 +2614,7 @@ OffThreadScriptReceiverCallback(void *aToken, void *aCallbackData) } nsresult -nsXULPrototypeScript::Compile(const PRUnichar* aText, +nsXULPrototypeScript::Compile(const char16_t* aText, int32_t aTextLength, nsIURI* aURI, uint32_t aLineNo, diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 26112ee1a544..a3d6466a6b20 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -229,7 +229,7 @@ public: nsresult DeserializeOutOfLine(nsIObjectInputStream* aInput, nsXULPrototypeDocument* aProtoDoc); - nsresult Compile(const PRUnichar* aText, int32_t aTextLength, + nsresult Compile(const char16_t* aText, int32_t aTextLength, nsIURI* aURI, uint32_t aLineNo, nsIDocument* aDocument, nsXULPrototypeDocument* aProtoDoc, diff --git a/content/xul/document/src/XULDocument.cpp b/content/xul/document/src/XULDocument.cpp index be5f8fc7ec5e..6129fe2c4fc7 100644 --- a/content/xul/document/src/XULDocument.cpp +++ b/content/xul/document/src/XULDocument.cpp @@ -1307,7 +1307,7 @@ XULDocument::Persist(const nsAString& aID, } else { // Make sure that this QName is going to be valid. - const PRUnichar *colon; + const char16_t *colon; rv = nsContentUtils::CheckQName(PromiseFlatString(aAttr), true, &colon); if (NS_FAILED(rv)) { @@ -2292,7 +2292,7 @@ XULDocument::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, continue; } - const PRUnichar* value; + const char16_t* value; rv = literal->GetValueConst(&value); if (NS_FAILED(rv)) return rv; @@ -3081,7 +3081,7 @@ XULDocument::ResumeWalk() if (piProto->mTarget.EqualsLiteral("xml-stylesheet") || piProto->mTarget.EqualsLiteral("xul-overlay")) { - const PRUnichar* params[] = { piProto->mTarget.get() }; + const char16_t* params[] = { piProto->mTarget.get() }; nsContentUtils::ReportToConsole( nsIScriptError::warningFlag, @@ -3377,7 +3377,7 @@ XULDocument::ReportMissingOverlay(nsIURI* aURI) aURI->GetSpec(spec); NS_ConvertUTF8toUTF16 utfSpec(spec); - const PRUnichar* params[] = { utfSpec.get() }; + const char16_t* params[] = { utfSpec.get() }; nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XUL Document"), this, nsContentUtils::eXUL_PROPERTIES, diff --git a/content/xul/document/src/nsXULCommandDispatcher.cpp b/content/xul/document/src/nsXULCommandDispatcher.cpp index 845ebed998f3..7f26f87c8fc0 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -443,14 +443,14 @@ nsXULCommandDispatcher::Matches(const nsString& aList, // okay, now make sure it's not a substring snafu; e.g., 'ur' // found inside of 'blur'. if (indx > 0) { - PRUnichar ch = aList[indx - 1]; - if (! nsCRT::IsAsciiSpace(ch) && ch != PRUnichar(',')) + char16_t ch = aList[indx - 1]; + if (! nsCRT::IsAsciiSpace(ch) && ch != char16_t(',')) return false; } if (indx + aElement.Length() < aList.Length()) { - PRUnichar ch = aList[indx + aElement.Length()]; - if (! nsCRT::IsAsciiSpace(ch) && ch != PRUnichar(',')) + char16_t ch = aList[indx + aElement.Length()]; + if (! nsCRT::IsAsciiSpace(ch) && ch != char16_t(',')) return false; } diff --git a/content/xul/document/src/nsXULContentSink.cpp b/content/xul/document/src/nsXULContentSink.cpp index adca134ff41c..87bff7a9507a 100644 --- a/content/xul/document/src/nsXULContentSink.cpp +++ b/content/xul/document/src/nsXULContentSink.cpp @@ -336,7 +336,7 @@ XULContentSinkImpl::Init(nsIDocument* aDocument, // bool -XULContentSinkImpl::IsDataInBuffer(PRUnichar* buffer, int32_t length) +XULContentSinkImpl::IsDataInBuffer(char16_t* buffer, int32_t length) { for (int32_t i = 0; i < length; ++i) { if (buffer[i] == ' ' || @@ -412,7 +412,7 @@ XULContentSinkImpl::FlushText(bool aCreateTextNode) //---------------------------------------------------------------------- nsresult -XULContentSinkImpl::NormalizeAttributeString(const PRUnichar *aExpatName, +XULContentSinkImpl::NormalizeAttributeString(const char16_t *aExpatName, nsAttrName &aName) { int32_t nameSpaceID; @@ -453,8 +453,8 @@ XULContentSinkImpl::CreateElement(nsINodeInfo *aNodeInfo, NS_IMETHODIMP -XULContentSinkImpl::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +XULContentSinkImpl::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -516,7 +516,7 @@ XULContentSinkImpl::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -XULContentSinkImpl::HandleEndElement(const PRUnichar *aName) +XULContentSinkImpl::HandleEndElement(const char16_t *aName) { // Never EVER return anything but NS_OK or // NS_ERROR_HTMLPARSER_BLOCK from this method. Doing so will blow @@ -603,14 +603,14 @@ XULContentSinkImpl::HandleEndElement(const PRUnichar *aName) } NS_IMETHODIMP -XULContentSinkImpl::HandleComment(const PRUnichar *aName) +XULContentSinkImpl::HandleComment(const char16_t *aName) { FlushText(); return NS_OK; } NS_IMETHODIMP -XULContentSinkImpl::HandleCDataSection(const PRUnichar *aData, uint32_t aLength) +XULContentSinkImpl::HandleCDataSection(const char16_t *aData, uint32_t aLength) { FlushText(); return AddText(aData, aLength); @@ -627,7 +627,7 @@ XULContentSinkImpl::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -XULContentSinkImpl::HandleCharacterData(const PRUnichar *aData, +XULContentSinkImpl::HandleCharacterData(const char16_t *aData, uint32_t aLength) { if (aData && mState != eInProlog && mState != eInEpilog) { @@ -637,8 +637,8 @@ XULContentSinkImpl::HandleCharacterData(const PRUnichar *aData, } NS_IMETHODIMP -XULContentSinkImpl::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +XULContentSinkImpl::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { FlushText(); @@ -674,8 +674,8 @@ XULContentSinkImpl::HandleProcessingInstruction(const PRUnichar *aTarget, NS_IMETHODIMP -XULContentSinkImpl::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +XULContentSinkImpl::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { return NS_OK; @@ -683,8 +683,8 @@ XULContentSinkImpl::HandleXMLDeclaration(const PRUnichar *aVersion, NS_IMETHODIMP -XULContentSinkImpl::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +XULContentSinkImpl::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { @@ -712,13 +712,13 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText, return NS_OK; } - const PRUnichar* noAtts[] = { 0, 0 }; + const char16_t* noAtts[] = { 0, 0 }; NS_NAMED_LITERAL_STRING(errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml"); nsAutoString parsererror(errorNs); - parsererror.Append((PRUnichar)0xFFFF); + parsererror.Append((char16_t)0xFFFF); parsererror.AppendLiteral("parsererror"); rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, 0); @@ -728,7 +728,7 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText, NS_ENSURE_SUCCESS(rv,rv); nsAutoString sourcetext(errorNs); - sourcetext.Append((PRUnichar)0xFFFF); + sourcetext.Append((char16_t)0xFFFF); sourcetext.AppendLiteral("sourcetext"); rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, 0); @@ -747,7 +747,7 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText, } nsresult -XULContentSinkImpl::OpenRoot(const PRUnichar** aAttributes, +XULContentSinkImpl::OpenRoot(const char16_t** aAttributes, const uint32_t aAttrLen, nsINodeInfo *aNodeInfo) { @@ -801,7 +801,7 @@ XULContentSinkImpl::OpenRoot(const PRUnichar** aAttributes, } nsresult -XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes, +XULContentSinkImpl::OpenTag(const char16_t** aAttributes, const uint32_t aAttrLen, const uint32_t aLineNumber, nsINodeInfo *aNodeInfo) @@ -866,7 +866,7 @@ XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes, } nsresult -XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, +XULContentSinkImpl::OpenScript(const char16_t** aAttributes, const uint32_t aLineNumber) { uint32_t langID = nsIProgrammingLanguage::JAVASCRIPT; @@ -1005,7 +1005,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, } nsresult -XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes, +XULContentSinkImpl::AddAttributes(const char16_t** aAttributes, const uint32_t aAttrLen, nsXULPrototypeElement* aElement) { @@ -1056,12 +1056,12 @@ XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes, } nsresult -XULContentSinkImpl::AddText(const PRUnichar* aText, +XULContentSinkImpl::AddText(const char16_t* aText, int32_t aLength) { // Create buffer when we first need it if (0 == mTextSize) { - mText = (PRUnichar *) moz_malloc(sizeof(PRUnichar) * 4096); + mText = (char16_t *) moz_malloc(sizeof(char16_t) * 4096); if (nullptr == mText) { return NS_ERROR_OUT_OF_MEMORY; } @@ -1084,13 +1084,13 @@ XULContentSinkImpl::AddText(const PRUnichar* aText, } else { mTextSize += aLength; - mText = (PRUnichar *) moz_realloc(mText, sizeof(PRUnichar) * mTextSize); + mText = (char16_t *) moz_realloc(mText, sizeof(char16_t) * mTextSize); if (nullptr == mText) { return NS_ERROR_OUT_OF_MEMORY; } } } - memcpy(&mText[mTextLength],aText + offset, sizeof(PRUnichar) * amount); + memcpy(&mText[mTextLength],aText + offset, sizeof(char16_t) * amount); mTextLength += amount; offset += amount; diff --git a/content/xul/document/src/nsXULContentSink.h b/content/xul/document/src/nsXULContentSink.h index d16768f329f2..0bbc32d2d177 100644 --- a/content/xul/document/src/nsXULContentSink.h +++ b/content/xul/document/src/nsXULContentSink.h @@ -55,20 +55,20 @@ public: protected: // pseudo-constants - PRUnichar* mText; + char16_t* mText; int32_t mTextLength; int32_t mTextSize; bool mConstrainSize; - nsresult AddAttributes(const PRUnichar** aAttributes, + nsresult AddAttributes(const char16_t** aAttributes, const uint32_t aAttrLen, nsXULPrototypeElement* aElement); - nsresult OpenRoot(const PRUnichar** aAttributes, + nsresult OpenRoot(const char16_t** aAttributes, const uint32_t aAttrLen, nsINodeInfo *aNodeInfo); - nsresult OpenTag(const PRUnichar** aAttributes, + nsresult OpenTag(const char16_t** aAttributes, const uint32_t aAttrLen, const uint32_t aLineNumber, nsINodeInfo *aNodeInfo); @@ -79,19 +79,19 @@ protected: // eInDocumentElement then we didn't create a prototype script (e.g. the // script had an unknown type), and the caller should create a prototype // element. - nsresult OpenScript(const PRUnichar** aAttributes, + nsresult OpenScript(const char16_t** aAttributes, const uint32_t aLineNumber); - static bool IsDataInBuffer(PRUnichar* aBuffer, int32_t aLength); + static bool IsDataInBuffer(char16_t* aBuffer, int32_t aLength); // Text management nsresult FlushText(bool aCreateTextNode = true); - nsresult AddText(const PRUnichar* aText, int32_t aLength); + nsresult AddText(const char16_t* aText, int32_t aLength); nsRefPtr mNodeInfoManager; - nsresult NormalizeAttributeString(const PRUnichar *aExpatName, + nsresult NormalizeAttributeString(const char16_t *aExpatName, nsAttrName &aName); nsresult CreateElement(nsINodeInfo *aNodeInfo, nsXULPrototypeElement** aResult); diff --git a/content/xul/document/src/nsXULControllers.cpp b/content/xul/document/src/nsXULControllers.cpp index bca3c2245029..65b87789a1d1 100644 --- a/content/xul/document/src/nsXULControllers.cpp +++ b/content/xul/document/src/nsXULControllers.cpp @@ -277,7 +277,7 @@ nsXULControllers::CanCreateWrapper(const nsIID * iid, char **_retval) } NS_IMETHODIMP -nsXULControllers::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, +nsXULControllers::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { // OK if you're cool enough @@ -287,7 +287,7 @@ nsXULControllers::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, NS_IMETHODIMP nsXULControllers::CanGetProperty(const nsIID * iid, - const PRUnichar *propertyName, + const char16_t *propertyName, char **_retval) { // OK if you're cool enough @@ -298,7 +298,7 @@ nsXULControllers::CanGetProperty(const nsIID * iid, NS_IMETHODIMP nsXULControllers::CanSetProperty(const nsIID * iid, - const PRUnichar *propertyName, + const char16_t *propertyName, char **_retval) { // OK if you're cool enough diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 76e3135278ff..e09157e8bbfd 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -111,7 +111,7 @@ nsXULPrototypeCache::GetInstance() NS_IMETHODIMP nsXULPrototypeCache::Observe(nsISupports* aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, "chrome-flush-skin-caches")) { FlushSkinFiles(); diff --git a/content/xul/templates/src/nsXULContentBuilder.cpp b/content/xul/templates/src/nsXULContentBuilder.cpp index a1860055d1dd..af98b52492b3 100644 --- a/content/xul/templates/src/nsXULContentBuilder.cpp +++ b/content/xul/templates/src/nsXULContentBuilder.cpp @@ -614,7 +614,7 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode, // given node. // SynchronizeUsingTemplate contains code used to update textnodes, // so make sure to modify both when changing this - PRUnichar attrbuf[128]; + char16_t attrbuf[128]; nsFixedString attrValue(attrbuf, ArrayLength(attrbuf), 0); tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue); if (!attrValue.IsEmpty()) { @@ -754,7 +754,7 @@ nsXULContentBuilder::CopyAttributesToElement(nsIContent* aTemplateNode, // Create a buffer here, because there's a chance that an // attribute in the template is going to be an RDF URI, which is // usually longish. - PRUnichar attrbuf[128]; + char16_t attrbuf[128]; nsFixedString attribValue(attrbuf, ArrayLength(attrbuf), 0); aTemplateNode->GetAttr(attribNameSpaceID, attribName, attribValue); if (!attribValue.IsEmpty()) { @@ -852,7 +852,7 @@ nsXULContentBuilder::AddPersistentAttributes(Element* aTemplateNode, if (! value) continue; - const PRUnichar* valueStr; + const char16_t* valueStr; rv = value->GetValueConst(&valueStr); NS_ENSURE_SUCCESS(rv, rv); @@ -892,7 +892,7 @@ nsXULContentBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode, // This code is similar to that in BuildContentFromTemplate if (tmplKid->NodeInfo()->Equals(nsGkAtoms::textnode, kNameSpaceID_XUL)) { - PRUnichar attrbuf[128]; + char16_t attrbuf[128]; nsFixedString attrValue(attrbuf, ArrayLength(attrbuf), 0); tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue); if (!attrValue.IsEmpty()) { diff --git a/content/xul/templates/src/nsXULContentUtils.cpp b/content/xul/templates/src/nsXULContentUtils.cpp index aba3543a28e0..6f267f298877 100644 --- a/content/xul/templates/src/nsXULContentUtils.cpp +++ b/content/xul/templates/src/nsXULContentUtils.cpp @@ -193,7 +193,7 @@ nsXULContentUtils::GetElementResource(nsIContent* aElement, nsIRDFResource** aRe // to an RDF resource. nsresult rv; - PRUnichar buf[128]; + char16_t buf[128]; nsFixedString id(buf, ArrayLength(buf), 0); // Whoa. Why the "id" attribute? What if it's not even a XUL @@ -233,7 +233,7 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAString& aResult) // Literals are the most common, so try these first. nsCOMPtr literal = do_QueryInterface(aNode); if (literal) { - const PRUnichar* p; + const char16_t* p; rv = literal->GetValueConst(&p); if (NS_FAILED(rv)) return rv; @@ -384,7 +384,7 @@ nsXULContentUtils::GetResource(int32_t aNameSpaceID, const nsAString& aAttribute nsresult rv; - PRUnichar buf[256]; + char16_t buf[256]; nsFixedString uri(buf, ArrayLength(buf), 0); if (aNameSpaceID != kNameSpaceID_Unknown && aNameSpaceID != kNameSpaceID_None) { rv = nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, uri); @@ -393,7 +393,7 @@ nsXULContentUtils::GetResource(int32_t aNameSpaceID, const nsAString& aAttribute // XXX check to see if we need to insert a '/' or a '#'. Oy. if (!uri.IsEmpty() && uri.Last() != '#' && uri.Last() != '/' && aAttribute.First() != '#') - uri.Append(PRUnichar('#')); + uri.Append(char16_t('#')); uri.Append(aAttribute); diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index f21d84073971..805337623b61 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -1072,7 +1072,7 @@ nsXULTemplateBuilder::RemoveListener(nsIXULBuilderListener* aListener) NS_IMETHODIMP nsXULTemplateBuilder::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { // Uuuuber hack to clean up circular references that the cycle collector // doesn't know about. See bug 394514. @@ -1476,13 +1476,13 @@ nsXULTemplateBuilder::ParseAttribute(const nsAString& aAttributeValue, // A variable is either prefixed with '?' (in the extended // syntax) or "rdf:" (in the simple syntax). bool isvar; - if (*iter == PRUnichar('?') && (++iter != done_parsing)) { + if (*iter == char16_t('?') && (++iter != done_parsing)) { isvar = true; } - else if ((*iter == PRUnichar('r') && (++iter != done_parsing)) && - (*iter == PRUnichar('d') && (++iter != done_parsing)) && - (*iter == PRUnichar('f') && (++iter != done_parsing)) && - (*iter == PRUnichar(':') && (++iter != done_parsing))) { + else if ((*iter == char16_t('r') && (++iter != done_parsing)) && + (*iter == char16_t('d') && (++iter != done_parsing)) && + (*iter == char16_t('f') && (++iter != done_parsing)) && + (*iter == char16_t(':') && (++iter != done_parsing))) { isvar = true; } else { @@ -1503,7 +1503,7 @@ nsXULTemplateBuilder::ParseAttribute(const nsAString& aAttributeValue, (*aTextCallback)(this, Substring(mark, backup), aClosure); } - if (*iter == PRUnichar('?')) { + if (*iter == char16_t('?')) { // Well, it was not really a variable, but "??". We use one // question mark (the second one, actually) literally. mark = iter; @@ -1516,10 +1516,10 @@ nsXULTemplateBuilder::ParseAttribute(const nsAString& aAttributeValue, // whichever comes first. nsAString::const_iterator first(backup); - PRUnichar c = 0; + char16_t c = 0; while (iter != done_parsing) { c = *iter; - if ((c == PRUnichar(' ')) || (c == PRUnichar('^'))) + if ((c == char16_t(' ')) || (c == char16_t('^'))) break; ++iter; @@ -1530,7 +1530,7 @@ nsXULTemplateBuilder::ParseAttribute(const nsAString& aAttributeValue, // Back up so we don't consume the terminating character // *unless* the terminating character was a caret: the caret // means "concatenate with no space in between". - if (c != PRUnichar('^')) + if (c != char16_t('^')) --iter; (*aVariableCallback)(this, Substring(first, last), aClosure); @@ -2079,7 +2079,7 @@ nsXULTemplateBuilder::DetermineMemberVariable(nsIContent* aElement) child = child->GetNextSibling()) { nsAutoString uri; child->GetAttr(kNameSpaceID_None, nsGkAtoms::uri, uri); - if (!uri.IsEmpty() && uri[0] == PRUnichar('?')) { + if (!uri.IsEmpty() && uri[0] == char16_t('?')) { return NS_NewAtom(uri); } @@ -2229,7 +2229,7 @@ nsXULTemplateBuilder::CompileWhereCondition(nsTemplateRule* aRule, } nsCOMPtr svar; - if (subject[0] == PRUnichar('?')) + if (subject[0] == char16_t('?')) svar = do_GetAtom(subject); nsAutoString relstring; @@ -2253,7 +2253,7 @@ nsXULTemplateBuilder::CompileWhereCondition(nsTemplateRule* aRule, nsGkAtoms::_true, eCaseMatters); nsCOMPtr vvar; - if (!shouldMultiple && (value[0] == PRUnichar('?'))) { + if (!shouldMultiple && (value[0] == char16_t('?'))) { vvar = do_GetAtom(value); } @@ -2347,7 +2347,7 @@ nsXULTemplateBuilder::CompileBinding(nsTemplateRule* aRule, } nsCOMPtr svar; - if (subject[0] == PRUnichar('?')) { + if (subject[0] == char16_t('?')) { svar = do_GetAtom(subject); } else { @@ -2373,7 +2373,7 @@ nsXULTemplateBuilder::CompileBinding(nsTemplateRule* aRule, } nsCOMPtr ovar; - if (object[0] == PRUnichar('?')) { + if (object[0] == char16_t('?')) { ovar = do_GetAtom(object); } else { diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp index 6f02e0c3c5ec..291e8c86714f 100644 --- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp +++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp @@ -658,7 +658,7 @@ nsXULTemplateQueryProcessorRDF::CompareResults(nsIXULTemplateResult* aLeft, if (l) { nsCOMPtr r = do_QueryInterface(rightNode); if (r) { - const PRUnichar *lstr, *rstr; + const char16_t *lstr, *rstr; l->GetValueConst(&lstr); r->GetValueConst(&rstr); @@ -1351,7 +1351,7 @@ nsXULTemplateQueryProcessorRDF::CompileTripleCondition(nsRDFQuery* aQuery, nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_TRIPLE_BAD_SUBJECT); return NS_OK; } - if (subject[0] == PRUnichar('?')) + if (subject[0] == char16_t('?')) svar = do_GetAtom(subject); else gRDFService->GetUnicodeResource(subject, getter_AddRefs(sres)); @@ -1361,7 +1361,7 @@ nsXULTemplateQueryProcessorRDF::CompileTripleCondition(nsRDFQuery* aQuery, aCondition->GetAttr(kNameSpaceID_None, nsGkAtoms::predicate, predicate); nsCOMPtr pres; - if (predicate.IsEmpty() || predicate[0] == PRUnichar('?')) { + if (predicate.IsEmpty() || predicate[0] == char16_t('?')) { nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_TRIPLE_BAD_PREDICATE); return NS_OK; } @@ -1378,7 +1378,7 @@ nsXULTemplateQueryProcessorRDF::CompileTripleCondition(nsRDFQuery* aQuery, return NS_OK; } - if (object[0] == PRUnichar('?')) { + if (object[0] == char16_t('?')) { ovar = do_GetAtom(object); } else if (object.FindChar(':') != -1) { // XXXwaterson evil. @@ -1445,7 +1445,7 @@ nsXULTemplateQueryProcessorRDF::CompileMemberCondition(nsRDFQuery* aQuery, nsAutoString container; aCondition->GetAttr(kNameSpaceID_None, nsGkAtoms::container, container); - if (!container.IsEmpty() && container[0] != PRUnichar('?')) { + if (!container.IsEmpty() && container[0] != char16_t('?')) { nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_MEMBER_NOCONTAINERVAR); return NS_OK; } @@ -1456,7 +1456,7 @@ nsXULTemplateQueryProcessorRDF::CompileMemberCondition(nsRDFQuery* aQuery, nsAutoString child; aCondition->GetAttr(kNameSpaceID_None, nsGkAtoms::child, child); - if (!child.IsEmpty() && child[0] != PRUnichar('?')) { + if (!child.IsEmpty() && child[0] != char16_t('?')) { nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_MEMBER_NOCHILDVAR); return NS_OK; } diff --git a/content/xul/templates/src/nsXULTreeBuilder.cpp b/content/xul/templates/src/nsXULTreeBuilder.cpp index c64a36830ed3..df0d4dcdbd13 100644 --- a/content/xul/templates/src/nsXULTreeBuilder.cpp +++ b/content/xul/templates/src/nsXULTreeBuilder.cpp @@ -979,7 +979,7 @@ nsXULTreeBuilder::SetCellText(int32_t aRow, nsITreeColumn* aCol, const nsAString } NS_IMETHODIMP -nsXULTreeBuilder::PerformAction(const PRUnichar* aAction) +nsXULTreeBuilder::PerformAction(const char16_t* aAction) { uint32_t count = mObservers.Count(); for (uint32_t i = 0; i < count; ++i) { @@ -992,7 +992,7 @@ nsXULTreeBuilder::PerformAction(const PRUnichar* aAction) } NS_IMETHODIMP -nsXULTreeBuilder::PerformActionOnRow(const PRUnichar* aAction, int32_t aRow) +nsXULTreeBuilder::PerformActionOnRow(const char16_t* aAction, int32_t aRow) { uint32_t count = mObservers.Count(); for (uint32_t i = 0; i < count; ++i) { @@ -1005,7 +1005,7 @@ nsXULTreeBuilder::PerformActionOnRow(const PRUnichar* aAction, int32_t aRow) } NS_IMETHODIMP -nsXULTreeBuilder::PerformActionOnCell(const PRUnichar* aAction, int32_t aRow, nsITreeColumn* aCol) +nsXULTreeBuilder::PerformActionOnCell(const char16_t* aAction, int32_t aRow, nsITreeColumn* aCol) { NS_ENSURE_ARG_POINTER(aCol); nsAutoString id; diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index a50f27e5c38a..aed031801364 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -638,7 +638,7 @@ nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn, // in non ascii.(see bug 87127) Since it is too risky to make interface change right // now, we decide not to do so now. // Therefore, the aIn we receive here maybe already in damage form - // (e.g. treat every bytes as ISO-8859-1 and cast up to PRUnichar + // (e.g. treat every bytes as ISO-8859-1 and cast up to char16_t // while the real data could be in file system charset ) // we choice the following logic which will work for most of the case. // Case will still failed only if it meet ALL the following condiction: @@ -784,8 +784,8 @@ bool nsDefaultURIFixup::PossiblyByteExpandedFileName(const nsAString& aIn) // have proper Unicode code points. // This is a temporary fix. Please refer to 58866, 86948 - nsReadingIterator iter; - nsReadingIterator iterEnd; + nsReadingIterator iter; + nsReadingIterator iterEnd; aIn.BeginReading(iter); aIn.EndReading(iterEnd); while (iter != iterEnd) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index daa1e898dcf6..964901325fdc 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -368,9 +368,9 @@ ForEachPing(nsIContent *content, ForEachPingCallback callback, void *closure) nsIDocument *doc = content->OwnerDoc(); // 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; @@ -2841,7 +2841,7 @@ nsDocShell::SetName(const nsAString& aName) } NS_IMETHODIMP -nsDocShell::NameEquals(const PRUnichar *aName, bool *_retval) +nsDocShell::NameEquals(const char16_t *aName, bool *_retval) { NS_ENSURE_ARG_POINTER(aName); NS_ENSURE_ARG_POINTER(_retval); @@ -3228,7 +3228,7 @@ ItemIsActive(nsIDocShellTreeItem *aItem) } NS_IMETHODIMP -nsDocShell::FindItemWithName(const PRUnichar * aName, +nsDocShell::FindItemWithName(const char16_t * aName, nsISupports * aRequestor, nsIDocShellTreeItem * aOriginalRequestor, nsIDocShellTreeItem ** _retval) @@ -3326,7 +3326,7 @@ nsDocShell::FindItemWithName(const PRUnichar * aName, } nsresult -nsDocShell::DoFindItemWithName(const PRUnichar* aName, +nsDocShell::DoFindItemWithName(const char16_t* aName, nsISupports* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** _retval) @@ -3769,7 +3769,7 @@ nsDocShell::GetChildAt(int32_t aIndex, nsIDocShellTreeItem ** aChild) } NS_IMETHODIMP -nsDocShell::FindChildWithName(const PRUnichar * aName, +nsDocShell::FindChildWithName(const char16_t * aName, bool aRecurse, bool aSameType, nsIDocShellTreeItem * aRequestor, nsIDocShellTreeItem * aOriginalRequestor, @@ -4237,7 +4237,7 @@ NS_IMETHODIMP nsDocShell::GotoIndex(int32_t aIndex) } NS_IMETHODIMP -nsDocShell::LoadURI(const PRUnichar * aURI, +nsDocShell::LoadURI(const char16_t * aURI, uint32_t aLoadFlags, nsIURI * aReferringURI, nsIInputStream * aPostStream, @@ -4344,7 +4344,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI, NS_IMETHODIMP nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, - const PRUnichar *aURL, + const char16_t *aURL, nsIChannel* aFailedChannel) { // Get prompt and string bundle servcies @@ -4651,7 +4651,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, rv = NS_OK; ++formatStrCount; - const PRUnichar *strs[kMaxFormatStrArgs]; + const char16_t *strs[kMaxFormatStrArgs]; for (uint32_t i = 0; i < formatStrCount; i++) { strs[i] = formatStrs[i].get(); } @@ -4689,10 +4689,10 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, NS_IMETHODIMP -nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, +nsDocShell::LoadErrorPage(nsIURI *aURI, const char16_t *aURL, const char *aErrorPage, - const PRUnichar *aErrorType, - const PRUnichar *aDescription, + const char16_t *aErrorType, + const char16_t *aDescription, const char *aCSSClass, nsIChannel* aFailedChannel) { @@ -5749,7 +5749,7 @@ nsDocShell::GetMainWidget(nsIWidget ** aMainWidget) } NS_IMETHODIMP -nsDocShell::GetTitle(PRUnichar ** aTitle) +nsDocShell::GetTitle(char16_t ** aTitle) { NS_ENSURE_ARG_POINTER(aTitle); @@ -5758,7 +5758,7 @@ nsDocShell::GetTitle(PRUnichar ** aTitle) } NS_IMETHODIMP -nsDocShell::SetTitle(const PRUnichar * aTitle) +nsDocShell::SetTitle(const char16_t * aTitle) { // Store local title mTitle = aTitle; @@ -6888,7 +6888,7 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, NS_IMETHODIMP nsDocShell::OnStatusChange(nsIWebProgress * aWebProgress, nsIRequest * aRequest, - nsresult aStatus, const PRUnichar * aMessage) + nsresult aStatus, const char16_t * aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; @@ -8829,7 +8829,7 @@ nsDocShell::InternalLoad(nsIURI * aURI, nsIURI * aReferrer, nsISupports * aOwner, uint32_t aFlags, - const PRUnichar *aWindowTarget, + const char16_t *aWindowTarget, const char* aTypeHint, const nsAString& aFileName, nsIInputStream * aPostData, @@ -11780,7 +11780,7 @@ nsDocShell::ConfirmRepost(bool * aRepost) else { // Brand available - if the app has an override file with formatting, the app name will // be included. Without an override, the prompt will look like the generic version. - const PRUnichar *formatStrings[] = { brandName.get() }; + const char16_t *formatStrings[] = { brandName.get() }; rv = appBundle->FormatStringFromName(MOZ_UTF16("confirmRepostPrompt"), formatStrings, ArrayLength(formatStrings), getter_Copies(msgString)); @@ -12392,7 +12392,7 @@ class OnLinkClickEvent : public nsRunnable { public: OnLinkClickEvent(nsDocShell* aHandler, nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, @@ -12426,7 +12426,7 @@ private: OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, nsIContent *aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, @@ -12448,7 +12448,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, NS_IMETHODIMP nsDocShell::OnLinkClick(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, @@ -12497,7 +12497,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent, NS_IMETHODIMP nsDocShell::OnLinkClickSync(nsIContent *aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, @@ -12617,7 +12617,7 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent, NS_IMETHODIMP nsDocShell::OnOverLink(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec) + const char16_t* aTargetSpec) { if (aContent->IsEditable()) { return NS_OK; diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 32a59c5a82c3..bb131b98c38e 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -184,14 +184,14 @@ public: // nsILinkHandler NS_IMETHOD OnLinkClick(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, bool aIsTrusted); NS_IMETHOD OnLinkClickSync(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream = 0, nsIInputStream* aHeadersDataStream = 0, @@ -199,7 +199,7 @@ public: nsIRequest** aRequest = 0); NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec); + const char16_t* aTargetSpec); NS_IMETHOD OnLeaveLink(); nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType); @@ -503,10 +503,10 @@ protected: nsresult EnsureTransferableHookData(); NS_IMETHOD EnsureFind(); nsresult RefreshURIFromQueue(); - NS_IMETHOD LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, + NS_IMETHOD LoadErrorPage(nsIURI *aURI, const char16_t *aURL, const char *aErrorPage, - const PRUnichar *aErrorType, - const PRUnichar *aDescription, + const char16_t *aErrorType, + const char16_t *aDescription, const char *aCSSClass, nsIChannel* aFailedChannel); bool IsNavigationAllowed(bool aDisplayPrintErrorDialog = true); @@ -883,7 +883,7 @@ private: // Separate function to do the actual name (i.e. not _top, _self etc.) // searching for FindItemWithName. - nsresult DoFindItemWithName(const PRUnichar* aName, + nsresult DoFindItemWithName(const char16_t* aName, nsISupports* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** _retval); diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp index 8b440825ce03..db4fa92ccf81 100644 --- a/docshell/base/nsDocShellLoadInfo.cpp +++ b/docshell/base/nsDocShellLoadInfo.cpp @@ -128,7 +128,7 @@ NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry) return NS_OK; } -NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(PRUnichar** aTarget) +NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(char16_t** aTarget) { NS_ENSURE_ARG_POINTER(aTarget); @@ -137,7 +137,7 @@ NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(PRUnichar** aTarget) return NS_OK; } -NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const PRUnichar* aTarget) +NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const char16_t* aTarget) { mTarget.Assign(aTarget); return NS_OK; diff --git a/docshell/base/nsILinkHandler.h b/docshell/base/nsILinkHandler.h index 0194e20995e3..8fcd8510296a 100644 --- a/docshell/base/nsILinkHandler.h +++ b/docshell/base/nsILinkHandler.h @@ -40,7 +40,7 @@ public: */ NS_IMETHOD OnLinkClick(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, @@ -64,7 +64,7 @@ public: */ NS_IMETHOD OnLinkClickSync(nsIContent* aContent, nsIURI* aURI, - const PRUnichar* aTargetSpec, + const char16_t* aTargetSpec, const nsAString& aFileName, nsIInputStream* aPostDataStream = 0, nsIInputStream* aHeadersDataStream = 0, @@ -81,7 +81,7 @@ public: */ NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURLSpec, - const PRUnichar* aTargetSpec) = 0; + const char16_t* aTargetSpec) = 0; /** * Process the mouse leaving a link. diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index cd10c23394ec..78d26a33ed62 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -193,7 +193,7 @@ nsSHEntry::GetSticky(bool *aSticky) return NS_OK; } -NS_IMETHODIMP nsSHEntry::GetTitle(PRUnichar** aTitle) +NS_IMETHODIMP nsSHEntry::GetTitle(char16_t** aTitle) { // Check for empty title... if (mTitle.IsEmpty() && mURI) { diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index fe99c05bd849..72187f2363dd 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -186,7 +186,7 @@ NS_IMPL_ISUPPORTS1(nsSHistoryObserver, nsIObserver) NS_IMETHODIMP nsSHistoryObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsSHistory::UpdatePrefs(); @@ -1467,7 +1467,7 @@ nsSHistory::GetSessionHistory(nsISHistory** aSessionHistory) NS_IMETHODIMP -nsSHistory::LoadURI(const PRUnichar* aURI, +nsSHistory::LoadURI(const char16_t* aURI, uint32_t aLoadFlags, nsIURI* aReferringURI, nsIInputStream* aPostStream, diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index a549c85ff575..855499eea945 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -633,7 +633,7 @@ AudioChannelService::ChannelName(AudioChannelType aType) } NS_IMETHODIMP -AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) +AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown")) { mDisabled = true; diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 403ae203b7df..2b943d0c50ef 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -356,8 +356,8 @@ Navigator::GetLanguage(nsAString& aLanguage) // Checks and fixups: // replace "_" with "-" to avoid POSIX/Windows "en_US" notation. - if (aLanguage.Length() > 2 && aLanguage[2] == PRUnichar('_')) { - aLanguage.Replace(2, 1, PRUnichar('-')); // TODO replace all + if (aLanguage.Length() > 2 && aLanguage[2] == char16_t('_')) { + aLanguage.Replace(2, 1, char16_t('-')); // TODO replace all } // Use uppercase for country part, e.g. "en-US", not "en-us", see BCP47 @@ -1997,7 +1997,7 @@ NS_GetNavigatorAppVersion(nsAString& aAppVersion) NS_ENSURE_SUCCESS(rv, rv); AppendASCIItoUTF16(str, aAppVersion); - aAppVersion.Append(PRUnichar(')')); + aAppVersion.Append(char16_t(')')); return rv; } diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index 9dd1d6041844..8168d3b44377 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -242,7 +242,7 @@ URL::GetProtocol(nsString& aProtocol) const } CopyASCIItoUTF16(protocol, aProtocol); - aProtocol.Append(PRUnichar(':')); + aProtocol.Append(char16_t(':')); } void @@ -482,7 +482,7 @@ URL::GetHash(nsString& aHash) const nsresult rv = mURI->GetRef(ref); if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) { NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes! - aHash.Assign(PRUnichar('#')); + aHash.Assign(char16_t('#')); AppendUTF8toUTF16(ref, aHash); } } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index dbdf6a17e71a..1e1d2fd9e60a 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1739,7 +1739,7 @@ GetExternalClassInfo(nsScriptNameSpaceManager *aNameSpaceManager, static nsresult ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx, - JS::Handle obj, const PRUnichar *name, + JS::Handle obj, const char16_t *name, const nsDOMClassInfoData *ci_data, const nsGlobalNameStruct *name_struct, nsScriptNameSpaceManager *nameSpaceManager, @@ -2265,7 +2265,7 @@ DefineInterfaceConstants(JSContext *cx, JS::Handle obj, const nsIID * class nsDOMConstructor MOZ_FINAL : public nsIDOMDOMConstructor { protected: - nsDOMConstructor(const PRUnichar* aName, + nsDOMConstructor(const char16_t* aName, bool aIsConstructable, nsPIDOMWindow* aOwner) : mClassName(aName), @@ -2276,7 +2276,7 @@ protected: public: - static nsresult Create(const PRUnichar* aName, + static nsresult Create(const char16_t* aName, const nsDOMClassInfoData* aData, const nsGlobalNameStruct* aNameStruct, nsPIDOMWindow* aOwner, @@ -2368,14 +2368,14 @@ private: aNameStruct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias; } - const PRUnichar* mClassName; + const char16_t* mClassName; const bool mConstructable; nsWeakPtr mWeakOwner; }; //static nsresult -nsDOMConstructor::Create(const PRUnichar* aName, +nsDOMConstructor::Create(const char16_t* aName, const nsDOMClassInfoData* aData, const nsGlobalNameStruct* aNameStruct, nsPIDOMWindow* aOwner, @@ -2661,7 +2661,7 @@ nsDOMConstructor::ToString(nsAString &aResult) { aResult.AssignLiteral("[object "); aResult.Append(mClassName); - aResult.Append(PRUnichar(']')); + aResult.Append(char16_t(']')); return NS_OK; } @@ -2726,7 +2726,7 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin, // eTypeClassProto. static nsresult ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx, - JS::Handle obj, const PRUnichar *name, + JS::Handle obj, const char16_t *name, const nsDOMClassInfoData *ci_data, const nsGlobalNameStruct *name_struct, nsScriptNameSpaceManager *nameSpaceManager, @@ -2928,7 +2928,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, nsDependentJSString name(id); - const PRUnichar *class_name = nullptr; + const char16_t *class_name = nullptr; const nsGlobalNameStruct *name_struct = nameSpaceManager->LookupName(name, &class_name); diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index a242522515e9..efe0dceb921d 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -33,7 +33,7 @@ typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject); struct nsDOMClassInfoData { const char *mName; - const PRUnichar *mNameUTF16; + const char16_t *mNameUTF16; union { nsDOMClassInfoConstructorFnc mConstructorFptr; nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr; diff --git a/dom/base/nsDOMScriptObjectFactory.cpp b/dom/base/nsDOMScriptObjectFactory.cpp index 8a0e1c625413..217519696f8f 100644 --- a/dom/base/nsDOMScriptObjectFactory.cpp +++ b/dom/base/nsDOMScriptObjectFactory.cpp @@ -90,7 +90,7 @@ nsDOMScriptObjectFactory::GetExternalClassInfoInstance(const nsAString& aName) NS_IMETHODIMP nsDOMScriptObjectFactory::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { #ifdef MOZ_XUL diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 017e7470c5a9..8c4e7b4208f2 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -204,7 +204,7 @@ nsFocusManager::Shutdown() NS_IMETHODIMP nsFocusManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsDependentString data(aData); diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 2d1457a93611..8b9b8cc90ca8 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -473,7 +473,7 @@ class nsGlobalWindowObserver MOZ_FINAL : public nsIObserver, public: nsGlobalWindowObserver(nsGlobalWindow* aWindow) : mWindow(aWindow) {} NS_DECL_ISUPPORTS - NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) + NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (!mWindow) return NS_OK; @@ -5877,7 +5877,7 @@ nsGlobalWindow::MakeScriptDialogTitle(nsAString &aOutTitle) fixedURI->GetPrePath(prepath); NS_ConvertUTF8toUTF16 ucsPrePath(prepath); - const PRUnichar *formatStrings[] = { ucsPrePath.get() }; + const char16_t *formatStrings[] = { ucsPrePath.get() }; nsXPIDLString tempString; nsContentUtils::FormatLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES, "ScriptDlgHeading", @@ -6172,7 +6172,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial, promptBag->SetPropertyAsBool(NS_LITERAL_STRING("allowTabModal"), allowTabModal); // Pass in the default value, if any. - PRUnichar *inoutValue = ToNewUnicode(fixedInitial); + char16_t *inoutValue = ToNewUnicode(fixedInitial); bool disallowDialog = false; nsXPIDLString label; @@ -10560,7 +10560,7 @@ nsGlobalWindow::ShowSlowScriptDialog() if (filename) { nsXPIDLString scriptLocation; NS_ConvertUTF8toUTF16 filenameUTF16(filename); - const PRUnichar *formatParams[] = { filenameUTF16.get() }; + const char16_t *formatParams[] = { filenameUTF16.get() }; rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, "KillScriptLocation", formatParams, @@ -10785,7 +10785,7 @@ nsGlobalWindow::UnregisterIdleObserver(nsIIdleObserver* aIdleObserver) nsresult nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!nsCRT::strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) { if (IsFrozen()) { @@ -11677,7 +11677,7 @@ nsGlobalWindow::RunTimeoutHandler(nsTimeout* aTimeout, nsRefPtr callback = handler->GetCallback(); if (!callback) { // Evaluate the timeout expression. - const PRUnichar* script = handler->GetHandlerText(); + const char16_t* script = handler->GetHandlerText(); NS_ASSERTION(script, "timeout has no script nor handler text!"); const char* filename = nullptr; diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 0805a5929f4c..c66bc75a5963 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -589,7 +589,7 @@ public: nsIScrollableFrame *GetScrollFrame(); nsresult Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData); + const char16_t* aData); // Outer windows only. void UnblockScriptedClosing(); diff --git a/dom/base/nsIScriptTimeoutHandler.h b/dom/base/nsIScriptTimeoutHandler.h index db03a38ad6aa..0741abcdb501 100644 --- a/dom/base/nsIScriptTimeoutHandler.h +++ b/dom/base/nsIScriptTimeoutHandler.h @@ -34,7 +34,7 @@ public: virtual mozilla::dom::Function *GetCallback() = 0; // Get the handler text of not a compiled object. - virtual const PRUnichar *GetHandlerText() = 0; + virtual const char16_t *GetHandlerText() = 0; // Get the location of the script. // Note: The memory pointed to by aFileName is owned by the diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index d61a0d037221..10dfede6dbb6 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -249,7 +249,7 @@ NS_IMPL_ISUPPORTS1(nsJSEnvironmentObserver, nsIObserver) NS_IMETHODIMP nsJSEnvironmentObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (sGCOnMemoryPressure && !nsCRT::strcmp(aTopic, "memory-pressure")) { if(StringBeginsWith(nsDependentString(aData), @@ -353,7 +353,7 @@ AsyncErrorReporter::AsyncErrorReporter(JSRuntime* aRuntime, const char* aFallbackMessage, bool aIsChromeError, nsPIDOMWindow* aWindow) - : mSourceLine(static_cast(aErrorReport->uclinebuf)) + : mSourceLine(static_cast(aErrorReport->uclinebuf)) , mLineNumber(aErrorReport->lineno) , mColumn(aErrorReport->uctokenptr - aErrorReport->uclinebuf) , mFlags(aErrorReport->flags) @@ -364,9 +364,9 @@ AsyncErrorReporter::AsyncErrorReporter(JSRuntime* aRuntime, mFileName.AssignWithConversion(aErrorReport->filename); } - const PRUnichar* m = static_cast(aErrorReport->ucmessage); + const char16_t* m = static_cast(aErrorReport->ucmessage); if (m) { - const PRUnichar* n = static_cast + const char16_t* n = static_cast (js::GetErrorTypeName(aRuntime, aErrorReport->exnType)); if (n) { mErrorMsg.Assign(n); @@ -598,7 +598,7 @@ NS_ScriptErrorReporter(JSContext *cx, error.AppendInt(report->lineno, 10); error.Append(": "); if (report->ucmessage) { - AppendUTF16toUTF8(reinterpret_cast(report->ucmessage), + AppendUTF16toUTF8(reinterpret_cast(report->ucmessage), error); } else { error.Append(message); @@ -973,10 +973,10 @@ nsJSContext::EvaluateString(const nsAString& aScript, bool AtomIsEventHandlerName(nsIAtom *aName) { - const PRUnichar *name = aName->GetUTF16String(); + const char16_t *name = aName->GetUTF16String(); - const PRUnichar *cp; - PRUnichar c; + const char16_t *cp; + char16_t c; for (cp = name; *cp != '\0'; ++cp) { c = *cp; diff --git a/dom/base/nsJSTimeoutHandler.cpp b/dom/base/nsJSTimeoutHandler.cpp index 57448916e172..1402011289f9 100644 --- a/dom/base/nsJSTimeoutHandler.cpp +++ b/dom/base/nsJSTimeoutHandler.cpp @@ -43,7 +43,7 @@ public: ErrorResult& aError); ~nsJSScriptTimeoutHandler(); - virtual const PRUnichar *GetHandlerText(); + virtual const char16_t *GetHandlerText(); virtual Function* GetCallback() { return mFunction; @@ -385,7 +385,7 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval, return NS_OK; } -const PRUnichar * +const char16_t * nsJSScriptTimeoutHandler::GetHandlerText() { NS_ASSERTION(!mFunction, "No expression, so no handler text!"); diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index adfdf7c76d62..b94d00c69586 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -281,7 +281,7 @@ nsLocation::GetHash(nsAString& aHash) } if (NS_SUCCEEDED(rv) && !unicodeRef.IsEmpty()) { - aHash.Assign(PRUnichar('#')); + aHash.Assign(char16_t('#')); aHash.Append(unicodeRef); } @@ -307,8 +307,8 @@ nsLocation::SetHash(const nsAString& aHash) } NS_ConvertUTF16toUTF8 hash(aHash); - if (hash.IsEmpty() || hash.First() != PRUnichar('#')) { - hash.Insert(PRUnichar('#'), 0); + if (hash.IsEmpty() || hash.First() != char16_t('#')) { + hash.Insert(char16_t('#'), 0); } rv = uri->SetRef(hash); if (NS_SUCCEEDED(rv)) { @@ -674,7 +674,7 @@ nsLocation::GetProtocol(nsAString& aProtocol) if (NS_SUCCEEDED(result)) { CopyASCIItoUTF16(protocol, aProtocol); - aProtocol.Append(PRUnichar(':')); + aProtocol.Append(char16_t(':')); } } @@ -721,7 +721,7 @@ nsLocation::GetSearch(nsAString& aSearch) result = url->GetQuery(search); if (NS_SUCCEEDED(result) && !search.IsEmpty()) { - aSearch.Assign(PRUnichar('?')); + aSearch.Assign(char16_t('?')); AppendUTF8toUTF16(search, aSearch); } } diff --git a/dom/base/nsPluginArray.cpp b/dom/base/nsPluginArray.cpp index 58be075c6869..eca59c7c294e 100644 --- a/dom/base/nsPluginArray.cpp +++ b/dom/base/nsPluginArray.cpp @@ -253,7 +253,7 @@ nsPluginArray::GetSupportedNames(nsTArray< nsString >& aRetval) NS_IMETHODIMP nsPluginArray::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) { + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "plugin-info-updated")) { Refresh(false); } diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp index 6a01287b7b58..75af51a35fd8 100644 --- a/dom/base/nsScriptNameSpaceManager.cpp +++ b/dom/base/nsScriptNameSpaceManager.cpp @@ -141,7 +141,7 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager() nsGlobalNameStruct * nsScriptNameSpaceManager::AddToHash(PLDHashTable *aTable, const nsAString *aKey, - const PRUnichar **aClassName) + const char16_t **aClassName) { GlobalNameMapEntry *entry = static_cast @@ -429,7 +429,7 @@ nsScriptNameSpaceManager::InitForContext(nsIScriptContext *aContext) nsGlobalNameStruct* nsScriptNameSpaceManager::LookupNameInternal(const nsAString& aName, - const PRUnichar **aClassName) + const char16_t **aClassName) { GlobalNameMapEntry *entry = static_cast @@ -472,7 +472,7 @@ nsScriptNameSpaceManager::RegisterClassName(const char *aClassName, bool aPrivileged, bool aXBLAllowed, bool aDisabled, - const PRUnichar **aResult) + const char16_t **aResult) { if (!nsCRT::IsAscii(aClassName)) { NS_ERROR("Trying to register a non-ASCII class name"); @@ -566,7 +566,7 @@ nsScriptNameSpaceManager::RegisterDOMCIData(const char *aName, bool aHasClassInterface, const nsCID *aConstructorCID) { - const PRUnichar* className; + const char16_t* className; nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aName, &className); NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY); @@ -763,7 +763,7 @@ nsScriptNameSpaceManager::RemoveCategoryEntryFromHash(nsICategoryManager* aCateg NS_IMETHODIMP nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!aData) { return NS_OK; diff --git a/dom/base/nsScriptNameSpaceManager.h b/dom/base/nsScriptNameSpaceManager.h index 8517a3eb84a7..2a511b99e912 100644 --- a/dom/base/nsScriptNameSpaceManager.h +++ b/dom/base/nsScriptNameSpaceManager.h @@ -109,7 +109,7 @@ public: // It also returns a pointer to the string buffer of the classname // in the nsGlobalNameStruct. const nsGlobalNameStruct* LookupName(const nsAString& aName, - const PRUnichar **aClassName = nullptr) + const char16_t **aClassName = nullptr) { return LookupNameInternal(aName, aClassName); } @@ -125,7 +125,7 @@ public: bool aPrivileged, bool aXBLAllowed, bool aDisabled, - const PRUnichar **aResult); + const char16_t **aResult); nsresult RegisterClassProto(const char *aClassName, const nsIID *aConstructorProtoIID, @@ -172,9 +172,9 @@ private: // nsGlobalNameStruct is != eTypeNotInitialized, an entry for aKey // already existed. nsGlobalNameStruct *AddToHash(PLDHashTable *aTable, const nsAString *aKey, - const PRUnichar **aClassName = nullptr); + const char16_t **aClassName = nullptr); nsGlobalNameStruct *AddToHash(PLDHashTable *aTable, const char *aKey, - const PRUnichar **aClassName = nullptr) + const char16_t **aClassName = nullptr) { NS_ConvertASCIItoUTF16 key(aKey); return AddToHash(aTable, &key, aClassName); @@ -220,7 +220,7 @@ private: bool aRemove); nsGlobalNameStruct* LookupNameInternal(const nsAString& aName, - const PRUnichar **aClassName = nullptr); + const char16_t **aClassName = nullptr); PLDHashTable mGlobalNames; PLDHashTable mNavigatorNames; diff --git a/dom/base/nsWindowMemoryReporter.cpp b/dom/base/nsWindowMemoryReporter.cpp index e376eec61f12..e1b2af4913bd 100644 --- a/dom/base/nsWindowMemoryReporter.cpp +++ b/dom/base/nsWindowMemoryReporter.cpp @@ -577,7 +577,7 @@ nsWindowMemoryReporter::GetGhostTimeout() NS_IMETHODIMP nsWindowMemoryReporter::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, DOM_WINDOW_DESTROYED_TOPIC)) { ObserveDOMWindowDetached(aSubject); diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index de98b3cdf3d4..aad2cc5dc92e 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -910,7 +910,7 @@ inline bool EnumValueNotFound(JSContext* cx, const jschar* chars, size_t length, const char* type, const char* sourceDescription) { - NS_LossyConvertUTF16toASCII deflated(static_cast(chars), + NS_LossyConvertUTF16toASCII deflated(static_cast(chars), length); return ThrowErrorMessage(cx, MSG_INVALID_ENUM_VALUE, sourceDescription, deflated.get(), type); diff --git a/dom/bluetooth/BluetoothHidManager.cpp b/dom/bluetooth/BluetoothHidManager.cpp index 378d958e96e7..a195bb1453dd 100644 --- a/dom/bluetooth/BluetoothHidManager.cpp +++ b/dom/bluetooth/BluetoothHidManager.cpp @@ -29,7 +29,7 @@ namespace { NS_IMETHODIMP BluetoothHidManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(sBluetoothHidManager); diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index 36fe27219a24..3a4d7aa32b60 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -770,7 +770,7 @@ BluetoothService::Get() nsresult BluetoothService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/bluetooth/ObexBase.h b/dom/bluetooth/ObexBase.h index 70baad9fb3df..3f597d042000 100644 --- a/dom/bluetooth/ObexBase.h +++ b/dom/bluetooth/ObexBase.h @@ -157,7 +157,7 @@ public: uint8_t* ptr = mHeaders[i]->mData.get(); for (int j = 0; j < nameLength; ++j) { - PRUnichar c = ((((uint32_t)ptr[j * 2]) << 8) | ptr[j * 2 + 1]); + char16_t c = ((((uint32_t)ptr[j * 2]) << 8) | ptr[j * 2 + 1]); aRetName += c; } diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp index 024807d29295..cd33064466fa 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp @@ -177,7 +177,7 @@ private: NS_IMETHODIMP BluetoothA2dpManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(sBluetoothA2dpManager); diff --git a/dom/bluetooth/bluedroid/BluetoothHfpManager.cpp b/dom/bluetooth/bluedroid/BluetoothHfpManager.cpp index 8cadfcbd9a65..7abb61c9dd96 100644 --- a/dom/bluetooth/bluedroid/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothHfpManager.cpp @@ -490,7 +490,7 @@ BluetoothHfpManager::Get() NS_IMETHODIMP BluetoothHfpManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) { HandleVolumeChanged(nsDependentString(aData)); diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 2a61ce638458..3c2a7f04045a 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -72,7 +72,7 @@ public: NS_IMETHODIMP BluetoothOppManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(sBluetoothOppManager); @@ -713,12 +713,12 @@ BluetoothOppManager::RetrieveSentFileName() } bool -BluetoothOppManager::IsReservedChar(PRUnichar c) +BluetoothOppManager::IsReservedChar(char16_t c) { return (c < 0x0020 || - c == PRUnichar('?') || c == PRUnichar('|') || c == PRUnichar('<') || - c == PRUnichar('>') || c == PRUnichar('"') || c == PRUnichar(':') || - c == PRUnichar('/') || c == PRUnichar('*') || c == PRUnichar('\\')); + c == char16_t('?') || c == char16_t('|') || c == char16_t('<') || + c == char16_t('>') || c == char16_t('"') || c == char16_t(':') || + c == char16_t('/') || c == char16_t('*') || c == char16_t('\\')); } void @@ -729,7 +729,7 @@ BluetoothOppManager::ValidateFileName() for (int i = 0; i < length; ++i) { // Replace reserved char of fat file system with '_' if (IsReservedChar(mFileName.CharAt(i))) { - mFileName.Replace(i, 1, PRUnichar('_')); + mFileName.Replace(i, 1, char16_t('_')); } } } @@ -1059,7 +1059,7 @@ BluetoothOppManager::SendPutHeaderRequest(const nsAString& aFileName, int len = aFileName.Length(); uint8_t* fileName = new uint8_t[(len + 1) * 2]; - const PRUnichar* fileNamePtr = aFileName.BeginReading(); + const char16_t* fileNamePtr = aFileName.BeginReading(); for (int i = 0; i < len; i++) { fileName[i * 2] = (uint8_t)(fileNamePtr[i] >> 8); diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.h b/dom/bluetooth/bluedroid/BluetoothOppManager.h index ca3ff5842aa3..e1b7659efc7d 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.h +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.h @@ -95,7 +95,7 @@ private: void AfterFirstPut(); void AfterOppDisconnected(); void ValidateFileName(); - bool IsReservedChar(PRUnichar c); + bool IsReservedChar(char16_t c); void ClearQueue(); void RetrieveSentFileName(); void NotifyAboutFileChange(); diff --git a/dom/bluetooth/bluez/BluetoothA2dpManager.cpp b/dom/bluetooth/bluez/BluetoothA2dpManager.cpp index fed6e335ca50..2c24ae8b4d35 100644 --- a/dom/bluetooth/bluez/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothA2dpManager.cpp @@ -31,7 +31,7 @@ namespace { NS_IMETHODIMP BluetoothA2dpManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(sBluetoothA2dpManager); diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.cpp b/dom/bluetooth/bluez/BluetoothHfpManager.cpp index bda21d158a78..1fae4ca0fd67 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp @@ -194,7 +194,7 @@ NS_IMPL_ISUPPORTS1(BluetoothHfpManager::GetVolumeTask, NS_IMETHODIMP BluetoothHfpManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) { HandleVolumeChanged(nsDependentString(aData)); diff --git a/dom/bluetooth/bluez/BluetoothOppManager.cpp b/dom/bluetooth/bluez/BluetoothOppManager.cpp index 4d7c561b82a5..cb09f8d4b539 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluez/BluetoothOppManager.cpp @@ -72,7 +72,7 @@ public: NS_IMETHODIMP BluetoothOppManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(sBluetoothOppManager); @@ -729,12 +729,12 @@ BluetoothOppManager::RetrieveSentFileName() } bool -BluetoothOppManager::IsReservedChar(PRUnichar c) +BluetoothOppManager::IsReservedChar(char16_t c) { return (c < 0x0020 || - c == PRUnichar('?') || c == PRUnichar('|') || c == PRUnichar('<') || - c == PRUnichar('>') || c == PRUnichar('"') || c == PRUnichar(':') || - c == PRUnichar('/') || c == PRUnichar('*') || c == PRUnichar('\\')); + c == char16_t('?') || c == char16_t('|') || c == char16_t('<') || + c == char16_t('>') || c == char16_t('"') || c == char16_t(':') || + c == char16_t('/') || c == char16_t('*') || c == char16_t('\\')); } void @@ -745,7 +745,7 @@ BluetoothOppManager::ValidateFileName() for (int i = 0; i < length; ++i) { // Replace reserved char of fat file system with '_' if (IsReservedChar(mFileName.CharAt(i))) { - mFileName.Replace(i, 1, PRUnichar('_')); + mFileName.Replace(i, 1, char16_t('_')); } } } @@ -1075,7 +1075,7 @@ BluetoothOppManager::SendPutHeaderRequest(const nsAString& aFileName, int len = aFileName.Length(); uint8_t* fileName = new uint8_t[(len + 1) * 2]; - const PRUnichar* fileNamePtr = aFileName.BeginReading(); + const char16_t* fileNamePtr = aFileName.BeginReading(); for (int i = 0; i < len; i++) { fileName[i * 2] = (uint8_t)(fileNamePtr[i] >> 8); diff --git a/dom/bluetooth/bluez/BluetoothOppManager.h b/dom/bluetooth/bluez/BluetoothOppManager.h index b1c496e210ef..9a384bcb6376 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.h +++ b/dom/bluetooth/bluez/BluetoothOppManager.h @@ -95,7 +95,7 @@ private: void AfterFirstPut(); void AfterOppDisconnected(); void ValidateFileName(); - bool IsReservedChar(PRUnichar c); + bool IsReservedChar(char16_t c); void ClearQueue(); void RetrieveSentFileName(); void NotifyAboutFileChange(); diff --git a/dom/camera/DOMCameraManager.cpp b/dom/camera/DOMCameraManager.cpp index 3734e73e7f70..fbdb8714726c 100644 --- a/dom/camera/DOMCameraManager.cpp +++ b/dom/camera/DOMCameraManager.cpp @@ -184,7 +184,7 @@ nsDOMCameraManager::XpComShutdown() } nsresult -nsDOMCameraManager::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) +nsDOMCameraManager::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (strcmp(aTopic, "xpcom-shutdown") == 0) { XpComShutdown(); diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 0a6601d98f08..ceddb0716897 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -293,7 +293,7 @@ DeviceStorageTypeChecker::Check(const nsAString& aType, nsIFile* aFile) nsString path; aFile->GetPath(path); - int32_t dotIdx = path.RFindChar(PRUnichar('.')); + int32_t dotIdx = path.RFindChar(char16_t('.')); if (dotIdx == kNotFound) { return false; } @@ -336,7 +336,7 @@ DeviceStorageTypeChecker::GetTypeFromFileName(const nsAString& aFileName, aType.AssignLiteral(DEVICESTORAGE_SDCARD); nsString fileName(aFileName); - int32_t dotIdx = fileName.RFindChar(PRUnichar('.')); + int32_t dotIdx = fileName.RFindChar(char16_t('.')); if (dotIdx == kNotFound) { return; } @@ -440,7 +440,7 @@ FileUpdateDispatcher::GetSingleton() NS_IMETHODIMP FileUpdateDispatcher::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (XRE_GetProcessType() != GeckoProcessType_Default) { @@ -880,11 +880,11 @@ DeviceStorageFile::IsSafePath(const nsAString& aPath) void DeviceStorageFile::NormalizeFilePath() { #if defined(XP_WIN) - PRUnichar* cur = mPath.BeginWriting(); - PRUnichar* end = mPath.EndWriting(); + char16_t* cur = mPath.BeginWriting(); + char16_t* end = mPath.EndWriting(); for (; cur < end; ++cur) { - if (PRUnichar('\\') == *cur) - *cur = PRUnichar('/'); + if (char16_t('\\') == *cur) + *cur = char16_t('/'); } #endif } @@ -900,12 +900,12 @@ DeviceStorageFile::AppendRelativePath(const nsAString& aPath) { nsString temp; temp.Assign(aPath); - PRUnichar* cur = temp.BeginWriting(); - PRUnichar* end = temp.EndWriting(); + char16_t* cur = temp.BeginWriting(); + char16_t* end = temp.EndWriting(); for (; cur < end; ++cur) { - if (PRUnichar('/') == *cur) - *cur = PRUnichar('\\'); + if (char16_t('/') == *cur) + *cur = char16_t('\\'); } mFile->AppendRelativePath(temp); #else @@ -3348,7 +3348,7 @@ nsDOMDeviceStorage::DispatchMountChangeEvent(nsAString& aVolumeStatus) NS_IMETHODIMP nsDOMDeviceStorage::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/encoding/TextDecoder.cpp b/dom/encoding/TextDecoder.cpp index f555a983ca51..4e3a5db63d17 100644 --- a/dom/encoding/TextDecoder.cpp +++ b/dom/encoding/TextDecoder.cpp @@ -9,7 +9,7 @@ namespace mozilla { namespace dom { -static const PRUnichar kReplacementChar = static_cast(0xFFFD); +static const char16_t kReplacementChar = static_cast(0xFFFD); void TextDecoder::Init(const nsAString& aLabel, const bool aFatal, @@ -63,7 +63,7 @@ TextDecoder::Decode(const char* aInput, const int32_t aLength, // Need a fallible allocator because the caller may be a content // and the content can specify the length of the string. static const fallible_t fallible = fallible_t(); - nsAutoArrayPtr buf(new (fallible) PRUnichar[outLen + 1]); + nsAutoArrayPtr buf(new (fallible) char16_t[outLen + 1]); if (!buf) { aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return; diff --git a/dom/encoding/TextEncoder.cpp b/dom/encoding/TextEncoder.cpp index cbd266e99480..e882e2714cab 100644 --- a/dom/encoding/TextEncoder.cpp +++ b/dom/encoding/TextEncoder.cpp @@ -44,7 +44,7 @@ TextEncoder::Encode(JSContext* aCx, // Run the steps of the encoding algorithm. int32_t srcLen = aString.Length(); int32_t maxLen; - const PRUnichar* data = PromiseFlatString(aString).get(); + const char16_t* data = PromiseFlatString(aString).get(); nsresult rv = mEncoder->GetMaxLength(data, srcLen, &maxLen); if (NS_FAILED(rv)) { aRv.Throw(rv); diff --git a/dom/file/FileService.cpp b/dom/file/FileService.cpp index 572a68b577f2..d8a04f533480 100644 --- a/dom/file/FileService.cpp +++ b/dom/file/FileService.cpp @@ -306,7 +306,7 @@ NS_IMPL_ISUPPORTS1(FileService, nsIObserver) NS_IMETHODIMP FileService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!strcmp(aTopic, "profile-before-change"), "Wrong topic!"); diff --git a/dom/fmradio/FMRadioService.cpp b/dom/fmradio/FMRadioService.cpp index 43907d9fe3e2..d602856e1387 100644 --- a/dom/fmradio/FMRadioService.cpp +++ b/dom/fmradio/FMRadioService.cpp @@ -652,7 +652,7 @@ FMRadioService::CancelSeek(FMRadioReplyRunnable* aReplyRunnable) NS_IMETHODIMP FMRadioService::Observe(nsISupports * aSubject, const char * aTopic, - const PRUnichar * aData) + const char16_t * aData) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(sFMRadioService); diff --git a/dom/gamepad/GamepadService.cpp b/dom/gamepad/GamepadService.cpp index 879b6b3cedfe..991f4ee5c332 100644 --- a/dom/gamepad/GamepadService.cpp +++ b/dom/gamepad/GamepadService.cpp @@ -65,7 +65,7 @@ GamepadService::GamepadService() NS_IMETHODIMP GamepadService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { nsCOMPtr observerService = mozilla::services::GetObserverService(); diff --git a/dom/indexedDB/CheckPermissionsHelper.cpp b/dom/indexedDB/CheckPermissionsHelper.cpp index 06d4aa32e42f..9f3aa3522ded 100644 --- a/dom/indexedDB/CheckPermissionsHelper.cpp +++ b/dom/indexedDB/CheckPermissionsHelper.cpp @@ -185,7 +185,7 @@ CheckPermissionsHelper::GetInterface(const nsIID& aIID, NS_IMETHODIMP CheckPermissionsHelper::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!strcmp(aTopic, TOPIC_PERMISSIONS_RESPONSE), "Bad topic!"); diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 4e894dae3da1..09301fc80d60 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -376,7 +376,7 @@ IDBFactory::SetDefaultPragmas(mozIStorageConnection* aConnection) inline bool -IgnoreWhitespace(PRUnichar c) +IgnoreWhitespace(char16_t c) { return false; } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 53f7c61008a6..6fd2745d1329 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -87,7 +87,7 @@ namespace { inline bool -IgnoreNothing(PRUnichar c) +IgnoreNothing(char16_t c) { return false; } diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 142ac55c031d..a618c11c37c8 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -675,7 +675,7 @@ IndexedDatabaseManager::InitWindowless(const jsval& aGlobal, JSContext* aCx) NS_IMETHODIMP IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(IsMainProcess(), "Wrong process!"); NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp index 537daa8a7f9a..45282f2ab337 100644 --- a/dom/indexedDB/Key.cpp +++ b/dom/indexedDB/Key.cpp @@ -268,9 +268,9 @@ Key::EncodeString(const nsAString& aString, uint8_t aTypeOffset) // chars below. uint32_t size = aString.Length() + 2; - const PRUnichar* start = aString.BeginReading(); - const PRUnichar* end = aString.EndReading(); - for (const PRUnichar* iter = start; iter < end; ++iter) { + const char16_t* start = aString.BeginReading(); + const char16_t* end = aString.EndReading(); + for (const char16_t* iter = start; iter < end; ++iter) { if (*iter > ONE_BYTE_LIMIT) { size += *iter > TWO_BYTE_LIMIT ? 2 : 1; } @@ -288,12 +288,12 @@ Key::EncodeString(const nsAString& aString, uint8_t aTypeOffset) *(buffer++) = eString + aTypeOffset; // Encode string - for (const PRUnichar* iter = start; iter < end; ++iter) { + for (const char16_t* iter = start; iter < end; ++iter) { if (*iter <= ONE_BYTE_LIMIT) { *(buffer++) = *iter + ONE_BYTE_ADJUST; } else if (*iter <= TWO_BYTE_LIMIT) { - PRUnichar c = PRUnichar(*iter) + TWO_BYTE_ADJUST + 0x8000; + char16_t c = char16_t(*iter) + TWO_BYTE_ADJUST + 0x8000; *(buffer++) = (char)(c >> 8); *(buffer++) = (char)(c & 0xFF); } @@ -336,7 +336,7 @@ Key::DecodeString(const unsigned char*& aPos, const unsigned char* aEnd, aEnd = iter; } - PRUnichar* out; + char16_t* out; if (size && !aString.GetMutableData(&out, size)) { return; } @@ -346,7 +346,7 @@ Key::DecodeString(const unsigned char*& aPos, const unsigned char* aEnd, *out = *(iter++) - ONE_BYTE_ADJUST; } else if (!(*iter & 0x40)) { - PRUnichar c = (PRUnichar(*(iter++)) << 8); + char16_t c = (char16_t(*(iter++)) << 8); if (iter < aEnd) { c |= *(iter++); } @@ -360,7 +360,7 @@ Key::DecodeString(const unsigned char*& aPos, const unsigned char* aEnd, if (iter < aEnd) { c |= *(iter++) >> THREE_BYTE_SHIFT; } - *out = (PRUnichar)c; + *out = (char16_t)c; } ++out; diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index 03369b9b890e..e0cf8bd3a992 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -20,7 +20,7 @@ namespace { inline bool -IgnoreWhitespace(PRUnichar c) +IgnoreWhitespace(char16_t c) { return false; } diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 5661dbdf0068..2fa566d99485 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -287,7 +287,7 @@ void SystemMessageHandledObserver::Init() NS_IMETHODIMP SystemMessageHandledObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (ContentChild::GetSingleton()) { ContentChild::GetSingleton()->SendSystemMessageHandled(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index c34dccb4d689..855bfbf8781c 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1597,7 +1597,7 @@ ContentParent::RecvSetClipboardText(const nsString& text, do_QueryInterface(dataWrapper); rv = trans->SetTransferData(kUnicodeMime, nsisupportsDataWrapper, - text.Length() * sizeof(PRUnichar)); + text.Length() * sizeof(char16_t)); NS_ENSURE_SUCCESS(rv, true); clipboard->SetData(trans, nullptr, whichClipboard); @@ -1835,7 +1835,7 @@ NS_IMPL_ISUPPORTS3(ContentParent, NS_IMETHODIMP ContentParent::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown") && mSubprocess) { ShutDownProcess(/* closeWithError */ false); @@ -3223,7 +3223,7 @@ ContentParent::RecvRemoveIdleObserver(const uint64_t& aObserver, const uint32_t& NS_IMPL_ISUPPORTS1(ParentIdleListener, nsIObserver) NS_IMETHODIMP -ParentIdleListener::Observe(nsISupports*, const char* aTopic, const PRUnichar* aData) { +ParentIdleListener::Observe(nsISupports*, const char* aTopic, const char16_t* aData) { mozilla::unused << mParent->SendNotifyIdleObserver(mObserver, nsDependentCString(aTopic), nsDependentString(aData)); diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index cfdb2cda9e23..9dc33666a883 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -139,7 +139,7 @@ PreallocatedProcessManagerImpl::Init() NS_IMETHODIMP PreallocatedProcessManagerImpl::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp("ipc:content-shutdown", aTopic)) { ObserveProcessShutdown(aSubject); diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index 35c6489e7ccd..ae2fb8d87802 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -430,7 +430,7 @@ NS_IMETHODIMP ProcessPriorityManagerImpl::Observe( nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { nsDependentCString topic(aTopic); if (topic.EqualsLiteral("ipc:content-created")) { @@ -661,7 +661,7 @@ ParticularProcessPriorityManager::Notify(const WakeLockInformation& aInfo) NS_IMETHODIMP ParticularProcessPriorityManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!mContentParent) { // We've been shut down. @@ -1156,7 +1156,7 @@ NS_IMETHODIMP ProcessPriorityManagerChild::Observe( nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(!strcmp(aTopic, "ipc:process-priority-changed")); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 42fb6e3c57a5..ddfe6c2200f3 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -310,7 +310,7 @@ TabChild::HandleEvent(nsIDOMEvent* aEvent) NS_IMETHODIMP TabChild::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, BROWSER_ZOOM_TO_RECT)) { nsCOMPtr docShell(do_QueryInterface(aSubject)); @@ -452,7 +452,7 @@ NS_IMETHODIMP TabChild::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { NS_NOTREACHED("not implemented in TabChild"); return NS_OK; @@ -740,7 +740,7 @@ NS_IMPL_ADDREF(TabChild) NS_IMPL_RELEASE(TabChild) NS_IMETHODIMP -TabChild::SetStatus(uint32_t aStatusType, const PRUnichar* aStatus) +TabChild::SetStatus(uint32_t aStatusType, const char16_t* aStatus) { return SetStatusWithContext(aStatusType, aStatus ? static_cast(nsDependentString(aStatus)) @@ -882,7 +882,7 @@ TabChild::SetVisibility(bool aVisibility) } NS_IMETHODIMP -TabChild::GetTitle(PRUnichar** aTitle) +TabChild::GetTitle(char16_t** aTitle) { NS_NOTREACHED("TabChild::GetTitle not supported in TabChild"); @@ -890,7 +890,7 @@ TabChild::GetTitle(PRUnichar** aTitle) } NS_IMETHODIMP -TabChild::SetTitle(const PRUnichar* aTitle) +TabChild::SetTitle(const char16_t* aTitle) { // JavaScript sends the "DOMTitleChanged" event to the parent // via the message manager. diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 426fa77e89c8..a72f3599e192 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -1574,7 +1574,7 @@ MediaManager::GetPrefs(nsIPrefBranch *aBranch, const char *aData) nsresult MediaManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(NS_IsMainThread(), "Observer invoked off the main thread"); nsCOMPtr obs = services::GetObserverService(); diff --git a/dom/media/MediaPermissionGonk.cpp b/dom/media/MediaPermissionGonk.cpp index a4f18ed0ae6b..be8b18b30bc9 100644 --- a/dom/media/MediaPermissionGonk.cpp +++ b/dom/media/MediaPermissionGonk.cpp @@ -377,7 +377,7 @@ MediaPermissionManager::Deinit() // nsIObserver method NS_IMETHODIMP MediaPermissionManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { nsresult rv; if (!strcmp(aTopic, "getUserMedia:request")) { diff --git a/dom/mobilemessage/src/MobileMessageManager.cpp b/dom/mobilemessage/src/MobileMessageManager.cpp index fc3282158883..f22d231e340b 100644 --- a/dom/mobilemessage/src/MobileMessageManager.cpp +++ b/dom/mobilemessage/src/MobileMessageManager.cpp @@ -514,7 +514,7 @@ MobileMessageManager::DispatchTrustedSmsEventToSelf(const char* aTopic, NS_IMETHODIMP MobileMessageManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, kSmsReceivedObserverTopic)) { return DispatchTrustedSmsEventToSelf(aTopic, RECEIVED_EVENT_NAME, aSubject); diff --git a/dom/mobilemessage/src/gonk/SmsService.cpp b/dom/mobilemessage/src/gonk/SmsService.cpp index 22cc64440bc5..ec4f6aa5f5aa 100644 --- a/dom/mobilemessage/src/gonk/SmsService.cpp +++ b/dom/mobilemessage/src/gonk/SmsService.cpp @@ -58,7 +58,7 @@ SmsService::SmsService() NS_IMETHODIMP SmsService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsDependentString data(aData); diff --git a/dom/mobilemessage/src/ipc/SmsIPCService.cpp b/dom/mobilemessage/src/ipc/SmsIPCService.cpp index 16aad04598c2..5eb2412aacab 100644 --- a/dom/mobilemessage/src/ipc/SmsIPCService.cpp +++ b/dom/mobilemessage/src/ipc/SmsIPCService.cpp @@ -120,7 +120,7 @@ SmsIPCService::SmsIPCService() NS_IMETHODIMP SmsIPCService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsDependentString data(aData); diff --git a/dom/mobilemessage/src/ipc/SmsParent.cpp b/dom/mobilemessage/src/ipc/SmsParent.cpp index 393771e718a0..935f5519967e 100644 --- a/dom/mobilemessage/src/ipc/SmsParent.cpp +++ b/dom/mobilemessage/src/ipc/SmsParent.cpp @@ -179,7 +179,7 @@ SmsParent::ActorDestroy(ActorDestroyReason why) NS_IMETHODIMP SmsParent::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, kSmsReceivedObserverTopic)) { MobileMessageData msgData; diff --git a/dom/plugins/base/nsIPluginInstanceOwner.idl b/dom/plugins/base/nsIPluginInstanceOwner.idl index 7999bf55138c..6d50c26d9d14 100644 --- a/dom/plugins/base/nsIPluginInstanceOwner.idl +++ b/dom/plugins/base/nsIPluginInstanceOwner.idl @@ -75,7 +75,7 @@ interface nsIPluginInstanceOwner : nsISupports void showStatus(in string aStatusMsg); %{C++ - NS_IMETHOD ShowStatus(const PRUnichar *aStatusMsg) = 0; + NS_IMETHOD ShowStatus(const char16_t *aStatusMsg) = 0; %} /** diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 1cfb84f32829..4a0cf2323e75 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -207,7 +207,7 @@ void NS_NotifyPluginCall(PRIntervalTime startTime, NSPluginCallReentry aReentryS float runTimeInSeconds = float(endTime) / PR_TicksPerSecond(); nsAutoString runTimeString; runTimeString.AppendFloat(runTimeInSeconds); - const PRUnichar* runTime = runTimeString.get(); + const char16_t* runTime = runTimeString.get(); notifyUIService->NotifyObservers(nullptr, "experimental-notify-plugin-call", runTime); } diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index e7689330d079..c3879ce951c3 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -3000,7 +3000,7 @@ nsresult nsPluginHost::NewPluginStreamListener(nsIURI* aURI, NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) { OnShutdown(); diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index ef78fcf17a60..4d4b00cf3ccd 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -547,7 +547,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg) return rv; } -NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const PRUnichar *aStatusMsg) +NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char16_t *aStatusMsg) { nsresult rv = NS_ERROR_FAILURE; diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index ccd51b1e048b..359b2fb02f3f 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -61,7 +61,7 @@ public: nsIInputStream *aPostStream, void *aHeadersData, uint32_t aHeadersDataLen) MOZ_OVERRIDE; - NS_IMETHOD ShowStatus(const PRUnichar *aStatusMsg) MOZ_OVERRIDE; + NS_IMETHOD ShowStatus(const char16_t *aStatusMsg) MOZ_OVERRIDE; NPError ShowNativeContextMenu(NPMenu* menu, void* event) MOZ_OVERRIDE; diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp index 80614242805e..9cb5cde9adfc 100644 --- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp +++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp @@ -570,7 +570,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIRequest *request, NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIRequest *request, nsISupports* aContext, nsresult aStatus, - const PRUnichar* aStatusArg) + const char16_t* aStatusArg) { return NS_OK; } diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp index 7c06f88ee153..5b6a9db93894 100644 --- a/dom/plugins/base/nsPluginTags.cpp +++ b/dom/plugins/base/nsPluginTags.cpp @@ -409,10 +409,10 @@ nsPluginTag::SetPluginState(PluginState state) } NS_IMETHODIMP -nsPluginTag::GetMimeTypes(uint32_t* aCount, PRUnichar*** aResults) +nsPluginTag::GetMimeTypes(uint32_t* aCount, char16_t*** aResults) { uint32_t count = mMimeTypes.Length(); - *aResults = static_cast + *aResults = static_cast (nsMemory::Alloc(count * sizeof(**aResults))); if (!*aResults) return NS_ERROR_OUT_OF_MEMORY; @@ -426,10 +426,10 @@ nsPluginTag::GetMimeTypes(uint32_t* aCount, PRUnichar*** aResults) } NS_IMETHODIMP -nsPluginTag::GetMimeDescriptions(uint32_t* aCount, PRUnichar*** aResults) +nsPluginTag::GetMimeDescriptions(uint32_t* aCount, char16_t*** aResults) { uint32_t count = mMimeDescriptions.Length(); - *aResults = static_cast + *aResults = static_cast (nsMemory::Alloc(count * sizeof(**aResults))); if (!*aResults) return NS_ERROR_OUT_OF_MEMORY; @@ -443,10 +443,10 @@ nsPluginTag::GetMimeDescriptions(uint32_t* aCount, PRUnichar*** aResults) } NS_IMETHODIMP -nsPluginTag::GetExtensions(uint32_t* aCount, PRUnichar*** aResults) +nsPluginTag::GetExtensions(uint32_t* aCount, char16_t*** aResults) { uint32_t count = mExtensions.Length(); - *aResults = static_cast + *aResults = static_cast (nsMemory::Alloc(count * sizeof(**aResults))); if (!*aResults) return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/plugins/ipc/PluginHangUIParent.cpp b/dom/plugins/ipc/PluginHangUIParent.cpp index 196b1ef81b07..94991f13fa28 100644 --- a/dom/plugins/ipc/PluginHangUIParent.cpp +++ b/dom/plugins/ipc/PluginHangUIParent.cpp @@ -154,7 +154,7 @@ PluginHangUIParent::Init(const nsString& aPluginName) CommandLine commandLine(exePath.value()); nsXPIDLString localizedStr; - const PRUnichar* formatParams[] = { aPluginName.get() }; + const char16_t* formatParams[] = { aPluginName.get() }; rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, "PluginHangUIMessage", formatParams, diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 36036167cf7a..5b0350812411 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -1480,7 +1480,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd, wchar_t szClass[26]; HWND hwnd = GetForegroundWindow(); if (hwnd && GetClassNameW(hwnd, szClass, - sizeof(szClass)/sizeof(PRUnichar)) && + sizeof(szClass)/sizeof(char16_t)) && !wcscmp(szClass, kFlashFullscreenClass)) { ReleaseCapture(); SetFocus(hwnd); @@ -2063,7 +2063,7 @@ PluginInstanceChild::EnumThreadWindowsCallback(HWND hWnd, } wchar_t className[64]; - if (!GetClassNameW(hWnd, className, sizeof(className)/sizeof(PRUnichar))) + if (!GetClassNameW(hWnd, className, sizeof(className)/sizeof(char16_t))) return TRUE; if (!wcscmp(className, L"SWFlash_PlaceholderX")) { diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index c2651e10aaf9..81a512768008 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -1217,7 +1217,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event) HWND hwnd = GetForegroundWindow(); if (hwnd && hwnd != mPluginHWND && GetClassNameW(hwnd, szClass, - sizeof(szClass)/sizeof(PRUnichar)) && + sizeof(szClass)/sizeof(char16_t)) && !wcscmp(szClass, kFlashFullscreenClass)) { return 0; } diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 63e09a24370d..a461ae01406e 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -2333,7 +2333,7 @@ PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam, LPARAM lParam) // message, otherwise fullscreen focus will not work correctly. wchar_t szClass[26]; if (GetClassNameW(pCwp->hwnd, szClass, - sizeof(szClass)/sizeof(PRUnichar)) && + sizeof(szClass)/sizeof(char16_t)) && !wcscmp(szClass, kFlashFullscreenClass)) { gDelayFlashFocusReplyUntilEval = true; } diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index f5aa4044756f..bb2ca2671830 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1762,7 +1762,7 @@ NS_IMPL_ISUPPORTS2(PluginProfilerObserver, nsIObserver, nsISupportsWeakReference NS_IMETHODIMP PluginProfilerObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { nsCOMPtr pse = do_QueryInterface(aSubject); if (pse) { diff --git a/dom/power/WakeLock.cpp b/dom/power/WakeLock.cpp index e7787ea0a1b7..aa5442ef31c4 100644 --- a/dom/power/WakeLock.cpp +++ b/dom/power/WakeLock.cpp @@ -105,7 +105,7 @@ WakeLock::Init(const nsAString& aTopic, ContentParent* aContentParent) } NS_IMETHODIMP -WakeLock::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* data) +WakeLock::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* data) { // If this wake lock was acquired on behalf of another process, unlock it // when that process dies. diff --git a/dom/quota/CheckQuotaHelper.cpp b/dom/quota/CheckQuotaHelper.cpp index c03c4c210e38..e38b08d91d1b 100644 --- a/dom/quota/CheckQuotaHelper.cpp +++ b/dom/quota/CheckQuotaHelper.cpp @@ -229,7 +229,7 @@ CheckQuotaHelper::GetInterface(const nsIID& aIID, NS_IMETHODIMP CheckQuotaHelper::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index 97f6f17d430d..df3b04afa44f 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -2368,7 +2368,7 @@ QuotaManager::Reset() NS_IMETHODIMP QuotaManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); diff --git a/dom/speakermanager/SpeakerManagerService.cpp b/dom/speakermanager/SpeakerManagerService.cpp index 635f95bec374..f0170010ff64 100644 --- a/dom/speakermanager/SpeakerManagerService.cpp +++ b/dom/speakermanager/SpeakerManagerService.cpp @@ -140,7 +140,7 @@ SpeakerManagerService::SetAudioChannelActive(bool aIsActive) NS_IMETHODIMP SpeakerManagerService::Observe(nsISupports* aSubject, const char* - aTopic, const PRUnichar* aData) + aTopic, const char16_t* aData) { if (!strcmp(aTopic, "ipc:content-shutdown")) { nsCOMPtr props = do_QueryInterface(aSubject); diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index 4b0bf5fe677c..07842b75b184 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -703,7 +703,7 @@ nsGeolocationService::~nsGeolocationService() } void -nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) +nsGeolocationService::HandleMozsettingChanged(const char16_t* aData) { // The string that we're interested in will be a JSON string that looks like: // {"key":"gelocation.enabled","value":true} @@ -759,7 +759,7 @@ nsGeolocationService::HandleMozsettingValue(const bool aValue) NS_IMETHODIMP nsGeolocationService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp("quit-application", aTopic)) { nsCOMPtr obs = services::GetObserverService(); diff --git a/dom/src/geolocation/nsGeolocation.h b/dom/src/geolocation/nsGeolocation.h index 692632353fd7..58b94596c7c3 100644 --- a/dom/src/geolocation/nsGeolocation.h +++ b/dom/src/geolocation/nsGeolocation.h @@ -66,7 +66,7 @@ public: nsresult Init(); - void HandleMozsettingChanged(const PRUnichar* aData); + void HandleMozsettingChanged(const char16_t* aData); void HandleMozsettingValue(const bool aValue); // Management of the Geolocation objects diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 7a817b2b4eb7..8f0b28d86cbf 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -165,7 +165,7 @@ static bool WriteCallback(const jschar *buf, uint32_t len, void *data) { nsJSONWriter *writer = static_cast(data); - nsresult rv = writer->Write((const PRUnichar*)buf, (uint32_t)len); + nsresult rv = writer->Write((const char16_t*)buf, (uint32_t)len); if (NS_FAILED(rv)) return false; @@ -288,14 +288,14 @@ nsJSONWriter::SetCharset(const char* aCharset) } nsresult -nsJSONWriter::Write(const PRUnichar *aBuffer, uint32_t aLength) +nsJSONWriter::Write(const char16_t *aBuffer, uint32_t aLength) { if (mStream) { return WriteToStream(mStream, mEncoder, aBuffer, aLength); } if (!mDidWrite) { - mBuffer = new PRUnichar[JSON_STREAM_BUFSIZE]; + mBuffer = new char16_t[JSON_STREAM_BUFSIZE]; if (!mBuffer) return NS_ERROR_OUT_OF_MEMORY; mDidWrite = true; @@ -310,7 +310,7 @@ nsJSONWriter::Write(const PRUnichar *aBuffer, uint32_t aLength) // we know mBufferCount is 0 because we know we hit the if above mOutputString.Append(aBuffer, aLength); } else { - memcpy(&mBuffer[mBufferCount], aBuffer, aLength * sizeof(PRUnichar)); + memcpy(&mBuffer[mBufferCount], aBuffer, aLength * sizeof(char16_t)); mBufferCount += aLength; } @@ -331,14 +331,14 @@ nsJSONWriter::FlushBuffer() nsresult nsJSONWriter::WriteToStream(nsIOutputStream *aStream, nsIUnicodeEncoder *encoder, - const PRUnichar *aBuffer, + const char16_t *aBuffer, uint32_t aLength) { nsresult rv; int32_t srcLength = aLength; uint32_t bytesWritten; - // The bytes written to the stream might differ from the PRUnichar size + // The bytes written to the stream might differ from the char16_t size int32_t aDestLength; rv = encoder->GetMaxLength(aBuffer, srcLength, &aDestLength); NS_ENSURE_SUCCESS(rv, rv); @@ -365,12 +365,12 @@ nsJSON::Decode(const nsAString& json, JSContext* cx, JS::Value* aRetval) if (NS_FAILED(rv)) return rv; - const PRUnichar *data; + const char16_t *data; uint32_t len = NS_StringGetData(json, &data); nsCOMPtr stream; rv = NS_NewByteInputStream(getter_AddRefs(stream), reinterpret_cast(data), - len * sizeof(PRUnichar), + len * sizeof(char16_t), NS_ASSIGNMENT_DEPEND); NS_ENSURE_SUCCESS(rv, rv); return DecodeInternal(cx, stream, len, false, aRetval); @@ -614,8 +614,8 @@ nsJSONListener::ProcessBytes(const char* aBuffer, uint32_t aByteLength) if (mNeedsConverter) { rv = ConsumeConverted(aBuffer, aByteLength); } else { - uint32_t unichars = aByteLength / sizeof(PRUnichar); - rv = Consume((PRUnichar *) aBuffer, unichars); + uint32_t unichars = aByteLength / sizeof(char16_t); + rv = Consume((char16_t *) aBuffer, unichars); } return rv; @@ -631,7 +631,7 @@ nsJSONListener::ConsumeConverted(const char* aBuffer, uint32_t aByteLength) rv = mDecoder->GetMaxLength(aBuffer, srcLen, &unicharLength); NS_ENSURE_SUCCESS(rv, rv); - PRUnichar* endelems = mBufferedChars.AppendElements(unicharLength); + char16_t* endelems = mBufferedChars.AppendElements(unicharLength); int32_t preLength = unicharLength; rv = mDecoder->Convert(aBuffer, &srcLen, endelems, &unicharLength); if (NS_FAILED(rv)) @@ -643,7 +643,7 @@ nsJSONListener::ConsumeConverted(const char* aBuffer, uint32_t aByteLength) } nsresult -nsJSONListener::Consume(const PRUnichar* aBuffer, uint32_t aByteLength) +nsJSONListener::Consume(const char16_t* aBuffer, uint32_t aByteLength) { if (!mBufferedChars.AppendElements(aBuffer, aByteLength)) return NS_ERROR_FAILURE; diff --git a/dom/src/json/nsJSON.h b/dom/src/json/nsJSON.h index c43980169785..7b85423fd96a 100644 --- a/dom/src/json/nsJSON.h +++ b/dom/src/json/nsJSON.h @@ -26,17 +26,17 @@ public: virtual ~nsJSONWriter(); nsresult SetCharset(const char *aCharset); nsCOMPtr mStream; - nsresult Write(const PRUnichar *aBuffer, uint32_t aLength); + nsresult Write(const char16_t *aBuffer, uint32_t aLength); nsString mOutputString; bool DidWrite(); void FlushBuffer(); protected: - PRUnichar *mBuffer; + char16_t *mBuffer; uint32_t mBufferCount; bool mDidWrite; nsresult WriteToStream(nsIOutputStream *aStream, nsIUnicodeEncoder *encoder, - const PRUnichar *aBuffer, uint32_t aLength); + const char16_t *aBuffer, uint32_t aLength); nsCOMPtr mEncoder; }; @@ -82,10 +82,10 @@ protected: JS::Value *mRootVal; nsCOMPtr mDecoder; nsCString mSniffBuffer; - nsTArray mBufferedChars; + nsTArray mBufferedChars; nsresult ProcessBytes(const char* aBuffer, uint32_t aByteLength); nsresult ConsumeConverted(const char* aBuffer, uint32_t aByteLength); - nsresult Consume(const PRUnichar *data, uint32_t len); + nsresult Consume(const char16_t *data, uint32_t len); }; #endif diff --git a/dom/src/notification/DesktopNotification.h b/dom/src/notification/DesktopNotification.h index e35f7f4fddca..671cee3e23c1 100644 --- a/dom/src/notification/DesktopNotification.h +++ b/dom/src/notification/DesktopNotification.h @@ -159,7 +159,7 @@ class AlertServiceObserver: public nsIObserver NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // forward to parent diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 51835ffece53..2b703adccad5 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -388,7 +388,7 @@ NS_IMPL_ISUPPORTS1(NotificationObserver, nsIObserver) NS_IMETHODIMP NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp("alertclickcallback", aTopic)) { mNotification->DispatchTrustedEvent(NS_LITERAL_STRING("click")); diff --git a/dom/src/offline/nsDOMOfflineResourceList.cpp b/dom/src/offline/nsDOMOfflineResourceList.cpp index 72c1021462b7..4fea2b7248dc 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.cpp +++ b/dom/src/offline/nsDOMOfflineResourceList.cpp @@ -566,7 +566,7 @@ nsDOMOfflineResourceList::SendEvent(const nsAString &aEventName) NS_IMETHODIMP nsDOMOfflineResourceList::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, "offline-cache-update-added")) { nsCOMPtr update = do_QueryInterface(aSubject); diff --git a/dom/src/storage/DOMStorageObserver.cpp b/dom/src/storage/DOMStorageObserver.cpp index b07590e871a9..0bba85551c5c 100644 --- a/dom/src/storage/DOMStorageObserver.cpp +++ b/dom/src/storage/DOMStorageObserver.cpp @@ -121,7 +121,7 @@ DOMStorageObserver::Notify(const char* aTopic, const nsACString& aData) NS_IMETHODIMP DOMStorageObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { nsresult rv; diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index 472f0ae26e60..12e3c4283989 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -182,7 +182,7 @@ class DelayedPathSetter MOZ_FINAL: public nsIObserver NS_IMPL_ISUPPORTS1(DelayedPathSetter, nsIObserver) NS_IMETHODIMP -DelayedPathSetter::Observe(nsISupports*, const char * aTopic, const PRUnichar*) +DelayedPathSetter::Observe(nsISupports*, const char * aTopic, const char16_t*) { if (gPaths == nullptr) { // Initialization of gPaths has not taken place, something is wrong, diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index d815db5b62c4..0bfeb4501c26 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -281,7 +281,7 @@ AudioManager::HandleBluetoothStatusChanged(nsISupports* aSubject, nsresult AudioManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if ((strcmp(aTopic, BLUETOOTH_SCO_STATUS_CHANGED_ID) == 0) || (strcmp(aTopic, BLUETOOTH_HFP_STATUS_CHANGED_ID) == 0) || diff --git a/dom/system/gonk/AutoMounterSetting.cpp b/dom/system/gonk/AutoMounterSetting.cpp index dabf39b84f91..6ea07d12f251 100644 --- a/dom/system/gonk/AutoMounterSetting.cpp +++ b/dom/system/gonk/AutoMounterSetting.cpp @@ -217,7 +217,7 @@ AutoMounterSetting::SetStatus(int32_t aStatus) NS_IMETHODIMP AutoMounterSetting::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, MOZSETTINGS_CHANGED) != 0) { return NS_OK; diff --git a/dom/system/gonk/SystemWorkerManager.cpp b/dom/system/gonk/SystemWorkerManager.cpp index 3f22a09b34f0..ebc8225b6740 100644 --- a/dom/system/gonk/SystemWorkerManager.cpp +++ b/dom/system/gonk/SystemWorkerManager.cpp @@ -443,7 +443,7 @@ NS_IMPL_ISUPPORTS3(SystemWorkerManager, NS_IMETHODIMP SystemWorkerManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, WORKERS_SHUTDOWN_TOPIC)) { Shutdown(); diff --git a/dom/system/gonk/TimeZoneSettingObserver.cpp b/dom/system/gonk/TimeZoneSettingObserver.cpp index f8d82793b0e6..6f08e9aaac62 100644 --- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -179,7 +179,7 @@ NS_IMPL_ISUPPORTS1(TimeZoneSettingObserver, nsIObserver) NS_IMETHODIMP TimeZoneSettingObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, MOZSETTINGS_CHANGED) != 0) { return NS_OK; diff --git a/dom/system/gonk/VolumeServiceTest.cpp b/dom/system/gonk/VolumeServiceTest.cpp index 730fde4617db..0166f9097dca 100644 --- a/dom/system/gonk/VolumeServiceTest.cpp +++ b/dom/system/gonk/VolumeServiceTest.cpp @@ -94,7 +94,7 @@ NS_IMPL_ISUPPORTS1(VolumeTestObserver, nsIObserver) NS_IMETHODIMP VolumeTestObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { LOG("TestObserver: topic: %s", aTopic); diff --git a/dom/system/gonk/nsVolumeMountLock.cpp b/dom/system/gonk/nsVolumeMountLock.cpp index 849094ec1862..a50d567ca83d 100644 --- a/dom/system/gonk/nsVolumeMountLock.cpp +++ b/dom/system/gonk/nsVolumeMountLock.cpp @@ -94,7 +94,7 @@ NS_IMETHODIMP nsVolumeMountLock::Unlock() return NS_OK; } -NS_IMETHODIMP nsVolumeMountLock::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) +NS_IMETHODIMP nsVolumeMountLock::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (strcmp(aTopic, NS_VOLUME_STATE_CHANGED) != 0) { return NS_OK; diff --git a/dom/telephony/ipc/TelephonyIPCProvider.cpp b/dom/telephony/ipc/TelephonyIPCProvider.cpp index 4db64a98a0a5..9c0bad705fef 100644 --- a/dom/telephony/ipc/TelephonyIPCProvider.cpp +++ b/dom/telephony/ipc/TelephonyIPCProvider.cpp @@ -64,7 +64,7 @@ TelephonyIPCProvider::~TelephonyIPCProvider() NS_IMETHODIMP TelephonyIPCProvider::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsDependentString data(aData); diff --git a/dom/wifi/WifiUtils.cpp b/dom/wifi/WifiUtils.cpp index 283aecb1a8ad..1fdb95241fba 100644 --- a/dom/wifi/WifiUtils.cpp +++ b/dom/wifi/WifiUtils.cpp @@ -44,7 +44,7 @@ void LossyConvertUTF8toUTF16(const char* aInput, uint32_t aLength, nsAString& aO { JS::UTF8Chars src(aInput, aLength); - PRUnichar dst[aLength]; // Allocating for worst case. + char16_t dst[aLength]; // Allocating for worst case. // First, count how many jschars need to be in the inflated string. // |i| is the index into |src|, and |j| is the the index into |dst|. @@ -54,7 +54,7 @@ void LossyConvertUTF8toUTF16(const char* aInput, uint32_t aLength, nsAString& aO uint32_t v = uint32_t(src[i]); if (!(v & 0x80)) { // ASCII code unit. Simple copy. - dst[j] = PRUnichar(v); + dst[j] = char16_t(v); } else { // Non-ASCII code unit. Determine its length in bytes (n). uint32_t n = 1; diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index dde3efd2a63f..fd5eebc479b4 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2294,7 +2294,7 @@ NS_IMPL_ISUPPORTS1(RuntimeService, nsIObserver) // nsIObserver NS_IMETHODIMP RuntimeService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { AssertIsOnMainThread(); diff --git a/editor/composer/src/nsEditingSession.cpp b/editor/composer/src/nsEditingSession.cpp index 0a86aefdcdb8..c5811c3e58d7 100644 --- a/editor/composer/src/nsEditingSession.cpp +++ b/editor/composer/src/nsEditingSession.cpp @@ -827,7 +827,7 @@ NS_IMETHODIMP nsEditingSession::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp index 21f1d827d91d..bfdc354b1488 100644 --- a/editor/composer/src/nsEditorSpellCheck.cpp +++ b/editor/composer/src/nsEditorSpellCheck.cpp @@ -408,7 +408,7 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, bool aEnableSelectionCh } NS_IMETHODIMP -nsEditorSpellCheck::GetNextMisspelledWord(PRUnichar **aNextMisspelledWord) +nsEditorSpellCheck::GetNextMisspelledWord(char16_t **aNextMisspelledWord) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -425,7 +425,7 @@ nsEditorSpellCheck::GetNextMisspelledWord(PRUnichar **aNextMisspelledWord) } NS_IMETHODIMP -nsEditorSpellCheck::GetSuggestedWord(PRUnichar **aSuggestedWord) +nsEditorSpellCheck::GetSuggestedWord(char16_t **aSuggestedWord) { nsAutoString word; if ( mSuggestedWordIndex < int32_t(mSuggestedWordList.Length())) @@ -440,7 +440,7 @@ nsEditorSpellCheck::GetSuggestedWord(PRUnichar **aSuggestedWord) } NS_IMETHODIMP -nsEditorSpellCheck::CheckCurrentWord(const PRUnichar *aSuggestedWord, +nsEditorSpellCheck::CheckCurrentWord(const char16_t *aSuggestedWord, bool *aIsMisspelled) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -451,7 +451,7 @@ nsEditorSpellCheck::CheckCurrentWord(const PRUnichar *aSuggestedWord, } NS_IMETHODIMP -nsEditorSpellCheck::CheckCurrentWordNoSuggest(const PRUnichar *aSuggestedWord, +nsEditorSpellCheck::CheckCurrentWordNoSuggest(const char16_t *aSuggestedWord, bool *aIsMisspelled) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -461,8 +461,8 @@ nsEditorSpellCheck::CheckCurrentWordNoSuggest(const PRUnichar *aSuggestedWord, } NS_IMETHODIMP -nsEditorSpellCheck::ReplaceWord(const PRUnichar *aMisspelledWord, - const PRUnichar *aReplaceWord, +nsEditorSpellCheck::ReplaceWord(const char16_t *aMisspelledWord, + const char16_t *aReplaceWord, bool allOccurrences) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -472,7 +472,7 @@ nsEditorSpellCheck::ReplaceWord(const PRUnichar *aMisspelledWord, } NS_IMETHODIMP -nsEditorSpellCheck::IgnoreWordAllOccurrences(const PRUnichar *aWord) +nsEditorSpellCheck::IgnoreWordAllOccurrences(const char16_t *aWord) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -491,7 +491,7 @@ nsEditorSpellCheck::GetPersonalDictionary() } NS_IMETHODIMP -nsEditorSpellCheck::GetPersonalDictionaryWord(PRUnichar **aDictionaryWord) +nsEditorSpellCheck::GetPersonalDictionaryWord(char16_t **aDictionaryWord) { if ( mDictionaryIndex < int32_t( mDictionaryList.Length())) { @@ -506,7 +506,7 @@ nsEditorSpellCheck::GetPersonalDictionaryWord(PRUnichar **aDictionaryWord) } NS_IMETHODIMP -nsEditorSpellCheck::AddWordToDictionary(const PRUnichar *aWord) +nsEditorSpellCheck::AddWordToDictionary(const char16_t *aWord) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -514,7 +514,7 @@ nsEditorSpellCheck::AddWordToDictionary(const PRUnichar *aWord) } NS_IMETHODIMP -nsEditorSpellCheck::RemoveWordFromDictionary(const PRUnichar *aWord) +nsEditorSpellCheck::RemoveWordFromDictionary(const char16_t *aWord) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -522,7 +522,7 @@ nsEditorSpellCheck::RemoveWordFromDictionary(const PRUnichar *aWord) } NS_IMETHODIMP -nsEditorSpellCheck::GetDictionaryList(PRUnichar ***aDictionaryList, uint32_t *aCount) +nsEditorSpellCheck::GetDictionaryList(char16_t ***aDictionaryList, uint32_t *aCount) { NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED); @@ -537,14 +537,14 @@ nsEditorSpellCheck::GetDictionaryList(PRUnichar ***aDictionaryList, uint32_t *aC NS_ENSURE_SUCCESS(rv, rv); - PRUnichar **tmpPtr = 0; + char16_t **tmpPtr = 0; if (dictList.Length() < 1) { // If there are no dictionaries, return an array containing // one element and a count of one. - tmpPtr = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *)); + tmpPtr = (char16_t **)nsMemory::Alloc(sizeof(char16_t *)); NS_ENSURE_TRUE(tmpPtr, NS_ERROR_OUT_OF_MEMORY); @@ -555,7 +555,7 @@ nsEditorSpellCheck::GetDictionaryList(PRUnichar ***aDictionaryList, uint32_t *aC return NS_OK; } - tmpPtr = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * dictList.Length()); + tmpPtr = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * dictList.Length()); NS_ENSURE_TRUE(tmpPtr, NS_ERROR_OUT_OF_MEMORY); diff --git a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp index 3bdce0f24c18..e9b7978d1274 100644 --- a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp +++ b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp @@ -23,7 +23,7 @@ class nsIEditor; -#define kNullCh (PRUnichar('\0')) +#define kNullCh (char16_t('\0')) NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ChangeCSSInlineStyleTxn, EditTxn, mElement) @@ -41,9 +41,9 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAString &aValueList, const nsAStr valueList.Append(kNullCh); // put an extra null at the end - PRUnichar *value = ToNewUnicode(aValue); - PRUnichar *start = valueList.BeginWriting(); - PRUnichar *end = start; + char16_t *value = ToNewUnicode(aValue); + char16_t *start = valueList.BeginWriting(); + char16_t *end = start; while (kNullCh != *start) { while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space @@ -85,8 +85,8 @@ ChangeCSSInlineStyleTxn::RemoveValueFromListOfValues(nsAString & aValues, const nsAutoString outString; classStr.Append(kNullCh); // put an extra null at the end - PRUnichar *start = classStr.BeginWriting(); - PRUnichar *end = start; + char16_t *start = classStr.BeginWriting(); + char16_t *end = start; while (kNullCh != *start) { while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space @@ -102,7 +102,7 @@ ChangeCSSInlineStyleTxn::RemoveValueFromListOfValues(nsAString & aValues, const if (start < end) { if (!aRemoveValue.Equals(start)) { outString.Append(start); - outString.Append(PRUnichar(' ')); + outString.Append(char16_t(' ')); } } @@ -308,7 +308,7 @@ ChangeCSSInlineStyleTxn::AddValueToMultivalueProperty(nsAString & aValues, const } else if (!ValueIncludes(aValues, aNewValue, false)) { // we already have another value but not this one; add it - aValues.Append(PRUnichar(' ')); + aValues.Append(char16_t(' ')); aValues.Append(aNewValue); } return NS_OK; diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index cdf0f940fedd..a692b85d50c7 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -1284,7 +1284,7 @@ NS_IMETHODIMP nsEditor::GetInlineSpellChecker(bool autoCreate, } NS_IMETHODIMP nsEditor::Observe(nsISupports* aSubj, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(!strcmp(aTopic, SPELLCHECK_DICTIONARY_UPDATE_NOTIFICATION), diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index a09562d6535f..b53b6690d02a 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -104,7 +104,7 @@ void ProcessLengthValue(const nsAString * aInputString, nsAString & aOutputStrin aOutputString.Truncate(); if (aInputString) { aOutputString.Append(*aInputString); - if (-1 == aOutputString.FindChar(PRUnichar('%'))) { + if (-1 == aOutputString.FindChar(char16_t('%'))) { aOutputString.AppendLiteral("px"); } } @@ -675,27 +675,27 @@ nsHTMLCSSUtils::ParseLength(const nsAString & aString, float * aValue, nsIAtom * float a = 10.0f , b = 1.0f, value = 0; int8_t sign = 1; int32_t i = 0, j = aString.Length(); - PRUnichar c; + char16_t c; bool floatingPointFound = false; c = *iter; - if (PRUnichar('-') == c) { sign = -1; iter++; i++; } - else if (PRUnichar('+') == c) { iter++; i++; } + if (char16_t('-') == c) { sign = -1; iter++; i++; } + else if (char16_t('+') == c) { iter++; i++; } while (i < j) { c = *iter; - if ((PRUnichar('0') == c) || - (PRUnichar('1') == c) || - (PRUnichar('2') == c) || - (PRUnichar('3') == c) || - (PRUnichar('4') == c) || - (PRUnichar('5') == c) || - (PRUnichar('6') == c) || - (PRUnichar('7') == c) || - (PRUnichar('8') == c) || - (PRUnichar('9') == c)) { - value = (value * a) + (b * (c - PRUnichar('0'))); + if ((char16_t('0') == c) || + (char16_t('1') == c) || + (char16_t('2') == c) || + (char16_t('3') == c) || + (char16_t('4') == c) || + (char16_t('5') == c) || + (char16_t('6') == c) || + (char16_t('7') == c) || + (char16_t('8') == c) || + (char16_t('9') == c)) { + value = (value * a) + (b * (c - char16_t('0'))); b = b / 10 * a; } - else if (!floatingPointFound && (PRUnichar('.') == c)) { + else if (!floatingPointFound && (char16_t('.') == c)) { floatingPointFound = true; a = 1.0f; b = 0.1f; } @@ -1039,7 +1039,7 @@ nsHTMLCSSUtils::GetCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode, NS_ENSURE_SUCCESS(res, res); // append the value to aValueString (possibly with a leading whitespace) if (index) { - aValueString.Append(PRUnichar(' ')); + aValueString.Append(char16_t(' ')); } aValueString.Append(valueString); } @@ -1166,7 +1166,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode *aNode, tmpStr.AppendInt(NS_GET_B(rgba), 10); htmlColor.Append(tmpStr); - htmlColor.Append(PRUnichar(')')); + htmlColor.Append(char16_t(')')); } aIsSet = htmlColor.Equals(valueString, @@ -1181,8 +1181,8 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode *aNode, } else if (nsEditProperty::font == aHTMLProperty && aHTMLAttribute && aHTMLAttribute->EqualsLiteral("face")) { if (!htmlValueString.IsEmpty()) { - const PRUnichar commaSpace[] = { PRUnichar(','), PRUnichar(' '), 0 }; - const PRUnichar comma[] = { PRUnichar(','), 0 }; + const char16_t commaSpace[] = { char16_t(','), char16_t(' '), 0 }; + const char16_t comma[] = { char16_t(','), 0 }; htmlValueString.ReplaceSubstring(commaSpace, comma); nsAutoString valueStringNorm(valueString); valueStringNorm.ReplaceSubstring(commaSpace, comma); diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index ff79b2986d46..861796e53aaf 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -932,7 +932,7 @@ RemoveFragComments(nsCString & aStr) } nsresult -nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext) +nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext) { // First obtain offsets from cfhtml str. int32_t startHTML, endHTML, startFragment, endFragment; @@ -1675,7 +1675,7 @@ nsHTMLEditor::InsertTextWithQuotations(const nsAString &aStringToInsert) // Whenever the quotedness changes (or we reach the string's end) // we will insert the hunk all at once, quoted or non. - static const PRUnichar cite('>'); + static const char16_t cite('>'); bool curHunkIsQuoted = (aStringToInsert.First() == cite); nsAString::const_iterator hunkStart, strEnd; @@ -2121,7 +2121,7 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString, if (!aInfoStr.IsEmpty()) { int32_t sep, num; - sep = aInfoStr.FindChar((PRUnichar)','); + sep = aInfoStr.FindChar((char16_t)','); numstr1 = Substring(aInfoStr, 0, sep); numstr2 = Substring(aInfoStr, sep+1, aInfoStr.Length() - (sep+1)); diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 04e94ea53f74..2013780f5dd9 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -1405,7 +1405,7 @@ nsHTMLEditRules::WillInsertText(EditAction aAction, NS_ENSURE_STATE(mHTMLEditor); nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor); nsAutoString tString(*inString); - const PRUnichar *unicodeBuf = tString.get(); + const char16_t *unicodeBuf = tString.get(); nsCOMPtr unused; int32_t pos = 0; NS_NAMED_LITERAL_STRING(newlineStr, LFSTR); diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index b0ae8515fcfa..00c222d9c1f9 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -853,7 +853,7 @@ nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode) return p.forget(); } -static const PRUnichar nbsp = 160; +static const char16_t nbsp = 160; /////////////////////////////////////////////////////////////////////////////// // IsNextCharInNodeWhitespace: checks the adjacent content in the same node to @@ -877,7 +877,7 @@ nsHTMLEditor::IsNextCharInNodeWhitespace(nsIContent* aContent, if (aContent->IsNodeOfType(nsINode::eTEXT) && (uint32_t)aOffset < aContent->Length()) { - PRUnichar ch = aContent->GetText()->CharAt(aOffset); + char16_t ch = aContent->GetText()->CharAt(aOffset); *outIsSpace = nsCRT::IsAsciiSpace(ch); *outIsNBSP = (ch == nbsp); if (outNode && outOffset) { @@ -910,7 +910,7 @@ nsHTMLEditor::IsPrevCharInNodeWhitespace(nsIContent* aContent, } if (aContent->IsNodeOfType(nsINode::eTEXT) && aOffset > 0) { - PRUnichar ch = aContent->GetText()->CharAt(aOffset - 1); + char16_t ch = aContent->GetText()->CharAt(aOffset - 1); *outIsSpace = nsCRT::IsAsciiSpace(ch); *outIsNBSP = (ch == nbsp); if (outNode && outOffset) { @@ -1291,15 +1291,15 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) NS_ENSURE_TRUE(bodyElement, NS_ERROR_NULL_POINTER); // Find where the tag starts. - nsReadingIterator beginbody; - nsReadingIterator endbody; + nsReadingIterator beginbody; + nsReadingIterator endbody; aSourceString.BeginReading(beginbody); aSourceString.EndReading(endbody); bool foundbody = CaseInsensitiveFindInReadable(NS_LITERAL_STRING(" beginhead; - nsReadingIterator endhead; + nsReadingIterator beginhead; + nsReadingIterator endhead; aSourceString.BeginReading(beginhead); aSourceString.EndReading(endhead); bool foundhead = CaseInsensitiveFindInReadable(NS_LITERAL_STRING(" beginbody.get()) foundhead = false; - nsReadingIterator beginclosehead; - nsReadingIterator endclosehead; + nsReadingIterator beginclosehead; + nsReadingIterator endclosehead; aSourceString.BeginReading(beginclosehead); aSourceString.EndReading(endclosehead); @@ -1326,7 +1326,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) // Time to change the document nsAutoEditBatch beginBatching(this); - nsReadingIterator endtotal; + nsReadingIterator endtotal; aSourceString.EndReading(endtotal); if (foundhead) { @@ -1340,7 +1340,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) // so we assume that there is no body res = ReplaceHeadContentsWithHTML(Substring(beginhead, endtotal)); } else { - nsReadingIterator begintotal; + nsReadingIterator begintotal; aSourceString.BeginReading(begintotal); NS_NAMED_LITERAL_STRING(head, ""); if (foundclosehead) @@ -1388,8 +1388,8 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) // will never return a body node in the DOM fragment // We already know where " beginclosebody = beginbody; - nsReadingIterator endclosebody; + nsReadingIterator beginclosebody = beginbody; + nsReadingIterator endclosebody; aSourceString.EndReading(endclosebody); if (!FindInReadable(NS_LITERAL_STRING(">"),beginclosebody,endclosebody)) return NS_ERROR_FAILURE; @@ -3371,21 +3371,21 @@ nsHTMLEditor::GetHeadContentsAsHTML(nsAString& aOutputString) { // Selection always includes , // so terminate there - nsReadingIterator findIter,endFindIter; + nsReadingIterator findIter,endFindIter; aOutputString.BeginReading(findIter); aOutputString.EndReading(endFindIter); //counting on our parser to always lower case!!! if (CaseInsensitiveFindInReadable(NS_LITERAL_STRING(" beginIter; + nsReadingIterator beginIter; aOutputString.BeginReading(beginIter); int32_t offset = Distance(beginIter, findIter);//get the distance - nsWritingIterator writeIter; + nsWritingIterator writeIter; aOutputString.BeginWriting(writeIter); // Ensure the string ends in a newline - PRUnichar newline ('\n'); + char16_t newline ('\n'); findIter.advance(-1); if (offset ==0 || (offset >0 && (*findIter) != newline)) //check for 0 { diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h index b493e4550aa7..8a77186eea64 100644 --- a/editor/libeditor/html/nsHTMLEditor.h +++ b/editor/libeditor/html/nsHTMLEditor.h @@ -553,7 +553,7 @@ protected: int32_t aDestOffset, bool aDoDeleteSelection); bool HavePrivateHTMLFlavor( nsIClipboard *clipboard ); - nsresult ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext); + nsresult ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext); nsresult DoContentFilterCallback(const nsAString &aFlavor, nsIDOMDocument *aSourceDoc, bool aWillDeleteSelection, diff --git a/editor/libeditor/html/nsHTMLURIRefObject.cpp b/editor/libeditor/html/nsHTMLURIRefObject.cpp index da4ef645647c..11374b8017cc 100644 --- a/editor/libeditor/html/nsHTMLURIRefObject.cpp +++ b/editor/libeditor/html/nsHTMLURIRefObject.cpp @@ -153,7 +153,7 @@ nsHTMLURIRefObject::GetNextURI(nsAString & aURI) NS_ENSURE_SUCCESS(rv, rv); nsString uri (aURI); // href pointing to a named anchor doesn't count - if (aURI.First() != PRUnichar('#')) + if (aURI.First() != char16_t('#')) return NS_OK; aURI.Truncate(); return NS_ERROR_INVALID_ARG; diff --git a/editor/libeditor/html/nsWSRunObject.cpp b/editor/libeditor/html/nsWSRunObject.cpp index 2e5265c0bf41..2c9b162269fe 100644 --- a/editor/libeditor/html/nsWSRunObject.cpp +++ b/editor/libeditor/html/nsWSRunObject.cpp @@ -25,7 +25,7 @@ #include "nsTextFragment.h" #include "nsWSRunObject.h" -const PRUnichar nbsp = 160; +const char16_t nbsp = 160; static bool IsBlockNode(nsIDOMNode* node) { @@ -647,7 +647,7 @@ nsWSRunObject::GetWSNodes() NS_NOTREACHED("looking beyond end of text fragment"); continue; } - PRUnichar theChar = textFrag->CharAt(pos); + char16_t theChar = textFrag->CharAt(pos); if (!nsCRT::IsAsciiSpace(theChar)) { if (theChar != nbsp) @@ -715,7 +715,7 @@ nsWSRunObject::GetWSNodes() NS_NOTREACHED("looking beyond end of text fragment"); continue; } - PRUnichar theChar = textFrag->CharAt(pos); + char16_t theChar = textFrag->CharAt(pos); if (!nsCRT::IsAsciiSpace(theChar)) { if (theChar != nbsp) @@ -780,7 +780,7 @@ nsWSRunObject::GetWSNodes() NS_NOTREACHED("looking beyond end of text fragment"); continue; } - PRUnichar theChar = textFrag->CharAt(pos); + char16_t theChar = textFrag->CharAt(pos); if (!nsCRT::IsAsciiSpace(theChar)) { if (theChar != nbsp) @@ -849,7 +849,7 @@ nsWSRunObject::GetWSNodes() NS_NOTREACHED("looking beyond end of text fragment"); continue; } - PRUnichar theChar = textFrag->CharAt(pos); + char16_t theChar = textFrag->CharAt(pos); if (!nsCRT::IsAsciiSpace(theChar)) { if (theChar != nbsp) @@ -1800,7 +1800,7 @@ nsWSRunObject::FindRun(nsIDOMNode *aNode, int32_t aOffset, WSFragment **outRun, } } -PRUnichar +char16_t nsWSRunObject::GetCharAt(nsIContent *aTextNode, int32_t aOffset) { // return 0 if we can't get a char, for whatever reason @@ -1999,7 +1999,7 @@ nsWSRunObject::CheckTrailingNBSPOfRun(WSFragment *aRun) nsCOMPtr textNode(do_QueryInterface(thePoint.mTextNode)); NS_ENSURE_TRUE(textNode, NS_ERROR_NULL_POINTER); nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor); - nsAutoString spaceStr(PRUnichar(32)); + nsAutoString spaceStr(char16_t(32)); res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr, textNode, thePoint.mOffset, true); NS_ENSURE_SUCCESS(res, res); @@ -2063,7 +2063,7 @@ nsWSRunObject::CheckTrailingNBSP(WSFragment *aRun, nsIDOMNode *aNode, int32_t aO nsCOMPtr textNode(do_QueryInterface(thePoint.mTextNode)); NS_ENSURE_TRUE(textNode, NS_ERROR_NULL_POINTER); nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor); - nsAutoString spaceStr(PRUnichar(32)); + nsAutoString spaceStr(char16_t(32)); nsresult res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr, textNode, thePoint.mOffset, true); @@ -2106,7 +2106,7 @@ nsWSRunObject::CheckLeadingNBSP(WSFragment *aRun, nsIDOMNode *aNode, int32_t aOf nsCOMPtr textNode(do_QueryInterface(thePoint.mTextNode)); NS_ENSURE_TRUE(textNode, NS_ERROR_NULL_POINTER); nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor); - nsAutoString spaceStr(PRUnichar(32)); + nsAutoString spaceStr(char16_t(32)); nsresult res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr, textNode, thePoint.mOffset, true); diff --git a/editor/libeditor/html/nsWSRunObject.h b/editor/libeditor/html/nsWSRunObject.h index 631fbc2834b3..dcb1485b2ac0 100644 --- a/editor/libeditor/html/nsWSRunObject.h +++ b/editor/libeditor/html/nsWSRunObject.h @@ -292,10 +292,10 @@ class MOZ_STACK_CLASS nsWSRunObject { nsCOMPtr mTextNode; uint32_t mOffset; - PRUnichar mChar; + char16_t mChar; WSPoint() : mTextNode(0),mOffset(0),mChar(0) {} - WSPoint(nsIDOMNode *aNode, int32_t aOffset, PRUnichar aChar) : + WSPoint(nsIDOMNode *aNode, int32_t aOffset, char16_t aChar) : mTextNode(do_QueryInterface(aNode)),mOffset(aOffset),mChar(aChar) { if (!mTextNode->IsNodeOfType(nsINode::eDATA_NODE)) { @@ -304,7 +304,7 @@ class MOZ_STACK_CLASS nsWSRunObject mTextNode = nullptr; } } - WSPoint(nsIContent *aTextNode, int32_t aOffset, PRUnichar aChar) : + WSPoint(nsIContent *aTextNode, int32_t aOffset, char16_t aChar) : mTextNode(aTextNode),mOffset(aOffset),mChar(aChar) {} }; @@ -364,7 +364,7 @@ class MOZ_STACK_CLASS nsWSRunObject nsCOMPtr *outStartNode, int32_t *outStartOffset, nsCOMPtr *outEndNode, int32_t *outEndOffset); void FindRun(nsIDOMNode *aNode, int32_t aOffset, WSFragment **outRun, bool after); - PRUnichar GetCharAt(nsIContent *aTextNode, int32_t aOffset); + char16_t GetCharAt(nsIContent *aTextNode, int32_t aOffset); WSPoint GetWSPointAfter(nsIDOMNode *aNode, int32_t aOffset); WSPoint GetWSPointBefore(nsIDOMNode *aNode, int32_t aOffset); nsresult CheckTrailingNBSPOfRun(WSFragment *aRun); diff --git a/editor/libeditor/text/nsInternetCiter.cpp b/editor/libeditor/text/nsInternetCiter.cpp index c51328079ea3..a71c045f7135 100644 --- a/editor/libeditor/text/nsInternetCiter.cpp +++ b/editor/libeditor/text/nsInternetCiter.cpp @@ -17,11 +17,11 @@ #include "nsString.h" #include "nsStringIterator.h" -const PRUnichar gt ('>'); -const PRUnichar space (' '); -const PRUnichar nbsp (0xa0); -const PRUnichar nl ('\n'); -const PRUnichar cr('\r'); +const char16_t gt ('>'); +const char16_t space (' '); +const char16_t nbsp (0xa0); +const char16_t nl ('\n'); +const char16_t cr('\r'); /** Mail citations using the Internet style: > This is a citation */ @@ -30,11 +30,11 @@ nsresult nsInternetCiter::GetCiteString(const nsAString& aInString, nsAString& aOutString) { aOutString.Truncate(); - PRUnichar uch = nl; + char16_t uch = nl; // Strip trailing new lines which will otherwise turn up // as ugly quoted empty lines. - nsReadingIterator beginIter,endIter; + nsReadingIterator beginIter,endIter; aInString.BeginReading(beginIter); aInString.EndReading(endIter); while(beginIter!= endIter && @@ -78,7 +78,7 @@ nsInternetCiter::StripCitesAndLinebreaks(const nsAString& aInString, *aCiteLevel = 0; aOutString.Truncate(); - nsReadingIterator beginIter,endIter; + nsReadingIterator beginIter,endIter; aInString.BeginReading(beginIter); aInString.EndReading(endIter); while (beginIter!= endIter) // loop over lines @@ -98,9 +98,9 @@ nsInternetCiter::StripCitesAndLinebreaks(const nsAString& aInString, ++beginIter; } if (aLinebreaksToo) - aOutString.Append(PRUnichar(' ')); + aOutString.Append(char16_t(' ')); else - aOutString.Append(PRUnichar('\n')); // DOM linebreaks, not NS_LINEBREAK + aOutString.Append(char16_t('\n')); // DOM linebreaks, not NS_LINEBREAK // Skip over any more consecutive linebreak-like characters: while (beginIter != endIter && (*beginIter == '\r' || *beginIter == '\n')) ++beginIter; @@ -140,7 +140,7 @@ BreakLine(nsAString& aOutString, uint32_t& outStringCol, outStringCol = 0; } -static inline bool IsSpace(PRUnichar c) +static inline bool IsSpace(char16_t c) { return (nsCRT::IsAsciiSpace(c) || (c == nl) || (c == cr) || (c == nbsp)); } @@ -154,7 +154,7 @@ nsInternetCiter::Rewrap(const nsAString& aInString, // There shouldn't be returns in this string, only dom newlines. // Check to make sure: #ifdef DEBUG - int32_t cr = aInString.FindChar(PRUnichar('\r')); + int32_t cr = aInString.FindChar(char16_t('\r')); NS_ASSERTION((cr < 0), "Rewrap: CR in string gotten from DOM!\n"); #endif /* DEBUG */ diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 1833f8a1d5d9..a4992bbd8b75 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1379,8 +1379,8 @@ nsPlaintextEditor::InsertAsQuotation(const nsAString& aQuotedText, // It's best to put a blank line after the quoted text so that mails // written without thinking won't be so ugly. - if (!aQuotedText.IsEmpty() && (aQuotedText.Last() != PRUnichar('\n'))) - quotedStuff.Append(PRUnichar('\n')); + if (!aQuotedText.IsEmpty() && (aQuotedText.Last() != char16_t('\n'))) + quotedStuff.Append(char16_t('\n')); // get selection nsRefPtr selection = GetSelection(); diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index 32185b7eb594..740ffb4f754e 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -1306,7 +1306,7 @@ nsTextEditRules::FillBufWithPWChars(nsAString *aOutString, int32_t aLength) MOZ_ASSERT(aOutString); // change the output to the platform password character - PRUnichar passwordChar = LookAndFeel::GetPasswordCharacter(); + char16_t passwordChar = LookAndFeel::GetPasswordCharacter(); int32_t i; aOutString->Truncate(); diff --git a/editor/txtsvc/src/nsTextServicesDocument.cpp b/editor/txtsvc/src/nsTextServicesDocument.cpp index 5ec01d09df0e..4c25a4ca667e 100644 --- a/editor/txtsvc/src/nsTextServicesDocument.cpp +++ b/editor/txtsvc/src/nsTextServicesDocument.cpp @@ -3639,7 +3639,7 @@ nsTextServicesDocument::FindWordBounds(nsTArray *aOffsetTable, // Now we use the word breaker to find the beginning and end // of the word from our calculated string offset. - const PRUnichar *str = aBlockStr->get(); + const char16_t *str = aBlockStr->get(); uint32_t strLen = aBlockStr->Length(); nsIWordBreaker* wordBreaker = nsContentUtils::WordBreaker(); diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index 98cbfc1ee58d..9e927397ab33 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -191,7 +191,7 @@ nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink) //***************************************************************************** NS_IMETHODIMP -nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName, +nsDocShellTreeOwner::FindItemWithName(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** aFoundItem) @@ -245,7 +245,7 @@ nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName, } nsresult -nsDocShellTreeOwner::FindItemWithNameAcrossWindows(const PRUnichar* aName, +nsDocShellTreeOwner::FindItemWithNameAcrossWindows(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** aFoundItem) @@ -662,7 +662,7 @@ nsDocShellTreeOwner::SetFocus() } NS_IMETHODIMP -nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle) +nsDocShellTreeOwner::GetTitle(char16_t** aTitle) { nsCOMPtr ownerWin = GetOwnerWin(); if (ownerWin) @@ -673,7 +673,7 @@ nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle) } NS_IMETHODIMP -nsDocShellTreeOwner::SetTitle(const PRUnichar* aTitle) +nsDocShellTreeOwner::SetTitle(const char16_t* aTitle) { nsCOMPtr ownerWin = GetOwnerWin(); if (ownerWin) @@ -725,7 +725,7 @@ NS_IMETHODIMP nsDocShellTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { return NS_OK; } @@ -1032,7 +1032,7 @@ UseSVGTitle(nsIDOMElement *currElement) /* void getNodeText (in nsIDOMNode aNode, out wstring aText); */ NS_IMETHODIMP -DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, +DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, char16_t **aText, bool *_retval) { NS_ENSURE_ARG_POINTER(aNode); diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.h b/embedding/browser/webBrowser/nsDocShellTreeOwner.h index 27ff7ddb4e2b..0d5ae5d76769 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.h +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.h @@ -92,7 +92,7 @@ protected: NS_IMETHOD AddChromeListeners(); NS_IMETHOD RemoveChromeListeners(); - nsresult FindItemWithNameAcrossWindows(const PRUnichar* aName, + nsresult FindItemWithNameAcrossWindows(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem **aFoundItem); diff --git a/embedding/browser/webBrowser/nsWebBrowser.cpp b/embedding/browser/webBrowser/nsWebBrowser.cpp index 3b3744e82575..c42072d6c317 100644 --- a/embedding/browser/webBrowser/nsWebBrowser.cpp +++ b/embedding/browser/webBrowser/nsWebBrowser.cpp @@ -416,7 +416,7 @@ NS_IMETHODIMP nsWebBrowser::SetName(const nsAString& aName) return NS_OK; } -NS_IMETHODIMP nsWebBrowser::NameEquals(const PRUnichar *aName, bool *_retval) +NS_IMETHODIMP nsWebBrowser::NameEquals(const char16_t *aName, bool *_retval) { NS_ENSURE_ARG_POINTER(aName); NS_ENSURE_ARG_POINTER(_retval); @@ -495,7 +495,7 @@ NS_IMETHODIMP nsWebBrowser::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootT return NS_OK; } -NS_IMETHODIMP nsWebBrowser::FindItemWithName(const PRUnichar *aName, +NS_IMETHODIMP nsWebBrowser::FindItemWithName(const char16_t *aName, nsISupports* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem **_retval) { @@ -560,7 +560,7 @@ NS_IMETHODIMP nsWebBrowser::GetChildAt(int32_t aIndex, } NS_IMETHODIMP nsWebBrowser::FindChildWithName( - const PRUnichar * aName, + const char16_t * aName, bool aRecurse, bool aSameType, nsIDocShellTreeItem * aRequestor, nsIDocShellTreeItem * aOriginalRequestor, @@ -604,7 +604,7 @@ NS_IMETHODIMP nsWebBrowser::GoForward() return mDocShellAsNav->GoForward(); } -NS_IMETHODIMP nsWebBrowser::LoadURI(const PRUnichar* aURI, +NS_IMETHODIMP nsWebBrowser::LoadURI(const char16_t* aURI, uint32_t aLoadFlags, nsIURI* aReferringURI, nsIInputStream* aPostDataStream, @@ -830,7 +830,7 @@ NS_IMETHODIMP nsWebBrowser::OnLocationChange(nsIWebProgress *aWebProgress, nsIRe } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsWebBrowser::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +NS_IMETHODIMP nsWebBrowser::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (mProgressListener) { @@ -1467,7 +1467,7 @@ NS_IMETHODIMP nsWebBrowser::SetFocus() return fm ? fm->SetFocusedWindow(window) : NS_OK; } -NS_IMETHODIMP nsWebBrowser::GetTitle(PRUnichar** aTitle) +NS_IMETHODIMP nsWebBrowser::GetTitle(char16_t** aTitle) { NS_ENSURE_ARG_POINTER(aTitle); NS_ENSURE_STATE(mDocShell); @@ -1477,7 +1477,7 @@ NS_IMETHODIMP nsWebBrowser::GetTitle(PRUnichar** aTitle) return NS_OK; } -NS_IMETHODIMP nsWebBrowser::SetTitle(const PRUnichar* aTitle) +NS_IMETHODIMP nsWebBrowser::SetTitle(const char16_t* aTitle) { NS_ENSURE_STATE(mDocShell); diff --git a/embedding/components/appstartup/src/nsAppStartupNotifier.cpp b/embedding/components/appstartup/src/nsAppStartupNotifier.cpp index 1e63557e8f35..ce64ab4e4cd5 100644 --- a/embedding/components/appstartup/src/nsAppStartupNotifier.cpp +++ b/embedding/components/appstartup/src/nsAppStartupNotifier.cpp @@ -23,7 +23,7 @@ nsAppStartupNotifier::~nsAppStartupNotifier() { } -NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { NS_ENSURE_ARG(aTopic); nsresult rv; diff --git a/embedding/components/commandhandler/src/nsCommandGroup.cpp b/embedding/components/commandhandler/src/nsCommandGroup.cpp index 465e0a674e77..8d5281fcbf9f 100644 --- a/embedding/components/commandhandler/src/nsCommandGroup.cpp +++ b/embedding/components/commandhandler/src/nsCommandGroup.cpp @@ -35,7 +35,7 @@ protected: nsHashtable& mHashTable; int32_t mIndex; - char ** mGroupNames; // array of pointers to PRUnichar* in the hash table + char ** mGroupNames; // array of pointers to char16_t* in the hash table bool mInitted; }; @@ -185,7 +185,7 @@ nsNamedGroupEnumerator::GetNext(nsISupports **_retval) if (mIndex >= int32_t(mGroupArray->Length())) return NS_ERROR_FAILURE; - PRUnichar *thisGroupName = (PRUnichar*)mGroupArray->ElementAt(mIndex); + char16_t *thisGroupName = (char16_t*)mGroupArray->ElementAt(mIndex); NS_ASSERTION(thisGroupName, "Bad Element in mGroupArray"); nsresult rv; @@ -236,7 +236,7 @@ nsControllerCommandGroup::AddCommandToGroup(const char * aCommand, const char *a mGroupsHash.Put(&groupKey, (void *)commandList); } // add the command to the list. Note that we're not checking for duplicates here - char* commandString = NS_strdup(aCommand); // we store allocated PRUnichar* in the array + char* commandString = NS_strdup(aCommand); // we store allocated char16_t* in the array if (!commandString) return NS_ERROR_OUT_OF_MEMORY; #ifdef DEBUG diff --git a/embedding/components/commandhandler/src/nsCommandGroup.h b/embedding/components/commandhandler/src/nsCommandGroup.h index 895b3d645865..8d0f2d3adf44 100644 --- a/embedding/components/commandhandler/src/nsCommandGroup.h +++ b/embedding/components/commandhandler/src/nsCommandGroup.h @@ -43,7 +43,7 @@ protected: protected: nsHashtable mGroupsHash; // hash keyed on command group. - // Entries are nsVoidArrays of pointers to PRUnichar* + // Entries are nsVoidArrays of pointers to char16_t* // This could be made more space-efficient, maybe with atoms }; diff --git a/embedding/components/find/src/nsFind.cpp b/embedding/components/find/src/nsFind.cpp index 02c5d342d1b0..f2f54e6d9751 100644 --- a/embedding/components/find/src/nsFind.cpp +++ b/embedding/components/find/src/nsFind.cpp @@ -32,19 +32,19 @@ using namespace mozilla; // Yikes! Casting a char to unichar can fill with ones! -#define CHAR_TO_UNICHAR(c) ((PRUnichar)(const unsigned char)c) +#define CHAR_TO_UNICHAR(c) ((char16_t)(const unsigned char)c) static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_CID(kCPreContentIteratorCID, NS_PRECONTENTITERATOR_CID); -#define CH_QUOTE ((PRUnichar) 0x22) -#define CH_APOSTROPHE ((PRUnichar) 0x27) -#define CH_LEFT_SINGLE_QUOTE ((PRUnichar) 0x2018) -#define CH_RIGHT_SINGLE_QUOTE ((PRUnichar) 0x2019) -#define CH_LEFT_DOUBLE_QUOTE ((PRUnichar) 0x201C) -#define CH_RIGHT_DOUBLE_QUOTE ((PRUnichar) 0x201D) +#define CH_QUOTE ((char16_t) 0x22) +#define CH_APOSTROPHE ((char16_t) 0x27) +#define CH_LEFT_SINGLE_QUOTE ((char16_t) 0x2018) +#define CH_RIGHT_SINGLE_QUOTE ((char16_t) 0x2019) +#define CH_LEFT_DOUBLE_QUOTE ((char16_t) 0x201C) +#define CH_RIGHT_DOUBLE_QUOTE ((char16_t) 0x201D) -#define CH_SHY ((PRUnichar) 0xAD) +#define CH_SHY ((char16_t) 0xAD) // nsFind::Find casts CH_SHY to char before calling StripChars // This works correctly if and only if CH_SHY <= 255 @@ -866,7 +866,7 @@ void nsFind::ResetAll() // until null (NextNode will return 0 at the end of our range). // NS_IMETHODIMP -nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange, +nsFind::Find(const char16_t *aPatText, nsIDOMRange* aSearchRange, nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint, nsIDOMRange** aRangeRet) { @@ -896,7 +896,7 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange, static const char kShy[] = { char(CH_SHY), 0 }; patAutoStr.StripChars(kShy); - const PRUnichar* patStr = patAutoStr.get(); + const char16_t* patStr = patAutoStr.get(); int32_t patLen = patAutoStr.Length() - 1; // current offset into the pattern -- reset to beginning/end: @@ -913,7 +913,7 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange, int32_t fragLen = 0; // Pointers into the current fragment: - const PRUnichar *t2b = nullptr; + const char16_t *t2b = nullptr; const char *t1b = nullptr; // Keep track of when we're in whitespace: @@ -930,7 +930,7 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange, aEndPoint->GetEndContainer(getter_AddRefs(endNode)); aEndPoint->GetEndOffset(&endOffset); - PRUnichar prevChar = 0; + char16_t prevChar = 0; while (1) { #ifdef DEBUG_FIND @@ -1077,8 +1077,8 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange, } // The two characters we'll be comparing: - PRUnichar c = (t2b ? t2b[findex] : CHAR_TO_UNICHAR(t1b[findex])); - PRUnichar patc = patStr[pindex]; + char16_t c = (t2b ? t2b[findex] : CHAR_TO_UNICHAR(t1b[findex])); + char16_t patc = patStr[pindex]; #ifdef DEBUG_FIND printf("Comparing '%c'=%x to '%c' (%d of %d), findex=%d%s\n", diff --git a/embedding/components/find/src/nsWebBrowserFind.cpp b/embedding/components/find/src/nsWebBrowserFind.cpp index a8fda22baf81..ee8392d1af88 100644 --- a/embedding/components/find/src/nsWebBrowserFind.cpp +++ b/embedding/components/find/src/nsWebBrowserFind.cpp @@ -235,14 +235,14 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(bool *outDidFind) /* attribute wstring searchString; */ -NS_IMETHODIMP nsWebBrowserFind::GetSearchString(PRUnichar * *aSearchString) +NS_IMETHODIMP nsWebBrowserFind::GetSearchString(char16_t * *aSearchString) { NS_ENSURE_ARG_POINTER(aSearchString); *aSearchString = ToNewUnicode(mSearchString); return NS_OK; } -NS_IMETHODIMP nsWebBrowserFind::SetSearchString(const PRUnichar * aSearchString) +NS_IMETHODIMP nsWebBrowserFind::SetSearchString(const char16_t * aSearchString) { mSearchString.Assign(aSearchString); return NS_OK; diff --git a/embedding/components/printingui/src/mac/nsPrintProgress.cpp b/embedding/components/printingui/src/mac/nsPrintProgress.cpp index 4348376204a3..a35b21a51579 100644 --- a/embedding/components/printingui/src/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/mac/nsPrintProgress.cpp @@ -195,7 +195,7 @@ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, ns } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (aMessage && *aMessage) m_pendingStatus = aMessage; @@ -223,7 +223,7 @@ nsresult nsPrintProgress::ReleaseListeners() return NS_OK; } -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) +NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status) { return OnStatusChange(nullptr, nullptr, NS_OK, status); } diff --git a/embedding/components/printingui/src/mac/nsPrintProgressParams.cpp b/embedding/components/printingui/src/mac/nsPrintProgressParams.cpp index 2b31b1344168..939af3455d85 100644 --- a/embedding/components/printingui/src/mac/nsPrintProgressParams.cpp +++ b/embedding/components/printingui/src/mac/nsPrintProgressParams.cpp @@ -18,7 +18,7 @@ nsPrintProgressParams::~nsPrintProgressParams() } /* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle) { NS_ENSURE_ARG(aDocTitle); @@ -26,14 +26,14 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle) { mDocTitle = aDocTitle; return NS_OK; } /* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) +NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL) { NS_ENSURE_ARG(aDocURL); @@ -41,7 +41,7 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) +NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL) { mDocURL = aDocURL; return NS_OK; diff --git a/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm b/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm index f36d5437eca0..966dda080425 100644 --- a/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm +++ b/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm @@ -79,7 +79,7 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p } NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) +nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -111,7 +111,7 @@ nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIReque /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { return NS_OK; } diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/embedding/components/printingui/src/os2/nsPrintProgress.cpp index 643c3f440422..7dd6fa636aef 100644 --- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/os2/nsPrintProgress.cpp @@ -189,7 +189,7 @@ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, ns } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (aMessage && *aMessage) m_pendingStatus = aMessage; @@ -217,7 +217,7 @@ nsresult nsPrintProgress::ReleaseListeners() return NS_OK; } -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) +NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status) { return OnStatusChange(nullptr, nullptr, NS_OK, status); } diff --git a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp b/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp index 2b31b1344168..939af3455d85 100644 --- a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp +++ b/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp @@ -18,7 +18,7 @@ nsPrintProgressParams::~nsPrintProgressParams() } /* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle) { NS_ENSURE_ARG(aDocTitle); @@ -26,14 +26,14 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle) { mDocTitle = aDocTitle; return NS_OK; } /* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) +NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL) { NS_ENSURE_ARG(aDocURL); @@ -41,7 +41,7 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) +NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL) { mDocURL = aDocURL; return NS_OK; diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp index a2ac83789873..9aaf826067e1 100644 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp @@ -150,7 +150,7 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p /* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */ NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) +nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) { nsresult rv = NS_ERROR_FAILURE; nsCOMPtr printService = do_GetService(sPrintOptionsContractID, &rv); @@ -269,7 +269,7 @@ nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIReque /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (mWebProgressListener) { return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); diff --git a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp index 1b626df970aa..3df417c84e18 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp @@ -194,7 +194,7 @@ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, ns } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (aMessage && *aMessage) m_pendingStatus = aMessage; @@ -223,7 +223,7 @@ nsresult nsPrintProgress::ReleaseListeners() return NS_OK; } -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) +NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status) { return OnStatusChange(nullptr, nullptr, NS_OK, status); } diff --git a/embedding/components/printingui/src/unixshared/nsPrintProgressParams.cpp b/embedding/components/printingui/src/unixshared/nsPrintProgressParams.cpp index 2b31b1344168..939af3455d85 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintProgressParams.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintProgressParams.cpp @@ -18,7 +18,7 @@ nsPrintProgressParams::~nsPrintProgressParams() } /* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle) { NS_ENSURE_ARG(aDocTitle); @@ -26,14 +26,14 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle) { mDocTitle = aDocTitle; return NS_OK; } /* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) +NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL) { NS_ENSURE_ARG(aDocURL); @@ -41,7 +41,7 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) +NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL) { mDocURL = aDocURL; return NS_OK; diff --git a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp index 64030863e66a..b36a477416e8 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp @@ -158,7 +158,7 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p /* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */ NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) +nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) { /* fixme: We simply ignore the |aPrinter| argument here * We should get the supported printer attributes from the printer and @@ -288,7 +288,7 @@ nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIReque /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (mWebProgressListener) { return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); diff --git a/embedding/components/printingui/src/win/nsPrintProgress.cpp b/embedding/components/printingui/src/win/nsPrintProgress.cpp index 4785861bd971..073de06bd699 100644 --- a/embedding/components/printingui/src/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/win/nsPrintProgress.cpp @@ -222,7 +222,7 @@ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, ns } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (aMessage && *aMessage) m_pendingStatus = aMessage; @@ -250,7 +250,7 @@ nsresult nsPrintProgress::ReleaseListeners() return NS_OK; } -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) +NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status) { return OnStatusChange(nullptr, nullptr, NS_OK, status); } diff --git a/embedding/components/printingui/src/win/nsPrintProgressParams.cpp b/embedding/components/printingui/src/win/nsPrintProgressParams.cpp index 2b31b1344168..939af3455d85 100644 --- a/embedding/components/printingui/src/win/nsPrintProgressParams.cpp +++ b/embedding/components/printingui/src/win/nsPrintProgressParams.cpp @@ -18,7 +18,7 @@ nsPrintProgressParams::~nsPrintProgressParams() } /* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle) { NS_ENSURE_ARG(aDocTitle); @@ -26,14 +26,14 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) +NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle) { mDocTitle = aDocTitle; return NS_OK; } /* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) +NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL) { NS_ENSURE_ARG(aDocURL); @@ -41,7 +41,7 @@ NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) return NS_OK; } -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) +NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL) { mDocURL = aDocURL; return NS_OK; diff --git a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp index e358ce0ba7e1..fc0a24b01b96 100644 --- a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp @@ -231,7 +231,7 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p /* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */ NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) +nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -334,7 +334,7 @@ nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIReque /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) +nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) { if (mWebProgressListener) { diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 2b428aea556b..7141e94c41c0 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -990,7 +990,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnProgress( in nsresult status, in wstring statusArg); */ NS_IMETHODIMP nsWebBrowserPersist::OnStatus( nsIRequest *request, nsISupports *ctxt, nsresult status, - const PRUnichar *statusArg) + const char16_t *statusArg) { if (mProgressListener) { @@ -1107,7 +1107,7 @@ nsresult nsWebBrowserPersist::SendErrorStatusChange( NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && bundle, NS_ERROR_FAILURE); nsXPIDLString msgText; - const PRUnichar *strings[1]; + const char16_t *strings[1]; strings[0] = path.get(); rv = bundle->FormatStringFromName(msgId.get(), strings, 1, getter_Copies(msgText)); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); @@ -1389,7 +1389,7 @@ nsresult nsWebBrowserPersist::SaveChannelInternal( } nsresult -nsWebBrowserPersist::GetExtensionForContentType(const PRUnichar *aContentType, PRUnichar **aExt) +nsWebBrowserPersist::GetExtensionForContentType(const char16_t *aContentType, char16_t **aExt) { NS_ENSURE_ARG_POINTER(aContentType); NS_ENSURE_ARG_POINTER(aExt); @@ -1419,7 +1419,7 @@ nsWebBrowserPersist::GetExtensionForContentType(const PRUnichar *aContentType, P } nsresult -nsWebBrowserPersist::GetDocumentExtension(nsIDOMDocument *aDocument, PRUnichar **aExt) +nsWebBrowserPersist::GetDocumentExtension(nsIDOMDocument *aDocument, char16_t **aExt) { NS_ENSURE_ARG_POINTER(aDocument); NS_ENSURE_ARG_POINTER(aExt); @@ -1431,7 +1431,7 @@ nsWebBrowserPersist::GetDocumentExtension(nsIDOMDocument *aDocument, PRUnichar * } nsresult -nsWebBrowserPersist::GetDocEncoderContentType(nsIDOMDocument *aDocument, const PRUnichar *aContentType, PRUnichar **aRealContentType) +nsWebBrowserPersist::GetDocEncoderContentType(nsIDOMDocument *aDocument, const char16_t *aContentType, char16_t **aRealContentType) { NS_ENSURE_ARG_POINTER(aDocument); NS_ENSURE_ARG_POINTER(aRealContentType); @@ -2129,7 +2129,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename) if (nsCRT::IsAsciiAlpha(*p) || nsCRT::IsAsciiDigit(*p) || *p == '.' || *p == '-' || *p == '_' || (*p == ' ')) { - fileName.Append(PRUnichar(*p)); + fileName.Append(char16_t(*p)); if (++nameLength == kDefaultMaxFilenameLength) { // Note: @@ -2152,7 +2152,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename) // the problem, all filenames are made at least one character long. if (fileName.IsEmpty()) { - fileName.Append(PRUnichar('a')); // 'a' is for arbitrary + fileName.Append(char16_t('a')); // 'a' is for arbitrary } end: @@ -2818,9 +2818,9 @@ nsresult nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode) nsAutoString linkRel; if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty()) { - nsReadingIterator start; - nsReadingIterator end; - nsReadingIterator current; + nsReadingIterator start; + nsReadingIterator end; + nsReadingIterator current; linkRel.BeginReading(start); linkRel.EndReading(end); @@ -2833,7 +2833,7 @@ nsresult nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode) continue; // Grab the next space delimited word - nsReadingIterator startWord = current; + nsReadingIterator startWord = current; do { ++current; } while (current != end && !nsCRT::IsAsciiSpace(*current)); @@ -3583,7 +3583,7 @@ nsWebBrowserPersist::StoreAndFixupStyleSheet(nsIStyleSheet *aStyleSheet) } bool -nsWebBrowserPersist::DocumentEncoderExists(const PRUnichar *aContentType) +nsWebBrowserPersist::DocumentEncoderExists(const char16_t *aContentType) { // Check if there is an encoder for the desired content type. nsAutoCString contractID(NS_DOC_ENCODER_CONTRACTID_BASE); @@ -3636,12 +3636,12 @@ nsWebBrowserPersist::SaveSubframeContent( { extension.AssignLiteral("htm"); } - aData->mSubFrameExt.Assign(PRUnichar('.')); + aData->mSubFrameExt.Assign(char16_t('.')); AppendUTF8toUTF16(extension, aData->mSubFrameExt); } else { - aData->mSubFrameExt.Assign(PRUnichar('.')); + aData->mSubFrameExt.Assign(char16_t('.')); aData->mSubFrameExt.Append(ext); } diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h index 2f5f439c43e6..e8c1cf772dcb 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h @@ -70,11 +70,11 @@ protected: nsIDOMDocument *aDocument, nsIURI *aFile, nsIURI *aDataPath); nsresult SaveDocuments(); nsresult GetDocEncoderContentType( - nsIDOMDocument *aDocument, const PRUnichar *aContentType, - PRUnichar **aRealContentType); + nsIDOMDocument *aDocument, const char16_t *aContentType, + char16_t **aRealContentType); nsresult GetExtensionForContentType( - const PRUnichar *aContentType, PRUnichar **aExt); - nsresult GetDocumentExtension(nsIDOMDocument *aDocument, PRUnichar **aExt); + const char16_t *aContentType, char16_t **aExt); + nsresult GetDocumentExtension(nsIDOMDocument *aDocument, char16_t **aExt); // Private members private: @@ -119,7 +119,7 @@ private: { return StoreURIAttributeNS(aNode, "", aAttribute, aNeedsPersisting, aData); } - bool DocumentEncoderExists(const PRUnichar *aContentType); + bool DocumentEncoderExists(const char16_t *aContentType); nsresult GetNodeToFixup(nsIDOMNode *aNodeIn, nsIDOMNode **aNodeOut); nsresult FixupURI(nsAString &aURI); diff --git a/embedding/components/windowwatcher/public/nsPromptUtils.h b/embedding/components/windowwatcher/public/nsPromptUtils.h index 42355d5fc1f6..65466c19aaf8 100644 --- a/embedding/components/windowwatcher/public/nsPromptUtils.h +++ b/embedding/components/windowwatcher/public/nsPromptUtils.h @@ -26,7 +26,7 @@ NS_SetAuthInfo(nsIAuthInformation* aAuthInfo, const nsString& user, aAuthInfo->GetFlags(&flags); if (flags & nsIAuthInformation::NEED_DOMAIN) { // Domain is separated from username by a backslash - int32_t idx = user.FindChar(PRUnichar('\\')); + int32_t idx = user.FindChar(char16_t('\\')); if (idx == kNotFound) { aAuthInfo->SetUsername(user); } else { diff --git a/embedding/components/windowwatcher/src/nsDialogParamBlock.cpp b/embedding/components/windowwatcher/src/nsDialogParamBlock.cpp index c1c29beeffcd..df92a8fe71f7 100644 --- a/embedding/components/windowwatcher/src/nsDialogParamBlock.cpp +++ b/embedding/components/windowwatcher/src/nsDialogParamBlock.cpp @@ -50,7 +50,7 @@ NS_IMETHODIMP nsDialogParamBlock::SetInt(int32_t inIndex, int32_t inInt) } -NS_IMETHODIMP nsDialogParamBlock::GetString(int32_t inIndex, PRUnichar **_retval) +NS_IMETHODIMP nsDialogParamBlock::GetString(int32_t inIndex, char16_t **_retval) { if (mNumStrings == 0) SetNumberStrings(kNumStrings); @@ -60,7 +60,7 @@ NS_IMETHODIMP nsDialogParamBlock::GetString(int32_t inIndex, PRUnichar **_retval return rv; } -NS_IMETHODIMP nsDialogParamBlock::SetString(int32_t inIndex, const PRUnichar *inString) +NS_IMETHODIMP nsDialogParamBlock::SetString(int32_t inIndex, const char16_t *inString) { if (mNumStrings == 0) SetNumberStrings(kNumStrings); diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 4b206a2dc2b8..692a26f26939 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1271,7 +1271,7 @@ nsWindowWatcher::GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome * } NS_IMETHODIMP -nsWindowWatcher::GetWindowByName(const PRUnichar *aTargetName, +nsWindowWatcher::GetWindowByName(const char16_t *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **aResult) { @@ -1622,7 +1622,7 @@ nsWindowWatcher::WinHasOption(const char *aOptions, const char *aName, necessarily return a failure method value. check aFoundItem. */ NS_IMETHODIMP -nsWindowWatcher::FindItemWithName(const PRUnichar* aName, +nsWindowWatcher::FindItemWithName(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** aFoundItem) diff --git a/embedding/tests/winEmbed/WebBrowserChrome.cpp b/embedding/tests/winEmbed/WebBrowserChrome.cpp index 32a38655406c..26bec83964b3 100644 --- a/embedding/tests/winEmbed/WebBrowserChrome.cpp +++ b/embedding/tests/winEmbed/WebBrowserChrome.cpp @@ -150,7 +150,7 @@ NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstance // WebBrowserChrome::nsIWebBrowserChrome //***************************************************************************** -NS_IMETHODIMP WebBrowserChrome::SetStatus(uint32_t aType, const PRUnichar* aStatus) +NS_IMETHODIMP WebBrowserChrome::SetStatus(uint32_t aType, const char16_t* aStatus) { WebBrowserChromeUI::UpdateStatusBarText(this, aStatus); return NS_OK; @@ -298,7 +298,7 @@ NS_IMETHODIMP WebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { WebBrowserChromeUI::UpdateStatusBarText(this, aMessage); return NS_OK; @@ -500,7 +500,7 @@ NS_IMETHODIMP WebBrowserChrome::Blur() } /* attribute wstring title; */ -NS_IMETHODIMP WebBrowserChrome::GetTitle(PRUnichar * *aTitle) +NS_IMETHODIMP WebBrowserChrome::GetTitle(char16_t * *aTitle) { NS_ENSURE_ARG_POINTER(aTitle); @@ -508,7 +508,7 @@ NS_IMETHODIMP WebBrowserChrome::GetTitle(PRUnichar * *aTitle) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP WebBrowserChrome::SetTitle(const PRUnichar * aTitle) +NS_IMETHODIMP WebBrowserChrome::SetTitle(const char16_t * aTitle) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -539,7 +539,7 @@ NS_IMETHODIMP WebBrowserChrome::GetSiteWindow(void * *aSiteWindow) // WebBrowserChrome::nsIObserver //***************************************************************************** -NS_IMETHODIMP WebBrowserChrome::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP WebBrowserChrome::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { nsresult rv = NS_OK; if (strcmp(aTopic, "profile-change-teardown") == 0) @@ -566,7 +566,7 @@ NS_IMETHODIMP WebBrowserChrome::OnShowContextMenu(uint32_t aContextFlags, nsIDOM //***************************************************************************** /* void OnShowTooltip (in long aXCoords, in long aYCoords, in wstring aTipText); */ -NS_IMETHODIMP WebBrowserChrome::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const PRUnichar *aTipText) +NS_IMETHODIMP WebBrowserChrome::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText) { WebBrowserChromeUI::ShowTooltip(this, aXCoords, aYCoords, aTipText); return NS_OK; diff --git a/embedding/tests/winEmbed/WebBrowserChrome.h b/embedding/tests/winEmbed/WebBrowserChrome.h index 628462e54b51..30f4600c7ba0 100644 --- a/embedding/tests/winEmbed/WebBrowserChrome.h +++ b/embedding/tests/winEmbed/WebBrowserChrome.h @@ -62,13 +62,13 @@ public: static void Destroy(nsIWebBrowserChrome* chrome); static void Destroyed(nsIWebBrowserChrome* chrome); static void SetFocus(nsIWebBrowserChrome *chrome); - static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText); + static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const char16_t* aStatusText); static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome); static void UpdateBusyState(nsIWebBrowserChrome *aChrome, bool aBusy); static void UpdateProgress(nsIWebBrowserChrome *aChrome, int32_t aCurrent, int32_t aMax); static void GetResourceStringById(int32_t aID, char ** aReturn); static void ShowContextMenu(nsIWebBrowserChrome *aChrome, uint32_t aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode); - static void ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const PRUnichar *aTipText); + static void ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText); static void HideTooltip(nsIWebBrowserChrome *aChrome); static void ShowWindow(nsIWebBrowserChrome *aChrome, bool aShow); static void SizeTo(nsIWebBrowserChrome *aChrome, int32_t aWidth, int32_t aHeight); diff --git a/embedding/tests/winEmbed/winEmbed.cpp b/embedding/tests/winEmbed/winEmbed.cpp index 8d95d6563679..3926a2b0e683 100644 --- a/embedding/tests/winEmbed/winEmbed.cpp +++ b/embedding/tests/winEmbed/winEmbed.cpp @@ -908,7 +908,7 @@ void WebBrowserChromeUI::SetFocus(nsIWebBrowserChrome *chrome) // // PURPOSE: Set the status bar text. // -void WebBrowserChromeUI::UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText) +void WebBrowserChromeUI::UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const char16_t* aStatusText) { HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); nsCString status; @@ -1004,7 +1004,7 @@ void WebBrowserChromeUI::ShowContextMenu(nsIWebBrowserChrome *aChrome, uint32_t // // PURPOSE: Show a tooltip // -void WebBrowserChromeUI::ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const PRUnichar *aTipText) +void WebBrowserChromeUI::ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText) { // TODO code to show a tooltip should go here } diff --git a/extensions/auth/nsAuthGSSAPI.cpp b/extensions/auth/nsAuthGSSAPI.cpp index a9515ff29108..c12d43bf6518 100644 --- a/extensions/auth/nsAuthGSSAPI.cpp +++ b/extensions/auth/nsAuthGSSAPI.cpp @@ -340,9 +340,9 @@ NS_IMPL_ISUPPORTS1(nsAuthGSSAPI, nsIAuthModule) NS_IMETHODIMP nsAuthGSSAPI::Init(const char *serviceName, uint32_t serviceFlags, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password) + const char16_t *domain, + const char16_t *username, + const char16_t *password) { // we don't expect to be passed any user credentials NS_ASSERTION(!domain && !username && !password, "unexpected credentials"); diff --git a/extensions/auth/nsAuthSASL.cpp b/extensions/auth/nsAuthSASL.cpp index 032dccb7dfbb..6782d4fc5609 100644 --- a/extensions/auth/nsAuthSASL.cpp +++ b/extensions/auth/nsAuthSASL.cpp @@ -28,9 +28,9 @@ NS_IMPL_ISUPPORTS1(nsAuthSASL, nsIAuthModule) NS_IMETHODIMP nsAuthSASL::Init(const char *serviceName, uint32_t serviceFlags, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password) + const char16_t *domain, + const char16_t *username, + const char16_t *password) { nsresult rv; diff --git a/extensions/auth/nsAuthSSPI.cpp b/extensions/auth/nsAuthSSPI.cpp index 3e16e4ae2a8d..55d7fe826bdb 100644 --- a/extensions/auth/nsAuthSSPI.cpp +++ b/extensions/auth/nsAuthSSPI.cpp @@ -183,9 +183,9 @@ NS_IMPL_ISUPPORTS1(nsAuthSSPI, nsIAuthModule) NS_IMETHODIMP nsAuthSSPI::Init(const char *serviceName, uint32_t serviceFlags, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password) + const char16_t *domain, + const char16_t *username, + const char16_t *password) { LOG((" nsAuthSSPI::Init\n")); diff --git a/extensions/auth/nsAuthSambaNTLM.cpp b/extensions/auth/nsAuthSambaNTLM.cpp index 5d83f9be859d..ecb1778151de 100644 --- a/extensions/auth/nsAuthSambaNTLM.cpp +++ b/extensions/auth/nsAuthSambaNTLM.cpp @@ -206,9 +206,9 @@ nsAuthSambaNTLM::SpawnNTLMAuthHelper() NS_IMETHODIMP nsAuthSambaNTLM::Init(const char *serviceName, uint32_t serviceFlags, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password) + const char16_t *domain, + const char16_t *username, + const char16_t *password) { NS_ASSERTION(!username && !domain && !password, "unexpected credentials"); diff --git a/extensions/auth/nsHttpNegotiateAuth.cpp b/extensions/auth/nsHttpNegotiateAuth.cpp index 524873033610..ae5124b84433 100644 --- a/extensions/auth/nsHttpNegotiateAuth.cpp +++ b/extensions/auth/nsHttpNegotiateAuth.cpp @@ -182,9 +182,9 @@ NS_IMETHODIMP nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, const char *challenge, bool isProxyAuth, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password, + const char16_t *domain, + const char16_t *username, + const char16_t *password, nsISupports **sessionState, nsISupports **continuationState, uint32_t *flags, diff --git a/extensions/cookie/nsCookiePermission.cpp b/extensions/cookie/nsCookiePermission.cpp index 0d68c5a3e8cc..fbfbce912947 100644 --- a/extensions/cookie/nsCookiePermission.cpp +++ b/extensions/cookie/nsCookiePermission.cpp @@ -366,7 +366,7 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI, NS_IMETHODIMP nsCookiePermission::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { nsCOMPtr prefBranch = do_QueryInterface(aSubject); NS_ASSERTION(!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic), diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 2cc6c94710c8..2167506e983c 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -182,7 +182,7 @@ public: // nsIObserver implementation. NS_IMETHODIMP - Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *data) + Observe(nsISupports *aSubject, const char *aTopic, const char16_t *data) { MOZ_ASSERT(!nsCRT::strcmp(aTopic, "webapps-clear-data")); @@ -1278,7 +1278,7 @@ NS_IMETHODIMP nsPermissionManager::GetEnumerator(nsISimpleEnumerator **aEnum) return NS_NewArrayEnumerator(aEnum, array); } -NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { ENSURE_NOT_CHILD_PROCESS; @@ -1499,7 +1499,7 @@ nsPermissionManager::NotifyObserversWithPermission(const nsACString &aHost, uint32_t aPermission, uint32_t aExpireType, int64_t aExpireTime, - const PRUnichar *aData) + const char16_t *aData) { nsCOMPtr permission = new nsPermission(aHost, aAppId, aIsInBrowserElement, aType, aPermission, @@ -1516,7 +1516,7 @@ nsPermissionManager::NotifyObserversWithPermission(const nsACString &aHost, // "cleared" means the entire permission list was cleared. aPermission is null. void nsPermissionManager::NotifyObservers(nsIPermission *aPermission, - const PRUnichar *aData) + const char16_t *aData) { if (mObserverService) mObserverService->NotifyObservers(aPermission, diff --git a/extensions/cookie/nsPermissionManager.h b/extensions/cookie/nsPermissionManager.h index 637da623c00a..765427968201 100644 --- a/extensions/cookie/nsPermissionManager.h +++ b/extensions/cookie/nsPermissionManager.h @@ -233,8 +233,8 @@ private: uint32_t aPermission, uint32_t aExpireType, int64_t aExpireTime, - const PRUnichar *aData); - void NotifyObservers(nsIPermission *aPermission, const PRUnichar *aData); + const char16_t *aData); + void NotifyObservers(nsIPermission *aPermission, const char16_t *aData); // Finalize all statements, close the DB and null it. // if aRebuildOnSuccess, reinitialize database diff --git a/extensions/cookie/nsPopupWindowManager.cpp b/extensions/cookie/nsPopupWindowManager.cpp index 3e2ff3ef9878..010df534e01b 100644 --- a/extensions/cookie/nsPopupWindowManager.cpp +++ b/extensions/cookie/nsPopupWindowManager.cpp @@ -92,7 +92,7 @@ nsPopupWindowManager::TestPermission(nsIPrincipal* aPrincipal, NS_IMETHODIMP nsPopupWindowManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { nsCOMPtr prefBranch = do_QueryInterface(aSubject); NS_ASSERTION(!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic), diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 52fa62b9448f..2d9820b2510e 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -826,17 +826,17 @@ mount_operation_ask_password (GMountOperation *mount_op, if (flags & G_ASK_PASSWORD_NEED_PASSWORD) { if (flags & G_ASK_PASSWORD_NEED_USERNAME) { if (!realm.IsEmpty()) { - const PRUnichar *strings[] = { realm.get(), dispHost.get() }; + const char16_t *strings[] = { realm.get(), dispHost.get() }; bundle->FormatStringFromName(MOZ_UTF16("EnterLoginForRealm"), strings, 2, getter_Copies(nsmessage)); } else { - const PRUnichar *strings[] = { dispHost.get() }; + const char16_t *strings[] = { dispHost.get() }; bundle->FormatStringFromName(MOZ_UTF16("EnterUserPasswordFor"), strings, 1, getter_Copies(nsmessage)); } } else { NS_ConvertUTF8toUTF16 userName(default_user); - const PRUnichar *strings[] = { userName.get(), dispHost.get() }; + const char16_t *strings[] = { userName.get(), dispHost.get() }; bundle->FormatStringFromName(MOZ_UTF16("EnterPasswordFor"), strings, 2, getter_Copies(nsmessage)); } @@ -851,7 +851,7 @@ mount_operation_ask_password (GMountOperation *mount_op, // Prompt the user... nsresult rv; bool retval = false; - PRUnichar *user = nullptr, *pass = nullptr; + char16_t *user = nullptr, *pass = nullptr; if (default_user) { // user will be freed by PromptUsernameAndPassword user = ToNewUnicode(NS_ConvertUTF8toUTF16(default_user)); @@ -1085,7 +1085,7 @@ nsGIOProtocolHandler::AllowPort(int32_t aPort, NS_IMETHODIMP nsGIOProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) { nsCOMPtr prefs = do_QueryInterface(aSubject); diff --git a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp index 49fd55af1757..941a0715ed12 100644 --- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp +++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp @@ -221,13 +221,13 @@ ProxiedAuthCallback(gconstpointer in, nsString message; if (!realm.IsEmpty()) { - const PRUnichar *strings[] = { realm.get(), dispHost.get() }; + const char16_t *strings[] = { realm.get(), dispHost.get() }; bundle->FormatStringFromName(MOZ_UTF16("EnterUserPasswordForRealm"), strings, 2, getter_Copies(message)); } else { - const PRUnichar *strings[] = { dispHost.get() }; + const char16_t *strings[] = { dispHost.get() }; bundle->FormatStringFromName(MOZ_UTF16("EnterUserPasswordFor"), strings, 1, getter_Copies(message)); } @@ -237,7 +237,7 @@ ProxiedAuthCallback(gconstpointer in, // Prompt the user... nsresult rv; bool retval = false; - PRUnichar *user = nullptr, *pass = nullptr; + char16_t *user = nullptr, *pass = nullptr; rv = prompt->PromptUsernameAndPassword(nullptr, message.get(), key.get(), @@ -939,7 +939,7 @@ nsGnomeVFSProtocolHandler::AllowPort(int32_t aPort, NS_IMETHODIMP nsGnomeVFSProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) { nsCOMPtr prefs = do_QueryInterface(aSubject); diff --git a/extensions/permissions/nsContentBlocker.cpp b/extensions/permissions/nsContentBlocker.cpp index d606489f564c..ecb5b4f8ee24 100644 --- a/extensions/permissions/nsContentBlocker.cpp +++ b/extensions/permissions/nsContentBlocker.cpp @@ -335,7 +335,7 @@ nsContentBlocker::TestPermission(nsIURI *aCurrentURI, NS_IMETHODIMP nsContentBlocker::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic), "unexpected topic - we only deal with pref changes!"); diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/extensions/pref/autoconfig/src/nsAutoConfig.cpp index 9cab4348ae56..7b6d44b27c9a 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -175,7 +175,7 @@ NS_IMETHODIMP nsAutoConfig::Notify(nsITimer *timer) NS_IMETHODIMP nsAutoConfig::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { nsresult rv = NS_OK; if (!nsCRT::strcmp(aTopic, "profile-after-change")) { @@ -208,7 +208,7 @@ nsresult nsAutoConfig::downloadAutoConfig() // in the previous read, we need to remove it when timer kicks in and // downloads the autoconfig file again. // If necessary, the email address will be added again as an argument. - int32_t index = mConfigURL.RFindChar((PRUnichar)'?'); + int32_t index = mConfigURL.RFindChar((char16_t)'?'); if (index != -1) mConfigURL.Truncate(index); diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp index bb2a2ba25fc9..3d83f42a74bb 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -100,7 +100,7 @@ nsReadConfig::~nsReadConfig() CentralizedAdminPrefManagerFinish(); } -NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { nsresult rv = NS_OK; diff --git a/extensions/spellcheck/hunspell/src/csutil.cpp b/extensions/spellcheck/hunspell/src/csutil.cpp index 4548d3673154..dc269b3ce879 100644 --- a/extensions/spellcheck/hunspell/src/csutil.cpp +++ b/extensions/spellcheck/hunspell/src/csutil.cpp @@ -5563,7 +5563,7 @@ struct cs_info * get_current_cs(const char * es) { if (i == 0) break; const char source = char(i); - PRUnichar uni, uniCased; + char16_t uni, uniCased; int32_t charLength = 1, uniLength = 1; rv = decoder->Convert(&source, &charLength, &uni, &uniLength); @@ -5716,7 +5716,7 @@ unsigned short unicodetoupper(unsigned short c, int langnum) return u_toupper(c); #else #ifdef MOZILLA_CLIENT - return ToUpperCase((PRUnichar) c); + return ToUpperCase((char16_t) c); #else return (utf_tbl) ? utf_tbl[c].cupper : c; #endif @@ -5734,7 +5734,7 @@ unsigned short unicodetolower(unsigned short c, int langnum) return u_tolower(c); #else #ifdef MOZILLA_CLIENT - return ToLowerCase((PRUnichar) c); + return ToLowerCase((char16_t) c); #else return (utf_tbl) ? utf_tbl[c].clower : c; #endif diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.cpp b/extensions/spellcheck/hunspell/src/mozHunspell.cpp index be5085979ec4..35a96a8e68eb 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp @@ -143,7 +143,7 @@ mozHunspell::~mozHunspell() } /* attribute wstring dictionary; */ -NS_IMETHODIMP mozHunspell::GetDictionary(PRUnichar **aDictionary) +NS_IMETHODIMP mozHunspell::GetDictionary(char16_t **aDictionary) { NS_ENSURE_ARG_POINTER(aDictionary); @@ -154,7 +154,7 @@ NS_IMETHODIMP mozHunspell::GetDictionary(PRUnichar **aDictionary) /* set the Dictionary. * This also Loads the dictionary and initializes the converter using the dictionaries converter */ -NS_IMETHODIMP mozHunspell::SetDictionary(const PRUnichar *aDictionary) +NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary) { NS_ENSURE_ARG_POINTER(aDictionary); @@ -249,7 +249,7 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const PRUnichar *aDictionary) } /* readonly attribute wstring language; */ -NS_IMETHODIMP mozHunspell::GetLanguage(PRUnichar **aLanguage) +NS_IMETHODIMP mozHunspell::GetLanguage(char16_t **aLanguage) { NS_ENSURE_ARG_POINTER(aLanguage); @@ -279,13 +279,13 @@ NS_IMETHODIMP mozHunspell::GetProvidesWordUtils(bool *aProvidesWordUtils) } /* readonly attribute wstring name; */ -NS_IMETHODIMP mozHunspell::GetName(PRUnichar * *aName) +NS_IMETHODIMP mozHunspell::GetName(char16_t * *aName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute wstring copyright; */ -NS_IMETHODIMP mozHunspell::GetCopyright(PRUnichar * *aCopyright) +NS_IMETHODIMP mozHunspell::GetCopyright(char16_t * *aCopyright) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -306,7 +306,7 @@ NS_IMETHODIMP mozHunspell::SetPersonalDictionary(mozIPersonalDictionary * aPerso struct AppendNewStruct { - PRUnichar **dics; + char16_t **dics; uint32_t count; bool failed; }; @@ -326,14 +326,14 @@ AppendNewString(const nsAString& aString, nsIFile* aFile, void* aClosure) } /* void GetDictionaryList ([array, size_is (count)] out wstring dictionaries, out uint32_t count); */ -NS_IMETHODIMP mozHunspell::GetDictionaryList(PRUnichar ***aDictionaries, +NS_IMETHODIMP mozHunspell::GetDictionaryList(char16_t ***aDictionaries, uint32_t *aCount) { if (!aDictionaries || !aCount) return NS_ERROR_NULL_POINTER; AppendNewStruct ans = { - (PRUnichar**) NS_Alloc(sizeof(PRUnichar*) * mDictionaries.Count()), + (char16_t**) NS_Alloc(sizeof(char16_t*) * mDictionaries.Count()), 0, false }; @@ -503,7 +503,7 @@ mozHunspell::LoadDictionariesFromDir(nsIFile* aDir) return NS_OK; } -nsresult mozHunspell::ConvertCharset(const PRUnichar* aStr, char ** aDst) +nsresult mozHunspell::ConvertCharset(const char16_t* aStr, char ** aDst) { NS_ENSURE_ARG_POINTER(aDst); NS_ENSURE_TRUE(mEncoder, NS_ERROR_NULL_POINTER); @@ -524,7 +524,7 @@ nsresult mozHunspell::ConvertCharset(const PRUnichar* aStr, char ** aDst) } /* boolean Check (in wstring word); */ -NS_IMETHODIMP mozHunspell::Check(const PRUnichar *aWord, bool *aResult) +NS_IMETHODIMP mozHunspell::Check(const char16_t *aWord, bool *aResult) { NS_ENSURE_ARG_POINTER(aWord); NS_ENSURE_ARG_POINTER(aResult); @@ -544,7 +544,7 @@ NS_IMETHODIMP mozHunspell::Check(const PRUnichar *aWord, bool *aResult) } /* void Suggest (in wstring word, [array, size_is (count)] out wstring suggestions, out uint32_t count); */ -NS_IMETHODIMP mozHunspell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggestions, uint32_t *aSuggestionCount) +NS_IMETHODIMP mozHunspell::Suggest(const char16_t *aWord, char16_t ***aSuggestions, uint32_t *aSuggestionCount) { NS_ENSURE_ARG_POINTER(aSuggestions); NS_ENSURE_ARG_POINTER(aSuggestionCount); @@ -561,7 +561,7 @@ NS_IMETHODIMP mozHunspell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest *aSuggestionCount = mHunspell->suggest(&wlst, charsetWord); if (*aSuggestionCount) { - *aSuggestions = (PRUnichar **)nsMemory::Alloc(*aSuggestionCount * sizeof(PRUnichar *)); + *aSuggestions = (char16_t **)nsMemory::Alloc(*aSuggestionCount * sizeof(char16_t *)); if (*aSuggestions) { uint32_t index = 0; for (index = 0; index < *aSuggestionCount && NS_SUCCEEDED(rv); ++index) { @@ -571,7 +571,7 @@ NS_IMETHODIMP mozHunspell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest rv = mDecoder->GetMaxLength(wlst[index], inLength, &outLength); if (NS_SUCCEEDED(rv)) { - (*aSuggestions)[index] = (PRUnichar *) nsMemory::Alloc(sizeof(PRUnichar) * (outLength+1)); + (*aSuggestions)[index] = (char16_t *) nsMemory::Alloc(sizeof(char16_t) * (outLength+1)); if ((*aSuggestions)[index]) { rv = mDecoder->Convert(wlst[index], &inLength, (*aSuggestions)[index], &outLength); @@ -584,7 +584,7 @@ NS_IMETHODIMP mozHunspell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest } if (NS_FAILED(rv)) - NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(index, *aSuggestions); // free the PRUnichar strings up to the point at which the error occurred + NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(index, *aSuggestions); // free the char16_t strings up to the point at which the error occurred } else // if (*aSuggestions) rv = NS_ERROR_OUT_OF_MEMORY; @@ -596,7 +596,7 @@ NS_IMETHODIMP mozHunspell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest NS_IMETHODIMP mozHunspell::Observe(nsISupports* aSubj, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(!strcmp(aTopic, "profile-do-change") || !strcmp(aTopic, "profile-after-change"), diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.h b/extensions/spellcheck/hunspell/src/mozHunspell.h index 5fc7808accf5..bc0e5c03688f 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.h +++ b/extensions/spellcheck/hunspell/src/mozHunspell.h @@ -99,7 +99,7 @@ public: void LoadDictionaryList(); // helper method for converting a word to the charset of the dictionary - nsresult ConvertCharset(const PRUnichar* aStr, char ** aDst); + nsresult ConvertCharset(const char16_t* aStr, char ** aDst); MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(MallocSizeOfOnAlloc) MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(MallocSizeOfOnFree) diff --git a/extensions/spellcheck/src/mozEnglishWordUtils.cpp b/extensions/spellcheck/src/mozEnglishWordUtils.cpp index 340f15776330..1247ecfb7e35 100644 --- a/extensions/spellcheck/src/mozEnglishWordUtils.cpp +++ b/extensions/spellcheck/src/mozEnglishWordUtils.cpp @@ -37,7 +37,7 @@ mozEnglishWordUtils::~mozEnglishWordUtils() } /* attribute wstring language; */ -NS_IMETHODIMP mozEnglishWordUtils::GetLanguage(PRUnichar * *aLanguage) +NS_IMETHODIMP mozEnglishWordUtils::GetLanguage(char16_t * *aLanguage) { nsresult rv = NS_OK; NS_ENSURE_ARG_POINTER(aLanguage); @@ -49,10 +49,10 @@ NS_IMETHODIMP mozEnglishWordUtils::GetLanguage(PRUnichar * *aLanguage) /* void GetRootForm (in wstring aWord, in uint32_t type, [array, size_is (count)] out wstring words, out uint32_t count); */ // return the possible root forms of aWord. -NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const PRUnichar *aWord, uint32_t type, PRUnichar ***words, uint32_t *count) +NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const char16_t *aWord, uint32_t type, char16_t ***words, uint32_t *count) { nsAutoString word(aWord); - PRUnichar **tmpPtr; + char16_t **tmpPtr; int32_t length = word.Length(); *count = 0; @@ -62,7 +62,7 @@ NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const PRUnichar *aWord, uint32_t { case HuhCap: case NoCap: - tmpPtr = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *)); + tmpPtr = (char16_t **)nsMemory::Alloc(sizeof(char16_t *)); if (!tmpPtr) return NS_ERROR_OUT_OF_MEMORY; tmpPtr[0] = ToNewUnicode(word); @@ -76,7 +76,7 @@ NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const PRUnichar *aWord, uint32_t case AllCap: - tmpPtr = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * 3); + tmpPtr = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * 3); if (!tmpPtr) return NS_ERROR_OUT_OF_MEMORY; tmpPtr[0] = ToNewUnicode(word); @@ -105,7 +105,7 @@ NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const PRUnichar *aWord, uint32_t break; case InitCap: - tmpPtr = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * 2); + tmpPtr = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * 2); if (!tmpPtr) return NS_ERROR_OUT_OF_MEMORY; @@ -132,18 +132,18 @@ NS_IMETHODIMP mozEnglishWordUtils::GetRootForm(const PRUnichar *aWord, uint32_t } // This needs vast improvement -bool mozEnglishWordUtils::ucIsAlpha(PRUnichar aChar) +bool mozEnglishWordUtils::ucIsAlpha(char16_t aChar) { // XXX we have to fix callers to handle the full Unicode range return nsIUGenCategory::kLetter == mozilla::unicode::GetGenCategory(aChar); } /* void FindNextWord (in wstring word, in uint32_t length, in uint32_t offset, out uint32_t begin, out uint32_t end); */ -NS_IMETHODIMP mozEnglishWordUtils::FindNextWord(const PRUnichar *word, uint32_t length, uint32_t offset, int32_t *begin, int32_t *end) +NS_IMETHODIMP mozEnglishWordUtils::FindNextWord(const char16_t *word, uint32_t length, uint32_t offset, int32_t *begin, int32_t *end) { - const PRUnichar *p = word + offset; - const PRUnichar *endbuf = word + length; - const PRUnichar *startWord=p; + const char16_t *p = word + offset; + const char16_t *endbuf = word + length; + const char16_t *startWord=p; if(pSuggest(PromiseFlatString(aWord).get(), &words, &count); NS_ENSURE_SUCCESS(result, result); @@ -237,7 +237,7 @@ NS_IMETHODIMP mozSpellChecker::AddWordToPersonalDictionary(const nsAString &aWord) { nsresult res; - PRUnichar empty=0; + char16_t empty=0; if (!mPersonalDictionary) return NS_ERROR_NULL_POINTER; res = mPersonalDictionary->AddWord(PromiseFlatString(aWord).get(),&empty); @@ -248,7 +248,7 @@ NS_IMETHODIMP mozSpellChecker::RemoveWordFromPersonalDictionary(const nsAString &aWord) { nsresult res; - PRUnichar empty=0; + char16_t empty=0; if (!mPersonalDictionary) return NS_ERROR_NULL_POINTER; res = mPersonalDictionary->RemoveWord(PromiseFlatString(aWord).get(),&empty); @@ -289,7 +289,7 @@ mozSpellChecker::GetDictionaryList(nsTArray *aDictionaryList) nsCOMPtr engine = spellCheckingEngines[i]; uint32_t count = 0; - PRUnichar **words = nullptr; + char16_t **words = nullptr; engine->GetDictionaryList(&words, &count); for (uint32_t k = 0; k < count; k++) { nsAutoString dictName; diff --git a/extensions/spellcheck/src/mozSpellI18NManager.cpp b/extensions/spellcheck/src/mozSpellI18NManager.cpp index a2d8d4dffdea..419276682c6f 100644 --- a/extensions/spellcheck/src/mozSpellI18NManager.cpp +++ b/extensions/spellcheck/src/mozSpellI18NManager.cpp @@ -21,7 +21,7 @@ mozSpellI18NManager::~mozSpellI18NManager() } /* mozISpellI18NUtil GetUtil (in wstring language); */ -NS_IMETHODIMP mozSpellI18NManager::GetUtil(const PRUnichar *aLanguage, mozISpellI18NUtil **_retval) +NS_IMETHODIMP mozSpellI18NManager::GetUtil(const char16_t *aLanguage, mozISpellI18NUtil **_retval) { if( nullptr == _retval) { return NS_ERROR_NULL_POINTER; diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index b2dc20cba1e7..197d5fb6fbb5 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -51,7 +51,7 @@ NS_IMPL_ISUPPORTS1(ObserverToDestroyFeaturesAlreadyReported, NS_IMETHODIMP ObserverToDestroyFeaturesAlreadyReported::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown")) { if (gFeaturesAlreadyReported) { diff --git a/gfx/src/nsColor.cpp b/gfx/src/nsColor.cpp index be9e734b709a..50ca1b48a179 100644 --- a/gfx/src/nsColor.cpp +++ b/gfx/src/nsColor.cpp @@ -65,7 +65,7 @@ void nsColorNames::ReleaseTable(void) } } -static int ComponentValue(const PRUnichar* aColorSpec, int aLen, int color, int dpc) +static int ComponentValue(const char16_t* aColorSpec, int aLen, int color, int dpc) { int component = 0; int index = (color * dpc); @@ -73,7 +73,7 @@ static int ComponentValue(const PRUnichar* aColorSpec, int aLen, int color, int dpc = 2; } while (--dpc >= 0) { - PRUnichar ch = ((index < aLen) ? aColorSpec[index++] : '0'); + char16_t ch = ((index < aLen) ? aColorSpec[index++] : '0'); if (('0' <= ch) && (ch <= '9')) { component = (component * 16) + (ch - '0'); } else if ((('a' <= ch) && (ch <= 'f')) || @@ -91,13 +91,13 @@ static int ComponentValue(const PRUnichar* aColorSpec, int aLen, int color, int NS_GFX_(bool) NS_HexToRGB(const nsAString& aColorSpec, nscolor* aResult) { - const PRUnichar* buffer = aColorSpec.BeginReading(); + const char16_t* buffer = aColorSpec.BeginReading(); int nameLen = aColorSpec.Length(); if ((nameLen == 3) || (nameLen == 6)) { // Make sure the digits are legal for (int i = 0; i < nameLen; i++) { - PRUnichar ch = buffer[i]; + char16_t ch = buffer[i]; if (((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'f')) || ((ch >= 'A') && (ch <= 'F'))) { @@ -141,7 +141,7 @@ NS_GFX_(bool) NS_LooseHexToRGB(const nsString& aColorSpec, nscolor* aResult) } int nameLen = aColorSpec.Length(); - const PRUnichar* colorSpec = aColorSpec.get(); + const char16_t* colorSpec = aColorSpec.get(); if (nameLen > 128) { nameLen = 128; } @@ -170,7 +170,7 @@ NS_GFX_(bool) NS_LooseHexToRGB(const nsString& aColorSpec, nscolor* aResult) for (int c = 0; c < 3; ++c) { NS_ABORT_IF_FALSE(c * dpc < nameLen, "should not pass end of string while newdpc > 2"); - PRUnichar ch = colorSpec[c * dpc]; + char16_t ch = colorSpec[c * dpc]; if (('1' <= ch && ch <= '9') || ('A' <= ch && ch <= 'F') || ('a' <= ch && ch <= 'f')) { diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 84220c738a07..750e3ed42d18 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -114,7 +114,7 @@ nsFontCache::Destroy() } NS_IMETHODIMP -nsFontCache::Observe(nsISupports*, const char* aTopic, const PRUnichar*) +nsFontCache::Observe(nsISupports*, const char* aTopic, const char16_t*) { if (!nsCRT::strcmp(aTopic, "memory-pressure")) Compact(); @@ -494,11 +494,11 @@ nsDeviceContext::InitForPrinting(nsIDeviceContextSpec *aDevice) nsresult nsDeviceContext::BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { - static const PRUnichar kEmpty[] = { '\0' }; + static const char16_t kEmpty[] = { '\0' }; nsresult rv; rv = mPrintingSurface->BeginPrinting(aTitle, diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h index 28789de62df1..8618af19c1e6 100644 --- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -16,7 +16,7 @@ #include "nsError.h" // for nsresult #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING #include "nsMathUtils.h" // for NS_round -#include "nscore.h" // for PRUnichar, nsAString +#include "nscore.h" // for char16_t, nsAString #include "mozilla/AppUnits.h" // for AppUnits class gfxASurface; @@ -189,7 +189,7 @@ public: * @return error status */ nsresult BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage); diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index fe6d3f7a6a1f..4d47fb594c7e 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -13,7 +13,7 @@ #include "nsISupports.h" #include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsUnicharUtils.h" -#include "nscore.h" // for PRUnichar +#include "nscore.h" // for char16_t #include "mozilla/gfx/2D.h" nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant, @@ -181,13 +181,13 @@ static bool IsGenericFontFamily(const nsString& aFamily) return generic != kGenericFont_NONE; } -const PRUnichar kSingleQuote = PRUnichar('\''); -const PRUnichar kDoubleQuote = PRUnichar('\"'); -const PRUnichar kComma = PRUnichar(','); +const char16_t kSingleQuote = char16_t('\''); +const char16_t kDoubleQuote = char16_t('\"'); +const char16_t kComma = char16_t(','); bool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const { - const PRUnichar *p, *p_end; + const char16_t *p, *p_end; name.BeginReading(p); name.EndReading(p_end); nsAutoString family; @@ -200,10 +200,10 @@ bool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const bool generic; if (*p == kSingleQuote || *p == kDoubleQuote) { // quoted font family - PRUnichar quoteMark = *p; + char16_t quoteMark = *p; if (++p == p_end) return true; - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; // XXX What about CSS character escapes? while (*p != quoteMark) @@ -218,7 +218,7 @@ bool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const } else { // unquoted font family - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; while (++p != p_end && *p != kComma) /* nothing */ ; diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index 3c7fdc3b935b..5df9de84f776 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -36,7 +36,7 @@ public: } AutoTextRun(nsFontMetrics* aMetrics, nsRenderingContext* aRC, - const PRUnichar* aString, int32_t aLength) + const char16_t* aString, int32_t aLength) { mTextRun = aMetrics->GetThebesFontGroup()->MakeTextRun( aString, aLength, @@ -287,7 +287,7 @@ nsFontMetrics::GetWidth(const char* aString, uint32_t aLength, } nscoord -nsFontMetrics::GetWidth(const PRUnichar* aString, uint32_t aLength, +nsFontMetrics::GetWidth(const char16_t* aString, uint32_t aLength, nsRenderingContext *aContext) { if (aLength == 0) @@ -325,7 +325,7 @@ nsFontMetrics::DrawString(const char *aString, uint32_t aLength, } void -nsFontMetrics::DrawString(const PRUnichar* aString, uint32_t aLength, +nsFontMetrics::DrawString(const char16_t* aString, uint32_t aLength, nscoord aX, nscoord aY, nsRenderingContext *aContext, nsRenderingContext *aTextRunConstructionContext) @@ -347,7 +347,7 @@ nsFontMetrics::DrawString(const PRUnichar* aString, uint32_t aLength, } static nsBoundingMetrics -GetTextBoundingMetrics(nsFontMetrics* aMetrics, const PRUnichar *aString, uint32_t aLength, +GetTextBoundingMetrics(nsFontMetrics* aMetrics, const char16_t *aString, uint32_t aLength, nsRenderingContext *aContext, gfxFont::BoundingBoxType aType) { if (aLength == 0) @@ -372,7 +372,7 @@ GetTextBoundingMetrics(nsFontMetrics* aMetrics, const PRUnichar *aString, uint32 } nsBoundingMetrics -nsFontMetrics::GetBoundingMetrics(const PRUnichar *aString, uint32_t aLength, +nsFontMetrics::GetBoundingMetrics(const char16_t *aString, uint32_t aLength, nsRenderingContext *aContext) { return GetTextBoundingMetrics(this, aString, aLength, aContext, gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS); @@ -380,7 +380,7 @@ nsFontMetrics::GetBoundingMetrics(const PRUnichar *aString, uint32_t aLength, } nsBoundingMetrics -nsFontMetrics::GetInkBoundsForVisualOverflow(const PRUnichar *aString, uint32_t aLength, +nsFontMetrics::GetInkBoundsForVisualOverflow(const char16_t *aString, uint32_t aLength, nsRenderingContext *aContext) { return GetTextBoundingMetrics(this, aString, aLength, aContext, gfxFont::LOOSE_INK_EXTENTS); diff --git a/gfx/src/nsFontMetrics.h b/gfx/src/nsFontMetrics.h index ec61eccfe522..ed435a20136e 100644 --- a/gfx/src/nsFontMetrics.h +++ b/gfx/src/nsFontMetrics.h @@ -16,7 +16,7 @@ #include "nsError.h" // for nsresult #include "nsFont.h" // for nsFont #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING -#include "nscore.h" // for PRUnichar +#include "nscore.h" // for char16_t class gfxUserFontSet; class gfxTextPerfMetrics; @@ -182,25 +182,25 @@ public: // want it in another format. nscoord GetWidth(const char* aString, uint32_t aLength, nsRenderingContext *aContext); - nscoord GetWidth(const PRUnichar* aString, uint32_t aLength, + nscoord GetWidth(const char16_t* aString, uint32_t aLength, nsRenderingContext *aContext); // Draw a string using this font handle on the surface passed in. void DrawString(const char *aString, uint32_t aLength, nscoord aX, nscoord aY, nsRenderingContext *aContext); - void DrawString(const PRUnichar* aString, uint32_t aLength, + void DrawString(const char16_t* aString, uint32_t aLength, nscoord aX, nscoord aY, nsRenderingContext *aContext, nsRenderingContext *aTextRunConstructionContext); - nsBoundingMetrics GetBoundingMetrics(const PRUnichar *aString, + nsBoundingMetrics GetBoundingMetrics(const char16_t *aString, uint32_t aLength, nsRenderingContext *aContext); // Returns the LOOSE_INK_EXTENTS bounds of the text for determing the // overflow area of the string. - nsBoundingMetrics GetInkBoundsForVisualOverflow(const PRUnichar *aString, + nsBoundingMetrics GetInkBoundsForVisualOverflow(const char16_t *aString, uint32_t aLength, nsRenderingContext *aContext); diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 4f47b3bb1d05..c94cf7bad9fc 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -32,7 +32,7 @@ class gfxASurface; // size the cluster buffer array in FindSafeLength #define MAX_GFX_TEXT_BUF_SIZE 8000 -static int32_t FindSafeLength(const PRUnichar *aString, uint32_t aLength, +static int32_t FindSafeLength(const char16_t *aString, uint32_t aLength, uint32_t aMaxChunkLength) { if (aLength <= aMaxChunkLength) @@ -447,7 +447,7 @@ nsRenderingContext::GetWidth(char aC) } nscoord -nsRenderingContext::GetWidth(PRUnichar aC) +nsRenderingContext::GetWidth(char16_t aC) { return GetWidth(&aC, 1); } @@ -479,7 +479,7 @@ nsRenderingContext::GetWidth(const char* aString, uint32_t aLength) } nscoord -nsRenderingContext::GetWidth(const PRUnichar *aString, uint32_t aLength) +nsRenderingContext::GetWidth(const char16_t *aString, uint32_t aLength) { uint32_t maxChunkLength = GetMaxChunkLength(); nscoord width = 0; @@ -493,7 +493,7 @@ nsRenderingContext::GetWidth(const PRUnichar *aString, uint32_t aLength) } nsBoundingMetrics -nsRenderingContext::GetBoundingMetrics(const PRUnichar* aString, +nsRenderingContext::GetBoundingMetrics(const char16_t* aString, uint32_t aLength) { uint32_t maxChunkLength = GetMaxChunkLength(); @@ -542,7 +542,7 @@ nsRenderingContext::DrawString(const nsString& aString, nscoord aX, nscoord aY) } void -nsRenderingContext::DrawString(const PRUnichar *aString, uint32_t aLength, +nsRenderingContext::DrawString(const char16_t *aString, uint32_t aLength, nscoord aX, nscoord aY) { uint32_t maxChunkLength = GetMaxChunkLength(); diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 3e0847ddbc6b..92f3c5f3a5a2 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -20,7 +20,7 @@ #include "nsFontMetrics.h" // for nsFontMetrics #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc #include "nsString.h" // for nsString -#include "nscore.h" // for PRUnichar +#include "nscore.h" // for char16_t class gfxASurface; class nsIntRegion; @@ -104,19 +104,19 @@ public: void SetTextRunRTL(bool aIsRTL); nscoord GetWidth(char aC); - nscoord GetWidth(PRUnichar aC); + nscoord GetWidth(char16_t aC); nscoord GetWidth(const nsString& aString); nscoord GetWidth(const char* aString); nscoord GetWidth(const char* aString, uint32_t aLength); - nscoord GetWidth(const PRUnichar *aString, uint32_t aLength); + nscoord GetWidth(const char16_t *aString, uint32_t aLength); - nsBoundingMetrics GetBoundingMetrics(const PRUnichar *aString, + nsBoundingMetrics GetBoundingMetrics(const char16_t *aString, uint32_t aLength); void DrawString(const nsString& aString, nscoord aX, nscoord aY); void DrawString(const char *aString, uint32_t aLength, nscoord aX, nscoord aY); - void DrawString(const PRUnichar *aString, uint32_t aLength, + void DrawString(const char16_t *aString, uint32_t aLength, nscoord aX, nscoord aY); void AddUserData(UserDataKey *key, void *userData, void (*destroy)(void*)) { diff --git a/gfx/src/nsThebesFontEnumerator.cpp b/gfx/src/nsThebesFontEnumerator.cpp index ada46411a6bf..80c7e27a9ddf 100644 --- a/gfx/src/nsThebesFontEnumerator.cpp +++ b/gfx/src/nsThebesFontEnumerator.cpp @@ -15,7 +15,7 @@ #include "nsMemory.h" // for nsMemory #include "nsString.h" // for nsAutoCString, nsAutoString, etc #include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc -#include "nscore.h" // for PRUnichar, NS_IMETHODIMP +#include "nscore.h" // for char16_t, NS_IMETHODIMP NS_IMPL_ISUPPORTS1(nsThebesFontEnumerator, nsIFontEnumerator) @@ -25,7 +25,7 @@ nsThebesFontEnumerator::nsThebesFontEnumerator() NS_IMETHODIMP nsThebesFontEnumerator::EnumerateAllFonts(uint32_t *aCount, - PRUnichar ***aResult) + char16_t ***aResult) { return EnumerateFonts (nullptr, nullptr, aCount, aResult); } @@ -34,7 +34,7 @@ NS_IMETHODIMP nsThebesFontEnumerator::EnumerateFonts(const char *aLangGroup, const char *aGeneric, uint32_t *aCount, - PRUnichar ***aResult) + char16_t ***aResult) { NS_ENSURE_ARG_POINTER(aCount); NS_ENSURE_ARG_POINTER(aResult); @@ -64,8 +64,8 @@ nsThebesFontEnumerator::EnumerateFonts(const char *aLangGroup, return NS_OK; } - PRUnichar **fs = static_cast - (nsMemory::Alloc(fontList.Length() * sizeof(PRUnichar*))); + char16_t **fs = static_cast + (nsMemory::Alloc(fontList.Length() * sizeof(char16_t*))); for (uint32_t i = 0; i < fontList.Length(); i++) { fs[i] = ToNewUnicode(fontList[i]); } @@ -89,7 +89,7 @@ nsThebesFontEnumerator::HaveFontFor(const char *aLangGroup, NS_IMETHODIMP nsThebesFontEnumerator::GetDefaultFont(const char *aLangGroup, const char *aGeneric, - PRUnichar **aResult) + char16_t **aResult) { NS_ENSURE_ARG_POINTER(aResult); *aResult = nullptr; @@ -105,8 +105,8 @@ nsThebesFontEnumerator::UpdateFontList(bool *_retval) } NS_IMETHODIMP -nsThebesFontEnumerator::GetStandardFamilyName(const PRUnichar *aName, - PRUnichar **aResult) +nsThebesFontEnumerator::GetStandardFamilyName(const char16_t *aName, + char16_t **aResult) { NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aName); diff --git a/gfx/tests/gtest/gfxWordCacheTest.cpp b/gfx/tests/gtest/gfxWordCacheTest.cpp index 436cbaf0d93b..02c350231ac5 100644 --- a/gfx/tests/gtest/gfxWordCacheTest.cpp +++ b/gfx/tests/gtest/gfxWordCacheTest.cpp @@ -49,7 +49,7 @@ public: }; static gfxTextRun * -MakeTextRun(const PRUnichar *aText, uint32_t aLength, +MakeTextRun(const char16_t *aText, uint32_t aLength, gfxFontGroup *aFontGroup, const gfxFontGroup::Parameters* aParams, uint32_t aFlags) { diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp index 4991f4d000c2..c6a2b06307ff 100644 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ b/gfx/thebes/gfxCoreTextShaper.cpp @@ -47,7 +47,7 @@ gfxCoreTextShaper::~gfxCoreTextShaper() bool gfxCoreTextShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxCoreTextShaper.h b/gfx/thebes/gfxCoreTextShaper.h index 9ec8d882e85e..07c0ccb12856 100644 --- a/gfx/thebes/gfxCoreTextShaper.h +++ b/gfx/thebes/gfxCoreTextShaper.h @@ -19,7 +19,7 @@ public: virtual ~gfxCoreTextShaper(); virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index b8dfe5592ef3..a432026dfe4a 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -1172,7 +1172,7 @@ gfxDWriteFontList::DelayedInitFontList() static void RemoveCharsetFromFontSubstitute(nsAString &aName) { - int32_t comma = aName.FindChar(PRUnichar(',')); + int32_t comma = aName.FindChar(char16_t(',')); if (comma >= 0) aName.Truncate(comma); } @@ -1211,8 +1211,8 @@ gfxDWriteFontList::GetFontSubstitutes() continue; } - nsAutoString substituteName((PRUnichar*) aliasName); - nsAutoString actualFontName((PRUnichar*) actualName); + nsAutoString substituteName((char16_t*) aliasName); + nsAutoString actualFontName((char16_t*) actualName); RemoveCharsetFromFontSubstitute(substituteName); BuildKeyNameFromFontName(substituteName); RemoveCharsetFromFontSubstitute(actualFontName); @@ -1247,14 +1247,14 @@ gfxDWriteFontList::GetDirectWriteSubstitutes() { for (uint32_t i = 0; i < ArrayLength(sDirectWriteSubs); ++i) { const FontSubstitution& sub(sDirectWriteSubs[i]); - nsAutoString substituteName((PRUnichar*)sub.aliasName); + nsAutoString substituteName((char16_t*)sub.aliasName); BuildKeyNameFromFontName(substituteName); if (nullptr != mFontFamilies.GetWeak(substituteName)) { // don't do the substitution if user actually has a usable font // with this name installed continue; } - nsAutoString actualFontName((PRUnichar*)sub.actualName); + nsAutoString actualFontName((char16_t*)sub.actualName); BuildKeyNameFromFontName(actualFontName); gfxFontFamily *ff; if (nullptr != (ff = mFontFamilies.GetWeak(actualFontName))) { diff --git a/gfx/thebes/gfxDWriteShaper.cpp b/gfx/thebes/gfxDWriteShaper.cpp index 462fd74fc78f..360a086a4aa9 100644 --- a/gfx/thebes/gfxDWriteShaper.cpp +++ b/gfx/thebes/gfxDWriteShaper.cpp @@ -14,7 +14,7 @@ bool gfxDWriteShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxDWriteShaper.h b/gfx/thebes/gfxDWriteShaper.h index 874bd8913f2b..03072f8be975 100644 --- a/gfx/thebes/gfxDWriteShaper.h +++ b/gfx/thebes/gfxDWriteShaper.h @@ -26,7 +26,7 @@ public: } virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxFT2Fonts.cpp b/gfx/thebes/gfxFT2Fonts.cpp index 7a49eb50a502..ffa697728640 100644 --- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -103,7 +103,7 @@ gfxFT2FontGroup::gfxFT2FontGroup(const nsAString& families, // We want to get rid of this entirely at some point, but first we need real lists of fonts. QFont defaultFont; QFontInfo fi (defaultFont); - familyArray.AppendElement(nsDependentString(static_cast(fi.family().utf16()))); + familyArray.AppendElement(nsDependentString(static_cast(fi.family().utf16()))); #elif defined(MOZ_WIDGET_GTK) FcResult result; FcChar8 *family = nullptr; @@ -404,7 +404,7 @@ gfxFT2FontGroup::WhichSystemFontSupportsChar(uint32_t aCh, int32_t aRunScript) bool gfxFT2Font::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -446,7 +446,7 @@ gfxFT2Font::ShapeText(gfxContext *aContext, } void -gfxFT2Font::AddRange(const PRUnichar *aText, uint32_t aOffset, +gfxFT2Font::AddRange(const char16_t *aText, uint32_t aOffset, uint32_t aLength, gfxShapedText *aShapedText) { const uint32_t appUnitsPerDevUnit = aShapedText->GetAppUnitsPerDevUnit(); @@ -462,7 +462,7 @@ gfxFT2Font::AddRange(const PRUnichar *aText, uint32_t aOffset, FT_UInt spaceGlyph = GetSpaceGlyph(); for (uint32_t i = 0; i < aLength; i++, aOffset++) { - PRUnichar ch = aText[i]; + char16_t ch = aText[i]; if (ch == 0) { // treat this null byte as a missing glyph, don't create a glyph for it @@ -487,7 +487,7 @@ gfxFT2Font::AddRange(const PRUnichar *aText, uint32_t aOffset, } else { // find next character and its glyph -- in case they exist // and exist in the current font face -- to compute kerning - PRUnichar chNext = 0; + char16_t chNext = 0; FT_UInt gidNext = 0; FT_Pos lsbDeltaNext = 0; diff --git a/gfx/thebes/gfxFT2Fonts.h b/gfx/thebes/gfxFT2Fonts.h index 5d77ab5fc30e..9ae6c96a957c 100644 --- a/gfx/thebes/gfxFT2Fonts.h +++ b/gfx/thebes/gfxFT2Fonts.h @@ -73,7 +73,7 @@ public: // new functions protected: virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -82,7 +82,7 @@ protected: void FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd); - void AddRange(const PRUnichar *aText, + void AddRange(const char16_t *aText, uint32_t aOffset, uint32_t aLength, gfxShapedText *aShapedText); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 22082ae83324..b5b387f333e0 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -60,8 +60,8 @@ using mozilla::services::GetObserverService; gfxFontCache *gfxFontCache::gGlobalCache = nullptr; -static const PRUnichar kEllipsisChar[] = { 0x2026, 0x0 }; -static const PRUnichar kASCIIPeriodsChar[] = { '.', '.', '.', 0x0 }; +static const char16_t kEllipsisChar[] = { 0x2026, 0x0 }; +static const char16_t kASCIIPeriodsChar[] = { '.', '.', '.', 0x0 }; #ifdef DEBUG_roc #define DEBUG_TEXT_RUN_STORAGE_METRICS @@ -1394,7 +1394,7 @@ NS_IMPL_ISUPPORTS1(gfxFontCache::Observer, nsIObserver) NS_IMETHODIMP gfxFontCache::Observer::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!nsCRT::strcmp(aTopic, "memory-pressure")) { gfxFontCache *fontCache = gfxFontCache::GetCache(); @@ -3072,13 +3072,13 @@ gfxFont::NotifyGlyphsChanged() } static bool -IsBoundarySpace(PRUnichar aChar, PRUnichar aNextChar) +IsBoundarySpace(char16_t aChar, char16_t aNextChar) { return (aChar == ' ' || aChar == 0x00A0) && !IsClusterExtender(aNextChar); } static inline uint32_t -HashMix(uint32_t aHash, PRUnichar aCh) +HashMix(uint32_t aHash, char16_t aCh) { return (aHash >> 28) ^ (aHash << 4) ^ aCh; } @@ -3184,8 +3184,8 @@ gfxFont::CacheHashEntry::KeyEquals(const KeyTypePointer aKey) const // so the TEXT_IS_8BIT flag was set and the cached ShapedWord we're // comparing with will have 8-bit text. const uint8_t *s1 = sw->Text8Bit(); - const PRUnichar *s2 = aKey->mText.mDouble; - const PRUnichar *s2end = s2 + aKey->mLength; + const char16_t *s2 = aKey->mText.mDouble; + const char16_t *s2end = s2 + aKey->mLength; while (s2 < s2end) { if (*s1++ != *s2++) { return false; @@ -3196,7 +3196,7 @@ gfxFont::CacheHashEntry::KeyEquals(const KeyTypePointer aKey) const NS_ASSERTION((aKey->mFlags & gfxTextRunFactory::TEXT_IS_8BIT) == 0 && !aKey->mTextIs8Bit, "didn't expect 8-bit text here"); return (0 == memcmp(sw->TextUnicode(), aKey->mText.mDouble, - aKey->mLength * sizeof(PRUnichar))); + aKey->mLength * sizeof(char16_t))); } bool @@ -3220,7 +3220,7 @@ gfxFont::ShapeText(gfxContext *aContext, bool gfxFont::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -3259,7 +3259,7 @@ gfxFont::ShapeText(gfxContext *aContext, void gfxFont::PostShapingFixup(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, gfxShapedText *aShapedText) @@ -3299,7 +3299,7 @@ gfxFont::ShapeFragmentWithoutWordCache(gfxContext *aContext, // in the 8-bit case, there are no multi-char clusters, // so we don't need to do this check - if (sizeof(T) == sizeof(PRUnichar)) { + if (sizeof(T) == sizeof(char16_t)) { uint32_t i; for (i = 0; i < BACKTRACK_LIMIT; ++i) { if (aTextRun->IsClusterStart(aOffset + fragLen - i)) { @@ -3396,7 +3396,7 @@ gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext, #endif inline static bool IsChar8Bit(uint8_t /*aCh*/) { return true; } -inline static bool IsChar8Bit(PRUnichar aCh) { return aCh < 0x100; } +inline static bool IsChar8Bit(char16_t aCh) { return aCh < 0x100; } template bool @@ -3493,7 +3493,7 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, // in the 8-bit version of this method, TEXT_IS_8BIT was // already set as part of |flags|, so no need for a per-word // adjustment here - if (sizeof(T) == sizeof(PRUnichar)) { + if (sizeof(T) == sizeof(char16_t)) { if (wordIs8Bit) { wordFlags |= gfxTextRunFactory::TEXT_IS_8BIT; } @@ -4232,7 +4232,7 @@ gfxFontGroup::IsInvalidChar(uint8_t ch) } bool -gfxFontGroup::IsInvalidChar(PRUnichar ch) +gfxFontGroup::IsInvalidChar(char16_t ch) { // All printable 7-bit ASCII values are OK if (ch >= ' ' && ch < 0x7f) { @@ -4290,9 +4290,9 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies, FontCreationCallback fc, void *closure) { - const PRUnichar kSingleQuote = PRUnichar('\''); - const PRUnichar kDoubleQuote = PRUnichar('\"'); - const PRUnichar kComma = PRUnichar(','); + const char16_t kSingleQuote = char16_t('\''); + const char16_t kDoubleQuote = char16_t('\"'); + const char16_t kComma = char16_t(','); nsIAtom *groupAtom = nullptr; nsAutoCString groupString; @@ -4311,7 +4311,7 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies, groupAtom->ToUTF8String(groupString); nsPromiseFlatString families(aFamilies); - const PRUnichar *p, *p_end; + const char16_t *p, *p_end; families.BeginReading(p); families.EndReading(p_end); nsAutoString family; @@ -4326,10 +4326,10 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies, bool generic; if (*p == kSingleQuote || *p == kDoubleQuote) { // quoted font family - PRUnichar quoteMark = *p; + char16_t quoteMark = *p; if (++p == p_end) return true; - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; // XXX What about CSS character escapes? while (*p != quoteMark) @@ -4345,7 +4345,7 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies, } else { // unquoted font family - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; while (++p != p_end && *p != kComma) /* nothing */ ; @@ -4503,7 +4503,7 @@ gfxFontGroup::MakeHyphenTextRun(gfxContext *aCtx, uint32_t aAppUnitsPerDevUnit) // only use U+2010 if it is supported by the first font in the group; // it's better to use ASCII '-' from the primary font than to fall back to // U+2010 from some other, possibly poorly-matching face - static const PRUnichar hyphen = 0x2010; + static const char16_t hyphen = 0x2010; gfxFont *font = GetFontAt(0); if (font && font->HasCharacter(hyphen)) { return MakeTextRun(&hyphen, 1, aCtx, aAppUnitsPerDevUnit, @@ -4561,7 +4561,7 @@ gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength, } gfxTextRun * -gfxFontGroup::MakeTextRun(const PRUnichar *aString, uint32_t aLength, +gfxFontGroup::MakeTextRun(const char16_t *aString, uint32_t aLength, const Parameters *aParams, uint32_t aFlags) { if (aLength == 0) { @@ -4599,7 +4599,7 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, // we need to do numeral processing even on 8-bit text, // in case we're converting Western to Hindi/Arabic digits int32_t numOption = gfxPlatform::GetPlatform()->GetBidiNumeralOption(); - nsAutoArrayPtr transformedString; + nsAutoArrayPtr transformedString; if (numOption != IBMBIDI_NUMERAL_NOMINAL) { // scan the string for numerals that may need to be transformed; // if we find any, we'll make a local copy here and use that for @@ -4607,13 +4607,13 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, bool prevIsArabic = (aTextRun->GetFlags() & gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR) != 0; for (uint32_t i = 0; i < aLength; ++i) { - PRUnichar origCh = aString[i]; - PRUnichar newCh = HandleNumberInChar(origCh, prevIsArabic, numOption); + char16_t origCh = aString[i]; + char16_t newCh = HandleNumberInChar(origCh, prevIsArabic, numOption); if (newCh != origCh) { if (!transformedString) { - transformedString = new PRUnichar[aLength]; - if (sizeof(T) == sizeof(PRUnichar)) { - memcpy(transformedString.get(), aString, i * sizeof(PRUnichar)); + transformedString = new char16_t[aLength]; + if (sizeof(T) == sizeof(char16_t)) { + memcpy(transformedString.get(), aString, i * sizeof(char16_t)); } else { for (uint32_t j = 0; j < i; ++j) { transformedString[j] = aString[j]; @@ -4663,13 +4663,13 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, InitScriptRun(aContext, aTextRun, aString, 0, aLength, MOZ_SCRIPT_LATIN); } else { - const PRUnichar *textPtr; + const char16_t *textPtr; if (transformedString) { textPtr = transformedString.get(); } else { // typecast to avoid compilation error for the 8-bit version, // even though this is dead code in that case - textPtr = reinterpret_cast(aString); + textPtr = reinterpret_cast(aString); } // split into script runs so that script can potentially influence @@ -4707,7 +4707,7 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, } } - if (sizeof(T) == sizeof(PRUnichar) && aLength > 0) { + if (sizeof(T) == sizeof(char16_t) && aLength > 0) { gfxTextRun::CompressedGlyph *glyph = aTextRun->GetCharacterGlyphs(); if (!glyph->IsSimpleGlyph()) { glyph->SetClusterStart(true); @@ -4795,7 +4795,7 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext, // for 16-bit textruns only, check for surrogate pairs and // special Unicode spaces; omit these checks in 8-bit runs - if (sizeof(T) == sizeof(PRUnichar)) { + if (sizeof(T) == sizeof(char16_t)) { if (NS_IS_HIGH_SURROGATE(ch) && index + 1 < aScriptRunEnd && NS_IS_LOW_SURROGATE(aString[index + 1])) @@ -5042,7 +5042,7 @@ void gfxFontGroup::ComputeRanges(nsTArray& aRanges, uint32_t ch = aString[i]; // in 16-bit case only, check for surrogate pair - if (sizeof(T) == sizeof(PRUnichar)) { + if (sizeof(T) == sizeof(char16_t)) { if ((i + 1 < aLength) && NS_IS_HIGH_SURROGATE(ch) && NS_IS_LOW_SURROGATE(aString[i + 1])) { i++; @@ -5272,7 +5272,7 @@ gfxFontStyle::ParseFontLanguageOverride(const nsString& aLangTag) } uint32_t index, result = 0; for (index = 0; index < aLangTag.Length(); ++index) { - PRUnichar ch = aLangTag[index]; + char16_t ch = aLangTag[index]; if (!nsCRT::IsAscii(ch)) { // valid tags are pure ASCII return NO_FONT_LANGUAGE_OVERRIDE; } @@ -5357,7 +5357,7 @@ gfxFontStyle::ComputeWeight() const void gfxShapedText::SetupClusterBoundaries(uint32_t aOffset, - const PRUnichar *aString, + const char16_t *aString, uint32_t aLength) { CompressedGlyph *glyphs = GetCharacterGlyphs() + aOffset; @@ -5374,7 +5374,7 @@ gfxShapedText::SetupClusterBoundaries(uint32_t aOffset, } while (!iter.AtEnd()) { - if (*iter == PRUnichar(' ')) { + if (*iter == char16_t(' ')) { glyphs->SetIsSpace(); } // advance iter to the next cluster-start (or end of text) @@ -6728,7 +6728,7 @@ gfxTextRun::SetSpaceGlyph(gfxFont *aFont, gfxContext *aContext, bool gfxTextRun::SetSpaceGlyphIfSimple(gfxFont *aFont, gfxContext *aContext, - uint32_t aCharIndex, PRUnichar aSpaceChar) + uint32_t aCharIndex, char16_t aSpaceChar) { uint32_t spaceGlyph = aFont->GetSpaceGlyph(); if (!spaceGlyph || !CompressedGlyph::IsSimpleGlyphID(spaceGlyph)) { diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 9d6c2b44ea23..a52ed1aa5df9 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1325,7 +1325,7 @@ public: // aShapedText. Parameters aOffset/aLength indicate the range of // aShapedText to be updated; aLength is also the length of aText. virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -1837,7 +1837,7 @@ protected: // Call the appropriate shaper to generate glyphs for aText and store // them into aShapedText. virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -1848,7 +1848,7 @@ protected: // in the shaped text; implementations of ShapeText should call this // after glyph shaping has been completed. void PostShapingFixup(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, // position within aShapedText uint32_t aLength, gfxShapedText *aShapedText); @@ -1894,7 +1894,7 @@ protected: struct CacheHashKey { union { const uint8_t *mSingle; - const PRUnichar *mDouble; + const char16_t *mDouble; } mText; uint32_t mLength; uint32_t mFlags; @@ -1920,7 +1920,7 @@ protected: mText.mSingle = aText; } - CacheHashKey(const PRUnichar *aText, uint32_t aLength, + CacheHashKey(const char16_t *aText, uint32_t aLength, uint32_t aStringHash, int32_t aScriptCode, int32_t aAppUnitsPerDevUnit, uint32_t aFlags) @@ -2345,7 +2345,7 @@ public: // based on the Unicode properties of the text in aString. // This is also responsible to set the IsSpace flag for space characters. void SetupClusterBoundaries(uint32_t aOffset, - const PRUnichar *aString, + const char16_t *aString, uint32_t aLength); // In 8-bit text, there won't actually be any clusters, but we still need // the space-marking functionality. @@ -2510,7 +2510,7 @@ protected: nsAutoPtr mDetailedGlyphs; - // Number of PRUnichar characters and CompressedGlyph glyph records + // Number of char16_t characters and CompressedGlyph glyph records uint32_t mLength; // Shaping flags (direction, ligature-suppression) @@ -2560,7 +2560,7 @@ public: aAppUnitsPerDevUnit, aFlags); } - static gfxShapedWord* Create(const PRUnichar *aText, uint32_t aLength, + static gfxShapedWord* Create(const char16_t *aText, uint32_t aLength, int32_t aRunScript, int32_t aAppUnitsPerDevUnit, uint32_t aFlags) { @@ -2580,7 +2580,7 @@ public: uint32_t size = offsetof(gfxShapedWord, mCharGlyphsStorage) + - aLength * (sizeof(CompressedGlyph) + sizeof(PRUnichar)); + aLength * (sizeof(CompressedGlyph) + sizeof(char16_t)); void *storage = moz_malloc(size); if (!storage) { return nullptr; @@ -2605,15 +2605,15 @@ public: return reinterpret_cast(mCharGlyphsStorage + GetLength()); } - const PRUnichar* TextUnicode() const { + const char16_t* TextUnicode() const { NS_ASSERTION(!TextIs8Bit(), "invalid use of TextUnicode()"); - return reinterpret_cast(mCharGlyphsStorage + GetLength()); + return reinterpret_cast(mCharGlyphsStorage + GetLength()); } - PRUnichar GetCharAt(uint32_t aOffset) const { + char16_t GetCharAt(uint32_t aOffset) const { NS_ASSERTION(aOffset < GetLength(), "aOffset out of range"); return TextIs8Bit() ? - PRUnichar(Text8Bit()[aOffset]) : TextUnicode()[aOffset]; + char16_t(Text8Bit()[aOffset]) : TextUnicode()[aOffset]; } int32_t Script() const { @@ -2645,7 +2645,7 @@ private: memcpy(text, aText, aLength * sizeof(uint8_t)); } - gfxShapedWord(const PRUnichar *aText, uint32_t aLength, + gfxShapedWord(const char16_t *aText, uint32_t aLength, int32_t aRunScript, int32_t aAppUnitsPerDevUnit, uint32_t aFlags) : gfxShapedText(aLength, aFlags, aAppUnitsPerDevUnit) @@ -2653,8 +2653,8 @@ private: , mAgeCounter(0) { memset(mCharGlyphsStorage, 0, aLength * sizeof(CompressedGlyph)); - PRUnichar *text = reinterpret_cast(&mCharGlyphsStorage[aLength]); - memcpy(text, aText, aLength * sizeof(PRUnichar)); + char16_t *text = reinterpret_cast(&mCharGlyphsStorage[aLength]); + memcpy(text, aText, aLength * sizeof(char16_t)); SetupClusterBoundaries(0, aText, aLength); } @@ -3130,7 +3130,7 @@ public: // if it returns false, the caller needs to fall back to some other // means to create the necessary (detailed) glyph data. bool SetSpaceGlyphIfSimple(gfxFont *aFont, gfxContext *aContext, - uint32_t aCharIndex, PRUnichar aSpaceChar); + uint32_t aCharIndex, char16_t aSpaceChar); // Record the positions of specific characters that layout may need to // detect in the textrun, even though it doesn't have an explicit copy @@ -3397,7 +3397,7 @@ public: * when creating textruns. */ static bool IsInvalidChar(uint8_t ch); - static bool IsInvalidChar(PRUnichar ch); + static bool IsInvalidChar(char16_t ch); /** * Make a textrun for a given string. @@ -3405,7 +3405,7 @@ public: * textrun will copy it. * This calls FetchGlyphExtents on the textrun. */ - virtual gfxTextRun *MakeTextRun(const PRUnichar *aString, uint32_t aLength, + virtual gfxTextRun *MakeTextRun(const char16_t *aString, uint32_t aLength, const Parameters *aParams, uint32_t aFlags); /** * Make a textrun for a given string. diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp index c4fd5a9c17e3..cf25821ae61a 100644 --- a/gfx/thebes/gfxFontUtils.cpp +++ b/gfx/thebes/gfxFontUtils.cpp @@ -516,7 +516,7 @@ typedef struct { #pragma pack() uint32_t -gfxFontUtils::MapCharToGlyphFormat4(const uint8_t *aBuf, PRUnichar aCh) +gfxFontUtils::MapCharToGlyphFormat4(const uint8_t *aBuf, char16_t aCh) { const Format4Cmap *cmap4 = reinterpret_cast(aBuf); uint16_t segCount; @@ -680,7 +680,7 @@ gfxFontUtils::MapCharToGlyph(const uint8_t *aCmapBuf, uint32_t aBufLength, switch (format) { case 4: gid = aUnicode < UNICODE_BMP_LIMIT ? - MapCharToGlyphFormat4(aCmapBuf + offset, PRUnichar(aUnicode)) : 0; + MapCharToGlyphFormat4(aCmapBuf + offset, char16_t(aUnicode)) : 0; break; case 12: gid = MapCharToGlyphFormat12(aCmapBuf + offset, aUnicode); @@ -706,7 +706,7 @@ gfxFontUtils::MapCharToGlyph(const uint8_t *aCmapBuf, uint32_t aBufLength, void gfxFontUtils::GetPrefsFontList(const char *aPrefName, nsTArray& aFontList) { - const PRUnichar kComma = PRUnichar(','); + const char16_t kComma = char16_t(','); aFontList.Clear(); @@ -718,12 +718,12 @@ void gfxFontUtils::GetPrefsFontList(const char *aPrefName, nsTArray& a // append each font name to the list nsAutoString fontname; - const PRUnichar *p, *p_end; + const char16_t *p, *p_end; fontlistValue.BeginReading(p); fontlistValue.EndReading(p_end); while (p < p_end) { - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; while (++p != p_end && *p != kComma) /* nothing */ ; @@ -860,7 +860,7 @@ gfxFontUtils::RenameFont(const nsAString& aName, const uint8_t *aFontData, uint16_t nameCount = ArrayLength(neededNameIDs); // leave room for null-terminator - uint16_t nameStrLength = (aName.Length() + 1) * sizeof(PRUnichar); + uint16_t nameStrLength = (aName.Length() + 1) * sizeof(char16_t); // round name table size up to 4-byte multiple uint32_t nameTableSize = (sizeof(NameHeader) + @@ -913,7 +913,7 @@ gfxFontUtils::RenameFont(const nsAString& aName, const uint8_t *aFontData, } // -- string data, located after the name records, stored in big-endian form - PRUnichar *strData = reinterpret_cast(nameRecord); + char16_t *strData = reinterpret_cast(nameRecord); mozilla::NativeEndian::copyAndSwapToBigEndian(strData, aName.BeginReading(), @@ -1289,7 +1289,7 @@ gfxFontUtils::DecodeFontName(const char *aNameData, int32_t aByteLen, CopySwapUTF16(reinterpret_cast(aNameData), reinterpret_cast(aName.BeginWriting()), strLen); #else - aName.Assign(reinterpret_cast(aNameData), strLen); + aName.Assign(reinterpret_cast(aNameData), strLen); #endif return true; } @@ -1426,7 +1426,7 @@ NS_IMPL_ISUPPORTS1(gfxFontInfoLoader::ShutdownObserver, nsIObserver) NS_IMETHODIMP gfxFontInfoLoader::ShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!nsCRT::strcmp(aTopic, "quit-application")) { mLoader->CancelLoader(); diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index ab10b83c590d..00649bedd6f9 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -779,7 +779,7 @@ public: bool& aUnicodeFont, bool& aSymbolFont); static uint32_t - MapCharToGlyphFormat4(const uint8_t *aBuf, PRUnichar aCh); + MapCharToGlyphFormat4(const uint8_t *aBuf, char16_t aCh); static uint32_t MapCharToGlyphFormat12(const uint8_t *aBuf, uint32_t aCh); @@ -884,7 +884,7 @@ public: kUnicodeRLO = 0x202E }; - static inline bool PotentialRTLChar(PRUnichar aCh) { + static inline bool PotentialRTLChar(char16_t aCh) { if (aCh >= kUnicodeBidiScriptsStart && aCh <= kUnicodeBidiScriptsEnd) // bidi scripts Hebrew, Arabic, Syriac, Thaana, N'Ko are all encoded together return true; diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index 4fcecaa4ce95..d9e3ddf5942d 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -113,7 +113,7 @@ UseUniscribe(gfxShapedText *aShapedText, bool gfxGDIFont::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -363,7 +363,7 @@ gfxGDIFont::Initialize() const MAT2 kIdentityMatrix = { {0, 1}, {0, 0}, {0, 0}, {0, 1} }; GLYPHMETRICS gm; - DWORD len = GetGlyphOutlineW(dc.GetDC(), PRUnichar('x'), GGO_METRICS, &gm, 0, nullptr, &kIdentityMatrix); + DWORD len = GetGlyphOutlineW(dc.GetDC(), char16_t('x'), GGO_METRICS, &gm, 0, nullptr, &kIdentityMatrix); if (len == GDI_ERROR || gm.gmptGlyphOrigin.y <= 0) { // 56% of ascent, best guess for true type mMetrics->xHeight = diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index b98e4d57869b..4ce3854944bf 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -66,7 +66,7 @@ protected: /* override to check for uniscribe failure and fall back to GDI */ virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 25e0f3a5129d..09613402039d 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -393,7 +393,7 @@ GDIFontEntry::InitLogFont(const nsAString& aName, mLogFont.lfWeight = mWeight; int len = std::min(aName.Length(), LF_FACESIZE - 1); - memcpy(&mLogFont.lfFaceName, aName.BeginReading(), len * sizeof(PRUnichar)); + memcpy(&mLogFont.lfFaceName, aName.BeginReading(), len * sizeof(char16_t)); mLogFont.lfFaceName[len] = '\0'; } @@ -526,7 +526,7 @@ GDIFontFamily::FindStyleVariations() logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfPitchAndFamily = 0; uint32_t l = std::min(mName.Length(), LF_FACESIZE - 1); - memcpy(logFont.lfFaceName, mName.get(), l * sizeof(PRUnichar)); + memcpy(logFont.lfFaceName, mName.get(), l * sizeof(char16_t)); EnumFontFamiliesExW(hdc, &logFont, (FONTENUMPROCW)GDIFontFamily::FamilyAddStylesProc, @@ -573,7 +573,7 @@ gfxGDIFontList::gfxGDIFontList() static void RemoveCharsetFromFontSubstitute(nsAString &aName) { - int32_t comma = aName.FindChar(PRUnichar(',')); + int32_t comma = aName.FindChar(char16_t(',')); if (comma >= 0) aName.Truncate(comma); } @@ -612,8 +612,8 @@ gfxGDIFontList::GetFontSubstitutes() continue; } - nsAutoString substituteName((PRUnichar*) aliasName); - nsAutoString actualFontName((PRUnichar*) actualName); + nsAutoString substituteName((char16_t*) aliasName); + nsAutoString actualFontName((char16_t*) actualName); RemoveCharsetFromFontSubstitute(substituteName); BuildKeyNameFromFontName(substituteName); RemoveCharsetFromFontSubstitute(actualFontName); diff --git a/gfx/thebes/gfxGDIShaper.cpp b/gfx/thebes/gfxGDIShaper.cpp index ed0787631dbe..2ff5925d6222 100644 --- a/gfx/thebes/gfxGDIShaper.cpp +++ b/gfx/thebes/gfxGDIShaper.cpp @@ -15,7 +15,7 @@ bool gfxGDIShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxGDIShaper.h b/gfx/thebes/gfxGDIShaper.h index 839b203aaad0..0bfc812b5be3 100644 --- a/gfx/thebes/gfxGDIShaper.h +++ b/gfx/thebes/gfxGDIShaper.h @@ -23,7 +23,7 @@ public: } virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxGraphiteShaper.cpp b/gfx/thebes/gfxGraphiteShaper.cpp index c15ae02babfb..3594d44b9932 100644 --- a/gfx/thebes/gfxGraphiteShaper.cpp +++ b/gfx/thebes/gfxGraphiteShaper.cpp @@ -83,7 +83,7 @@ AddFeature(const uint32_t& aTag, uint32_t& aValue, void *aUserArg) bool gfxGraphiteShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -183,7 +183,7 @@ gfxGraphiteShaper::SetGlyphsFromSegment(gfxContext *aContext, gfxShapedText *aShapedText, uint32_t aOffset, uint32_t aLength, - const PRUnichar *aText, + const char16_t *aText, gr_segment *aSegment) { int32_t dev2appUnits = aShapedText->GetAppUnitsPerDevUnit(); diff --git a/gfx/thebes/gfxGraphiteShaper.h b/gfx/thebes/gfxGraphiteShaper.h index 371e41bf33f4..b6cdfcfab78f 100644 --- a/gfx/thebes/gfxGraphiteShaper.h +++ b/gfx/thebes/gfxGraphiteShaper.h @@ -18,7 +18,7 @@ public: virtual ~gfxGraphiteShaper(); virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -31,7 +31,7 @@ protected: gfxShapedText *aShapedText, uint32_t aOffset, uint32_t aLength, - const PRUnichar *aText, + const char16_t *aText, gr_segment *aSegment); static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid); diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index a9acb9db66ac..c8cbb2070cad 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -646,7 +646,7 @@ HBGetEastAsianWidth(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, // Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; // note that some letters do not have a dagesh presForm encoded -static const PRUnichar sDageshForms[0x05EA - 0x05D0 + 1] = { +static const char16_t sDageshForms[0x05EA - 0x05D0 + 1] = { 0xFB30, // ALEF 0xFB31, // BET 0xFB32, // GIMEL @@ -799,7 +799,7 @@ static hb_unicode_funcs_t * sHBUnicodeFuncs = nullptr; bool gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -990,7 +990,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, gfxShapedText *aShapedText, uint32_t aOffset, uint32_t aLength, - const PRUnichar *aText, + const char16_t *aText, hb_buffer_t *aBuffer) { uint32_t numGlyphs; diff --git a/gfx/thebes/gfxHarfBuzzShaper.h b/gfx/thebes/gfxHarfBuzzShaper.h index 610830bb5610..f5325f77291c 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.h +++ b/gfx/thebes/gfxHarfBuzzShaper.h @@ -25,7 +25,7 @@ public: }; virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -50,7 +50,7 @@ protected: gfxShapedText *aShapedText, uint32_t aOffset, uint32_t aLength, - const PRUnichar *aText, + const char16_t *aText, hb_buffer_t *aBuffer); // retrieve glyph positions, applying advance adjustments and attachments diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index da6a79b3771a..56a34f73638a 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -127,7 +127,7 @@ gfxMacFont::~gfxMacFont() bool gfxMacFont::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -336,7 +336,7 @@ gfxMacFont::InitMetrics() } gfxFloat -gfxMacFont::GetCharWidth(CFDataRef aCmap, PRUnichar aUniChar, +gfxMacFont::GetCharWidth(CFDataRef aCmap, char16_t aUniChar, uint32_t *aGlyphID, gfxFloat aConvFactor) { CGGlyph glyph = 0; diff --git a/gfx/thebes/gfxMacFont.h b/gfx/thebes/gfxMacFont.h index e352d43ef0e1..0e88c5d0f06b 100644 --- a/gfx/thebes/gfxMacFont.h +++ b/gfx/thebes/gfxMacFont.h @@ -55,7 +55,7 @@ protected: // override to prefer CoreText shaping with fonts that depend on AAT virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -67,7 +67,7 @@ protected: // Get width and glyph ID for a character; uses aConvFactor // to convert font units as returned by CG to actual dimensions - gfxFloat GetCharWidth(CFDataRef aCmap, PRUnichar aUniChar, + gfxFloat GetCharWidth(CFDataRef aCmap, char16_t aUniChar, uint32_t *aGlyphID, gfxFloat aConvFactor); // a weak reference to the CoreGraphics font: this is owned by the diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index bbeb91a44129..9ba32feed547 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -851,7 +851,7 @@ gfxMacPlatformFontList::GlobalFontFallback(const uint32_t aCh, ::CFStringGetCharacters(familyName, ::CFRangeMake(0, len), buffer.Elements()); buffer[len] = 0; - nsDependentString familyName(reinterpret_cast(buffer.Elements()), len); + nsDependentString familyName(reinterpret_cast(buffer.Elements()), len); bool needsBold; // ignored in the system fallback case diff --git a/gfx/thebes/gfxOS2Fonts.cpp b/gfx/thebes/gfxOS2Fonts.cpp index 97297aaea78e..c773ceebf3a9 100644 --- a/gfx/thebes/gfxOS2Fonts.cpp +++ b/gfx/thebes/gfxOS2Fonts.cpp @@ -547,12 +547,12 @@ gfxFontGroup *gfxOS2FontGroup::Copy(const gfxFontStyle *aStyle) */ static int32_t AppendDirectionalIndicatorUTF8(bool aIsRTL, nsACString& aString) { - static const PRUnichar overrides[2][2] = { { 0x202d, 0 }, { 0x202e, 0 }}; // LRO, RLO + static const char16_t overrides[2][2] = { { 0x202d, 0 }, { 0x202e, 0 }}; // LRO, RLO AppendUTF16toUTF8(overrides[aIsRTL], aString); return 3; // both overrides map to 3 bytes in UTF8 } -gfxTextRun *gfxOS2FontGroup::MakeTextRun(const PRUnichar* aString, uint32_t aLength, +gfxTextRun *gfxOS2FontGroup::MakeTextRun(const char16_t* aString, uint32_t aLength, const Parameters* aParams, uint32_t aFlags) { NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text"); @@ -568,7 +568,7 @@ gfxTextRun *gfxOS2FontGroup::MakeTextRun(const PRUnichar* aString, uint32_t aLen #ifdef DEBUG_thebes_2 NS_ConvertUTF8toUTF16 u16(utf8); - printf("gfxOS2FontGroup[%#x]::MakeTextRun(PRUnichar %s, %d, %#x, %d)\n", + printf("gfxOS2FontGroup[%#x]::MakeTextRun(char16_t %s, %d, %#x, %d)\n", (unsigned)this, NS_LossyConvertUTF16toASCII(u16).get(), aLength, (unsigned)aParams, aFlags); #endif diff --git a/gfx/thebes/gfxOS2Fonts.h b/gfx/thebes/gfxOS2Fonts.h index b353c4770044..6cadb6a5d8fa 100644 --- a/gfx/thebes/gfxOS2Fonts.h +++ b/gfx/thebes/gfxOS2Fonts.h @@ -67,7 +67,7 @@ public: virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle); // create and initialize the textRun using FreeType font - virtual gfxTextRun *MakeTextRun(const PRUnichar* aString, uint32_t aLength, + virtual gfxTextRun *MakeTextRun(const char16_t* aString, uint32_t aLength, const Parameters* aParams, uint32_t aFlags); virtual gfxTextRun *MakeTextRun(const uint8_t* aString, uint32_t aLength, const Parameters* aParams, uint32_t aFlags); diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp index 56dd8eb864cb..2fa5fd079481 100644 --- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -662,14 +662,14 @@ public: protected: virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, gfxShapedText *aShapedText, bool aPreferPlatformShaping); - bool InitGlyphRunWithPango(const PRUnichar *aString, + bool InitGlyphRunWithPango(const char16_t *aString, uint32_t aOffset, uint32_t aLength, int32_t aScript, @@ -1631,7 +1631,7 @@ gfxFcFont::~gfxFcFont() bool gfxFcFont::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 741ea3cc4696..7c5da58a6276 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -140,7 +140,7 @@ NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference) NS_IMETHODIMP SRGBOverrideObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { NS_ASSERTION(NS_strcmp(someData, MOZ_UTF16("gfx.color_mangement.force_srgb")), @@ -183,7 +183,7 @@ NS_IMPL_ISUPPORTS1(FontPrefsObserver, nsIObserver) NS_IMETHODIMP FontPrefsObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!someData) { NS_ERROR("font pref observer code broken"); @@ -207,7 +207,7 @@ NS_IMPL_ISUPPORTS1(OrientationSyncPrefsObserver, nsIObserver) NS_IMETHODIMP OrientationSyncPrefsObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!someData) { NS_ERROR("orientation sync pref observer broken"); @@ -231,7 +231,7 @@ NS_IMPL_ISUPPORTS1(MemoryPressureObserver, nsIObserver) NS_IMETHODIMP MemoryPressureObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { NS_ASSERTION(strcmp(aTopic, "memory-pressure") == 0, "unexpected event topic"); Factory::PurgeAllCaches(); @@ -1871,7 +1871,7 @@ static void MigratePrefs() // default SetupClusterBoundaries, based on Unicode properties; // platform subclasses may override if they wish void -gfxPlatform::SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aString) +gfxPlatform::SetupClusterBoundaries(gfxTextRun *aTextRun, const char16_t *aString) { if (aTextRun->GetFlags() & gfxTextRunFactory::TEXT_IS_8BIT) { // 8-bit text doesn't have clusters. diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 2ba4391ea171..b3954ab3df80 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -296,7 +296,7 @@ public: * Font bits */ - virtual void SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aString); + virtual void SetupClusterBoundaries(gfxTextRun *aTextRun, const char16_t *aString); /** * Fill aListOfFonts with the results of querying the list of font names diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 0d301ee30aff..bf19e21ad848 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -66,7 +66,7 @@ NS_IMPL_ISUPPORTS1(gfxFontListPrefObserver, nsIObserver) NS_IMETHODIMP gfxFontListPrefObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID), "invalid topic"); // XXX this could be made to only clear out the cache for the prefs that were changed diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp index 4a7d35c5c776..2818a6748b32 100644 --- a/gfx/thebes/gfxSVGGlyphs.cpp +++ b/gfx/thebes/gfxSVGGlyphs.cpp @@ -425,7 +425,7 @@ gfxSVGGlyphsDocument::InsertGlyphId(Element *aGlyphElement) uint32_t id = 0; for (uint32_t i = glyphPrefixLength; i < glyphIdStr.Length(); ++i) { - PRUnichar ch = glyphIdStr.CharAt(i); + char16_t ch = glyphIdStr.CharAt(i); if (ch < '0' || ch > '9') { return; } diff --git a/gfx/thebes/gfxScriptItemizer.cpp b/gfx/thebes/gfxScriptItemizer.cpp index 9ca632a23fb4..3ca2581b1758 100644 --- a/gfx/thebes/gfxScriptItemizer.cpp +++ b/gfx/thebes/gfxScriptItemizer.cpp @@ -124,14 +124,14 @@ HasMirroredChar(uint32_t aCh) return GetCharProps1(aCh).mMirrorOffsetIndex != 0; } -gfxScriptItemizer::gfxScriptItemizer(const PRUnichar *src, uint32_t length) +gfxScriptItemizer::gfxScriptItemizer(const char16_t *src, uint32_t length) : textPtr(src), textLength(length) { reset(); } void -gfxScriptItemizer::SetText(const PRUnichar *src, uint32_t length) +gfxScriptItemizer::SetText(const char16_t *src, uint32_t length) { textPtr = src; textLength = length; diff --git a/gfx/thebes/gfxScriptItemizer.h b/gfx/thebes/gfxScriptItemizer.h index 618cfbb0766f..def77663ed2b 100644 --- a/gfx/thebes/gfxScriptItemizer.h +++ b/gfx/thebes/gfxScriptItemizer.h @@ -58,9 +58,9 @@ class gfxScriptItemizer { public: - gfxScriptItemizer(const PRUnichar *src, uint32_t length); + gfxScriptItemizer(const char16_t *src, uint32_t length); - void SetText(const PRUnichar *src, uint32_t length); + void SetText(const char16_t *src, uint32_t length); bool Next(uint32_t& aRunStart, uint32_t& aRunLimit, int32_t& aRunScript); @@ -84,7 +84,7 @@ protected: int32_t scriptCode; }; - const PRUnichar *textPtr; + const char16_t *textPtr; uint32_t textLength; uint32_t scriptStart; diff --git a/gfx/thebes/gfxUniscribeShaper.cpp b/gfx/thebes/gfxUniscribeShaper.cpp index 7f3e8dd40e29..2a5fbecfda98 100644 --- a/gfx/thebes/gfxUniscribeShaper.cpp +++ b/gfx/thebes/gfxUniscribeShaper.cpp @@ -33,7 +33,7 @@ class UniscribeItem public: UniscribeItem(gfxContext *aContext, HDC aDC, gfxUniscribeShaper *aShaper, - const PRUnichar *aString, uint32_t aLength, + const char16_t *aString, uint32_t aLength, SCRIPT_ITEM *aItem, uint32_t aIVS) : mContext(aContext), mDC(aDC), mShaper(aShaper), @@ -320,14 +320,14 @@ private: void GenerateAlternativeString() { if (mAlternativeString) free(mAlternativeString); - mAlternativeString = (PRUnichar *)malloc(mItemLength * sizeof(PRUnichar)); + mAlternativeString = (char16_t *)malloc(mItemLength * sizeof(char16_t)); if (!mAlternativeString) return; memcpy((void *)mAlternativeString, (const void *)mItemString, - mItemLength * sizeof(PRUnichar)); + mItemLength * sizeof(char16_t)); for (uint32_t i = 0; i < mItemLength; i++) { if (NS_IS_HIGH_SURROGATE(mItemString[i]) || NS_IS_LOW_SURROGATE(mItemString[i])) - mAlternativeString[i] = PRUnichar(0xFFFD); + mAlternativeString[i] = char16_t(0xFFFD); } } @@ -341,11 +341,11 @@ private: public: // these point to the full string/length of the item - const PRUnichar *mItemString; + const char16_t *mItemString; const uint32_t mItemLength; private: - PRUnichar *mAlternativeString; + char16_t *mAlternativeString; #define AVERAGE_ITEM_LENGTH 40 @@ -368,7 +368,7 @@ private: class Uniscribe { public: - Uniscribe(const PRUnichar *aString, + Uniscribe(const char16_t *aString, gfxShapedText *aShapedText, uint32_t aOffset, uint32_t aLength): mString(aString), mShapedText(aShapedText), @@ -431,7 +431,7 @@ private: bool gfxUniscribeShaper::ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxUniscribeShaper.h b/gfx/thebes/gfxUniscribeShaper.h index d1f4d8d459e0..a694b5961edd 100644 --- a/gfx/thebes/gfxUniscribeShaper.h +++ b/gfx/thebes/gfxUniscribeShaper.h @@ -29,7 +29,7 @@ public: } virtual bool ShapeText(gfxContext *aContext, - const PRUnichar *aText, + const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index d47a8c42bdd2..c72350f96c35 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -829,7 +829,7 @@ gfxUserFontSet::UserFontCache::Entry::DisconnectSVG(Entry* aEntry, NS_IMETHODIMP gfxUserFontSet::UserFontCache::Flusher::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!sUserFonts) { return NS_OK; diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 25ff9f942a6d..548c698a26aa 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -767,7 +767,7 @@ gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup, static void RemoveCharsetFromFontSubstitute(nsAString &aName) { - int32_t comma = aName.FindChar(PRUnichar(',')); + int32_t comma = aName.FindChar(char16_t(',')); if (comma >= 0) aName.Truncate(comma); } diff --git a/hal/HalWakeLock.cpp b/hal/HalWakeLock.cpp index 81615950876b..b4d6c8f8e16f 100644 --- a/hal/HalWakeLock.cpp +++ b/hal/HalWakeLock.cpp @@ -105,7 +105,7 @@ public: NS_IMPL_ISUPPORTS1(ClearHashtableOnShutdown, nsIObserver) NS_IMETHODIMP -ClearHashtableOnShutdown::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* data) +ClearHashtableOnShutdown::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* data) { MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown")); @@ -124,7 +124,7 @@ public: NS_IMPL_ISUPPORTS1(CleanupOnContentShutdown, nsIObserver) NS_IMETHODIMP -CleanupOnContentShutdown::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* data) +CleanupOnContentShutdown::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* data) { MOZ_ASSERT(!strcmp(aTopic, "ipc:content-shutdown")); diff --git a/hal/cocoa/CocoaBattery.cpp b/hal/cocoa/CocoaBattery.cpp index 4f0a0f24b7eb..dec1c655d4dc 100644 --- a/hal/cocoa/CocoaBattery.cpp +++ b/hal/cocoa/CocoaBattery.cpp @@ -111,7 +111,7 @@ struct SingletonDestroyer MOZ_FINAL : public nsIObserver NS_IMPL_ISUPPORTS1(SingletonDestroyer, nsIObserver) NS_IMETHODIMP -SingletonDestroyer::Observe(nsISupports*, const char* aTopic, const PRUnichar*) +SingletonDestroyer::Observe(nsISupports*, const char* aTopic, const char16_t*) { MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown")); MacPowerInformationService::Shutdown(); diff --git a/hal/gonk/GonkHal.cpp b/hal/gonk/GonkHal.cpp index 64049694ec2a..7a4b048c5804 100644 --- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -190,7 +190,7 @@ VibratorRunnable::Run() NS_IMETHODIMP VibratorRunnable::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { MOZ_ASSERT(strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0); MonitorAutoLock lock(mMonitor); diff --git a/hal/windows/WindowsGamepad.cpp b/hal/windows/WindowsGamepad.cpp index 0d929c71571d..ae8266165a4b 100644 --- a/hal/windows/WindowsGamepad.cpp +++ b/hal/windows/WindowsGamepad.cpp @@ -611,7 +611,7 @@ WindowsGamepadService::DevicesChanged(DeviceChangeType type) { NS_IMETHODIMP Observer::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) { + const char16_t* aData) { if (strcmp(aTopic, "timer-callback") == 0) { mSvc.DevicesChanged(WindowsGamepadService::DeviceChangeStable); } else if (strcmp(aTopic, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID) == 0) { diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index b3f80d61da86..4c14e303dc36 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -3134,7 +3134,7 @@ RasterImage::DecodePool::~DecodePool() NS_IMETHODIMP RasterImage::DecodePool::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { NS_ASSERTION(strcmp(topic, "xpcom-shutdown-threads") == 0, "oops"); diff --git a/image/src/SVGDocumentWrapper.cpp b/image/src/SVGDocumentWrapper.cpp index 3fcd869d7bde..a6a14a75f915 100644 --- a/image/src/SVGDocumentWrapper.cpp +++ b/image/src/SVGDocumentWrapper.cpp @@ -274,7 +274,7 @@ SVGDocumentWrapper::OnStopRequest(nsIRequest* aRequest, nsISupports* ctxt, NS_IMETHODIMP SVGDocumentWrapper::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { // Sever ties from rendering observers to helper-doc's root SVG node diff --git a/image/src/SurfaceCache.cpp b/image/src/SurfaceCache.cpp index 91ce1a5bdd3c..4d2f13ca4a7d 100644 --- a/image/src/SurfaceCache.cpp +++ b/image/src/SurfaceCache.cpp @@ -410,7 +410,7 @@ private: virtual ~MemoryPressureObserver() { } - NS_IMETHOD Observe(nsISupports*, const char* aTopic, const PRUnichar*) + NS_IMETHOD Observe(nsISupports*, const char* aTopic, const char16_t*) { if (sInstance && strcmp(aTopic, "memory-pressure") == 0) { sInstance->DiscardAll(); diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 3bf3e7de20ad..94cd64307f12 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -242,7 +242,7 @@ NS_IMETHODIMP nsProgressNotificationProxy::OnStatus(nsIRequest* request, nsISupports* ctxt, nsresult status, - const PRUnichar* statusArg) + const char16_t* statusArg) { nsCOMPtr loadGroup; request->GetLoadGroup(getter_AddRefs(loadGroup)); @@ -664,7 +664,7 @@ public: NS_IMPL_ISUPPORTS1(imgCacheObserver, nsIObserver) NS_IMETHODIMP -imgCacheObserver::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aSomeData) +imgCacheObserver::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aSomeData) { if (strcmp(aTopic, "memory-pressure") == 0) { DiscardTracker::DiscardAll(); @@ -861,7 +861,7 @@ imgLoader::RespectPrivacyNotifications() } NS_IMETHODIMP -imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) +imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { // We listen for pref change notifications... if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { diff --git a/intl/chardet/tools/GenCyrillicClass.cpp b/intl/chardet/tools/GenCyrillicClass.cpp index f52cf5b4cfd1..f8c4946ed3bf 100644 --- a/intl/chardet/tools/GenCyrillicClass.cpp +++ b/intl/chardet/tools/GenCyrillicClass.cpp @@ -52,7 +52,7 @@ static nsICharsetConverterManager* gCCM = nullptr; //--------------------------------------------------------------------------- uint8_t CyrillicClass(nsIUnicodeDecoder* decoder, uint8_t byte) { - PRUnichar ubuf[2]; + char16_t ubuf[2]; uint8_t bbuf[2]; int32_t blen = 1; diff --git a/intl/hyphenation/src/nsHyphenationManager.cpp b/intl/hyphenation/src/nsHyphenationManager.cpp index 1865b87d90bb..f6424e8b57c6 100644 --- a/intl/hyphenation/src/nsHyphenationManager.cpp +++ b/intl/hyphenation/src/nsHyphenationManager.cpp @@ -33,7 +33,7 @@ NS_IMPL_ISUPPORTS1(nsHyphenationManager::MemoryPressureObserver, NS_IMETHODIMP nsHyphenationManager::MemoryPressureObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, kMemoryPressureNotification)) { // We don't call Instance() here, as we don't want to create a hyphenation diff --git a/intl/hyphenation/src/nsHyphenator.cpp b/intl/hyphenation/src/nsHyphenator.cpp index 932dfa1cc666..815e14a4117b 100644 --- a/intl/hyphenation/src/nsHyphenator.cpp +++ b/intl/hyphenation/src/nsHyphenator.cpp @@ -80,7 +80,7 @@ nsHyphenator::Hyphenate(const nsAString& aString, } if (inWord) { - const PRUnichar *begin = aString.BeginReading(); + const char16_t *begin = aString.BeginReading(); NS_ConvertUTF16toUTF8 utf8(begin + wordStart, wordLimit - wordStart); nsAutoTArray utf8hyphens; @@ -98,8 +98,8 @@ nsHyphenator::Hyphenate(const nsAString& aString, // string directly) to Unicode character indexing. // We then need to convert this to utf16 code unit offsets for Gecko. const char *hyphPtr = utf8hyphens.Elements(); - const PRUnichar *cur = begin + wordStart; - const PRUnichar *end = begin + wordLimit; + const char16_t *cur = begin + wordStart; + const char16_t *end = begin + wordLimit; while (cur < end) { if (*hyphPtr & 0x01) { aHyphens[cur - begin] = true; diff --git a/intl/locale/src/mac/nsDateTimeFormatMac.cpp b/intl/locale/src/mac/nsDateTimeFormatMac.cpp index 55d8780bd063..761a8e3fcfb4 100644 --- a/intl/locale/src/mac/nsDateTimeFormatMac.cpp +++ b/intl/locale/src/mac/nsDateTimeFormatMac.cpp @@ -221,7 +221,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale, nsAutoTArray stringBuffer; if (stringBuffer.SetLength(stringLen + 1)) { CFStringGetCharacters(formattedDate, CFRangeMake(0, stringLen), stringBuffer.Elements()); - stringOut.Assign(reinterpret_cast(stringBuffer.Elements()), stringLen); + stringOut.Assign(reinterpret_cast(stringBuffer.Elements()), stringLen); } CFRelease(formattedDate); diff --git a/intl/locale/src/nsCollation.cpp b/intl/locale/src/nsCollation.cpp index e6b4a83558ea..e5710424c59a 100644 --- a/intl/locale/src/nsCollation.cpp +++ b/intl/locale/src/nsCollation.cpp @@ -52,13 +52,13 @@ nsresult nsCollation::NormalizeString(const nsAString& stringIn, nsAString& stri int32_t aLength = stringIn.Length(); if (aLength <= 64) { - PRUnichar conversionBuffer[64]; + char16_t conversionBuffer[64]; ToLowerCase(PromiseFlatString(stringIn).get(), conversionBuffer, aLength); stringOut.Assign(conversionBuffer, aLength); } else { - PRUnichar* conversionBuffer; - conversionBuffer = new PRUnichar[aLength]; + char16_t* conversionBuffer; + conversionBuffer = new char16_t[aLength]; if (!conversionBuffer) { return NS_ERROR_OUT_OF_MEMORY; } @@ -92,7 +92,7 @@ nsresult nsCollation::UnicodeToChar(const nsAString& aSrc, char** dst) if (NS_SUCCEEDED(res)) { const nsPromiseFlatString& src = PromiseFlatString(aSrc); - const PRUnichar *unichars = src.get(); + const char16_t *unichars = src.get(); int32_t unicharLength = src.Length(); int32_t dstLength; res = mEncoder->GetMaxLength(unichars, unicharLength, &dstLength); diff --git a/intl/locale/src/nsLocale.cpp b/intl/locale/src/nsLocale.cpp index ebb208a3e2fa..e18b64a20c3c 100644 --- a/intl/locale/src/nsLocale.cpp +++ b/intl/locale/src/nsLocale.cpp @@ -39,7 +39,7 @@ nsLocale::~nsLocale(void) NS_IMETHODIMP nsLocale::GetCategory(const nsAString& category, nsAString& result) { - const PRUnichar *value = (const PRUnichar*) + const char16_t *value = (const char16_t*) PL_HashTableLookup(fHashtable, PromiseFlatString(category).get()); if (value) @@ -54,11 +54,11 @@ nsLocale::GetCategory(const nsAString& category, nsAString& result) NS_IMETHODIMP nsLocale::AddCategory(const nsAString &category, const nsAString &value) { - PRUnichar* newKey = ToNewUnicode(category); + char16_t* newKey = ToNewUnicode(category); if (!newKey) return NS_ERROR_OUT_OF_MEMORY; - PRUnichar* newValue = ToNewUnicode(value); + char16_t* newValue = ToNewUnicode(value); if (!newValue) { nsMemory::Free(newKey); return NS_ERROR_OUT_OF_MEMORY; @@ -77,7 +77,7 @@ nsLocale::AddCategory(const nsAString &category, const nsAString &value) PLHashNumber nsLocale::Hash_HashFunction(const void* key) { - const PRUnichar* ptr = (const PRUnichar *) key; + const char16_t* ptr = (const char16_t *) key; PLHashNumber hash; hash = (PLHashNumber)0; @@ -92,7 +92,7 @@ nsLocale::Hash_HashFunction(const void* key) int nsLocale::Hash_CompareNSString(const void* s1, const void* s2) { - return !nsCRT::strcmp((const PRUnichar *) s1, (const PRUnichar *) s2); + return !nsCRT::strcmp((const char16_t *) s1, (const char16_t *) s2); } @@ -100,8 +100,8 @@ int nsLocale::Hash_EnumerateDelete(PLHashEntry *he, int hashIndex, void *arg) { // delete an entry - nsMemory::Free((PRUnichar *)he->key); - nsMemory::Free((PRUnichar *)he->value); + nsMemory::Free((char16_t *)he->key); + nsMemory::Free((char16_t *)he->value); return (HT_ENUMERATE_NEXT | HT_ENUMERATE_REMOVE); } diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp index 415575c2d2e2..7c27c2e9cf67 100644 --- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -230,7 +230,7 @@ nsLocaleService::nsLocaleService(void) buffer[size] = 0; // Convert the locale string to the format that Mozilla expects - nsAutoString xpLocale(reinterpret_cast(buffer.Elements())); + nsAutoString xpLocale(reinterpret_cast(buffer.Elements())); xpLocale.ReplaceChar('_', '-'); nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale)); diff --git a/intl/locale/src/nsScriptableDateFormat.cpp b/intl/locale/src/nsScriptableDateFormat.cpp index 96827a0b88c7..c3b1a5cbeb7e 100644 --- a/intl/locale/src/nsScriptableDateFormat.cpp +++ b/intl/locale/src/nsScriptableDateFormat.cpp @@ -17,7 +17,7 @@ class nsScriptableDateFormat : public nsIScriptableDateFormat { public: NS_DECL_ISUPPORTS - NS_IMETHOD FormatDateTime(const PRUnichar *locale, + NS_IMETHOD FormatDateTime(const char16_t *locale, nsDateFormatSelector dateFormatSelector, nsTimeFormatSelector timeFormatSelector, int32_t year, @@ -26,23 +26,23 @@ class nsScriptableDateFormat : public nsIScriptableDateFormat { int32_t hour, int32_t minute, int32_t second, - PRUnichar **dateTimeString); + char16_t **dateTimeString); - NS_IMETHOD FormatDate(const PRUnichar *locale, + NS_IMETHOD FormatDate(const char16_t *locale, nsDateFormatSelector dateFormatSelector, int32_t year, int32_t month, int32_t day, - PRUnichar **dateString) + char16_t **dateString) {return FormatDateTime(locale, dateFormatSelector, kTimeFormatNone, year, month, day, 0, 0, 0, dateString);} - NS_IMETHOD FormatTime(const PRUnichar *locale, + NS_IMETHOD FormatTime(const char16_t *locale, nsTimeFormatSelector timeFormatSelector, int32_t hour, int32_t minute, int32_t second, - PRUnichar **timeString) + char16_t **timeString) {return FormatDateTime(locale, kDateFormatNone, timeFormatSelector, 1999, 1, 1, hour, minute, second, timeString);} @@ -55,7 +55,7 @@ private: NS_IMPL_ISUPPORTS1(nsScriptableDateFormat, nsIScriptableDateFormat) NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime( - const PRUnichar *aLocale, + const char16_t *aLocale, nsDateFormatSelector dateFormatSelector, nsTimeFormatSelector timeFormatSelector, int32_t year, @@ -64,7 +64,7 @@ NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime( int32_t hour, int32_t minute, int32_t second, - PRUnichar **dateTimeString) + char16_t **dateTimeString) { // We can't have a valid date with the year, month or day // being lower than 1. diff --git a/intl/locale/src/os2/nsCollationOS2.cpp b/intl/locale/src/os2/nsCollationOS2.cpp index da8cc1ac5ebb..4b40147e2b07 100644 --- a/intl/locale/src/os2/nsCollationOS2.cpp +++ b/intl/locale/src/os2/nsCollationOS2.cpp @@ -134,7 +134,7 @@ nsresult nsCollationOS2::AllocateRawSortKey(int32_t strength, if (uLen < iBufferLength) { // Success! // Give 'em the real size in bytes... - *key = (uint8_t *)NS_strdup((PRUnichar*) pLocalBuffer); + *key = (uint8_t *)NS_strdup((char16_t*) pLocalBuffer); *outLen = uLen * 2 + 2; res = NS_OK; } diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp index d5bfe91e951d..28f2cc43f9ce 100644 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp +++ b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp @@ -121,7 +121,7 @@ nsresult nsDateTimeFormatOS2::FormatTMTime(nsILocale* locale, UniStrcat( uFmtT, (UniChar*)L""); } - PRUnichar buffer[NSDATETIME_FORMAT_BUFFER_LEN] = {0}; + char16_t buffer[NSDATETIME_FORMAT_BUFFER_LEN] = {0}; if ((dateFormatSelector != kDateFormatNone) && (timeFormatSelector != kTimeFormatNone)) { UniStrcat( uFmtD, (UniChar*)L" "); } diff --git a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp index a1988e6bfc5f..12816e20ad2b 100644 --- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp @@ -227,7 +227,7 @@ nsresult nsDateTimeFormatUnix::FormatTMTime(nsILocale* locale, // convert result to unicode int32_t srcLength = (int32_t) strlen(strOut); int32_t unicharLength = NSDATETIME_FORMAT_BUFFER_LEN*2; - PRUnichar unichars[NSDATETIME_FORMAT_BUFFER_LEN*2]; // buffer for date and time + char16_t unichars[NSDATETIME_FORMAT_BUFFER_LEN*2]; // buffer for date and time rv = mDecoder->Convert(strOut, &srcLength, unichars, &unicharLength); if (NS_FAILED(rv)) diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.cpp b/intl/locale/src/windows/nsDateTimeFormatWin.cpp index 20d6ac667d81..2c65107e9466 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.cpp +++ b/intl/locale/src/windows/nsDateTimeFormatWin.cpp @@ -94,7 +94,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale, SYSTEMTIME system_time; DWORD dwFlags_Date = 0, dwFlags_Time = 0; int dateLen, timeLen; - PRUnichar dateBuffer[NSDATETIMEFORMAT_BUFFER_LEN], timeBuffer[NSDATETIMEFORMAT_BUFFER_LEN]; + char16_t dateBuffer[NSDATETIMEFORMAT_BUFFER_LEN], timeBuffer[NSDATETIMEFORMAT_BUFFER_LEN]; // set up locale data (void) Initialize(locale); @@ -182,7 +182,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale, stringOut.Truncate(); if (dateLen != 0 && timeLen != 0) { stringOut.Assign(dateBuffer, dateLen); - stringOut.Append((PRUnichar *)(L" "), 1); + stringOut.Append((char16_t *)(L" "), 1); stringOut.Append(timeBuffer, timeLen); } else if (dateLen != 0 && timeLen == 0) { @@ -232,7 +232,7 @@ nsresult nsDateTimeFormatWin::FormatPRExplodedTime(nsILocale* locale, } int nsDateTimeFormatWin::nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTime, - const char* format, PRUnichar *timeStr, int cchTime) + const char* format, char16_t *timeStr, int cchTime) { int len = 0; len = GetTimeFormatW(mLCID, dwFlags, lpTime, @@ -244,7 +244,7 @@ int nsDateTimeFormatWin::nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTim } int nsDateTimeFormatWin::nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDate, - const char* format, PRUnichar *dateStr, int cchDate) + const char* format, char16_t *dateStr, int cchDate) { int len = 0; len = GetDateFormatW(mLCID, dwFlags, lpDate, diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.h b/intl/locale/src/windows/nsDateTimeFormatWin.h index 071011d1028c..9940c0c54561 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.h +++ b/intl/locale/src/windows/nsDateTimeFormatWin.h @@ -58,11 +58,11 @@ private: // call GetTimeFormatW or TimeFormatA int nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTime, - const char* format, PRUnichar *timeStr, int cchTime); + const char* format, char16_t *timeStr, int cchTime); // call GetDateFormatW or GetDateFormatA int nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDate, - const char* format, PRUnichar *dateStr, int cchDate); + const char* format, char16_t *dateStr, int cchDate); nsString mLocale; nsString mAppLocale; diff --git a/intl/locale/src/windows/nsWin32Locale.cpp b/intl/locale/src/windows/nsWin32Locale.cpp index 1f901460bfed..aea16594f381 100644 --- a/intl/locale/src/windows/nsWin32Locale.cpp +++ b/intl/locale/src/windows/nsWin32Locale.cpp @@ -618,7 +618,7 @@ nsWin32Locale::GetPlatformLocale(const nsAString& locale, LCID* winLCID) size_t i, j; // parse the locale - const PRUnichar* data; + const char16_t* data; j = NS_StringGetData(locale, &data); for (i = 0; i < 7 && i < j; i++) { locale_string[i] = data[i] == '-' ? '\0' : data[i]; @@ -701,7 +701,7 @@ nsWin32Locale::GetXPLocale(LCID winLCID, nsAString& locale) } for(j=0;iso_list[i].sublang_list[j].win_code;j++) { if (sublang_id == iso_list[i].sublang_list[j].win_code) { - locale.Append(PRUnichar('-')); + locale.Append(char16_t('-')); locale.AppendASCII(iso_list[i].sublang_list[j].iso_code); break; } diff --git a/intl/lwbrk/public/nsILineBreaker.h b/intl/lwbrk/public/nsILineBreaker.h index df3804fcb481..19adbac10795 100644 --- a/intl/lwbrk/public/nsILineBreaker.h +++ b/intl/lwbrk/public/nsILineBreaker.h @@ -27,10 +27,10 @@ public: kWordBreak_KeepAll = 2 // always keep }; - virtual int32_t Next( const PRUnichar* aText, uint32_t aLen, + virtual int32_t Next( const char16_t* aText, uint32_t aLen, uint32_t aPos) = 0; - virtual int32_t Prev( const PRUnichar* aText, uint32_t aLen, + virtual int32_t Prev( const char16_t* aText, uint32_t aLen, uint32_t aPos) = 0; // Call this on a word with whitespace at either end. We will apply JISx4051 @@ -39,7 +39,7 @@ public: // because we never return a break before the first character. // aLength is the length of the aText array and also the length of the aBreakBefore // output array. - virtual void GetJISx4051Breaks(const PRUnichar* aText, uint32_t aLength, + virtual void GetJISx4051Breaks(const char16_t* aText, uint32_t aLength, uint8_t aWordBreak, uint8_t* aBreakBefore) = 0; virtual void GetJISx4051Breaks(const uint8_t* aText, uint32_t aLength, @@ -50,7 +50,7 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(nsILineBreaker, NS_ILINEBREAKER_IID) static inline bool -NS_IsSpace(PRUnichar u) +NS_IsSpace(char16_t u) { return u == 0x0020 || // SPACE u == 0x0009 || // CHARACTER TABULATION @@ -65,7 +65,7 @@ NS_IsSpace(PRUnichar u) } static inline bool -NS_NeedsPlatformNativeHandling(PRUnichar aChar) +NS_NeedsPlatformNativeHandling(char16_t aChar) { return (0x0e01 <= aChar && aChar <= 0x0fff) || // Thai, Lao, Tibetan (0x1780 <= aChar && aChar <= 0x17ff); // Khmer diff --git a/intl/lwbrk/public/nsIWordBreaker.h b/intl/lwbrk/public/nsIWordBreaker.h index a04b5053486f..3867fba0642c 100644 --- a/intl/lwbrk/public/nsIWordBreaker.h +++ b/intl/lwbrk/public/nsIWordBreaker.h @@ -26,12 +26,12 @@ class nsIWordBreaker : public nsISupports public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWORDBREAKER_IID) - virtual bool BreakInBetween(const PRUnichar* aText1 , uint32_t aTextLen1, - const PRUnichar* aText2 , + virtual bool BreakInBetween(const char16_t* aText1 , uint32_t aTextLen1, + const char16_t* aText2 , uint32_t aTextLen2) = 0; - virtual nsWordRange FindWord(const PRUnichar* aText1 , uint32_t aTextLen1, + virtual nsWordRange FindWord(const char16_t* aText1 , uint32_t aTextLen1, uint32_t aOffset) = 0; - virtual int32_t NextWord(const PRUnichar* aText, uint32_t aLen, + virtual int32_t NextWord(const char16_t* aText, uint32_t aLen, uint32_t aPos) = 0; }; diff --git a/intl/lwbrk/src/nsCarbonBreaker.cpp b/intl/lwbrk/src/nsCarbonBreaker.cpp index a0853804b4eb..1b37bc1298bc 100644 --- a/intl/lwbrk/src/nsCarbonBreaker.cpp +++ b/intl/lwbrk/src/nsCarbonBreaker.cpp @@ -9,7 +9,7 @@ #include "nscore.h" void -NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength, +NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, uint8_t* aBreakBefore) { NS_ASSERTION(aText, "aText shouldn't be null"); diff --git a/intl/lwbrk/src/nsComplexBreaker.h b/intl/lwbrk/src/nsComplexBreaker.h index dcc8a0e13ad4..d4ebb3581abf 100644 --- a/intl/lwbrk/src/nsComplexBreaker.h +++ b/intl/lwbrk/src/nsComplexBreaker.h @@ -13,7 +13,7 @@ * corresponding charactersin aBreakBefore[] on return. */ void -NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength, +NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, uint8_t* aBreakBefore); #endif /* nsComplexBreaker_h__ */ diff --git a/intl/lwbrk/src/nsJISx4051LineBreaker.cpp b/intl/lwbrk/src/nsJISx4051LineBreaker.cpp index ecba271152cc..9f1de41d8f60 100644 --- a/intl/lwbrk/src/nsJISx4051LineBreaker.cpp +++ b/intl/lwbrk/src/nsJISx4051LineBreaker.cpp @@ -340,18 +340,18 @@ static const uint16_t gPairConservative[MAX_CLASSES] = { #define CLASS_CLOSE_LIKE_CHARACTER 0x0A #define CLASS_NON_BREAKABLE 0x0B -#define U_NULL PRUnichar(0x0000) -#define U_SLASH PRUnichar('/') -#define U_SPACE PRUnichar(' ') -#define U_HYPHEN PRUnichar('-') -#define U_EQUAL PRUnichar('=') -#define U_PERCENT PRUnichar('%') -#define U_AMPERSAND PRUnichar('&') -#define U_SEMICOLON PRUnichar(';') -#define U_BACKSLASH PRUnichar('\\') -#define U_OPEN_SINGLE_QUOTE PRUnichar(0x2018) -#define U_OPEN_DOUBLE_QUOTE PRUnichar(0x201C) -#define U_OPEN_GUILLEMET PRUnichar(0x00AB) +#define U_NULL char16_t(0x0000) +#define U_SLASH char16_t('/') +#define U_SPACE char16_t(' ') +#define U_HYPHEN char16_t('-') +#define U_EQUAL char16_t('=') +#define U_PERCENT char16_t('%') +#define U_AMPERSAND char16_t('&') +#define U_SEMICOLON char16_t(';') +#define U_BACKSLASH char16_t('\\') +#define U_OPEN_SINGLE_QUOTE char16_t(0x2018) +#define U_OPEN_DOUBLE_QUOTE char16_t(0x201C) +#define U_OPEN_GUILLEMET char16_t(0x00AB) #define NEED_CONTEXTUAL_ANALYSIS(c) (IS_HYPHEN(c) || \ (c) == U_SLASH || \ @@ -372,13 +372,13 @@ GETCLASSFROMTABLE(const uint32_t* t, uint16_t l) } static inline int -IS_HALFWIDTH_IN_JISx4051_CLASS3(PRUnichar u) +IS_HALFWIDTH_IN_JISx4051_CLASS3(char16_t u) { return ((0xff66 <= (u)) && ((u) <= 0xff70)); } static inline int -IS_CJK_CHAR(PRUnichar u) +IS_CJK_CHAR(char16_t u) { return ((0x1100 <= (u) && (u) <= 0x11ff) || (0x2e80 <= (u) && (u) <= 0xd7ff) || @@ -387,13 +387,13 @@ IS_CJK_CHAR(PRUnichar u) } static inline bool -IS_NONBREAKABLE_SPACE(PRUnichar u) +IS_NONBREAKABLE_SPACE(char16_t u) { return u == 0x00A0 || u == 0x2007; // NO-BREAK SPACE, FIGURE SPACE } static inline bool -IS_HYPHEN(PRUnichar u) +IS_HYPHEN(char16_t u) { return (u == U_HYPHEN || u == 0x058A || // ARMENIAN HYPHEN @@ -403,7 +403,7 @@ IS_HYPHEN(PRUnichar u) } static int8_t -GetClass(PRUnichar u) +GetClass(char16_t u) { uint16_t h = u & 0xFF00; uint16_t l = u & 0x00ff; @@ -451,7 +451,7 @@ GetClass(PRUnichar u) } else if (l < 0x00e0) { c = CLASS_CHARACTER; // Halfwidth Hangul variants } else if (l < 0x00f0) { - static PRUnichar NarrowFFEx[16] = { + static char16_t NarrowFFEx[16] = { 0x00A2, 0x00A3, 0x00AC, 0x00AF, 0x00A6, 0x00A5, 0x20A9, 0x0000, 0x2502, 0x2190, 0x2191, 0x2192, 0x2193, 0x25A0, 0x25CB, 0x0000 }; @@ -534,7 +534,7 @@ NS_IMPL_ISUPPORTS1(nsJISx4051LineBreaker, nsILineBreaker) class ContextState { public: - ContextState(const PRUnichar* aText, uint32_t aLength) { + ContextState(const char16_t* aText, uint32_t aLength) { mUniText = aText; mText = nullptr; mLength = aLength; @@ -551,9 +551,9 @@ public: uint32_t Length() { return mLength; } uint32_t Index() { return mIndex; } - PRUnichar GetCharAt(uint32_t aIndex) { + char16_t GetCharAt(uint32_t aIndex) { NS_ASSERTION(aIndex < mLength, "Out of range!"); - return mUniText ? mUniText[aIndex] : PRUnichar(mText[aIndex]); + return mUniText ? mUniText[aIndex] : char16_t(mText[aIndex]); } void AdvanceIndex() { @@ -619,10 +619,10 @@ public: mHasPreviousBackslash = true; } - PRUnichar GetPreviousNonHyphenCharacter() const { + char16_t GetPreviousNonHyphenCharacter() const { return mPreviousNonHyphenCharacter; } - void NotifyNonHyphenCharacter(PRUnichar ch) { + void NotifyNonHyphenCharacter(char16_t ch) { mPreviousNonHyphenCharacter = ch; } @@ -638,7 +638,7 @@ private: mHasPreviousBackslash = false; for (uint32_t i = 0; i < mLength; ++i) { - PRUnichar u = GetCharAt(i); + char16_t u = GetCharAt(i); if (!mHasNonbreakableSpace && IS_NONBREAKABLE_SPACE(u)) mHasNonbreakableSpace = 1; else if (mUniText && !mHasCJKChar && IS_CJK_CHAR(u)) @@ -646,13 +646,13 @@ private: } } - const PRUnichar* mUniText; + const char16_t* mUniText; const uint8_t* mText; uint32_t mIndex; uint32_t mLength; // length of text uint32_t mLastBreakIndex; - PRUnichar mPreviousNonHyphenCharacter; // The last character we have seen + char16_t mPreviousNonHyphenCharacter; // The last character we have seen // which is not U_HYPHEN bool mHasCJKChar; // if the text has CJK character, this is true. bool mHasNonbreakableSpace; // if the text has no-breakable space, @@ -663,7 +663,7 @@ private: }; static int8_t -ContextualAnalysis(PRUnichar prev, PRUnichar cur, PRUnichar next, +ContextualAnalysis(char16_t prev, char16_t cur, char16_t next, ContextState &aState) { // Don't return CLASS_OPEN/CLASS_CLOSE if aState.UseJISX4051 is FALSE. @@ -681,7 +681,7 @@ ContextualAnalysis(PRUnichar prev, PRUnichar cur, PRUnichar next, // If one side is numeric and the other is a character, or if both sides are // characters, the hyphen should be breakable. if (!aState.UseConservativeBreaking(1)) { - PRUnichar prevOfHyphen = aState.GetPreviousNonHyphenCharacter(); + char16_t prevOfHyphen = aState.GetPreviousNonHyphenCharacter(); if (prevOfHyphen && next) { bool prevIsChar = !NEED_CONTEXTUAL_ANALYSIS(prevOfHyphen) && GetClass(prevOfHyphen) == CLASS_CHARACTER; @@ -743,7 +743,7 @@ ContextualAnalysis(PRUnichar prev, PRUnichar cur, PRUnichar next, int32_t -nsJISx4051LineBreaker::WordMove(const PRUnichar* aText, uint32_t aLen, +nsJISx4051LineBreaker::WordMove(const char16_t* aText, uint32_t aLen, uint32_t aPos, int8_t aDirection) { bool textNeedsJISx4051 = false; @@ -785,7 +785,7 @@ nsJISx4051LineBreaker::WordMove(const PRUnichar* aText, uint32_t aLen, } int32_t -nsJISx4051LineBreaker::Next(const PRUnichar* aText, uint32_t aLen, +nsJISx4051LineBreaker::Next(const char16_t* aText, uint32_t aLen, uint32_t aPos) { NS_ASSERTION(aText, "aText shouldn't be null"); @@ -796,7 +796,7 @@ nsJISx4051LineBreaker::Next(const PRUnichar* aText, uint32_t aLen, } int32_t -nsJISx4051LineBreaker::Prev(const PRUnichar* aText, uint32_t aLen, +nsJISx4051LineBreaker::Prev(const char16_t* aText, uint32_t aLen, uint32_t aPos) { NS_ASSERTION(aText, "aText shouldn't be null"); @@ -808,7 +808,7 @@ nsJISx4051LineBreaker::Prev(const PRUnichar* aText, uint32_t aLen, } void -nsJISx4051LineBreaker::GetJISx4051Breaks(const PRUnichar* aChars, uint32_t aLength, +nsJISx4051LineBreaker::GetJISx4051Breaks(const char16_t* aChars, uint32_t aLength, uint8_t aWordBreak, uint8_t* aBreakBefore) { @@ -817,7 +817,7 @@ nsJISx4051LineBreaker::GetJISx4051Breaks(const PRUnichar* aChars, uint32_t aLeng ContextState state(aChars, aLength); for (cur = 0; cur < aLength; ++cur, state.AdvanceIndex()) { - PRUnichar ch = aChars[cur]; + char16_t ch = aChars[cur]; int8_t cl; if (NEED_CONTEXTUAL_ANALYSIS(ch)) { @@ -882,7 +882,7 @@ nsJISx4051LineBreaker::GetJISx4051Breaks(const uint8_t* aChars, uint32_t aLength ContextState state(aChars, aLength); for (cur = 0; cur < aLength; ++cur, state.AdvanceIndex()) { - PRUnichar ch = aChars[cur]; + char16_t ch = aChars[cur]; int8_t cl; if (NEED_CONTEXTUAL_ANALYSIS(ch)) { diff --git a/intl/lwbrk/src/nsJISx4051LineBreaker.h b/intl/lwbrk/src/nsJISx4051LineBreaker.h index 1898d6a883fd..5c8ad253fcd2 100644 --- a/intl/lwbrk/src/nsJISx4051LineBreaker.h +++ b/intl/lwbrk/src/nsJISx4051LineBreaker.h @@ -16,11 +16,11 @@ public: nsJISx4051LineBreaker(); virtual ~nsJISx4051LineBreaker(); - int32_t Next( const PRUnichar* aText, uint32_t aLen, uint32_t aPos); + int32_t Next( const char16_t* aText, uint32_t aLen, uint32_t aPos); - int32_t Prev( const PRUnichar* aText, uint32_t aLen, uint32_t aPos); + int32_t Prev( const char16_t* aText, uint32_t aLen, uint32_t aPos); - virtual void GetJISx4051Breaks(const PRUnichar* aText, uint32_t aLength, + virtual void GetJISx4051Breaks(const char16_t* aText, uint32_t aLength, uint8_t aBreakMode, uint8_t* aBreakBefore); virtual void GetJISx4051Breaks(const uint8_t* aText, uint32_t aLength, @@ -28,7 +28,7 @@ public: uint8_t* aBreakBefore); private: - int32_t WordMove(const PRUnichar* aText, uint32_t aLen, uint32_t aPos, + int32_t WordMove(const char16_t* aText, uint32_t aLen, uint32_t aPos, int8_t aDirection); }; diff --git a/intl/lwbrk/src/nsPangoBreaker.cpp b/intl/lwbrk/src/nsPangoBreaker.cpp index 2a17233aaba6..e54ba443be4d 100644 --- a/intl/lwbrk/src/nsPangoBreaker.cpp +++ b/intl/lwbrk/src/nsPangoBreaker.cpp @@ -11,7 +11,7 @@ #include "nsTArray.h" void -NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength, +NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, uint8_t* aBreakBefore) { NS_ASSERTION(aText, "aText shouldn't be null"); diff --git a/intl/lwbrk/src/nsRuleBreaker.cpp b/intl/lwbrk/src/nsRuleBreaker.cpp index 1c1a1ae37c61..035996873620 100644 --- a/intl/lwbrk/src/nsRuleBreaker.cpp +++ b/intl/lwbrk/src/nsRuleBreaker.cpp @@ -9,7 +9,7 @@ #include "rulebrk.h" void -NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength, +NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, uint8_t* aBreakBefore) { NS_ASSERTION(aText, "aText shouldn't be null"); diff --git a/intl/lwbrk/src/nsSampleWordBreaker.cpp b/intl/lwbrk/src/nsSampleWordBreaker.cpp index d91808801f8c..1421ed472f3d 100644 --- a/intl/lwbrk/src/nsSampleWordBreaker.cpp +++ b/intl/lwbrk/src/nsSampleWordBreaker.cpp @@ -16,8 +16,8 @@ nsSampleWordBreaker::~nsSampleWordBreaker() NS_IMPL_ISUPPORTS1(nsSampleWordBreaker, nsIWordBreaker) bool nsSampleWordBreaker::BreakInBetween( - const PRUnichar* aText1 , uint32_t aTextLen1, - const PRUnichar* aText2 , uint32_t aTextLen2) + const char16_t* aText1 , uint32_t aTextLen1, + const char16_t* aText2 , uint32_t aTextLen2) { NS_PRECONDITION( nullptr != aText1, "null ptr"); NS_PRECONDITION( nullptr != aText2, "null ptr"); @@ -42,7 +42,7 @@ bool nsSampleWordBreaker::BreakInBetween( #define IS_HALFWIDTHKATAKANA(c) (( 0xFF60 <= (c)) && ((c) <= 0xFF9F)) #define IS_THAI(c) (0x0E00 == (0xFF80 & (c) )) // Look at the higest 9 bits -uint8_t nsSampleWordBreaker::GetClass(PRUnichar c) +uint8_t nsSampleWordBreaker::GetClass(char16_t c) { // begin of the hack @@ -79,7 +79,7 @@ uint8_t nsSampleWordBreaker::GetClass(PRUnichar c) } nsWordRange nsSampleWordBreaker::FindWord( - const PRUnichar* aText , uint32_t aTextLen, + const char16_t* aText , uint32_t aTextLen, uint32_t aOffset) { nsWordRange range; @@ -125,7 +125,7 @@ nsWordRange nsSampleWordBreaker::FindWord( } int32_t nsSampleWordBreaker::NextWord( - const PRUnichar* aText, uint32_t aLen, uint32_t aPos) + const char16_t* aText, uint32_t aLen, uint32_t aPos) { int8_t c1, c2; uint32_t cur = aPos; diff --git a/intl/lwbrk/src/nsSampleWordBreaker.h b/intl/lwbrk/src/nsSampleWordBreaker.h index 7da9f824717e..aa20e5f80807 100644 --- a/intl/lwbrk/src/nsSampleWordBreaker.h +++ b/intl/lwbrk/src/nsSampleWordBreaker.h @@ -27,15 +27,15 @@ public: nsSampleWordBreaker() ; virtual ~nsSampleWordBreaker() ; - bool BreakInBetween(const PRUnichar* aText1 , uint32_t aTextLen1, - const PRUnichar* aText2 , uint32_t aTextLen2); - nsWordRange FindWord(const PRUnichar* aText1 , uint32_t aTextLen1, + bool BreakInBetween(const char16_t* aText1 , uint32_t aTextLen1, + const char16_t* aText2 , uint32_t aTextLen2); + nsWordRange FindWord(const char16_t* aText1 , uint32_t aTextLen1, uint32_t aOffset); - int32_t NextWord(const PRUnichar* aText, uint32_t aLen, uint32_t aPos); + int32_t NextWord(const char16_t* aText, uint32_t aLen, uint32_t aPos); protected: - uint8_t GetClass(PRUnichar aChar); + uint8_t GetClass(char16_t aChar); }; #endif /* nsSampleWordBreaker_h__ */ diff --git a/intl/lwbrk/src/nsSemanticUnitScanner.cpp b/intl/lwbrk/src/nsSemanticUnitScanner.cpp index cb50d5e7573e..f6d6b6dc4ec3 100644 --- a/intl/lwbrk/src/nsSemanticUnitScanner.cpp +++ b/intl/lwbrk/src/nsSemanticUnitScanner.cpp @@ -26,7 +26,7 @@ NS_IMETHODIMP nsSemanticUnitScanner::Start(const char *characterSet) } /* void next (in wstring text, in long length, in long pos, out boolean hasMoreUnits, out long begin, out long end); */ -NS_IMETHODIMP nsSemanticUnitScanner::Next(const PRUnichar *text, int32_t length, int32_t pos, bool isLastBuffer, int32_t *begin, int32_t *end, bool *_retval) +NS_IMETHODIMP nsSemanticUnitScanner::Next(const char16_t *text, int32_t length, int32_t pos, bool isLastBuffer, int32_t *begin, int32_t *end, bool *_retval) { // xxx need to bullet proff and check input pointer // make sure begin, end and _retval is not nullptr here diff --git a/intl/lwbrk/src/nsUniscribeBreaker.cpp b/intl/lwbrk/src/nsUniscribeBreaker.cpp index d6359aec91fa..0d29d284a318 100644 --- a/intl/lwbrk/src/nsUniscribeBreaker.cpp +++ b/intl/lwbrk/src/nsUniscribeBreaker.cpp @@ -14,7 +14,7 @@ #include "nsTArray.h" void -NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength, +NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, uint8_t* aBreakBefore) { NS_ASSERTION(aText, "aText shouldn't be null"); diff --git a/intl/lwbrk/src/th_char.h b/intl/lwbrk/src/th_char.h index 1e4b1eb2ba9b..cb710fc21573 100644 --- a/intl/lwbrk/src/th_char.h +++ b/intl/lwbrk/src/th_char.h @@ -16,7 +16,7 @@ purpose. It is provided "as is" without express or implied warranty. typedef unsigned char tis_char; #ifdef TH_UNICODE -typedef PRUnichar th_char; +typedef char16_t th_char; #define TH_THAIBEGIN_ 0x0e00 #define th_isthai(c) (0x0e00 <= (c) && (c) <= 0x0e5f) #else diff --git a/intl/strres/src/nsStringBundle.cpp b/intl/strres/src/nsStringBundle.cpp index ee29c01fc437..3adb7a97da47 100644 --- a/intl/strres/src/nsStringBundle.cpp +++ b/intl/strres/src/nsStringBundle.cpp @@ -154,9 +154,9 @@ nsStringBundle::GetStringFromName(const nsAString& aName, NS_IMETHODIMP nsStringBundle::FormatStringFromID(int32_t aID, - const PRUnichar **aParams, + const char16_t **aParams, uint32_t aLength, - PRUnichar ** aResult) + char16_t ** aResult) { nsAutoString idStr; idStr.AppendInt(aID, 10); @@ -166,10 +166,10 @@ nsStringBundle::FormatStringFromID(int32_t aID, // this function supports at most 10 parameters.. see below for why NS_IMETHODIMP -nsStringBundle::FormatStringFromName(const PRUnichar *aName, - const PRUnichar **aParams, +nsStringBundle::FormatStringFromName(const char16_t *aName, + const char16_t **aParams, uint32_t aLength, - PRUnichar **aResult) + char16_t **aResult) { NS_ENSURE_ARG_POINTER(aName); NS_ASSERTION(aParams && aLength, "FormatStringFromName() without format parameters: use GetStringFromName() instead"); @@ -191,7 +191,7 @@ NS_IMPL_ISUPPORTS1(nsStringBundle, nsIStringBundle) /* void GetStringFromID (in long aID, out wstring aResult); */ NS_IMETHODIMP -nsStringBundle::GetStringFromID(int32_t aID, PRUnichar **aResult) +nsStringBundle::GetStringFromID(int32_t aID, char16_t **aResult) { nsresult rv; rv = LoadProperties(); @@ -211,7 +211,7 @@ nsStringBundle::GetStringFromID(int32_t aID, PRUnichar **aResult) /* void GetStringFromName (in wstring aName, out wstring aResult); */ NS_IMETHODIMP -nsStringBundle::GetStringFromName(const PRUnichar *aName, PRUnichar **aResult) +nsStringBundle::GetStringFromName(const char16_t *aName, char16_t **aResult) { NS_ENSURE_ARG_POINTER(aName); NS_ENSURE_ARG_POINTER(aResult); @@ -323,9 +323,9 @@ nsStringBundle::GetSimpleEnumeration(nsISimpleEnumerator** elements) } nsresult -nsStringBundle::FormatString(const PRUnichar *aFormatStr, - const PRUnichar **aParams, uint32_t aLength, - PRUnichar **aResult) +nsStringBundle::FormatString(const char16_t *aFormatStr, + const char16_t **aParams, uint32_t aLength, + char16_t **aResult) { NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG(aLength <= 10); // enforce 10-parameter limit @@ -336,7 +336,7 @@ nsStringBundle::FormatString(const PRUnichar *aFormatStr, // Don't believe me? See: // http://www.eskimo.com/~scs/C-faq/q15.13.html // -alecf - PRUnichar *text = + char16_t *text = nsTextFormatter::smprintf(aFormatStr, aLength >= 1 ? aParams[0] : nullptr, aLength >= 2 ? aParams[1] : nullptr, @@ -417,7 +417,7 @@ nsExtensibleStringBundle::~nsExtensibleStringBundle() { } -nsresult nsExtensibleStringBundle::GetStringFromID(int32_t aID, PRUnichar ** aResult) +nsresult nsExtensibleStringBundle::GetStringFromID(int32_t aID, char16_t ** aResult) { nsresult rv; const uint32_t size = mBundles.Count(); @@ -433,8 +433,8 @@ nsresult nsExtensibleStringBundle::GetStringFromID(int32_t aID, PRUnichar ** aRe return NS_ERROR_FAILURE; } -nsresult nsExtensibleStringBundle::GetStringFromName(const PRUnichar *aName, - PRUnichar ** aResult) +nsresult nsExtensibleStringBundle::GetStringFromName(const char16_t *aName, + char16_t ** aResult) { nsresult rv; const uint32_t size = mBundles.Count(); @@ -452,9 +452,9 @@ nsresult nsExtensibleStringBundle::GetStringFromName(const PRUnichar *aName, NS_IMETHODIMP nsExtensibleStringBundle::FormatStringFromID(int32_t aID, - const PRUnichar ** aParams, + const char16_t ** aParams, uint32_t aLength, - PRUnichar ** aResult) + char16_t ** aResult) { nsAutoString idStr; idStr.AppendInt(aID, 10); @@ -462,10 +462,10 @@ nsExtensibleStringBundle::FormatStringFromID(int32_t aID, } NS_IMETHODIMP -nsExtensibleStringBundle::FormatStringFromName(const PRUnichar *aName, - const PRUnichar ** aParams, +nsExtensibleStringBundle::FormatStringFromName(const char16_t *aName, + const char16_t ** aParams, uint32_t aLength, - PRUnichar ** aResult) + char16_t ** aResult) { nsXPIDLString formatStr; nsresult rv; @@ -543,7 +543,7 @@ nsStringBundleService::Init() NS_IMETHODIMP nsStringBundleService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aSomeData) + const char16_t* aSomeData) { if (strcmp("memory-pressure", aTopic) == 0 || strcmp("profile-do-change", aTopic) == 0 || @@ -712,8 +712,8 @@ nsStringBundleService::CreateExtensibleBundle(const char* aCategory, nsresult nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus, - uint32_t argCount, PRUnichar** argArray, - PRUnichar* *result) + uint32_t argCount, char16_t** argArray, + char16_t* *result) { nsresult rv; nsXPIDLCString key; @@ -724,14 +724,14 @@ nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatu // first try looking up the error message with the string key: if (NS_SUCCEEDED(rv)) { rv = bundle->FormatStringFromName(NS_ConvertASCIItoUTF16(key).get(), - (const PRUnichar**)argArray, + (const char16_t**)argArray, argCount, result); } // if the string key fails, try looking up the error message with the int key: if (NS_FAILED(rv)) { uint16_t code = NS_ERROR_GET_CODE(aStatus); - rv = bundle->FormatStringFromID(code, (const PRUnichar**)argArray, argCount, result); + rv = bundle->FormatStringFromID(code, (const char16_t**)argArray, argCount, result); } // If the int key fails, try looking up the default error message. E.g. print: @@ -739,7 +739,7 @@ nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatu if (NS_FAILED(rv)) { nsAutoString statusStr; statusStr.AppendInt(static_cast(aStatus), 16); - const PRUnichar* otherArgArray[1]; + const char16_t* otherArgArray[1]; otherArgArray[0] = statusStr.get(); uint16_t code = NS_ERROR_GET_CODE(NS_ERROR_FAILURE); rv = bundle->FormatStringFromID(code, otherArgArray, 1, result); @@ -750,8 +750,8 @@ nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatu NS_IMETHODIMP nsStringBundleService::FormatStatusMessage(nsresult aStatus, - const PRUnichar* aStatusArg, - PRUnichar* *result) + const char16_t* aStatusArg, + char16_t* *result) { nsresult rv; uint32_t i, argCount = 0; @@ -771,14 +771,14 @@ nsStringBundleService::FormatStatusMessage(nsresult aStatus, // format the arguments: const nsDependentString args(aStatusArg); - argCount = args.CountChar(PRUnichar('\n')) + 1; + argCount = args.CountChar(char16_t('\n')) + 1; NS_ENSURE_ARG(argCount <= 10); // enforce 10-parameter limit - PRUnichar* argArray[10]; + char16_t* argArray[10]; - // convert the aStatusArg into a PRUnichar array + // convert the aStatusArg into a char16_t array if (argCount == 1) { // avoid construction for the simple case: - argArray[0] = (PRUnichar*)aStatusArg; + argArray[0] = (char16_t*)aStatusArg; } else if (argCount > 1) { int32_t offset = 0; diff --git a/intl/strres/src/nsStringBundle.h b/intl/strres/src/nsStringBundle.h index ed63ac2f0c0c..599c0670671c 100644 --- a/intl/strres/src/nsStringBundle.h +++ b/intl/strres/src/nsStringBundle.h @@ -45,9 +45,9 @@ private: bool mLoaded; public: - static nsresult FormatString(const PRUnichar *formatStr, - const PRUnichar **aParams, uint32_t aLength, - PRUnichar **aResult); + static nsresult FormatString(const char16_t *formatStr, + const char16_t **aParams, uint32_t aLength, + char16_t **aResult); }; /** diff --git a/intl/strres/src/nsStringBundleService.h b/intl/strres/src/nsStringBundleService.h index e429f04f67a3..a41343130f34 100644 --- a/intl/strres/src/nsStringBundleService.h +++ b/intl/strres/src/nsStringBundleService.h @@ -38,8 +38,8 @@ public: private: nsresult getStringBundle(const char *aUrl, nsIStringBundle** aResult); nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus, - uint32_t argCount, PRUnichar** argArray, - PRUnichar* *result); + uint32_t argCount, char16_t** argArray, + char16_t* *result); void flushBundleCache(); diff --git a/intl/uconv/public/nsIUnicodeDecoder.h b/intl/uconv/public/nsIUnicodeDecoder.h index f306a5666aaf..0d2864e3633a 100644 --- a/intl/uconv/public/nsIUnicodeDecoder.h +++ b/intl/uconv/public/nsIUnicodeDecoder.h @@ -92,7 +92,7 @@ public: * and retry. */ NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) = 0; + char16_t * aDest, int32_t * aDestLength) = 0; /** * Returns a quick estimation of the size of the buffer needed to hold the @@ -126,7 +126,7 @@ public: /** * return the UNICODE character for unmapped character */ - virtual PRUnichar GetCharacterForUnMapped() = 0; + virtual char16_t GetCharacterForUnMapped() = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicodeDecoder, NS_IUNICODEDECODER_IID) diff --git a/intl/uconv/public/nsIUnicodeEncoder.h b/intl/uconv/public/nsIUnicodeEncoder.h index a34029c4d6ce..3bdafb0e27a2 100644 --- a/intl/uconv/public/nsIUnicodeEncoder.h +++ b/intl/uconv/public/nsIUnicodeEncoder.h @@ -40,7 +40,7 @@ public: /** * Converts a character from Unicode to a Charset. */ - NS_IMETHOD Convert(PRUnichar aChar, char * aDest, int32_t * aDestLength) = 0; + NS_IMETHOD Convert(char16_t aChar, char * aDest, int32_t * aDestLength) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicharEncoder, NS_IUNICHARENCODER_IID) @@ -51,7 +51,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicharEncoder, NS_IUNICHARENCODER_IID) // // p = the buffer pointer (char*) // e = encoder (nsIUnicodeEncoder*) -// s = string (PRUnichar*) +// s = string (char16_t*) // l = string length (int32_t) // sb = static buffer (char[]) // sbl = static buffer length (uint32_t) @@ -132,7 +132,7 @@ public: * NS_ERROR_UENC_NOMAPPING if character without mapping * was encountered and the behavior was set to "signal". */ - NS_IMETHOD Convert(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) = 0; /** @@ -158,7 +158,7 @@ public: * @return NS_OK_UENC_EXACTLENGTH if an exact length was computed * NS_OK if all we have is an approximation */ - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, + NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) = 0; /** @@ -173,7 +173,7 @@ public: * @param aOrder [IN] the behavior; taken from the enum */ NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, - nsIUnicharEncoder * aEncoder, PRUnichar aChar) = 0; + nsIUnicharEncoder * aEncoder, char16_t aChar) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicodeEncoder, NS_IUNICODEENCODER_IID) diff --git a/intl/uconv/src/nsCharsetConverterManager.cpp b/intl/uconv/src/nsCharsetConverterManager.cpp index 5eaab5260533..2bdfd7f901a7 100644 --- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -60,7 +60,7 @@ static nsresult GetBundleValue(nsIStringBundle * aBundle, const char * aName, const nsAFlatString& aProp, - PRUnichar ** aResult) + char16_t ** aResult) { nsAutoString key; @@ -90,7 +90,7 @@ nsresult GetBundleValue(nsIStringBundle * aBundle, } static -nsresult GetCharsetDataImpl(const char * aCharset, const PRUnichar * aProp, +nsresult GetCharsetDataImpl(const char * aCharset, const char16_t * aProp, nsAString& aResult) { NS_ENSURE_ARG_POINTER(aCharset); @@ -315,7 +315,7 @@ nsCharsetConverterManager::GetCharsetTitle(const char * aCharset, NS_IMETHODIMP nsCharsetConverterManager::GetCharsetData(const char * aCharset, - const PRUnichar * aProp, + const char16_t * aProp, nsAString& aResult) { return GetCharsetDataImpl(aCharset, aProp, aResult); diff --git a/intl/uconv/src/nsConverterInputStream.cpp b/intl/uconv/src/nsConverterInputStream.cpp index b99dc33f794c..0953f41cc0a5 100644 --- a/intl/uconv/src/nsConverterInputStream.cpp +++ b/intl/uconv/src/nsConverterInputStream.cpp @@ -21,7 +21,7 @@ NS_IMETHODIMP nsConverterInputStream::Init(nsIInputStream* aStream, const char *aCharset, int32_t aBufferSize, - PRUnichar aReplacementChar) + char16_t aReplacementChar) { static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -69,7 +69,7 @@ nsConverterInputStream::Close() } NS_IMETHODIMP -nsConverterInputStream::Read(PRUnichar* aBuf, +nsConverterInputStream::Read(char16_t* aBuf, uint32_t aCount, uint32_t *aReadCount) { @@ -87,7 +87,7 @@ nsConverterInputStream::Read(PRUnichar* aBuf, readCount = aCount; } memcpy(aBuf, mUnicharData.Elements() + mUnicharDataOffset, - readCount * sizeof(PRUnichar)); + readCount * sizeof(char16_t)); mUnicharDataOffset += readCount; *aReadCount = readCount; return NS_OK; @@ -153,7 +153,7 @@ nsConverterInputStream::ReadString(uint32_t aCount, nsAString& aString, if (readCount > aCount) { readCount = aCount; } - const PRUnichar* buf = mUnicharData.Elements() + mUnicharDataOffset; + const char16_t* buf = mUnicharData.Elements() + mUnicharDataOffset; aString.Assign(buf, readCount); mUnicharDataOffset += readCount; *aReadCount = readCount; @@ -235,7 +235,7 @@ NS_IMETHODIMP nsConverterInputStream::ReadLine(nsAString& aLine, bool* aResult) { if (!mLineBuffer) { - mLineBuffer = new nsLineBuffer; + mLineBuffer = new nsLineBuffer; } return NS_ReadLine(this, mLineBuffer.get(), aLine, aResult); } diff --git a/intl/uconv/src/nsConverterInputStream.h b/intl/uconv/src/nsConverterInputStream.h index 3586eeda3184..ec4822402cd5 100644 --- a/intl/uconv/src/nsConverterInputStream.h +++ b/intl/uconv/src/nsConverterInputStream.h @@ -50,16 +50,16 @@ class nsConverterInputStream : public nsIConverterInputStream, nsCOMPtr mConverter; FallibleTArray mByteData; - FallibleTArray mUnicharData; + FallibleTArray mUnicharData; nsCOMPtr mInput; nsresult mLastErrorCode; uint32_t mLeftOverBytes; uint32_t mUnicharDataOffset; uint32_t mUnicharDataLength; - PRUnichar mReplacementChar; + char16_t mReplacementChar; - nsAutoPtr > mLineBuffer; + nsAutoPtr > mLineBuffer; }; #endif diff --git a/intl/uconv/src/nsConverterOutputStream.cpp b/intl/uconv/src/nsConverterOutputStream.cpp index 624f145749ea..a627df6ce93e 100644 --- a/intl/uconv/src/nsConverterOutputStream.cpp +++ b/intl/uconv/src/nsConverterOutputStream.cpp @@ -24,7 +24,7 @@ NS_IMETHODIMP nsConverterOutputStream::Init(nsIOutputStream* aOutStream, const char* aCharset, uint32_t aBufferSize /* ignored */, - PRUnichar aReplacementChar) + char16_t aReplacementChar) { NS_PRECONDITION(aOutStream, "Null output stream!"); @@ -51,7 +51,7 @@ nsConverterOutputStream::Init(nsIOutputStream* aOutStream, } NS_IMETHODIMP -nsConverterOutputStream::Write(uint32_t aCount, const PRUnichar* aChars, +nsConverterOutputStream::Write(uint32_t aCount, const char16_t* aChars, bool* aSuccess) { if (!mOutStream) { diff --git a/intl/uconv/src/nsReplacementToUnicode.cpp b/intl/uconv/src/nsReplacementToUnicode.cpp index 5e05eda8a05b..c068003b3330 100644 --- a/intl/uconv/src/nsReplacementToUnicode.cpp +++ b/intl/uconv/src/nsReplacementToUnicode.cpp @@ -12,7 +12,7 @@ nsReplacementToUnicode::nsReplacementToUnicode() NS_IMETHODIMP nsReplacementToUnicode::Convert(const char* aSrc, int32_t* aSrcLength, - PRUnichar* aDest, + char16_t* aDest, int32_t* aDestLength) { if (mSeenByte || !(*aSrcLength)) { diff --git a/intl/uconv/src/nsReplacementToUnicode.h b/intl/uconv/src/nsReplacementToUnicode.h index e55ebd80457d..09b8211ca60c 100644 --- a/intl/uconv/src/nsReplacementToUnicode.h +++ b/intl/uconv/src/nsReplacementToUnicode.h @@ -21,7 +21,7 @@ public: NS_IMETHOD Convert(const char* aSrc, int32_t* aSrcLength, - PRUnichar* aDest, + char16_t* aDest, int32_t* aDestLength); NS_IMETHOD GetMaxLength(const char* aSrc, diff --git a/intl/uconv/src/nsScriptableUConv.cpp b/intl/uconv/src/nsScriptableUConv.cpp index 794d0772b620..784f59bac6f7 100644 --- a/intl/uconv/src/nsScriptableUConv.cpp +++ b/intl/uconv/src/nsScriptableUConv.cpp @@ -135,7 +135,7 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData, inLength, &outLength); if (NS_SUCCEEDED(rv)) { - PRUnichar* buf = (PRUnichar*)moz_malloc((outLength+1)*sizeof(PRUnichar)); + char16_t* buf = (char16_t*)moz_malloc((outLength+1)*sizeof(char16_t)); if (!buf) return NS_ERROR_OUT_OF_MEMORY; @@ -261,7 +261,7 @@ nsScriptableUnicodeConverter::InitConverter() return rv; } - rv = mEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, (PRUnichar)'?'); + rv = mEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, (char16_t)'?'); if (NS_FAILED(rv)) { return rv; } diff --git a/intl/uconv/src/nsTextToSubURI.cpp b/intl/uconv/src/nsTextToSubURI.cpp index 4759e3837f1e..a90155a5329d 100644 --- a/intl/uconv/src/nsTextToSubURI.cpp +++ b/intl/uconv/src/nsTextToSubURI.cpp @@ -23,7 +23,7 @@ nsTextToSubURI::~nsTextToSubURI() NS_IMPL_ISUPPORTS1(nsTextToSubURI, nsITextToSubURI) NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape( - const char *charset, const PRUnichar *text, char **_retval) + const char *charset, const char16_t *text, char **_retval) { if(nullptr == _retval) return NS_ERROR_NULL_POINTER; @@ -38,7 +38,7 @@ NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape( rv = ccm->GetUnicodeEncoder(charset, &encoder); NS_RELEASE(ccm); if (NS_SUCCEEDED(rv)) { - rv = encoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, (PRUnichar)'?'); + rv = encoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, (char16_t)'?'); if(NS_SUCCEEDED(rv)) { char buf[256]; @@ -79,7 +79,7 @@ NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape( } NS_IMETHODIMP nsTextToSubURI::UnEscapeAndConvert( - const char *charset, const char *text, PRUnichar **_retval) + const char *charset, const char *text, char16_t **_retval) { if(nullptr == _retval) return NS_ERROR_NULL_POINTER; @@ -105,11 +105,11 @@ NS_IMETHODIMP nsTextToSubURI::UnEscapeAndConvert( nsIUnicodeDecoder *decoder; rv = ccm->GetUnicodeDecoder(charset, &decoder); if (NS_SUCCEEDED(rv)) { - PRUnichar *pBuf = nullptr; + char16_t *pBuf = nullptr; int32_t len = strlen(unescaped); int32_t outlen = 0; if (NS_SUCCEEDED(rv = decoder->GetMaxLength(unescaped, len, &outlen))) { - pBuf = (PRUnichar *) NS_Alloc((outlen+1)*sizeof(PRUnichar)); + pBuf = (char16_t *) NS_Alloc((outlen+1)*sizeof(char16_t)); if (nullptr == pBuf) rv = NS_ERROR_OUT_OF_MEMORY; else { @@ -180,7 +180,7 @@ nsresult nsTextToSubURI::convertURItoUnicode(const nsAFlatCString &aCharset, rv = unicodeDecoder->GetMaxLength(aURI.get(), srcLen, &dstLen); NS_ENSURE_SUCCESS(rv, rv); - PRUnichar *ustr = (PRUnichar *) NS_Alloc(dstLen * sizeof(PRUnichar)); + char16_t *ustr = (char16_t *) NS_Alloc(dstLen * sizeof(char16_t)); NS_ENSURE_TRUE(ustr, NS_ERROR_OUT_OF_MEMORY); rv = unicodeDecoder->Convert(aURI.get(), &srcLen, ustr, &dstLen); diff --git a/intl/uconv/src/nsUTF8ConverterService.cpp b/intl/uconv/src/nsUTF8ConverterService.cpp index 05cce1c6a187..48938ec66b1f 100644 --- a/intl/uconv/src/nsUTF8ConverterService.cpp +++ b/intl/uconv/src/nsUTF8ConverterService.cpp @@ -40,7 +40,7 @@ ToUTF8(const nsACString &aString, const char *aCharset, rv = unicodeDecoder->GetMaxLength(inStr.get(), srcLen, &dstLen); NS_ENSURE_SUCCESS(rv, rv); - nsAutoArrayPtr ustr(new PRUnichar[dstLen]); + nsAutoArrayPtr ustr(new char16_t[dstLen]); NS_ENSURE_TRUE(ustr, NS_ERROR_OUT_OF_MEMORY); rv = unicodeDecoder->Convert(inStr.get(), &srcLen, ustr, &dstLen); diff --git a/intl/uconv/src/nsUTF8ToUnicode.cpp b/intl/uconv/src/nsUTF8ToUnicode.cpp index 7c9d94d4c05e..3620f4aa3f60 100644 --- a/intl/uconv/src/nsUTF8ToUnicode.cpp +++ b/intl/uconv/src/nsUTF8ToUnicode.cpp @@ -12,7 +12,7 @@ #define UNICODE_BYTE_ORDER_MARK 0xFEFF -static PRUnichar* EmitSurrogatePair(uint32_t ucs4, PRUnichar* aDest) +static char16_t* EmitSurrogatePair(uint32_t ucs4, char16_t* aDest) { NS_ASSERTION(ucs4 > 0xFFFF, "Should be a supplementary character"); ucs4 -= 0x00010000; @@ -90,7 +90,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Reset() // reading/writing a word at a time for as long as we can static inline void Convert_ascii_run (const char *&src, - PRUnichar *&dst, + char16_t *&dst, int32_t len) { const uint32_t *src32; @@ -107,7 +107,7 @@ Convert_ascii_run (const char *&src, { if (*src & 0x80U) return; - *dst++ = (PRUnichar) *src++; + *dst++ = (char16_t) *src++; len--; } } else { @@ -133,11 +133,11 @@ Convert_ascii_run (const char *&src, } src = (const char *) src32; - dst = (PRUnichar *) dst32; + dst = (char16_t *) dst32; finish: while (len-- > 0 && (*src & 0x80U) == 0) { - *dst++ = (PRUnichar) *src++; + *dst++ = (char16_t) *src++; } } @@ -147,7 +147,7 @@ finish: namespace mozilla { namespace SSE2 { -void Convert_ascii_run(const char *&src, PRUnichar *&dst, int32_t len); +void Convert_ascii_run(const char *&src, char16_t *&dst, int32_t len); } } @@ -155,7 +155,7 @@ void Convert_ascii_run(const char *&src, PRUnichar *&dst, int32_t len); static inline void Convert_ascii_run (const char *&src, - PRUnichar *&dst, + char16_t *&dst, int32_t len) { #ifdef MOZILLA_MAY_SUPPORT_SSE2 @@ -166,7 +166,7 @@ Convert_ascii_run (const char *&src, #endif while (len-- > 0 && (*src & 0x80U) == 0) { - *dst++ = (PRUnichar) *src++; + *dst++ = (char16_t) *src++; } } @@ -174,7 +174,7 @@ Convert_ascii_run (const char *&src, NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { uint32_t aSrcLen = (uint32_t) (*aSrcLength); @@ -183,7 +183,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc, const char *in, *inend; inend = aSrc + aSrcLen; - PRUnichar *out, *outend; + char16_t *out, *outend; outend = aDest + aDestLen; nsresult res = NS_OK; // conversion result diff --git a/intl/uconv/src/nsUTF8ToUnicode.h b/intl/uconv/src/nsUTF8ToUnicode.h index 3a5692c0f1d9..2d2e84efd5a5 100644 --- a/intl/uconv/src/nsUTF8ToUnicode.h +++ b/intl/uconv/src/nsUTF8ToUnicode.h @@ -56,7 +56,7 @@ protected: // Subclassing of nsBasicDecoderSupport class [declaration] NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); //-------------------------------------------------------------------- // Subclassing of nsBasicDecoderSupport class [declaration] diff --git a/intl/uconv/src/nsUTF8ToUnicodeSSE2.cpp b/intl/uconv/src/nsUTF8ToUnicodeSSE2.cpp index 5db2089c5c4b..58e92be9bb09 100644 --- a/intl/uconv/src/nsUTF8ToUnicodeSSE2.cpp +++ b/intl/uconv/src/nsUTF8ToUnicodeSSE2.cpp @@ -13,7 +13,7 @@ namespace SSE2 { void Convert_ascii_run(const char *&src, - PRUnichar *&dst, + char16_t *&dst, int32_t len) { if (len > 15) { @@ -26,7 +26,7 @@ Convert_ascii_run(const char *&src, while ((NS_PTR_TO_UINT32(src) & 15) && len > 0) { if (*src & 0x80U) return; - *dst++ = (PRUnichar) *src++; + *dst++ = (char16_t) *src++; len--; } @@ -88,7 +88,7 @@ Convert_ascii_run(const char *&src, // finish off a byte at a time while (len-- > 0 && (*src & 0x80U) == 0) { - *dst++ = (PRUnichar) *src++; + *dst++ = (char16_t) *src++; } } diff --git a/intl/uconv/src/nsUnicodeToUTF8.cpp b/intl/uconv/src/nsUnicodeToUTF8.cpp index 08b702bbb366..6b41916e0aed 100644 --- a/intl/uconv/src/nsUnicodeToUTF8.cpp +++ b/intl/uconv/src/nsUnicodeToUTF8.cpp @@ -12,7 +12,7 @@ NS_IMPL_ISUPPORTS1(nsUnicodeToUTF8, nsIUnicodeEncoder) //---------------------------------------------------------------------- // nsUnicodeToUTF8 class [implementation] -NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc, +NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) { @@ -25,13 +25,13 @@ NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc, return NS_OK; } -NS_IMETHODIMP nsUnicodeToUTF8::Convert(const PRUnichar * aSrc, +NS_IMETHODIMP nsUnicodeToUTF8::Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; int32_t destLen = *aDestLength; uint32_t n; @@ -47,14 +47,14 @@ NS_IMETHODIMP nsUnicodeToUTF8::Convert(const PRUnichar * aSrc, *aDestLength = 0; return NS_OK_UENC_MOREOUTPUT; } - if (*src < (PRUnichar)0xdc00 || *src > (PRUnichar)0xdfff) { //not a pair + if (*src < (char16_t)0xdc00 || *src > (char16_t)0xdfff) { //not a pair *dest++ = (char)0xef; //replacement character *dest++ = (char)0xbf; *dest++ = (char)0xbd; destLen -= 3; } else { - n = ((mHighSurrogate - (PRUnichar)0xd800) << 10) + - (*src - (PRUnichar)0xdc00) + 0x10000; + n = ((mHighSurrogate - (char16_t)0xd800) << 10) + + (*src - (char16_t)0xdc00) + 0x10000; *dest++ = (char)0xf0 | (n >> 18); *dest++ = (char)0x80 | ((n >> 12) & 0x3f); *dest++ = (char)0x80 | ((n >> 6) & 0x3f); @@ -77,8 +77,8 @@ NS_IMETHODIMP nsUnicodeToUTF8::Convert(const PRUnichar * aSrc, *dest++ = (char)0xc0 | (*src >> 6); *dest++ = (char)0x80 | (*src & 0x003f); destLen -= 2; - } else if (*src >= (PRUnichar)0xd800 && *src <= (PRUnichar)0xdfff) { - if (*src >= (PRUnichar)0xdc00) { //not a pair + } else if (*src >= (char16_t)0xd800 && *src <= (char16_t)0xdfff) { + if (*src >= (char16_t)0xdc00) { //not a pair if (destLen < 3) goto error_more_output; *dest++ = (char)0xef; //replacement character @@ -97,13 +97,13 @@ NS_IMETHODIMP nsUnicodeToUTF8::Convert(const PRUnichar * aSrc, //handle surrogate if (destLen < 4) goto error_more_output; - if (*(src+1) < (PRUnichar)0xdc00 || *(src+1) > 0xdfff) { //not a pair + if (*(src+1) < (char16_t)0xdc00 || *(src+1) > 0xdfff) { //not a pair *dest++ = (char)0xef; //replacement character *dest++ = (char)0xbf; *dest++ = (char)0xbd; destLen -= 3; } else { - n = ((*src - (PRUnichar)0xd800) << 10) + (*(src+1) - (PRUnichar)0xdc00) + (uint32_t)0x10000; + n = ((*src - (char16_t)0xd800) << 10) + (*(src+1) - (char16_t)0xdc00) + (uint32_t)0x10000; *dest++ = (char)0xf0 | (n >> 18); *dest++ = (char)0x80 | ((n >> 12) & 0x3f); *dest++ = (char)0x80 | ((n >> 6) & 0x3f); diff --git a/intl/uconv/src/nsUnicodeToUTF8.h b/intl/uconv/src/nsUnicodeToUTF8.h index 3fe0ebd10bb1..55557236da71 100644 --- a/intl/uconv/src/nsUnicodeToUTF8.h +++ b/intl/uconv/src/nsUnicodeToUTF8.h @@ -39,23 +39,23 @@ public: */ nsUnicodeToUTF8() {mHighSurrogate = 0;} - NS_IMETHOD Convert(const PRUnichar * aSrc, + NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD Finish(char * aDest, int32_t * aDestLength); - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, + NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength); NS_IMETHOD Reset() {mHighSurrogate = 0; return NS_OK;} NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, - nsIUnicharEncoder * aEncoder, PRUnichar aChar) {return NS_OK;} + nsIUnicharEncoder * aEncoder, char16_t aChar) {return NS_OK;} protected: - PRUnichar mHighSurrogate; + char16_t mHighSurrogate; }; diff --git a/intl/uconv/tests/TestUConv.cpp b/intl/uconv/tests/TestUConv.cpp index 76d932c0b864..8101d183884c 100644 --- a/intl/uconv/tests/TestUConv.cpp +++ b/intl/uconv/tests/TestUConv.cpp @@ -100,7 +100,7 @@ private: */ nsresult TestTempBug(); - nsresult Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, char ** aDest, + nsresult Encode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest, char * aDestEnd, const nsAFlatCString& aCharset); /** @@ -110,7 +110,7 @@ private: * * This wraps an encoder Convert() call. */ - nsresult ConvertEncode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, char ** aDest, + nsresult ConvertEncode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest, char * aDestEnd, nsIUnicodeEncoder * aEncoder); /** @@ -421,13 +421,13 @@ nsresult nsTestUConv::TestTempBug() nsresult res = NS_OK; NS_NAMED_LITERAL_CSTRING(charset, "ISO-2022-JP"); - PRUnichar src[] = {0x0043, 0x004e, 0x0045, 0x0054, 0x0020, 0x004A, 0x0061, + char16_t src[] = {0x0043, 0x004e, 0x0045, 0x0054, 0x0020, 0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0020, 0x7DE8, 0x96C6, 0x5C40}; - PRUnichar * srcEnd = src + ARRAY_SIZE(src); + char16_t * srcEnd = src + ARRAY_SIZE(src); char dest[BIG_BUFFER_SIZE]; char * destEnd = dest + BIG_BUFFER_SIZE; - PRUnichar * p = src; + char16_t * p = src; char * q = dest; res = Encode(&p, srcEnd, &q, destEnd, charset); @@ -435,7 +435,7 @@ nsresult nsTestUConv::TestTempBug() return res; } -nsresult nsTestUConv::Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, +nsresult nsTestUConv::Encode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest, char * aDestEnd, const nsAFlatCString& aCharset) { @@ -473,11 +473,11 @@ nsresult nsTestUConv::Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, return res; } -nsresult nsTestUConv::ConvertEncode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, +nsresult nsTestUConv::ConvertEncode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest, char * aDestEnd, nsIUnicodeEncoder * aEncoder) { - PRUnichar * src = (*aSrc); + char16_t * src = (*aSrc); char * dest = (*aDest); int32_t srcLen = aSrcEnd - src; int32_t destLen = aDestEnd - dest; diff --git a/intl/uconv/tests/convperf.cpp b/intl/uconv/tests/convperf.cpp index 18c03ad6ab83..801fa4982598 100644 --- a/intl/uconv/tests/convperf.cpp +++ b/intl/uconv/tests/convperf.cpp @@ -29,7 +29,7 @@ FILE* infile = 0; #define OUTBUFSIZE (1024*16*8) char inbuffer[INBUFSIZE]; char outbuffer[OUTBUFSIZE]; -PRUnichar medbuffer[MEDBUFSIZE]; +char16_t medbuffer[MEDBUFSIZE]; nsIUnicodeEncoder* encoder = nullptr; nsIUnicodeDecoder* decoder = nullptr; UINT incp = 932; @@ -45,29 +45,29 @@ void memcpyEncode(const char* src, int32_t srclen, char* dest) } void WideDecode(const char* src, - int32_t srclen, PRUnichar *dest, int32_t *destLen) + int32_t srclen, char16_t *dest, int32_t *destLen) { const char* end = src+srclen ; while(src < end) - *dest++ = (PRUnichar) *src++; + *dest++ = (char16_t) *src++; *destLen = srclen; } -void NarrowEncode(const PRUnichar *src, +void NarrowEncode(const char16_t *src, int32_t srclen, char* dest, int32_t* destLen) { - const PRUnichar* end = src+srclen ; + const char16_t* end = src+srclen ; while(src < end) *dest++ = (char) *src++; *destLen = srclen; } void msDecode(UINT cp, const char* src, - int32_t srclen, PRUnichar *dest, int32_t *destLen) + int32_t srclen, char16_t *dest, int32_t *destLen) { *destLen = ::MultiByteToWideChar(cp, 0,src, srclen, (LPWSTR)dest, *destLen); if(*destLen <= 0) fprintf(stderr, "problem in ::MultiByteToWideChar\n"); } -void msEncode(UINT cp, const PRUnichar *src, +void msEncode(UINT cp, const char16_t *src, int32_t srcLen, char* dest, int32_t* destLen) { *destLen = ::WideCharToMultiByte(cp, 0, src, srcLen, (LPSTR)dest, *destLen, diff --git a/intl/uconv/tests/nsTestUConv.cpp b/intl/uconv/tests/nsTestUConv.cpp index dec3cc702b8f..cba995335b4c 100644 --- a/intl/uconv/tests/nsTestUConv.cpp +++ b/intl/uconv/tests/nsTestUConv.cpp @@ -51,7 +51,7 @@ char bLatin1_d0[] = { "\x00\x0d\x7f\x80\xff" }; -PRUnichar cLatin1_d0[] = { +char16_t cLatin1_d0[] = { 0x0000,0x000d,0x007f,0x20ac,0x00ff }; @@ -96,14 +96,14 @@ nsresult testCharsetConverterManager() */ nsresult testDecoder(nsIUnicodeDecoder * aDec, const char * aSrc, int32_t aSrcLength, - const PRUnichar * aRes, int32_t aResLength, + const char16_t * aRes, int32_t aResLength, const char * aTestName) { nsresult res; // prepare for conversion int32_t srcLen = aSrcLength; - PRUnichar dest[GENERAL_BUFFER/2]; + char16_t dest[GENERAL_BUFFER/2]; int32_t destLen = GENERAL_BUFFER/2; // conversion @@ -135,7 +135,7 @@ nsresult testDecoder(nsIUnicodeDecoder * aDec, * This method will test the conversion only. */ nsresult testEncoder(nsIUnicodeEncoder * aEnc, - const PRUnichar * aSrc, int32_t aSrcLength, + const char16_t * aSrc, int32_t aSrcLength, const char * aRes, int32_t aResLength, const char * aTestName) { @@ -192,7 +192,7 @@ nsresult testEncoder(nsIUnicodeEncoder * aEnc, */ nsresult testStressDecoder(nsIUnicodeDecoder * aDec, const char * aSrc, int32_t aSrcLength, - const PRUnichar * aRes, int32_t aResLength, + const char16_t * aRes, int32_t aResLength, const char * aTestName) { nsresult res; @@ -209,7 +209,7 @@ nsresult testStressDecoder(nsIUnicodeDecoder * aDec, // prepare for conversion int32_t srcLen = 0; int32_t srcOff = 0; - PRUnichar dest[1024]; + char16_t dest[1024]; int32_t destLen = 0; int32_t destOff = 0; @@ -277,7 +277,7 @@ nsresult testStressDecoder(nsIUnicodeDecoder * aDec, * very stressful conditions. */ nsresult testStressEncoder(nsIUnicodeEncoder * aEnc, - const PRUnichar * aSrc, int32_t aSrcLength, + const char16_t * aSrc, int32_t aSrcLength, const char * aRes, int32_t aResLength, const char * aTestName) { @@ -404,7 +404,7 @@ nsresult resetEncoder(nsIUnicodeEncoder * aEnc, const char * aTestName) * A standard decoder test. */ nsresult standardDecoderTest(char * aTestName, char * aCharset, char * aSrc, - int32_t aSrcLen, PRUnichar * aRes, int32_t aResLen) + int32_t aSrcLen, char16_t * aRes, int32_t aResLen) { printf("\n[%s] Unicode <- %s\n", aTestName, aCharset); @@ -451,7 +451,7 @@ nsresult loadBinaryFile(char * aFile, char * aBuff, int32_t * aBuffLen) return NS_OK; } -nsresult loadUnicodeFile(char * aFile, PRUnichar * aBuff, int32_t * aBuffLen) +nsresult loadUnicodeFile(char * aFile, char16_t * aBuff, int32_t * aBuffLen) { int32_t buffLen = 2*(*aBuffLen); @@ -470,7 +470,7 @@ nsresult testDecoderFromFiles(char * aCharset, char * aSrcFile, char * aResultFi int32_t srcLen = GENERAL_BUFFER; char src[GENERAL_BUFFER]; int32_t expLen = GENERAL_BUFFER/2; - PRUnichar exp[GENERAL_BUFFER/2]; + char16_t exp[GENERAL_BUFFER/2]; res = loadBinaryFile(aSrcFile, src, &srcLen); if (NS_FAILED(res)) return res; @@ -516,7 +516,7 @@ nsresult testISO2022JPDecoder() // test data char src[] = {"\x0d\x7f\xdd" "\x1b(J\xaa\xdc\x41" "\x1b$B\x21\x21" "\x1b$@\x32\x37" "\x1b(J\x1b(B\xcc"}; - PRUnichar exp[] = {0x000d,0x007f,0xfffd, 0xff6a,0xFF9C,0x0041, 0x3000, 0x5378, 0xfffd}; + char16_t exp[] = {0x000d,0x007f,0xfffd, 0xff6a,0xFF9C,0x0041, 0x3000, 0x5378, 0xfffd}; // test converter - normal operation res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName); @@ -552,7 +552,7 @@ nsresult testEUCJPDecoder() // test data char src[] = {"\x45"}; - PRUnichar exp[] = {0x0045}; + char16_t exp[] = {0x0045}; // test converter - normal operation res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName); @@ -593,7 +593,7 @@ nsresult testISO88597Decoder() "\xa7\xb1\xb3\xc9" "\xd9\xe3\xf4\xff" }; - PRUnichar exp[] = { + char16_t exp[] = { 0x0009, 0x000d, 0x0020, 0x0040, 0xfffd, 0xfffd, 0x00a3, 0x2015, 0x00a7, 0x00b1, 0x00b3, 0x0399, @@ -640,7 +640,7 @@ nsresult testSJISDecoder() "\x82\xd0\x82\xe7\x82\xaa\x82\xc8" /* Hiragana */ "\x82\x50\x82\x51\x82\x52\x82\x60\x82\x61\x82\x62" /* full width 123ABC */ }; - PRUnichar exp[] = { + char16_t exp[] = { 0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0065, 0x0073, 0x0065, 0x6f22, 0x5b57, 0x30ab, 0x30bf, 0x30ab, 0x30ca, @@ -683,7 +683,7 @@ nsresult testUTF8Decoder() #ifdef NOPE // XXX decomment this when I have test data // test data char src[] = {}; - PRUnichar exp[] = {}; + char16_t exp[] = {}; // test converter - normal operation res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName); @@ -720,7 +720,7 @@ nsresult testMUTF7Decoder() // test data char src[] = {"\x50\x51\x52\x53&AAAAAAAA-&-&AAA-"}; - PRUnichar exp[] = {0x0050,0x0051,0x0052,0x0053,0x0000,0x0000,0x0000,'&',0x0000}; + char16_t exp[] = {0x0050,0x0051,0x0052,0x0053,0x0000,0x0000,0x0000,'&',0x0000}; // test converter - normal operation res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName); @@ -756,7 +756,7 @@ nsresult testUTF7Decoder() // test data char src[] = {"+ADwAIQ-DOC"}; - PRUnichar exp[] = {'<','!','D','O','C'}; + char16_t exp[] = {'<','!','D','O','C'}; // test converter - normal operation res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName); @@ -795,7 +795,7 @@ nsresult testLatin1Encoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = {0x0001,0x0002,0xffff,0x00e3}; + char16_t src[] = {0x0001,0x0002,0xffff,0x00e3}; char exp[] = {"\x01\x02\xcc\xe3"}; // test converter - easy test @@ -832,7 +832,7 @@ nsresult testSJISEncoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = { + char16_t src[] = { 0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0065, 0x0073, 0x0065, 0x6f22, 0x5b57, 0x30ab, 0x30bf, 0x30ab, 0x30ca, @@ -881,7 +881,7 @@ nsresult testEUCJPEncoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = {0x0045, 0x0054}; + char16_t src[] = {0x0045, 0x0054}; char exp[] = {"\x45\x54"}; // test converter - easy test @@ -918,7 +918,7 @@ nsresult testISO2022JPEncoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = {0x000d,0x007f, 0xff6a,0xFF9C, 0x3000, 0x5378}; + char16_t src[] = {0x000d,0x007f, 0xff6a,0xFF9C, 0x3000, 0x5378}; char exp[] = {"\x0d\x7f" "\x1b(J\xaa\xdc" "\x1b$@\x21\x21\x32\x37\x1b(B"}; // test converter - easy test @@ -955,7 +955,7 @@ nsresult testMUTF7Encoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = {0x0050,0x0051,0x0052,0x0053,0x0000,0x0000,0x0000,'&',0x0000}; + char16_t src[] = {0x0050,0x0051,0x0052,0x0053,0x0000,0x0000,0x0000,'&',0x0000}; char exp[] = {"\x50\x51\x52\x53&AAAAAAAA-&-&AAA-"}; // test converter - easy test @@ -992,7 +992,7 @@ nsresult testUTF7Encoder() enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data - PRUnichar src[] = {'e','t','i','r','a',0x0a}; + char16_t src[] = {'e','t','i','r','a',0x0a}; char exp[] = {"etira\x0a"}; // test converter - easy test diff --git a/intl/uconv/tests/nsconv.cpp b/intl/uconv/tests/nsconv.cpp index 4f28cdb7353d..116f6fc1f316 100644 --- a/intl/uconv/tests/nsconv.cpp +++ b/intl/uconv/tests/nsconv.cpp @@ -32,7 +32,7 @@ void usage() #define OUTBUFSIZE (1024*16*8) char inbuffer[INBUFSIZE]; char outbuffer[OUTBUFSIZE]; -PRUnichar medbuffer[MEDBUFSIZE]; +char16_t medbuffer[MEDBUFSIZE]; int main(int argc, const char** argv) { diff --git a/intl/uconv/ucvcn/gbku.h b/intl/uconv/ucvcn/gbku.h index 814dda89fcb3..19563c099727 100644 --- a/intl/uconv/ucvcn/gbku.h +++ b/intl/uconv/ucvcn/gbku.h @@ -38,17 +38,17 @@ #define _GBKU_H__ -#define UCS2_NO_MAPPING ((PRUnichar) 0xfffd) +#define UCS2_NO_MAPPING ((char16_t) 0xfffd) #define UINT8_IN_RANGE(a, b, c) \ (((uint8_t)(a) <= (uint8_t)(b))&&((uint8_t)(b) <= (uint8_t)(c))) #define UNICHAR_IN_RANGE(a, b, c) \ - (((PRUnichar)(a) <= (PRUnichar)(b))&&((PRUnichar)(b) <= (PRUnichar)(c))) -#define CAST_CHAR_TO_UNICHAR(a) ((PRUnichar)((unsigned char)(a))) + (((char16_t)(a) <= (char16_t)(b))&&((char16_t)(b) <= (char16_t)(c))) +#define CAST_CHAR_TO_UNICHAR(a) ((char16_t)((unsigned char)(a))) #define CAST_UNICHAR_TO_CHAR(a) ((char)a) #define IS_ASCII(a) (0==(0xff80 & (a))) #define IS_GBK_EURO(c) ((char)0x80 == (c)) -#define UCS2_EURO ((PRUnichar) 0x20ac) +#define UCS2_EURO ((char16_t) 0x20ac) #include "nsGBKConvUtil.h" diff --git a/intl/uconv/ucvcn/nsGBKConvUtil.cpp b/intl/uconv/ucvcn/nsGBKConvUtil.cpp index e343306538a9..3eed63e19518 100644 --- a/intl/uconv/ucvcn/nsGBKConvUtil.cpp +++ b/intl/uconv/ucvcn/nsGBKConvUtil.cpp @@ -11,7 +11,7 @@ // nsGBKConvUtil //-------------------------------------------------------------------- -static const PRUnichar gGBKToUnicodeTable[MAX_GBK_LENGTH] = { +static const char16_t gGBKToUnicodeTable[MAX_GBK_LENGTH] = { #include "cp936map.h" }; static const uint16_t gUnicodeToGBKTable[0xA000-0x4e00] = { @@ -19,7 +19,7 @@ static const uint16_t gUnicodeToGBKTable[0xA000-0x4e00] = { }; bool nsGBKConvUtil::UnicodeToGBKChar( - PRUnichar aChar, bool aToGL, char* + char16_t aChar, bool aToGL, char* aOutByte1, char* aOutByte2) { bool found=false; @@ -74,7 +74,7 @@ bool nsGBKConvUtil::UnicodeToGBKChar( } return true; } -PRUnichar nsGBKConvUtil::GBKCharToUnicode(char aByte1, char aByte2) +char16_t nsGBKConvUtil::GBKCharToUnicode(char aByte1, char aByte2) { NS_ASSERTION(UINT8_IN_RANGE(0x81,aByte1, 0xFE), "first byte out of range"); NS_ASSERTION(UINT8_IN_RANGE(0x40,aByte2, 0xFE), "second byte out of range"); diff --git a/intl/uconv/ucvcn/nsGBKConvUtil.h b/intl/uconv/ucvcn/nsGBKConvUtil.h index d7a4a33745bd..959861975706 100644 --- a/intl/uconv/ucvcn/nsGBKConvUtil.h +++ b/intl/uconv/ucvcn/nsGBKConvUtil.h @@ -9,8 +9,8 @@ class nsGBKConvUtil { public: nsGBKConvUtil() { } ~nsGBKConvUtil() { } - PRUnichar GBKCharToUnicode(char aByte1, char aByte2); - bool UnicodeToGBKChar(PRUnichar aChar, bool aToGL, + char16_t GBKCharToUnicode(char aByte1, char aByte2); + bool UnicodeToGBKChar(char16_t aChar, bool aToGL, char* aOutByte1, char* aOutByte2); }; #endif /* nsGBKConvUtil_h_ */ diff --git a/intl/uconv/ucvcn/nsGBKToUnicode.cpp b/intl/uconv/ucvcn/nsGBKToUnicode.cpp index f6eb928e25e2..f28f818b372a 100644 --- a/intl/uconv/ucvcn/nsGBKToUnicode.cpp +++ b/intl/uconv/ucvcn/nsGBKToUnicode.cpp @@ -99,7 +99,7 @@ nsGB18030Unique4BytesToUnicode::nsGB18030Unique4BytesToUnicode() NS_IMETHODIMP nsGBKToUnicode::ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, - PRUnichar *aDest, + char16_t *aDest, int32_t * aDestLength) { int32_t i=0; @@ -168,7 +168,7 @@ NS_IMETHODIMP nsGBKToUnicode::ConvertNoBuff(const char* aSrc, { if(DecodeToSurrogate(aSrc, aDest)) { - // surrogte two PRUnichar + // surrogte two char16_t iDestlen++; aDest++; } else { @@ -246,7 +246,7 @@ void nsGB18030ToUnicode::Create4BytesDecoder() { m4BytesDecoder = new nsGB18030Unique4BytesToUnicode(); } -bool nsGB18030ToUnicode::DecodeToSurrogate(const char* aSrc, PRUnichar* aOut) +bool nsGB18030ToUnicode::DecodeToSurrogate(const char* aSrc, char16_t* aOut) { NS_ASSERTION(FIRST_BYTE_IS_SURROGATE(aSrc[0]), "illegal first byte"); NS_ASSERTION(LEGAL_GBK_4BYTE_SECOND_BYTE(aSrc[1]), "illegal second byte"); @@ -279,7 +279,7 @@ bool nsGB18030ToUnicode::DecodeToSurrogate(const char* aSrc, PRUnichar* aOut) return true; } -bool nsGBKToUnicode::TryExtensionDecoder(const char* aSrc, PRUnichar* aOut) +bool nsGBKToUnicode::TryExtensionDecoder(const char* aSrc, char16_t* aOut) { if(!mExtensionDecoder) CreateExtensionDecoder(); @@ -300,11 +300,11 @@ bool nsGBKToUnicode::TryExtensionDecoder(const char* aSrc, PRUnichar* aOut) } return false; } -bool nsGBKToUnicode::DecodeToSurrogate(const char* aSrc, PRUnichar* aOut) +bool nsGBKToUnicode::DecodeToSurrogate(const char* aSrc, char16_t* aOut) { return false; } -bool nsGBKToUnicode::Try4BytesDecoder(const char* aSrc, PRUnichar* aOut) +bool nsGBKToUnicode::Try4BytesDecoder(const char* aSrc, char16_t* aOut) { if(!m4BytesDecoder) Create4BytesDecoder(); diff --git a/intl/uconv/ucvcn/nsGBKToUnicode.h b/intl/uconv/ucvcn/nsGBKToUnicode.h index b5556e030473..6264944e708e 100644 --- a/intl/uconv/ucvcn/nsGBKToUnicode.h +++ b/intl/uconv/ucvcn/nsGBKToUnicode.h @@ -37,7 +37,7 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsDecoderSupport class [declaration] - NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, PRUnichar *aDest, int32_t * aDestLength); + NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, char16_t *aDest, int32_t * aDestLength); protected: nsGBKConvUtil mUtil; @@ -46,9 +46,9 @@ protected: virtual void CreateExtensionDecoder(); virtual void Create4BytesDecoder(); - bool TryExtensionDecoder(const char* aSrc, PRUnichar* aDest); - bool Try4BytesDecoder(const char* aSrc, PRUnichar* aDest); - virtual bool DecodeToSurrogate(const char* aSrc, PRUnichar* aDest); + bool TryExtensionDecoder(const char* aSrc, char16_t* aDest); + bool Try4BytesDecoder(const char* aSrc, char16_t* aDest); + virtual bool DecodeToSurrogate(const char* aSrc, char16_t* aDest); }; @@ -61,7 +61,7 @@ public: protected: virtual void CreateExtensionDecoder(); virtual void Create4BytesDecoder(); - virtual bool DecodeToSurrogate(const char* aSrc, PRUnichar* aDest); + virtual bool DecodeToSurrogate(const char* aSrc, char16_t* aDest); }; #endif /* nsGBK2312ToUnicode_h___ */ diff --git a/intl/uconv/ucvcn/nsHZToUnicode.cpp b/intl/uconv/ucvcn/nsHZToUnicode.cpp index daa86a8f710e..758644db37d5 100644 --- a/intl/uconv/ucvcn/nsHZToUnicode.cpp +++ b/intl/uconv/ucvcn/nsHZToUnicode.cpp @@ -64,7 +64,7 @@ nsHZToUnicode::nsHZToUnicode() : nsBufferDecoderSupport(1) NS_IMETHODIMP nsHZToUnicode::ConvertNoBuff( const char* aSrc, int32_t * aSrcLength, - PRUnichar *aDest, + char16_t *aDest, int32_t * aDestLength) { int32_t i=0; diff --git a/intl/uconv/ucvcn/nsHZToUnicode.h b/intl/uconv/ucvcn/nsHZToUnicode.h index 2592d752b0b0..ef2dbb9a704e 100644 --- a/intl/uconv/ucvcn/nsHZToUnicode.h +++ b/intl/uconv/ucvcn/nsHZToUnicode.h @@ -33,7 +33,7 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsDecoderSupport class [declaration] NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, - PRUnichar *aDest, int32_t * aDestLength); + char16_t *aDest, int32_t * aDestLength); nsGBKConvUtil mUtil; private: diff --git a/intl/uconv/ucvcn/nsISO2022CNToUnicode.cpp b/intl/uconv/ucvcn/nsISO2022CNToUnicode.cpp index 1b860d4557f1..82bdc0fac628 100644 --- a/intl/uconv/ucvcn/nsISO2022CNToUnicode.cpp +++ b/intl/uconv/ucvcn/nsISO2022CNToUnicode.cpp @@ -9,7 +9,7 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); -NS_IMETHODIMP nsISO2022CNToUnicode::GB2312_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, PRUnichar * aDest, int32_t * aDestLength) +NS_IMETHODIMP nsISO2022CNToUnicode::GB2312_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, char16_t * aDest, int32_t * aDestLength) { nsresult rv; @@ -32,7 +32,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::GB2312_To_Unicode(unsigned char *aSrc, int32 return rv; } -NS_IMETHODIMP nsISO2022CNToUnicode::EUCTW_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, PRUnichar * aDest, int32_t * aDestLength) +NS_IMETHODIMP nsISO2022CNToUnicode::EUCTW_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, char16_t * aDest, int32_t * aDestLength) { nsresult rv; @@ -55,12 +55,12 @@ NS_IMETHODIMP nsISO2022CNToUnicode::EUCTW_To_Unicode(unsigned char *aSrc, int32_ return(rv); } -NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen, PRUnichar * aDest, int32_t * aDestLen) +NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen, char16_t * aDest, int32_t * aDestLen) { const unsigned char * srcEnd = (unsigned char *)aSrc + *aSrcLen; const unsigned char * src = (unsigned char *) aSrc; - PRUnichar* destEnd = aDest + *aDestLen; - PRUnichar* dest = aDest; + char16_t* destEnd = aDest + *aDestLen; + char16_t* dest = aDest; nsresult rv; int32_t aLen; @@ -74,7 +74,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -86,8 +86,8 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -103,9 +103,9 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -119,10 +119,10 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 4)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) ')'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) ')'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -135,11 +135,11 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 5)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) ')'; - *dest++ = (PRUnichar) 'A'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) ')'; + *dest++ = (char16_t) 'A'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -163,7 +163,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } } break; @@ -189,8 +189,8 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) mData; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) mData; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } mState = eState_GB2312_1980; break; @@ -204,7 +204,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_29_A_SO_SI; } @@ -217,11 +217,11 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 5)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) ')'; - *dest++ = (PRUnichar) 'G'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) ')'; + *dest++ = (char16_t) 'G'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -245,7 +245,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } } break; @@ -271,8 +271,8 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) mData; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) mData; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } mState = eState_CNS11643_1; break; @@ -286,7 +286,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_29_G_SO_SI; } @@ -298,10 +298,10 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 4)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '*'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '*'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -313,11 +313,11 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 5)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '*'; - *dest++ = (PRUnichar) 'H'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '*'; + *dest++ = (char16_t) 'H'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -332,12 +332,12 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 6)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '*'; - *dest++ = (PRUnichar) 'H'; - *dest++ = (PRUnichar) ESC; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '*'; + *dest++ = (char16_t) 'H'; + *dest++ = (char16_t) ESC; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -361,7 +361,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } } break; @@ -389,8 +389,8 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) mData; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) mData; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } mState = eState_CNS11643_2; break; @@ -401,7 +401,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_2A_H_ESC_SS2_SI; } @@ -416,7 +416,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_2A_H_ESC_SS2_SI; } @@ -429,10 +429,10 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 4)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '+'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '+'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -444,11 +444,11 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 5)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '+'; - *dest++ = (PRUnichar) 'I' + mPlaneID - 3; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '+'; + *dest++ = (char16_t) 'I' + mPlaneID - 3; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -463,12 +463,12 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 6)) goto error1; - *dest++ = (PRUnichar) ESC; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '+'; - *dest++ = (PRUnichar) 'I' + mPlaneID - 3; - *dest++ = (PRUnichar) ESC; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) ESC; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '+'; + *dest++ = (char16_t) 'I' + mPlaneID - 3; + *dest++ = (char16_t) ESC; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ASCII; } @@ -492,7 +492,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } } @@ -521,8 +521,8 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) mData; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) mData; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; } mState = eState_CNS11643_3; break; @@ -533,7 +533,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_2B_I_ESC_SS3_SI; } @@ -548,7 +548,7 @@ NS_IMETHODIMP nsISO2022CNToUnicode::Convert(const char * aSrc, int32_t * aSrcLen } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = eState_ESC_24_2B_I_ESC_SS3_SI; } diff --git a/intl/uconv/ucvcn/nsISO2022CNToUnicode.h b/intl/uconv/ucvcn/nsISO2022CNToUnicode.h index 19ae97f1c88f..a9b7e19d523f 100644 --- a/intl/uconv/ucvcn/nsISO2022CNToUnicode.h +++ b/intl/uconv/ucvcn/nsISO2022CNToUnicode.h @@ -34,7 +34,7 @@ public: virtual ~nsISO2022CNToUnicode() {} NS_IMETHOD Convert(const char *aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength) @@ -100,9 +100,9 @@ private: nsCOMPtr mEUCTW_Decoder; NS_IMETHOD GB2312_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD EUCTW_To_Unicode(unsigned char *aSrc, int32_t aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; }; #endif // nsISO2022CNToUnicode_h__ diff --git a/intl/uconv/ucvcn/nsUnicodeToGB2312V2.cpp b/intl/uconv/ucvcn/nsUnicodeToGB2312V2.cpp index 8347ea3c048c..b633a7594de9 100644 --- a/intl/uconv/ucvcn/nsUnicodeToGB2312V2.cpp +++ b/intl/uconv/ucvcn/nsUnicodeToGB2312V2.cpp @@ -13,7 +13,7 @@ nsUnicodeToGB2312V2::nsUnicodeToGB2312V2() : { } -NS_IMETHODIMP nsUnicodeToGB2312V2::ConvertNoBuff(const PRUnichar * aSrc, +NS_IMETHODIMP nsUnicodeToGB2312V2::ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) @@ -51,7 +51,7 @@ NS_IMETHODIMP nsUnicodeToGB2312V2::ConvertNoBuff(const PRUnichar * aSrc, break; } } - iSrcLength++ ; // each unicode char just count as one in PRUnichar* string + iSrcLength++ ; // each unicode char just count as one in char16_t* string aSrc++; if ( iDestLength >= (*aDestLength) && (iSrcLength < *aSrcLength )) { diff --git a/intl/uconv/ucvcn/nsUnicodeToGB2312V2.h b/intl/uconv/ucvcn/nsUnicodeToGB2312V2.h index a29362fa1ada..4e6e0bd57d03 100644 --- a/intl/uconv/ucvcn/nsUnicodeToGB2312V2.h +++ b/intl/uconv/ucvcn/nsUnicodeToGB2312V2.h @@ -29,7 +29,7 @@ public: protected: - NS_IMETHOD ConvertNoBuff(const PRUnichar * aSrc, + NS_IMETHOD ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); @@ -37,7 +37,7 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { return NS_OK; diff --git a/intl/uconv/ucvcn/nsUnicodeToGBK.cpp b/intl/uconv/ucvcn/nsUnicodeToGBK.cpp index c14d35a6ab28..9e7e90bf7a89 100644 --- a/intl/uconv/ucvcn/nsUnicodeToGBK.cpp +++ b/intl/uconv/ucvcn/nsUnicodeToGBK.cpp @@ -80,16 +80,16 @@ void nsUnicodeToGB18030::Create4BytesEncoder() } bool nsUnicodeToGB18030::EncodeSurrogate( - PRUnichar aSurrogateHigh, - PRUnichar aSurrogateLow, + char16_t aSurrogateHigh, + char16_t aSurrogateLow, char* aOut) { if( NS_IS_HIGH_SURROGATE(aSurrogateHigh) && NS_IS_LOW_SURROGATE(aSurrogateLow) ) { // notice that idx does not include the 0x10000 - uint32_t idx = ((aSurrogateHigh - (PRUnichar)0xD800) << 10 ) | - (aSurrogateLow - (PRUnichar) 0xDC00); + uint32_t idx = ((aSurrogateHigh - (char16_t)0xD800) << 10 ) | + (aSurrogateLow - (char16_t) 0xDC00); unsigned char *out = (unsigned char*) aOut; // notice this is from 0x90 for supplment planes @@ -123,7 +123,7 @@ void nsUnicodeToGBK::Create4BytesEncoder() m4BytesEncoder = nullptr; } bool nsUnicodeToGBK::TryExtensionEncoder( - PRUnichar aChar, + char16_t aChar, char* aOut, int32_t *aOutLen ) @@ -148,7 +148,7 @@ bool nsUnicodeToGBK::TryExtensionEncoder( } bool nsUnicodeToGBK::Try4BytesEncoder( - PRUnichar aChar, + char16_t aChar, char* aOut, int32_t *aOutLen ) @@ -174,22 +174,22 @@ bool nsUnicodeToGBK::Try4BytesEncoder( return false; } bool nsUnicodeToGBK::EncodeSurrogate( - PRUnichar aSurrogateHigh, - PRUnichar aSurrogateLow, + char16_t aSurrogateHigh, + char16_t aSurrogateLow, char* aOut) { return false; // GBK cannot encode Surrogate, let the subclass encode it. } NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuff( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { int32_t iSrcLength = 0; int32_t iDestLength = 0; - PRUnichar unicode; + char16_t unicode; nsresult res = NS_OK; while (iSrcLength < *aSrcLength ) { @@ -294,7 +294,7 @@ NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuff( } } } - iSrcLength++ ; // Each unicode char just count as one in PRUnichar string; + iSrcLength++ ; // Each unicode char just count as one in char16_t string; mSurrogateHigh = 0; aSrc++; if ( iDestLength >= (*aDestLength) && (iSrcLength < *aSrcLength) ) diff --git a/intl/uconv/ucvcn/nsUnicodeToGBK.h b/intl/uconv/ucvcn/nsUnicodeToGBK.h index 5f155a3ef337..dc18f81efdec 100644 --- a/intl/uconv/ucvcn/nsUnicodeToGBK.h +++ b/intl/uconv/ucvcn/nsUnicodeToGBK.h @@ -35,12 +35,12 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuff(const PRUnichar * aSrc, + NS_IMETHOD ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { return NS_OK; @@ -52,11 +52,11 @@ protected: nsCOMPtr mExtensionEncoder; nsCOMPtr m4BytesEncoder; protected: - PRUnichar mSurrogateHigh; + char16_t mSurrogateHigh; nsGBKConvUtil mUtil; - bool TryExtensionEncoder(PRUnichar aChar, char* aDest, int32_t* aOutLen); - bool Try4BytesEncoder(PRUnichar aChar, char* aDest, int32_t* aOutLen); - virtual bool EncodeSurrogate(PRUnichar aSurrogateHigh, PRUnichar aSurrogateLow, char* aDest); + bool TryExtensionEncoder(char16_t aChar, char* aDest, int32_t* aOutLen); + bool Try4BytesEncoder(char16_t aChar, char* aDest, int32_t* aOutLen); + virtual bool EncodeSurrogate(char16_t aSurrogateHigh, char16_t aSurrogateLow, char* aDest); }; class nsUnicodeToGB18030: public nsUnicodeToGBK @@ -67,7 +67,7 @@ public: protected: virtual void CreateExtensionEncoder(); virtual void Create4BytesEncoder(); - virtual bool EncodeSurrogate(PRUnichar aSurrogateHigh, PRUnichar aSurrogateLow, char* aDest); + virtual bool EncodeSurrogate(char16_t aSurrogateHigh, char16_t aSurrogateLow, char* aDest); }; #endif /* nsUnicodeToGBK_h___ */ diff --git a/intl/uconv/ucvcn/nsUnicodeToHZ.cpp b/intl/uconv/ucvcn/nsUnicodeToHZ.cpp index 3eec631332f2..745d5d7d55e4 100644 --- a/intl/uconv/ucvcn/nsUnicodeToHZ.cpp +++ b/intl/uconv/ucvcn/nsUnicodeToHZ.cpp @@ -29,7 +29,7 @@ nsUnicodeToHZ::nsUnicodeToHZ() : nsEncoderSupport(6) mHZState = HZ_STATE_ASCII; // per HZ spec, default to HZ mode } NS_IMETHODIMP nsUnicodeToHZ::ConvertNoBuff( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) @@ -84,7 +84,7 @@ NS_IMETHODIMP nsUnicodeToHZ::ConvertNoBuff( // other regular ASCII chars convert by normal ways // Is this works for both little endian and big endian machines ? - *aDest = (char) ( (PRUnichar)(*aSrc) ); + *aDest = (char) ( (char16_t)(*aSrc) ); aDest++; // increment 1 byte iDestLength +=1; } diff --git a/intl/uconv/ucvcn/nsUnicodeToHZ.h b/intl/uconv/ucvcn/nsUnicodeToHZ.h index 82ce7006e0da..a786abf7cabb 100644 --- a/intl/uconv/ucvcn/nsUnicodeToHZ.h +++ b/intl/uconv/ucvcn/nsUnicodeToHZ.h @@ -32,14 +32,14 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuff(const PRUnichar * aSrc, + NS_IMETHOD ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD FinishNoBuff(char * aDest, int32_t * aDestLength); - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { return NS_OK; diff --git a/intl/uconv/ucvja/nsJapaneseToUnicode.cpp b/intl/uconv/ucvja/nsJapaneseToUnicode.cpp index b6c5a1a460d9..8abb68e2cd42 100644 --- a/intl/uconv/ucvja/nsJapaneseToUnicode.cpp +++ b/intl/uconv/ucvja/nsJapaneseToUnicode.cpp @@ -34,7 +34,7 @@ NS_IMETHODIMP nsShiftJISToUnicode::Convert( const char * aSrc, int32_t * aSrcLen, - PRUnichar * aDest, int32_t * aDestLen) + char16_t * aDest, int32_t * aDestLen) { static const uint8_t sbIdx[256] = { @@ -74,14 +74,14 @@ NS_IMETHODIMP nsShiftJISToUnicode::Convert( const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen; const unsigned char* src =(unsigned char*) aSrc; - PRUnichar* destEnd = aDest + *aDestLen; - PRUnichar* dest = aDest; + char16_t* destEnd = aDest + *aDestLen; + char16_t* dest = aDest; while (src < srcEnd) { switch (mState) { case 0: if (*src <= 0x80) { // ASCII - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; if (dest >= destEnd) { goto error1; } @@ -116,7 +116,7 @@ NS_IMETHODIMP nsShiftJISToUnicode::Convert( goto error_invalidchar; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - PRUnichar ch = gJapaneseMap[mData+off]; + char16_t ch = gJapaneseMap[mData+off]; if(ch == 0xfffd) { if (mErrBehavior == kOnError_Signal) goto error_invalidchar; @@ -170,15 +170,15 @@ error1: return NS_OK_UDEC_MOREOUTPUT; } -PRUnichar +char16_t nsShiftJISToUnicode::GetCharacterForUnMapped() { - return PRUnichar(SJIS_UNMAPPED); + return char16_t(SJIS_UNMAPPED); } NS_IMETHODIMP nsEUCJPToUnicodeV2::Convert( const char * aSrc, int32_t * aSrcLen, - PRUnichar * aDest, int32_t * aDestLen) + char16_t * aDest, int32_t * aDestLen) { static const uint8_t sbIdx[256] = { @@ -234,8 +234,8 @@ NS_IMETHODIMP nsEUCJPToUnicodeV2::Convert( const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen; const unsigned char* src =(unsigned char*) aSrc; - PRUnichar* destEnd = aDest + *aDestLen; - PRUnichar* dest = aDest; + char16_t* destEnd = aDest + *aDestLen; + char16_t* dest = aDest; while((src < srcEnd)) { switch(mState) @@ -265,7 +265,7 @@ NS_IMETHODIMP nsEUCJPToUnicodeV2::Convert( } } else { // ASCII - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; if(dest >= destEnd) goto error1; } @@ -384,7 +384,7 @@ error1: NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( const char * aSrc, int32_t * aSrcLen, - PRUnichar * aDest, int32_t * aDestLen) + char16_t * aDest, int32_t * aDestLen) { static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -469,8 +469,8 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen; const unsigned char* src =(unsigned char*) aSrc; - PRUnichar* destEnd = aDest + *aDestLen; - PRUnichar* dest = aDest; + char16_t* destEnd = aDest + *aDestLen; + char16_t* dest = aDest; while((src < srcEnd)) { @@ -490,7 +490,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } break; @@ -506,13 +506,13 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) 0x1b; + *dest++ = (char16_t) 0x1b; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } mState = mLastLegalState; } @@ -543,14 +543,14 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '('; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '('; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } mState = mLastLegalState; } @@ -571,14 +571,14 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '$'; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '$'; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } mState = mLastLegalState; } @@ -594,15 +594,15 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 4)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) '('; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) '('; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } mState = mLastLegalState; } @@ -625,7 +625,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( // to map them to Yen and Overbar if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; ++mRunLength; } break; @@ -785,7 +785,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( goto error2; } else { unsigned char gb[2]; - PRUnichar uni; + char16_t uni; int32_t gbLen = 2, uniLen = 1; // ((mData/94)+0x21) is the original 1st byte. // *src is the present 2nd byte. @@ -843,7 +843,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( goto error2; } else { unsigned char ksc[2]; - PRUnichar uni; + char16_t uni; int32_t kscLen = 2, uniLen = 1; // ((mData/94)+0x21) is the original 1st byte. // *src is the present 2nd byte. @@ -888,14 +888,14 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '.'; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '.'; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } } break; @@ -925,7 +925,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { // Put one character with ISO-8859-7 encoding. unsigned char gr = *src | 0x80; - PRUnichar uni; + char16_t uni; int32_t grLen = 1, uniLen = 1; // Convert ISO-8859-7 to unicode. mISO88597Decoder->Convert((const char *)&gr, &grLen, @@ -941,14 +941,14 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert( } else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) 'N'; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) 'N'; if (0x80 & *src) { if (mErrBehavior == kOnError_Signal) goto error3; *dest++ = UNICODE_REPLACEMENT_CHARACTER; } else { - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } } break; diff --git a/intl/uconv/ucvja/nsJapaneseToUnicode.h b/intl/uconv/ucvja/nsJapaneseToUnicode.h index 0693c7fb002a..a6524b02be8f 100644 --- a/intl/uconv/ucvja/nsJapaneseToUnicode.h +++ b/intl/uconv/ucvja/nsJapaneseToUnicode.h @@ -20,7 +20,7 @@ public: virtual ~nsShiftJISToUnicode() {} NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength) { @@ -33,7 +33,7 @@ public: return NS_OK; } - virtual PRUnichar GetCharacterForUnMapped(); + virtual char16_t GetCharacterForUnMapped(); private: @@ -53,7 +53,7 @@ public: virtual ~nsEUCJPToUnicodeV2() {} NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength) { @@ -95,7 +95,7 @@ public: } NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength) { diff --git a/intl/uconv/ucvja/nsUnicodeToISO2022JP.cpp b/intl/uconv/ucvja/nsUnicodeToISO2022JP.cpp index 0578ff9c6e6f..9328afdee06b 100644 --- a/intl/uconv/ucvja/nsUnicodeToISO2022JP.cpp +++ b/intl/uconv/ucvja/nsUnicodeToISO2022JP.cpp @@ -12,7 +12,7 @@ // Basic mapping from Hankaku to Zenkaku // Nigori and Maru are taken care of outside this basic mapping -static const PRUnichar gBasicMapping[0x40] = +static const char16_t gBasicMapping[0x40] = { // 0xff60 0xff60,0x3002,0x300c,0x300d,0x3001,0x30fb,0x30f2,0x30a1, @@ -138,18 +138,18 @@ nsresult nsUnicodeToISO2022JP::ChangeCharset(int32_t aCharset, return NS_OK; } -nsresult nsUnicodeToISO2022JP::ConvertHankaku(const PRUnichar * aSrc, +nsresult nsUnicodeToISO2022JP::ConvertHankaku(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { nsresult res = NS_OK; - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; - PRUnichar srcChar, tempChar; + char16_t srcChar, tempChar; int32_t bcr, bcw; bcw = destEnd - dest; @@ -169,7 +169,7 @@ nsresult nsUnicodeToISO2022JP::ConvertHankaku(const PRUnichar * aSrc, if (src < srcEnd) { // if the character could take a modifier, and the next char - // is a modifier, modify it and eat one PRUnichar + // is a modifier, modify it and eat one char16_t if (NEED_TO_CHECK_NIGORI(srcChar) && IS_NIGORI(*src)) { tempChar += NIGORI_MODIFIER; ++src; @@ -196,15 +196,15 @@ nsresult nsUnicodeToISO2022JP::ConvertHankaku(const PRUnichar * aSrc, // Subclassing of nsTableEncoderSupport class [implementation] NS_IMETHODIMP nsUnicodeToISO2022JP::ConvertNoBuffNoErr( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { nsresult res = NS_OK; - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; int32_t bcr, bcw; diff --git a/intl/uconv/ucvja/nsUnicodeToISO2022JP.h b/intl/uconv/ucvja/nsUnicodeToISO2022JP.h index 59df4721cafb..f2d4ba1b7220 100644 --- a/intl/uconv/ucvja/nsUnicodeToISO2022JP.h +++ b/intl/uconv/ucvja/nsUnicodeToISO2022JP.h @@ -37,13 +37,13 @@ protected: nsresult ChangeCharset(int32_t aCharset, char * aDest, int32_t * aDestLength); - nsresult ConvertHankaku(const PRUnichar *aSrc, int32_t * aSrcLength, + nsresult ConvertHankaku(const char16_t *aSrc, int32_t * aSrcLength, char *aDest, int32_t * aDestLength); //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD FinishNoBuff(char * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); diff --git a/intl/uconv/ucvko/nsISO2022KRToUnicode.cpp b/intl/uconv/ucvko/nsISO2022KRToUnicode.cpp index 4edb8fe4ca45..61a6e2a0420e 100644 --- a/intl/uconv/ucvko/nsISO2022KRToUnicode.cpp +++ b/intl/uconv/ucvko/nsISO2022KRToUnicode.cpp @@ -7,14 +7,14 @@ #include "nsICharsetConverterManager.h" #include "nsServiceManagerUtils.h" -NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen, PRUnichar * aDest, int32_t * aDestLen) +NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen, char16_t * aDest, int32_t * aDestLen) { static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen; const unsigned char* src =(unsigned char*) aSrc; - PRUnichar* destEnd = aDest + *aDestLen; - PRUnichar* dest = aDest; + char16_t* destEnd = aDest + *aDestLen; + char16_t* dest = aDest; while((src < srcEnd)) { // if LF/CR, return to US-ASCII unconditionally. @@ -45,7 +45,7 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen else { if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; } break; @@ -56,8 +56,8 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen else { if (CHECK_OVERRUN(dest, destEnd, 2)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) 0x1b; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = mLastLegalState; } break; @@ -69,9 +69,9 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen else { if (CHECK_OVERRUN(dest, destEnd, 3)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '$'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '$'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = mLastLegalState; } break; @@ -85,10 +85,10 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen else { if (CHECK_OVERRUN(dest, destEnd, 4)) goto error1; - *dest++ = (PRUnichar) 0x1b; - *dest++ = (PRUnichar) '$'; - *dest++ = (PRUnichar) ')'; - *dest++ = (0x80 & *src) ? 0xFFFD : (PRUnichar) *src; + *dest++ = (char16_t) 0x1b; + *dest++ = (char16_t) '$'; + *dest++ = (char16_t) ')'; + *dest++ = (0x80 & *src) ? 0xFFFD : (char16_t) *src; mState = mLastLegalState; } break; @@ -112,7 +112,7 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; mState = mState_KSX1001_1992; - *dest++ = (PRUnichar) *src; + *dest++ = (char16_t) *src; ++mRunLength; } else { // Everything else is invalid. @@ -141,7 +141,7 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, int32_t * aSrcLen if (CHECK_OVERRUN(dest, destEnd, 1)) goto error1; unsigned char ksx[2]; - PRUnichar uni; + char16_t uni; int32_t ksxLen = 2, uniLen = 1; // mData is the original 1st byte. // *src is the present 2nd byte. diff --git a/intl/uconv/ucvko/nsISO2022KRToUnicode.h b/intl/uconv/ucvko/nsISO2022KRToUnicode.h index 0af443a7183f..73b5a56c3c30 100644 --- a/intl/uconv/ucvko/nsISO2022KRToUnicode.h +++ b/intl/uconv/ucvko/nsISO2022KRToUnicode.h @@ -28,7 +28,7 @@ public: } NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) ; + char16_t * aDest, int32_t * aDestLength) ; NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength) diff --git a/intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp b/intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp index 95ebc98e28a1..2b8f40ab20ea 100644 --- a/intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsUTF16ToUnicode.cpp @@ -17,15 +17,15 @@ enum { nsresult nsUTF16ToUnicodeBase::UTF16ConvertToUnicode(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength, bool aSwapBytes) { const char* src = aSrc; const char* srcEnd = aSrc + *aSrcLength; - PRUnichar* dest = aDest; - PRUnichar* destEnd = aDest + *aDestLength; - PRUnichar oddHighSurrogate; + char16_t* dest = aDest; + char16_t* destEnd = aDest + *aDestLength; + char16_t oddHighSurrogate; switch(mState) { case STATE_FIRST_CALL: @@ -67,7 +67,7 @@ nsUTF16ToUnicodeBase::UTF16ConvertToUnicode(const char * aSrc, const char* srcEvenEnd; - PRUnichar u; + char16_t u; if (mState == STATE_HALF_CODE_POINT) { if (dest == destEnd) goto error; @@ -91,7 +91,7 @@ nsUTF16ToUnicodeBase::UTF16ConvertToUnicode(const char * aSrc, goto error; #if !defined(__sparc__) && !defined(__arm__) - u = *(const PRUnichar*)src; + u = *(const char16_t*)src; #else memcpy(&u, src, 2); #endif @@ -192,7 +192,7 @@ nsUTF16ToUnicodeBase::GetMaxLength(const char * aSrc, int32_t aSrcLength, NS_IMETHODIMP nsUTF16BEToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) + char16_t * aDest, int32_t * aDestLength) { switch (mState) { case STATE_FIRST_CALL: @@ -211,11 +211,11 @@ nsUTF16BEToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, } #ifdef IS_LITTLE_ENDIAN // on LE machines, BE BOM is 0xFFFE - if (0xFFFE != *((PRUnichar*)aSrc)) { + if (0xFFFE != *((char16_t*)aSrc)) { mState = STATE_NORMAL; } #else - if (0xFEFF != *((PRUnichar*)aSrc)) { + if (0xFEFF != *((char16_t*)aSrc)) { mState = STATE_NORMAL; } #endif @@ -245,7 +245,7 @@ nsUTF16BEToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, NS_IMETHODIMP nsUTF16LEToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) + char16_t * aDest, int32_t * aDestLength) { switch (mState) { case STATE_FIRST_CALL: @@ -264,11 +264,11 @@ nsUTF16LEToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, } #ifdef IS_BIG_ENDIAN // on BE machines, LE BOM is 0xFFFE - if (0xFFFE != *((PRUnichar*)aSrc)) { + if (0xFFFE != *((char16_t*)aSrc)) { mState = STATE_NORMAL; } #else - if (0xFEFF != *((PRUnichar*)aSrc)) { + if (0xFEFF != *((char16_t*)aSrc)) { mState = STATE_NORMAL; } #endif @@ -306,7 +306,7 @@ nsUTF16ToUnicode::Reset() NS_IMETHODIMP nsUTF16ToUnicode::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) + char16_t * aDest, int32_t * aDestLength) { if(STATE_FIRST_CALL == mState && *aSrcLength < 2) { diff --git a/intl/uconv/ucvlatin/nsUTF16ToUnicode.h b/intl/uconv/ucvlatin/nsUTF16ToUnicode.h index 5a1aa50e86ea..01c988dd1d24 100644 --- a/intl/uconv/ucvlatin/nsUTF16ToUnicode.h +++ b/intl/uconv/ucvlatin/nsUTF16ToUnicode.h @@ -17,7 +17,7 @@ protected: nsUTF16ToUnicodeBase() { Reset();} nsresult UTF16ConvertToUnicode(const char * aSrc, - int32_t * aSrcLength, PRUnichar * aDest, + int32_t * aSrcLength, char16_t * aDest, int32_t * aDestLength, bool aSwapBytes); public: @@ -33,9 +33,9 @@ protected: // to store an odd byte left over between runs uint8_t mOddByte; // to store an odd high surrogate left over between runs - PRUnichar mOddHighSurrogate; + char16_t mOddHighSurrogate; // to store an odd low surrogate left over between runs - PRUnichar mOddLowSurrogate; + char16_t mOddLowSurrogate; }; // UTF-16 big endian @@ -44,7 +44,7 @@ class nsUTF16BEToUnicode : public nsUTF16ToUnicodeBase public: NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); }; // UTF-16 little endian @@ -53,7 +53,7 @@ class nsUTF16LEToUnicode : public nsUTF16ToUnicodeBase public: NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); }; // UTF-16 with BOM @@ -63,7 +63,7 @@ public: nsUTF16ToUnicode() { Reset();} NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); diff --git a/intl/uconv/ucvlatin/nsUTF7ToUnicode.cpp b/intl/uconv/ucvlatin/nsUTF7ToUnicode.cpp index c04e58d2598c..24c89faccfd4 100644 --- a/intl/uconv/ucvlatin/nsUTF7ToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsUTF7ToUnicode.cpp @@ -22,13 +22,13 @@ nsBasicUTF7Decoder::nsBasicUTF7Decoder(char aLastChar, char aEscChar) nsresult nsBasicUTF7Decoder::DecodeDirect( const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { const char * srcEnd = aSrc + *aSrcLength; const char * src = aSrc; - PRUnichar * destEnd = aDest + *aDestLength; - PRUnichar * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; nsresult res = NS_OK; char ch; @@ -60,13 +60,13 @@ nsresult nsBasicUTF7Decoder::DecodeDirect( nsresult nsBasicUTF7Decoder::DecodeBase64( const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { const char * srcEnd = aSrc + *aSrcLength; const char * src = aSrc; - PRUnichar * destEnd = aDest + *aDestLength; - PRUnichar * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; nsresult res = NS_OK; char ch; uint32_t value; @@ -94,7 +94,7 @@ nsresult nsBasicUTF7Decoder::DecodeBase64( break; } mEncBits += value >> 2; - *(dest++) = (PRUnichar) mEncBits; + *(dest++) = (char16_t) mEncBits; mEncBits = (value & 0x03) << 14; break; case 3: @@ -109,7 +109,7 @@ nsresult nsBasicUTF7Decoder::DecodeBase64( break; } mEncBits += value >> 4; - *(dest++) = (PRUnichar) mEncBits; + *(dest++) = (char16_t) mEncBits; mEncBits = (value & 0x0f) << 12; break; case 6: @@ -121,7 +121,7 @@ nsresult nsBasicUTF7Decoder::DecodeBase64( break; } mEncBits += value; - *(dest++) = (PRUnichar) mEncBits; + *(dest++) = (char16_t) mEncBits; mEncBits = 0; break; } @@ -157,13 +157,13 @@ uint32_t nsBasicUTF7Decoder::CharToValue(char aChar) { NS_IMETHODIMP nsBasicUTF7Decoder::ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { const char * srcEnd = aSrc + *aSrcLength; const char * src = aSrc; - PRUnichar * destEnd = aDest + *aDestLength; - PRUnichar * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; int32_t bcr,bcw; nsresult res = NS_OK; diff --git a/intl/uconv/ucvlatin/nsUTF7ToUnicode.h b/intl/uconv/ucvlatin/nsUTF7ToUnicode.h index db4fb2500fca..e676fefc8ce7 100644 --- a/intl/uconv/ucvlatin/nsUTF7ToUnicode.h +++ b/intl/uconv/ucvlatin/nsUTF7ToUnicode.h @@ -36,16 +36,16 @@ protected: bool mFreshBase64; nsresult DecodeDirect(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); nsresult DecodeBase64(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); uint32_t CharToValue(char aChar); //-------------------------------------------------------------------- // Subclassing of nsBufferDecoderSupport class [declaration] NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); }; diff --git a/intl/uconv/ucvlatin/nsUnicodeToTSCII.cpp b/intl/uconv/ucvlatin/nsUnicodeToTSCII.cpp index 991289d6c328..9bc45c9b21f2 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToTSCII.cpp +++ b/intl/uconv/ucvlatin/nsUnicodeToTSCII.cpp @@ -78,18 +78,18 @@ static const uint8_t consonant_with_virama[18] = // Bruno Haible. My modifications are based on Unicode 3.0 chap. 9 and // the code chart for Tamil. NS_IMETHODIMP -nsUnicodeToTSCII::Convert(const PRUnichar * aSrc, int32_t * aSrcLength, +nsUnicodeToTSCII::Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = dest + *aDestLength; nsresult rv = NS_OK; while (src < srcEnd && dest < destEnd) { - PRUnichar ch = *src; + char16_t ch = *src; if (mBuffer) { // Attempt to combine the last character with this one. uint32_t last = mBuffer; @@ -347,7 +347,7 @@ nsUnicodeToTSCII::Reset() } NS_IMETHODIMP -nsUnicodeToTSCII::GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, +nsUnicodeToTSCII::GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) { // Some Tamil letters can be decomposed into 2 glyphs in TSCII. @@ -359,14 +359,14 @@ nsUnicodeToTSCII::GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, NS_IMETHODIMP nsUnicodeToTSCII::SetOutputErrorBehavior(int32_t aBehavior, nsIUnicharEncoder *aEncoder, - PRUnichar aChar) + char16_t aChar) { return NS_OK; } // same as the mapping of the C1(0x80-0x9f) part of Windows-1252 to Unicode -const static PRUnichar gTSCIIToTTF[] = { +const static char16_t gTSCIIToTTF[] = { 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, @@ -379,7 +379,7 @@ const static PRUnichar gTSCIIToTTF[] = { NS_IMPL_ISUPPORTS_INHERITED0(nsUnicodeToTamilTTF, nsUnicodeToTSCII) NS_IMETHODIMP -nsUnicodeToTamilTTF::Convert(const PRUnichar * aSrc, +nsUnicodeToTamilTTF::Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { @@ -415,7 +415,7 @@ nsUnicodeToTamilTTF::Convert(const PRUnichar * aSrc, // widen 8bit TSCII to pseudo-Unicode font encoding of TSCII-Tamil font for (i = 0, j = 0; i < medLen; i++) { // Only C1 part(0x80-0x9f) needs to be mapped as if they're CP1251. - PRUnichar ucs2 = (med[i] & 0xe0) == 0x80 ? + char16_t ucs2 = (med[i] & 0xe0) == 0x80 ? gTSCIIToTTF[med[i] & 0x7f] : uint8_t(med[i]); // A lot of TSCII fonts are still based on TSCII 1.6 so that // they have Tamil vowel 'I' at 0xad instead of 0xfe. @@ -433,7 +433,7 @@ nsUnicodeToTamilTTF::Convert(const PRUnichar * aSrc, } NS_IMETHODIMP -nsUnicodeToTamilTTF::GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, int32_t * aDestLength) +nsUnicodeToTamilTTF::GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) { // Each Tamil character can generate at most two presentation forms, // but we're 'extending' them to 16bit shorts, which accounts for @@ -446,7 +446,7 @@ nsUnicodeToTamilTTF::GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, in NS_IMETHODIMP nsUnicodeToTamilTTF::SetOutputErrorBehavior(int32_t aBehavior, nsIUnicharEncoder *aEncoder, - PRUnichar aChar) + char16_t aChar) { if (aBehavior == kOnError_CallBack && aEncoder == nullptr) return NS_ERROR_NULL_POINTER; diff --git a/intl/uconv/ucvlatin/nsUnicodeToTSCII.h b/intl/uconv/ucvlatin/nsUnicodeToTSCII.h index 82f105d90733..285daf2953b4 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToTSCII.h +++ b/intl/uconv/ucvlatin/nsUnicodeToTSCII.h @@ -24,19 +24,19 @@ public: nsUnicodeToTSCII() { mBuffer = 0; } virtual ~nsUnicodeToTSCII() {} - NS_IMETHOD Convert(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD Finish(char * aDest, int32_t * aDestLength); - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, + NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength); NS_IMETHOD Reset(); NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, nsIUnicharEncoder * aEncoder, - PRUnichar aChar); + char16_t aChar); private: uint32_t mBuffer; // buffer for character(s) to be combined with the following @@ -57,19 +57,19 @@ public: nsUnicodeToTamilTTF() : nsUnicodeToTSCII() {} virtual ~nsUnicodeToTamilTTF() {} - NS_IMETHOD Convert (const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD Convert (const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); - NS_IMETHOD GetMaxLength (const PRUnichar * aSrc, int32_t aSrcLength, + NS_IMETHOD GetMaxLength (const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength); NS_IMETHOD SetOutputErrorBehavior (int32_t aBehavior, nsIUnicharEncoder *aEncoder, - PRUnichar aChar); + char16_t aChar); private: char mStaticBuffer[CHAR_BUFFER_SIZE]; int32_t mErrBehavior; - PRUnichar mErrChar; + char16_t mErrChar; nsCOMPtr mErrEncoder; }; diff --git a/intl/uconv/ucvlatin/nsUnicodeToUTF16.cpp b/intl/uconv/ucvlatin/nsUnicodeToUTF16.cpp index 402df09db609..b4da1b5bfd6a 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToUTF16.cpp +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF16.cpp @@ -6,9 +6,9 @@ #include "nsUnicodeToUTF16.h" #include -inline static void SwapBytes(char *aDest, const PRUnichar* aSrc, int32_t aLen); +inline static void SwapBytes(char *aDest, const char16_t* aSrc, int32_t aLen); -NS_IMETHODIMP nsUnicodeToUTF16BE::Convert(const PRUnichar * aSrc, int32_t * aSrcLength, +NS_IMETHODIMP nsUnicodeToUTF16BE::Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { int32_t srcInLen = *aSrcLength; @@ -16,7 +16,7 @@ NS_IMETHODIMP nsUnicodeToUTF16BE::Convert(const PRUnichar * aSrc, int32_t * aSrc int32_t srcOutLen = 0; int32_t destOutLen = 0; int32_t copyCharLen; - PRUnichar *p = (PRUnichar*)aDest; + char16_t *p = (char16_t*)aDest; // Handle BOM if necessary if(0!=mBOM) @@ -53,7 +53,7 @@ needmoreoutput: return NS_OK_UENC_MOREOUTPUT; } -NS_IMETHODIMP nsUnicodeToUTF16BE::GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, +NS_IMETHODIMP nsUnicodeToUTF16BE::GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) { if(0 != mBOM) @@ -69,7 +69,7 @@ NS_IMETHODIMP nsUnicodeToUTF16BE::Finish(char * aDest, int32_t * aDestLength) { if(*aDestLength >= 2) { - *((PRUnichar*)aDest)= mBOM; + *((char16_t*)aDest)= mBOM; mBOM=0; *aDestLength = 2; return NS_OK; @@ -90,12 +90,12 @@ NS_IMETHODIMP nsUnicodeToUTF16BE::Reset() } NS_IMETHODIMP nsUnicodeToUTF16BE::SetOutputErrorBehavior(int32_t aBehavior, - nsIUnicharEncoder * aEncoder, PRUnichar aChar) + nsIUnicharEncoder * aEncoder, char16_t aChar) { return NS_OK; } -NS_IMETHODIMP nsUnicodeToUTF16BE::CopyData(char* aDest, const PRUnichar* aSrc, int32_t aLen ) +NS_IMETHODIMP nsUnicodeToUTF16BE::CopyData(char* aDest, const char16_t* aSrc, int32_t aLen ) { #ifdef IS_BIG_ENDIAN //UnicodeToUTF16SameEndian @@ -109,7 +109,7 @@ NS_IMETHODIMP nsUnicodeToUTF16BE::CopyData(char* aDest, const PRUnichar* aSrc, i return NS_OK; } -NS_IMETHODIMP nsUnicodeToUTF16LE::CopyData(char* aDest, const PRUnichar* aSrc, int32_t aLen ) +NS_IMETHODIMP nsUnicodeToUTF16LE::CopyData(char* aDest, const char16_t* aSrc, int32_t aLen ) { #ifdef IS_LITTLE_ENDIAN //UnicodeToUTF16SameEndian @@ -123,13 +123,13 @@ NS_IMETHODIMP nsUnicodeToUTF16LE::CopyData(char* aDest, const PRUnichar* aSrc, i return NS_OK; } -inline void SwapBytes(char *aDest, const PRUnichar* aSrc, int32_t aLen) +inline void SwapBytes(char *aDest, const char16_t* aSrc, int32_t aLen) { - PRUnichar *p = (PRUnichar*) aDest; + char16_t *p = (char16_t*) aDest; // copy the data by swaping for(int32_t i = 0; i < aLen; i++) { - PRUnichar aChar = *aSrc++; + char16_t aChar = *aSrc++; *p++ = (0x00FF & (aChar >> 8)) | (0xFF00 & (aChar << 8)); } } diff --git a/intl/uconv/ucvlatin/nsUnicodeToUTF16.h b/intl/uconv/ucvlatin/nsUnicodeToUTF16.h index 6ed0825858ff..bfcda6b98939 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToUTF16.h +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF16.h @@ -16,18 +16,18 @@ public: //-------------------------------------------------------------------- // Interface nsIUnicodeEncoder [declaration] - NS_IMETHOD Convert(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, int32_t aSrcLength, + NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength); NS_IMETHOD Finish(char * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, - nsIUnicharEncoder * aEncoder, PRUnichar aChar); + nsIUnicharEncoder * aEncoder, char16_t aChar); protected: - PRUnichar mBOM; - NS_IMETHOD CopyData(char* aDest, const PRUnichar* aSrc, int32_t aLen ); + char16_t mBOM; + NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen ); }; class nsUnicodeToUTF16LE: public nsUnicodeToUTF16BE @@ -36,7 +36,7 @@ public: nsUnicodeToUTF16LE() { mBOM = 0;} protected: - NS_IMETHOD CopyData(char* aDest, const PRUnichar* aSrc, int32_t aLen ); + NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen ); }; // XXX In theory, we have to check the endianness at run-time because some diff --git a/intl/uconv/ucvlatin/nsUnicodeToUTF7.cpp b/intl/uconv/ucvlatin/nsUnicodeToUTF7.cpp index 6c418bae7287..a7f93150e620 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToUTF7.cpp +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF7.cpp @@ -64,17 +64,17 @@ nsresult nsBasicUTF7Encoder::ShiftEncoding(int32_t aEncoding, } nsresult nsBasicUTF7Encoder::EncodeDirect( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { nsresult res = NS_OK; - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; - PRUnichar ch; + char16_t ch; while (src < srcEnd) { ch = *src; @@ -110,17 +110,17 @@ nsresult nsBasicUTF7Encoder::EncodeDirect( } nsresult nsBasicUTF7Encoder::EncodeBase64( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { nsresult res = NS_OK; - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; - PRUnichar ch; + char16_t ch; uint32_t value; while (src < srcEnd) { @@ -195,7 +195,7 @@ char nsBasicUTF7Encoder::ValueToChar(uint32_t aValue) { return -1; } -bool nsBasicUTF7Encoder::DirectEncodable(PRUnichar aChar) { +bool nsBasicUTF7Encoder::DirectEncodable(char16_t aChar) { // spec says: printable US-ASCII chars if ((aChar >= 0x20) && (aChar <= 0x7e)) return true; else return false; @@ -205,18 +205,18 @@ bool nsBasicUTF7Encoder::DirectEncodable(PRUnichar aChar) { // Subclassing of nsEncoderSupport class [implementation] NS_IMETHODIMP nsBasicUTF7Encoder::ConvertNoBuffNoErr( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { nsresult res = NS_OK; - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; int32_t bcr,bcw; - PRUnichar ch; + char16_t ch; int32_t enc; while (src < srcEnd) { @@ -274,7 +274,7 @@ nsUnicodeToUTF7::nsUnicodeToUTF7() } -bool nsUnicodeToUTF7::DirectEncodable(PRUnichar aChar) { +bool nsUnicodeToUTF7::DirectEncodable(char16_t aChar) { if ((aChar >= 'A') && (aChar <= 'Z')) return true; else if ((aChar >= 'a') && (aChar <= 'z')) return true; else if ((aChar >= '0') && (aChar <= '9')) return true; diff --git a/intl/uconv/ucvlatin/nsUnicodeToUTF7.h b/intl/uconv/ucvlatin/nsUnicodeToUTF7.h index affe667d7f5a..bf8b9c102d57 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToUTF7.h +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF7.h @@ -36,17 +36,17 @@ protected: nsresult ShiftEncoding(int32_t aEncoding, char * aDest, int32_t * aDestLength); - nsresult EncodeDirect(const PRUnichar * aSrc, int32_t * aSrcLength, + nsresult EncodeDirect(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); - nsresult EncodeBase64(const PRUnichar * aSrc, int32_t * aSrcLength, + nsresult EncodeBase64(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); char ValueToChar(uint32_t aValue); - virtual bool DirectEncodable(PRUnichar aChar); + virtual bool DirectEncodable(char16_t aChar); //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD FinishNoBuff(char * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); @@ -72,7 +72,7 @@ public: protected: - virtual bool DirectEncodable(PRUnichar aChar); + virtual bool DirectEncodable(char16_t aChar); }; #endif /* nsUnicodeToUTF7_h___ */ diff --git a/intl/uconv/util/nsUCSupport.cpp b/intl/uconv/util/nsUCSupport.cpp index 1cfc8167d81c..c17975970cf4 100644 --- a/intl/uconv/util/nsUCSupport.cpp +++ b/intl/uconv/util/nsUCSupport.cpp @@ -46,10 +46,10 @@ nsBasicDecoderSupport::SetInputErrorBehavior(int32_t aBehavior) mErrBehavior = aBehavior; } -PRUnichar +char16_t nsBasicDecoderSupport::GetCharacterForUnMapped() { - return PRUnichar(0xfffd); // Unicode REPLACEMENT CHARACTER + return char16_t(0xfffd); // Unicode REPLACEMENT CHARACTER } //---------------------------------------------------------------------- @@ -83,14 +83,14 @@ void nsBufferDecoderSupport::FillBuffer(const char ** aSrc, int32_t aSrcLength) NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { // we do all operations using pointers internally const char * src = aSrc; const char * srcEnd = aSrc + *aSrcLength; - PRUnichar * dest = aDest; - PRUnichar * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; int32_t bcr, bcw; // byte counts for read & write; nsresult res = NS_OK; @@ -212,7 +212,7 @@ nsTableDecoderSupport::~nsTableDecoderSupport() NS_IMETHODIMP nsTableDecoderSupport::ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { return nsUnicodeDecodeHelper::ConvertByTable(aSrc, aSrcLength, @@ -248,7 +248,7 @@ nsMultiTableDecoderSupport::~nsMultiTableDecoderSupport() NS_IMETHODIMP nsMultiTableDecoderSupport::ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { return nsUnicodeDecodeHelper::ConvertByMultiTable(aSrc, aSrcLength, @@ -280,7 +280,7 @@ nsOneByteDecoderSupport::~nsOneByteDecoderSupport() NS_IMETHODIMP nsOneByteDecoderSupport::Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength) { if (!mFastTableCreated) { @@ -359,14 +359,14 @@ nsEncoderSupport::~nsEncoderSupport() delete [] mBuffer; } -NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc, +NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { // we do all operations using pointers internally - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; @@ -382,7 +382,7 @@ NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc, if (res == NS_ERROR_UENC_NOMAPPING) { if (mErrBehavior == kOnError_Replace) { - const PRUnichar buff[] = {mErrChar}; + const char16_t buff[] = {mErrChar}; bcr = 1; bcw = destEnd - dest; src--; // back the input: maybe the guy won't consume consume anything. @@ -440,14 +440,14 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd) //---------------------------------------------------------------------- // Interface nsIUnicodeEncoder [implementation] -NS_IMETHODIMP nsEncoderSupport::Convert(const PRUnichar * aSrc, +NS_IMETHODIMP nsEncoderSupport::Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) { // we do all operations using pointers internally - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; @@ -535,7 +535,7 @@ NS_IMETHODIMP nsEncoderSupport::Reset() NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior( int32_t aBehavior, nsIUnicharEncoder * aEncoder, - PRUnichar aChar) + char16_t aChar) { if (aBehavior == kOnError_CallBack && !aEncoder) return NS_ERROR_NULL_POINTER; @@ -547,7 +547,7 @@ NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior( } NS_IMETHODIMP -nsEncoderSupport::GetMaxLength(const PRUnichar * aSrc, +nsEncoderSupport::GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength) { @@ -588,7 +588,7 @@ nsTableEncoderSupport::~nsTableEncoderSupport() // Subclassing of nsEncoderSupport class [implementation] NS_IMETHODIMP nsTableEncoderSupport::ConvertNoBuffNoErr( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) @@ -624,7 +624,7 @@ nsMultiTableEncoderSupport::~nsMultiTableEncoderSupport() // Subclassing of nsEncoderSupport class [implementation] NS_IMETHODIMP nsMultiTableEncoderSupport::ConvertNoBuffNoErr( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) diff --git a/intl/uconv/util/nsUCSupport.h b/intl/uconv/util/nsUCSupport.h index 7047ae32b122..2850991098a2 100644 --- a/intl/uconv/util/nsUCSupport.h +++ b/intl/uconv/util/nsUCSupport.h @@ -14,7 +14,7 @@ #define ONE_BYTE_TABLE_SIZE 256 -inline bool WillOverrun(PRUnichar* aDest, PRUnichar* aDestEnd, uint32_t aLength) +inline bool WillOverrun(char16_t* aDest, char16_t* aDestEnd, uint32_t aLength) { NS_ASSERTION(aDest <= aDestEnd, "Pointer overrun even before check"); return (uint32_t(aDestEnd - aDest) < aLength); @@ -87,7 +87,7 @@ public: // Interface nsIUnicodeDecoder [declaration] virtual void SetInputErrorBehavior(int32_t aBehavior); - virtual PRUnichar GetCharacterForUnMapped(); + virtual char16_t GetCharacterForUnMapped(); protected: int32_t mErrBehavior; @@ -122,7 +122,7 @@ protected: * Convert method but *without* the buffer management stuff. */ NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength) = 0; + char16_t * aDest, int32_t * aDestLength) = 0; void FillBuffer(const char ** aSrc, int32_t aSrcLength); @@ -142,7 +142,7 @@ public: // Interface nsIUnicodeDecoder [declaration] NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); NS_IMETHOD GetMaxLength(const char *aSrc, int32_t aSrcLength, @@ -183,7 +183,7 @@ protected: // Subclassing of nsBufferDecoderSupport class [declaration] NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); }; //---------------------------------------------------------------------- @@ -223,7 +223,7 @@ protected: // Subclassing of nsBufferDecoderSupport class [declaration] NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); }; //---------------------------------------------------------------------- @@ -252,7 +252,7 @@ public: protected: uMappingTable * mMappingTable; - PRUnichar mFastTable[ONE_BYTE_TABLE_SIZE]; + char16_t mFastTable[ONE_BYTE_TABLE_SIZE]; bool mFastTableCreated; mozilla::Mutex mFastTableMutex; @@ -260,7 +260,7 @@ protected: // Subclassing of nsBasicDecoderSupport class [declaration] NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength); + char16_t * aDest, int32_t * aDestLength); NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, int32_t * aDestLength); NS_IMETHOD Reset(); @@ -320,21 +320,21 @@ protected: */ int32_t mErrBehavior; nsCOMPtr mErrEncoder; - PRUnichar mErrChar; + char16_t mErrChar; uint32_t mMaxLengthFactor; /** * Convert method but *without* the buffer management stuff and *with* * error handling stuff. */ - NS_IMETHOD ConvertNoBuff(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); /** * Convert method but *without* the buffer management stuff and *without* * error handling stuff. */ - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength) = 0; /** @@ -362,13 +362,13 @@ public: //-------------------------------------------------------------------- // Interface nsIUnicodeEncoder [declaration] - NS_IMETHOD Convert(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); NS_IMETHOD Finish(char * aDest, int32_t * aDestLength); NS_IMETHOD Reset(); NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, - nsIUnicharEncoder * aEncoder, PRUnichar aChar); - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, + nsIUnicharEncoder * aEncoder, char16_t aChar); + NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, int32_t * aDestLength); }; @@ -412,7 +412,7 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); }; @@ -453,7 +453,7 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsEncoderSupport class [declaration] - NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, int32_t * aSrcLength, + NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength); }; diff --git a/intl/uconv/util/nsUnicodeDecodeHelper.cpp b/intl/uconv/util/nsUnicodeDecodeHelper.cpp index a2469bddbc02..9a6ebd29bda9 100644 --- a/intl/uconv/util/nsUnicodeDecodeHelper.cpp +++ b/intl/uconv/util/nsUnicodeDecodeHelper.cpp @@ -12,7 +12,7 @@ nsresult nsUnicodeDecodeHelper::ConvertByTable( const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength, uScanClassID aScanClass, uShiftInTable * aShiftInTable, @@ -21,10 +21,10 @@ nsresult nsUnicodeDecodeHelper::ConvertByTable( { const char * src = aSrc; int32_t srcLen = *aSrcLength; - PRUnichar * dest = aDest; - PRUnichar * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; - PRUnichar med; + char16_t med; int32_t bcr; // byte count for read nsresult res = NS_OK; @@ -74,7 +74,7 @@ nsresult nsUnicodeDecodeHelper::ConvertByTable( nsresult nsUnicodeDecodeHelper::ConvertByMultiTable( const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength, int32_t aTableCount, const uRange * aRangeArray, @@ -84,10 +84,10 @@ nsresult nsUnicodeDecodeHelper::ConvertByMultiTable( { uint8_t * src = (uint8_t *)aSrc; int32_t srcLen = *aSrcLength; - PRUnichar * dest = aDest; - PRUnichar * destEnd = aDest + *aDestLength; + char16_t * dest = aDest; + char16_t * destEnd = aDest + *aDestLength; - PRUnichar med; + char16_t med; int32_t bcr; // byte count for read nsresult res = NS_OK; int32_t i; @@ -183,15 +183,15 @@ nsresult nsUnicodeDecodeHelper::ConvertByMultiTable( nsresult nsUnicodeDecodeHelper::ConvertByFastTable( const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, + char16_t * aDest, int32_t * aDestLength, - const PRUnichar * aFastTable, + const char16_t * aFastTable, int32_t aTableSize, bool aErrorSignal) { uint8_t * src = (uint8_t *)aSrc; uint8_t * srcEnd = src; - PRUnichar * dest = aDest; + char16_t * dest = aDest; nsresult res; if (*aSrcLength > *aDestLength) { @@ -219,7 +219,7 @@ nsresult nsUnicodeDecodeHelper::ConvertByFastTable( nsresult nsUnicodeDecodeHelper::CreateFastTable( uMappingTable * aMappingTable, - PRUnichar * aFastTable, + char16_t * aFastTable, int32_t aTableSize) { int32_t tableSize = aTableSize; diff --git a/intl/uconv/util/nsUnicodeDecodeHelper.h b/intl/uconv/util/nsUnicodeDecodeHelper.h index c131b00cd0e1..f1ce56b195bc 100644 --- a/intl/uconv/util/nsUnicodeDecodeHelper.h +++ b/intl/uconv/util/nsUnicodeDecodeHelper.h @@ -22,7 +22,7 @@ public: * Converts data using a lookup table and optional shift table */ static nsresult ConvertByTable(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength, + char16_t * aDest, int32_t * aDestLength, uScanClassID aScanClass, uShiftInTable * aShiftInTable, uMappingTable * aMappingTable, @@ -32,7 +32,7 @@ public: * Converts data using a set of lookup tables. */ static nsresult ConvertByMultiTable(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength, int32_t aTableCount, + char16_t * aDest, int32_t * aDestLength, int32_t aTableCount, const uRange * aRangeArray, uScanClassID * aScanClassArray, uMappingTable ** aMappingTable, bool aErrorSignal = false); @@ -40,14 +40,14 @@ public: * Converts data using a fast lookup table. */ static nsresult ConvertByFastTable(const char * aSrc, int32_t * aSrcLength, - PRUnichar * aDest, int32_t * aDestLength, const PRUnichar * aFastTable, + char16_t * aDest, int32_t * aDestLength, const char16_t * aFastTable, int32_t aTableSize, bool aErrorSignal); /** * Create a cache-like fast lookup table from a normal one. */ static nsresult CreateFastTable(uMappingTable * aMappingTable, - PRUnichar * aFastTable, int32_t aTableSize); + char16_t * aFastTable, int32_t aTableSize); }; #endif // nsUnicodeDecodeHelper_h__ diff --git a/intl/uconv/util/nsUnicodeEncodeHelper.cpp b/intl/uconv/util/nsUnicodeEncodeHelper.cpp index d4ea3f42e7b3..f801e81669d5 100644 --- a/intl/uconv/util/nsUnicodeEncodeHelper.cpp +++ b/intl/uconv/util/nsUnicodeEncodeHelper.cpp @@ -10,7 +10,7 @@ //---------------------------------------------------------------------- // Class nsUnicodeEncodeHelper [implementation] nsresult nsUnicodeEncodeHelper::ConvertByTable( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength, @@ -18,17 +18,17 @@ nsresult nsUnicodeEncodeHelper::ConvertByTable( uShiftOutTable * aShiftOutTable, uMappingTable * aMappingTable) { - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; int32_t destLen = *aDestLength; - PRUnichar med; + char16_t med; int32_t bcw; // byte count for write; nsresult res = NS_OK; while (src < srcEnd) { - if (!uMapCode((uTable*) aMappingTable, static_cast(*(src++)), reinterpret_cast(&med))) { + if (!uMapCode((uTable*) aMappingTable, static_cast(*(src++)), reinterpret_cast(&med))) { if (aScanClass == u1ByteCharset && *(src - 1) < 0x20) { // some tables are missing the 0x00 - 0x20 part med = *(src - 1); @@ -65,7 +65,7 @@ nsresult nsUnicodeEncodeHelper::ConvertByTable( } nsresult nsUnicodeEncodeHelper::ConvertByMultiTable( - const PRUnichar * aSrc, + const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength, @@ -74,12 +74,12 @@ nsresult nsUnicodeEncodeHelper::ConvertByMultiTable( uShiftOutTable ** aShiftOutTable, uMappingTable ** aMappingTable) { - const PRUnichar * src = aSrc; - const PRUnichar * srcEnd = aSrc + *aSrcLength; + const char16_t * src = aSrc; + const char16_t * srcEnd = aSrc + *aSrcLength; char * dest = aDest; int32_t destLen = *aDestLength; - PRUnichar med; + char16_t med; int32_t bcw; // byte count for write; nsresult res = NS_OK; int32_t i; diff --git a/intl/uconv/util/nsUnicodeEncodeHelper.h b/intl/uconv/util/nsUnicodeEncodeHelper.h index b633f839d948..456c277ba8f0 100644 --- a/intl/uconv/util/nsUnicodeEncodeHelper.h +++ b/intl/uconv/util/nsUnicodeEncodeHelper.h @@ -24,14 +24,14 @@ public: /** * Converts data using a lookup table and optional shift table. */ - static nsresult ConvertByTable(const PRUnichar * aSrc, int32_t * aSrcLength, + static nsresult ConvertByTable(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength, uScanClassID aScanClass, uShiftOutTable * aShiftOutTable, uMappingTable * aMappingTable); /** * Converts data using a set of lookup tables and optional shift tables. */ - static nsresult ConvertByMultiTable(const PRUnichar * aSrc, int32_t * aSrcLength, + static nsresult ConvertByMultiTable(const char16_t * aSrc, int32_t * aSrcLength, char * aDest, int32_t * aDestLength, int32_t aTableCount, uScanClassID * aScanClassArray, uShiftOutTable ** aShiftOutTable, uMappingTable ** aMappingTable); diff --git a/intl/unicharutil/public/nsICaseConversion.h b/intl/unicharutil/public/nsICaseConversion.h index deb221b06e94..06d5dc5a1f09 100644 --- a/intl/unicharutil/public/nsICaseConversion.h +++ b/intl/unicharutil/public/nsICaseConversion.h @@ -21,23 +21,23 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICASECONVERSION_IID) // Convert one Unicode character into upper case - NS_IMETHOD ToUpper( PRUnichar aChar, PRUnichar* aReturn) = 0; + NS_IMETHOD ToUpper( char16_t aChar, char16_t* aReturn) = 0; // Convert one Unicode character into lower case - NS_IMETHOD ToLower( PRUnichar aChar, PRUnichar* aReturn) = 0; + NS_IMETHOD ToLower( char16_t aChar, char16_t* aReturn) = 0; // Convert one Unicode character into title case - NS_IMETHOD ToTitle( PRUnichar aChar, PRUnichar* aReturn) = 0; + NS_IMETHOD ToTitle( char16_t aChar, char16_t* aReturn) = 0; // Convert an array of Unicode characters into upper case - NS_IMETHOD ToUpper( const PRUnichar* anArray, PRUnichar* aReturn, uint32_t aLen) = 0; + NS_IMETHOD ToUpper( const char16_t* anArray, char16_t* aReturn, uint32_t aLen) = 0; // Convert an array of Unicode characters into lower case - NS_IMETHOD ToLower( const PRUnichar* anArray, PRUnichar* aReturn, uint32_t aLen) = 0; + NS_IMETHOD ToLower( const char16_t* anArray, char16_t* aReturn, uint32_t aLen) = 0; - // case-insensitive PRUnichar* comparison - aResult returns similar + // case-insensitive char16_t* comparison - aResult returns similar // to strcasecmp - NS_IMETHOD CaseInsensitiveCompare(const PRUnichar* aLeft, const PRUnichar* aRight, uint32_t aLength, int32_t* aResult) = 0; + NS_IMETHOD CaseInsensitiveCompare(const char16_t* aLeft, const char16_t* aRight, uint32_t aLength, int32_t* aResult) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsICaseConversion, NS_ICASECONVERSION_IID) diff --git a/intl/unicharutil/src/normalization_data.h b/intl/unicharutil/src/normalization_data.h index bb0dc0d96413..90dcd9f4eba0 100644 --- a/intl/unicharutil/src/normalization_data.h +++ b/intl/unicharutil/src/normalization_data.h @@ -68,7 +68,7 @@ #define CANON_CLASS_BITS_1 7 #define CANON_CLASS_BITS_2 5 -static const PRUnichar canon_class_imap[] = { +static const char16_t canon_class_imap[] = { 272, 400, 528, 656, 784, 784, 784, 784, 784, 784, 912, 784, 784, 784, 784, 1040, 1168, 784, 784, 784, 784, 784, 784, 784, @@ -522,7 +522,7 @@ static const struct { #define CANON_COMPOSE_BITS_1 7 #define CANON_COMPOSE_BITS_2 5 -static const PRUnichar compose_imap[] = { +static const char16_t compose_imap[] = { 272, 400, 528, 656, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, @@ -1557,7 +1557,7 @@ static const struct composition compose_seq[] = { #define DECOMP_BITS_2 5 #define DECOMP_COMPAT 32768 -static const PRUnichar decompose_imap[] = { +static const char16_t decompose_imap[] = { 272, 400, 528, 656, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 912, 784, 784, 784, 784, 784, 784, 784, 784, @@ -1723,7 +1723,7 @@ static const PRUnichar decompose_imap[] = { }; static const struct { - PRUnichar tbl[32]; + char16_t tbl[32]; } decompose_table[] = { {{ 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/intl/unicharutil/src/nsCaseConversionImp2.cpp b/intl/unicharutil/src/nsCaseConversionImp2.cpp index 00f128390554..f1dac9ca1f0c 100644 --- a/intl/unicharutil/src/nsCaseConversionImp2.cpp +++ b/intl/unicharutil/src/nsCaseConversionImp2.cpp @@ -18,34 +18,34 @@ NS_IMETHODIMP_(nsrefcnt) nsCaseConversionImp2::Release(void) NS_IMPL_QUERY_INTERFACE1(nsCaseConversionImp2, nsICaseConversion) -NS_IMETHODIMP nsCaseConversionImp2::ToUpper(PRUnichar aChar, PRUnichar* aReturn) +NS_IMETHODIMP nsCaseConversionImp2::ToUpper(char16_t aChar, char16_t* aReturn) { *aReturn = ToUpperCase(aChar); return NS_OK; } -NS_IMETHODIMP nsCaseConversionImp2::ToLower(PRUnichar aChar, PRUnichar* aReturn) +NS_IMETHODIMP nsCaseConversionImp2::ToLower(char16_t aChar, char16_t* aReturn) { *aReturn = ToLowerCase(aChar); return NS_OK; } -NS_IMETHODIMP nsCaseConversionImp2::ToTitle(PRUnichar aChar, PRUnichar* aReturn) +NS_IMETHODIMP nsCaseConversionImp2::ToTitle(char16_t aChar, char16_t* aReturn) { *aReturn = ToTitleCase(aChar); return NS_OK; } -NS_IMETHODIMP nsCaseConversionImp2::ToUpper(const PRUnichar* anArray, - PRUnichar* aReturn, +NS_IMETHODIMP nsCaseConversionImp2::ToUpper(const char16_t* anArray, + char16_t* aReturn, uint32_t aLen) { ToUpperCase(anArray, aReturn, aLen); return NS_OK; } -NS_IMETHODIMP nsCaseConversionImp2::ToLower(const PRUnichar* anArray, - PRUnichar* aReturn, +NS_IMETHODIMP nsCaseConversionImp2::ToLower(const char16_t* anArray, + char16_t* aReturn, uint32_t aLen) { ToLowerCase(anArray, aReturn, aLen); @@ -53,8 +53,8 @@ NS_IMETHODIMP nsCaseConversionImp2::ToLower(const PRUnichar* anArray, } NS_IMETHODIMP -nsCaseConversionImp2::CaseInsensitiveCompare(const PRUnichar *aLeft, - const PRUnichar *aRight, +nsCaseConversionImp2::CaseInsensitiveCompare(const char16_t *aLeft, + const char16_t *aRight, uint32_t aCount, int32_t* aResult) { *aResult = ::CaseInsensitiveCompare(aLeft, aRight, aCount); diff --git a/intl/unicharutil/src/nsCaseConversionImp2.h b/intl/unicharutil/src/nsCaseConversionImp2.h index 0b1413735f16..a5d3b6ac7a23 100644 --- a/intl/unicharutil/src/nsCaseConversionImp2.h +++ b/intl/unicharutil/src/nsCaseConversionImp2.h @@ -19,17 +19,17 @@ public: static nsCaseConversionImp2* GetInstance(); - NS_IMETHOD ToUpper(PRUnichar aChar, PRUnichar* aReturn); + NS_IMETHOD ToUpper(char16_t aChar, char16_t* aReturn); - NS_IMETHOD ToLower(PRUnichar aChar, PRUnichar* aReturn); + NS_IMETHOD ToLower(char16_t aChar, char16_t* aReturn); - NS_IMETHOD ToTitle(PRUnichar aChar, PRUnichar* aReturn); + NS_IMETHOD ToTitle(char16_t aChar, char16_t* aReturn); - NS_IMETHOD ToUpper(const PRUnichar* anArray, PRUnichar* aReturn, uint32_t aLen); + NS_IMETHOD ToUpper(const char16_t* anArray, char16_t* aReturn, uint32_t aLen); - NS_IMETHOD ToLower(const PRUnichar* anArray, PRUnichar* aReturn, uint32_t aLen); + NS_IMETHOD ToLower(const char16_t* anArray, char16_t* aReturn, uint32_t aLen); - NS_IMETHOD CaseInsensitiveCompare(const PRUnichar* aLeft, const PRUnichar* aRight, uint32_t aLength, int32_t *aResult); + NS_IMETHOD CaseInsensitiveCompare(const char16_t* aLeft, const char16_t* aRight, uint32_t aLength, int32_t *aResult); }; #endif diff --git a/intl/unicharutil/src/nsEntityConverter.cpp b/intl/unicharutil/src/nsEntityConverter.cpp index 8c6d43c0b350..4821bb789ef1 100644 --- a/intl/unicharutil/src/nsEntityConverter.cpp +++ b/intl/unicharutil/src/nsEntityConverter.cpp @@ -62,7 +62,7 @@ nsEntityConverter::LoadVersionPropertyFile() uint32_t len = value.Length(); if (kVERSION_STRING_LEN < len) return NS_ERROR_UNEXPECTED; - memcpy(mVersionList[i].mEntityListName, value.get(), len*sizeof(PRUnichar)); + memcpy(mVersionList[i].mEntityListName, value.get(), len*sizeof(char16_t)); mVersionList[i].mEntityListName[len] = 0; mVersionList[i].mVersion = (1 << i); } @@ -80,7 +80,7 @@ nsEntityConverter::LoadEntityBundle(uint32_t version) do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, nullptr); - const PRUnichar *versionName = GetVersionName(version); + const char16_t *versionName = GetVersionName(version); NS_ENSURE_TRUE(versionName, nullptr); // all property file names are ASCII, like "html40Latin1" so this is safe @@ -94,7 +94,7 @@ nsEntityConverter::LoadEntityBundle(uint32_t version) return bundle.forget(); } -const PRUnichar* +const char16_t* nsEntityConverter:: GetVersionName(uint32_t versionNumber) { for (uint32_t i = 0; i < mVersionListLength; i++) { @@ -142,7 +142,7 @@ NS_IMPL_ISUPPORTS1(nsEntityConverter,nsIEntityConverter) // nsIEntityConverter // NS_IMETHODIMP -nsEntityConverter::ConvertToEntity(PRUnichar character, uint32_t entityVersion, char **_retval) +nsEntityConverter::ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval) { return ConvertUTF32ToEntity((uint32_t)character, entityVersion, _retval); } @@ -181,7 +181,7 @@ nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersi } NS_IMETHODIMP -nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityVersion, PRUnichar **_retval) +nsEntityConverter::ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval) { NS_ENSURE_ARG_POINTER(inString); NS_ENSURE_ARG_POINTER(_retval); @@ -205,7 +205,7 @@ nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityV } nsXPIDLString value; - const PRUnichar *entity = nullptr; + const char16_t *entity = nullptr; for (uint32_t mask = 1, mask2 = 0xFFFFFFFFL; (0!=(entityVersion & mask2)); mask<<=1, mask2<<=1) { if (0 == (entityVersion & mask)) diff --git a/intl/unicharutil/src/nsEntityConverter.h b/intl/unicharutil/src/nsEntityConverter.h index 78965297d84f..4dbab456e302 100644 --- a/intl/unicharutil/src/nsEntityConverter.h +++ b/intl/unicharutil/src/nsEntityConverter.h @@ -18,7 +18,7 @@ public: nsEntityVersionList() {} uint32_t mVersion; - PRUnichar mEntityListName[kVERSION_STRING_LEN+1]; + char16_t mEntityListName[kVERSION_STRING_LEN+1]; nsCOMPtr mEntities; }; @@ -41,9 +41,9 @@ public: // nsIEntityConverter // NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval); - NS_IMETHOD ConvertToEntity(PRUnichar character, uint32_t entityVersion, char **_retval); + NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval); - NS_IMETHOD ConvertToEntities(const PRUnichar *inString, uint32_t entityVersion, PRUnichar **_retval); + NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval); protected: @@ -51,7 +51,7 @@ protected: NS_IMETHOD LoadVersionPropertyFile(); // map version number to version string - const PRUnichar* GetVersionName(uint32_t versionNumber); + const char16_t* GetVersionName(uint32_t versionNumber); // map version number to a string bundle nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber); diff --git a/intl/unicharutil/src/nsSaveAsCharset.cpp b/intl/unicharutil/src/nsSaveAsCharset.cpp index c3ff961476b7..2895d118da50 100644 --- a/intl/unicharutil/src/nsSaveAsCharset.cpp +++ b/intl/unicharutil/src/nsSaveAsCharset.cpp @@ -54,7 +54,7 @@ nsSaveAsCharset::Init(const char *charset, uint32_t attr, uint32_t entityVersion } NS_IMETHODIMP -nsSaveAsCharset::Convert(const PRUnichar *inString, char **_retval) +nsSaveAsCharset::Convert(const char16_t *inString, char **_retval) { NS_ENSURE_ARG_POINTER(_retval); NS_ENSURE_ARG_POINTER(inString); @@ -88,7 +88,7 @@ nsSaveAsCharset::Convert(const PRUnichar *inString, char **_retval) if (attr_EntityBeforeCharsetConv == MASK_ENTITY(mAttribute)) { NS_ASSERTION(mEntityConverter, "need to call Init() before Convert()"); NS_ENSURE_TRUE(mEntityConverter, NS_ERROR_FAILURE); - PRUnichar *entity = nullptr; + char16_t *entity = nullptr; // do the entity conversion first rv = mEntityConverter->ConvertToEntities(inString, mEntityVersion, &entity); if(NS_SUCCEEDED(rv)) { @@ -163,7 +163,7 @@ nsSaveAsCharset::HandleFallBack(uint32_t character, char **outString, int32_t *b } NS_IMETHODIMP -nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString) +nsSaveAsCharset::DoCharsetConversion(const char16_t *inString, char **outString) { NS_ENSURE_ARG_POINTER(outString); diff --git a/intl/unicharutil/src/nsSaveAsCharset.h b/intl/unicharutil/src/nsSaveAsCharset.h index 3a8cb5278037..b4f648b82551 100644 --- a/intl/unicharutil/src/nsSaveAsCharset.h +++ b/intl/unicharutil/src/nsSaveAsCharset.h @@ -40,13 +40,13 @@ public: // NS_IMETHOD Init(const char *charset, uint32_t attr, uint32_t entityVersion); - NS_IMETHOD Convert(const PRUnichar *inString, char **_retval); + NS_IMETHOD Convert(const char16_t *inString, char **_retval); NS_IMETHODIMP GetCharset(char * *aCharset); protected: - NS_IMETHOD DoCharsetConversion(const PRUnichar *inString, char **outString); + NS_IMETHOD DoCharsetConversion(const char16_t *inString, char **outString); NS_IMETHOD DoConversionFallBack(uint32_t inUCS4, char *outString, int32_t bufferLength); diff --git a/intl/unicharutil/src/nsUnicodeNormalizer.cpp b/intl/unicharutil/src/nsUnicodeNormalizer.cpp index 982e9ff67cc8..87626a11e20e 100644 --- a/intl/unicharutil/src/nsUnicodeNormalizer.cpp +++ b/intl/unicharutil/src/nsUnicodeNormalizer.cpp @@ -340,7 +340,7 @@ mdn_normalize(bool do_composition, bool compat, while (start != end) { uint32_t c; - PRUnichar curChar; + char16_t curChar; //assert(wb.cur == wb.last); @@ -547,10 +547,10 @@ flush_before_cur(workbuf_t *wb, nsAString& aToStr) for (i = 0; i < wb->cur; i++) { if (!IS_IN_BMP(wb->ucs[i])) { - aToStr.Append((PRUnichar)H_SURROGATE(wb->ucs[i])); - aToStr.Append((PRUnichar)L_SURROGATE(wb->ucs[i])); + aToStr.Append((char16_t)H_SURROGATE(wb->ucs[i])); + aToStr.Append((char16_t)L_SURROGATE(wb->ucs[i])); } else { - aToStr.Append((PRUnichar)(wb->ucs[i])); + aToStr.Append((char16_t)(wb->ucs[i])); } } diff --git a/intl/unicharutil/tests/NormalizationTest.cpp b/intl/unicharutil/tests/NormalizationTest.cpp index b3a447b5a113..94b5d67bb5b9 100644 --- a/intl/unicharutil/tests/NormalizationTest.cpp +++ b/intl/unicharutil/tests/NormalizationTest.cpp @@ -56,11 +56,11 @@ void showError(const char* description, const char* errorText) bool TestInvariants(testcaseLine* testLine) { nsAutoString c1, c2, c3, c4, c5, normalized; - c1 = nsDependentString((PRUnichar*)testLine->c1); - c2 = nsDependentString((PRUnichar*)testLine->c2); - c3 = nsDependentString((PRUnichar*)testLine->c3); - c4 = nsDependentString((PRUnichar*)testLine->c4); - c5 = nsDependentString((PRUnichar*)testLine->c5); + c1 = nsDependentString((char16_t*)testLine->c1); + c2 = nsDependentString((char16_t*)testLine->c2); + c3 = nsDependentString((char16_t*)testLine->c3); + c4 = nsDependentString((char16_t*)testLine->c4); + c5 = nsDependentString((char16_t*)testLine->c5); bool rv = true; /* @@ -135,7 +135,7 @@ uint32_t UTF32CodepointFromTestcase(testcaseLine* testLine) bool TestUnspecifiedCodepoint(uint32_t codepoint) { bool rv = true; - PRUnichar unicharArray[3]; + char16_t unicharArray[3]; nsAutoString X, normalized; char description[9]; diff --git a/intl/unicharutil/tests/UnicharSelfTest.cpp b/intl/unicharutil/tests/UnicharSelfTest.cpp index 77fb8be67115..f2e37f1d6703 100644 --- a/intl/unicharutil/tests/UnicharSelfTest.cpp +++ b/intl/unicharutil/tests/UnicharSelfTest.cpp @@ -25,7 +25,7 @@ NS_DEFINE_CID(kUnicodeNormalizerCID, NS_UNICODE_NORMALIZER_CID); #define T4LEN TESTLEN // test data for ToUpper -static PRUnichar t2data [T2LEN+1] = { +static char16_t t2data [T2LEN+1] = { 0x0031 , // 0 0x0019 , // 1 0x0043 , // 2 @@ -61,7 +61,7 @@ static PRUnichar t2data [T2LEN+1] = { 0x00 }; // expected result for ToUpper -static PRUnichar t2result[T2LEN+1] = { +static char16_t t2result[T2LEN+1] = { 0x0031 , // 0 0x0019 , // 1 0x0043 , // 2 @@ -97,7 +97,7 @@ static PRUnichar t2result[T2LEN+1] = { 0x00 }; // test data for ToLower -static PRUnichar t3data [T3LEN+1] = { +static char16_t t3data [T3LEN+1] = { 0x0031 , // 0 0x0019 , // 1 0x0043 , // 2 @@ -133,7 +133,7 @@ static PRUnichar t3data [T3LEN+1] = { 0x00 }; // expected result for ToLower -static PRUnichar t3result[T3LEN+1] = { +static char16_t t3result[T3LEN+1] = { 0x0031 , // 0 0x0019 , // 1 0x0063 , // 2 @@ -169,7 +169,7 @@ static PRUnichar t3result[T3LEN+1] = { 0x00 }; // test data for ToTitle -static PRUnichar t4data [T4LEN+2] = { +static char16_t t4data [T4LEN+2] = { 0x0031 , // 0 0x0019 , // 1 0x0043 , // 2 @@ -206,7 +206,7 @@ static PRUnichar t4data [T4LEN+2] = { 0x00 }; // expected result for ToTitle -static PRUnichar t4result[T4LEN+2] = { +static char16_t t4result[T4LEN+2] = { 0x0031 , // 0 0x0019 , // 1 0x0043 , // 2 @@ -347,34 +347,34 @@ void TestCaseConversion() printf("==========================\n"); int i; - PRUnichar buf[256]; + char16_t buf[256]; - printf("Test 1 - ToUpper(PRUnichar, PRUnichar*):\n"); + printf("Test 1 - ToUpper(char16_t, char16_t*):\n"); for(i=0;i < T2LEN ; i++) { - PRUnichar ch = ToUpperCase(t2data[i]); + char16_t ch = ToUpperCase(t2data[i]); if(ch != t2result[i]) printf("\tFailed!! result unexpected %d\n", i); } - printf("Test 2 - ToLower(PRUnichar, PRUnichar*):\n"); + printf("Test 2 - ToLower(char16_t, char16_t*):\n"); for(i=0;i < T3LEN; i++) { - PRUnichar ch = ToLowerCase(t3data[i]); + char16_t ch = ToLowerCase(t3data[i]); if(ch != t3result[i]) printf("\tFailed!! result unexpected %d\n", i); } - printf("Test 3 - ToTitle(PRUnichar, PRUnichar*):\n"); + printf("Test 3 - ToTitle(char16_t, char16_t*):\n"); for(i=0;i < T4LEN; i++) { - PRUnichar ch = ToTitleCase(t4data[i]); + char16_t ch = ToTitleCase(t4data[i]); if(ch != t4result[i]) printf("\tFailed!! result unexpected %d\n", i); } - printf("Test 4 - ToUpper(PRUnichar*, PRUnichar*, uint32_t):\n"); + printf("Test 4 - ToUpper(char16_t*, char16_t*, uint32_t):\n"); ToUpperCase(t2data, buf, T2LEN); for(i = 0; i < T2LEN; i++) { @@ -385,7 +385,7 @@ void TestCaseConversion() } } - printf("Test 5 - ToLower(PRUnichar*, PRUnichar*, uint32_t):\n"); + printf("Test 5 - ToLower(char16_t*, char16_t*, uint32_t):\n"); ToLowerCase(t3data, buf, T3LEN); for(i = 0; i < T3LEN; i++) { @@ -485,20 +485,20 @@ static void TestEntityConversion(uint32_t version) uint32_t i; nsString inString; - PRUnichar uChar; + char16_t uChar; nsresult res; inString.Assign(NS_ConvertASCIItoUTF16("\xA0\xA1\xA2\xA3")); - uChar = (PRUnichar) 8364; //euro + uChar = (char16_t) 8364; //euro inString.Append(&uChar, 1); - uChar = (PRUnichar) 9830; // + uChar = (char16_t) 9830; // inString.Append(&uChar, 1); nsCOMPtr entityConv = do_CreateInstance(kEntityConverterCID, &res);; if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n"); return;} - const PRUnichar *data; + const char16_t *data; uint32_t length = NS_StringGetData(inString, &data); // convert char by char @@ -512,10 +512,10 @@ static void TestEntityConversion(uint32_t version) } // convert at once as a string - PRUnichar *entities; + char16_t *entities; res = entityConv->ConvertToEntities(inString.get(), version, &entities); if (NS_SUCCEEDED(res) && entities) { - for (PRUnichar *centity = entities; *centity; ++centity) { + for (char16_t *centity = entities; *centity; ++centity) { printf("%c", (char) *centity); if (';' == (char) *centity) printf("\n"); @@ -540,7 +540,7 @@ static void TestSaveAsCharset() inString.Assign(NS_ConvertASCIItoUTF16("\x61\x62\x80\xA0\x63")); char *outString; - const PRUnichar *data; + const char16_t *data; uint32_t length = NS_StringGetData(inString, &data); // first, dump input string @@ -624,7 +624,7 @@ static void TestSaveAsCharset() printf("==============================\n\n"); } -static PRUnichar normStr[] = +static char16_t normStr[] = { 0x00E1, 0x0061, @@ -635,7 +635,7 @@ static PRUnichar normStr[] = 0x0000 }; -static PRUnichar nfdForm[] = +static char16_t nfdForm[] = { 0x0061, 0x0301, diff --git a/intl/unicharutil/util/nsBidiUtils.cpp b/intl/unicharutil/util/nsBidiUtils.cpp index 04bda0572305..8c186ac68524 100644 --- a/intl/unicharutil/util/nsBidiUtils.cpp +++ b/intl/unicharutil/util/nsBidiUtils.cpp @@ -27,7 +27,7 @@ ((c) + (uint16_t)ARABIC_TO_PERSIAN_DIGIT_INCREMENT) : \ (c))) -PRUnichar HandleNumberInChar(PRUnichar aChar, bool aPrevCharArabic, uint32_t aNumFlag) +char16_t HandleNumberInChar(char16_t aChar, bool aPrevCharArabic, uint32_t aNumFlag) { // IBMBIDI_NUMERAL_NOMINAL * // IBMBIDI_NUMERAL_REGULAR @@ -61,7 +61,7 @@ PRUnichar HandleNumberInChar(PRUnichar aChar, bool aPrevCharArabic, uint32_t aNu } } -nsresult HandleNumbers(PRUnichar* aBuffer, uint32_t aSize, uint32_t aNumFlag) +nsresult HandleNumbers(char16_t* aBuffer, uint32_t aSize, uint32_t aNumFlag) { uint32_t i; @@ -90,7 +90,7 @@ bool HasRTLChars(const nsAString& aString) // It's fine to enable bidi in rare cases where it actually isn't needed. int32_t length = aString.Length(); for (int32_t i = 0; i < length; i++) { - PRUnichar ch = aString.CharAt(i); + char16_t ch = aString.CharAt(i); if (ch >= 0xD800 || IS_IN_BMP_RTL_BLOCK(ch)) { return true; } diff --git a/intl/unicharutil/util/nsBidiUtils.h b/intl/unicharutil/util/nsBidiUtils.h index ea33ec29e5a5..b73b9f4ac8c1 100644 --- a/intl/unicharutil/util/nsBidiUtils.h +++ b/intl/unicharutil/util/nsBidiUtils.h @@ -66,7 +66,7 @@ typedef enum nsCharType nsCharType; * IBMBIDI_NUMERAL_HINDICONTEXT: convert numbers in Arabic text to Hindi, otherwise to Arabic * @return the converted Unichar */ - PRUnichar HandleNumberInChar(PRUnichar aChar, bool aPrevCharArabic, uint32_t aNumFlag); + char16_t HandleNumberInChar(char16_t aChar, bool aPrevCharArabic, uint32_t aNumFlag); /** * Scan a Unichar string, converting numbers to Arabic or Hindi forms in place @@ -78,7 +78,7 @@ typedef enum nsCharType nsCharType; * IBMBIDI_NUMERAL_ARABIC: convert to Arabic forms (Unicode 0030-0039) * IBMBIDI_NUMERAL_HINDICONTEXT: convert numbers in Arabic text to Hindi, otherwise to Arabic */ - nsresult HandleNumbers(PRUnichar* aBuffer, uint32_t aSize, uint32_t aNumFlag); + nsresult HandleNumbers(char16_t* aBuffer, uint32_t aSize, uint32_t aNumFlag); /** * Give a UTF-32 codepoint diff --git a/intl/unicharutil/util/nsSpecialCasingData.h b/intl/unicharutil/util/nsSpecialCasingData.h index c6adee5fe32b..e7631df89bf8 100644 --- a/intl/unicharutil/util/nsSpecialCasingData.h +++ b/intl/unicharutil/util/nsSpecialCasingData.h @@ -10,11 +10,11 @@ namespace unicode { // Multi-character mappings (from SpecialCasing.txt) map a single Unicode // value to a sequence of 2 or 3 Unicode characters. There are currently none -// defined outside the BMP, so we can use PRUnichar here. Unused trailing +// defined outside the BMP, so we can use char16_t here. Unused trailing // positions in mMappedChars are set to 0. struct MultiCharMapping { - PRUnichar mOriginalChar; - PRUnichar mMappedChars[3]; + char16_t mOriginalChar; + char16_t mMappedChars[3]; }; // Return a pointer to the special case mapping for the given character; diff --git a/intl/unicharutil/util/nsUnicharUtils.cpp b/intl/unicharutil/util/nsUnicharUtils.cpp index acb350b597ed..f82902f0fbf2 100644 --- a/intl/unicharutil/util/nsUnicharUtils.cpp +++ b/intl/unicharutil/util/nsUnicharUtils.cpp @@ -55,7 +55,7 @@ ToLowerCaseASCII_inline(const uint32_t aChar) void ToLowerCase(nsAString& aString) { - PRUnichar *buf = aString.BeginWriting(); + char16_t *buf = aString.BeginWriting(); ToLowerCase(buf, buf, aString.Length()); } @@ -63,8 +63,8 @@ void ToLowerCase(const nsAString& aSource, nsAString& aDest) { - const PRUnichar *in; - PRUnichar *out; + const char16_t *in; + char16_t *out; uint32_t len = NS_StringGetData(aSource, &in); NS_StringGetMutableData(aDest, len, &out); NS_ASSERTION(out, "Uh..."); @@ -80,7 +80,7 @@ ToLowerCaseASCII(const uint32_t aChar) void ToUpperCase(nsAString& aString) { - PRUnichar *buf = aString.BeginWriting(); + char16_t *buf = aString.BeginWriting(); ToUpperCase(buf, buf, aString.Length()); } @@ -88,8 +88,8 @@ void ToUpperCase(const nsAString& aSource, nsAString& aDest) { - const PRUnichar *in; - PRUnichar *out; + const char16_t *in; + char16_t *out; uint32_t len = NS_StringGetData(aSource, &in); NS_StringGetMutableData(aDest, len, &out); NS_ASSERTION(out, "Uh..."); @@ -99,8 +99,8 @@ ToUpperCase(const nsAString& aSource, #ifdef MOZILLA_INTERNAL_API int32_t -nsCaseInsensitiveStringComparator::operator()(const PRUnichar* lhs, - const PRUnichar* rhs, +nsCaseInsensitiveStringComparator::operator()(const char16_t* lhs, + const char16_t* rhs, uint32_t lLength, uint32_t rLength) const { @@ -118,8 +118,8 @@ nsCaseInsensitiveUTF8StringComparator::operator()(const char* lhs, } int32_t -nsASCIICaseInsensitiveStringComparator::operator()(const PRUnichar* lhs, - const PRUnichar* rhs, +nsASCIICaseInsensitiveStringComparator::operator()(const char16_t* lhs, + const char16_t* rhs, uint32_t lLength, uint32_t rLength) const { @@ -132,8 +132,8 @@ nsASCIICaseInsensitiveStringComparator::operator()(const PRUnichar* lhs, while (rLength) { // we don't care about surrogates here, because we're only // lowercasing the ASCII range - PRUnichar l = *lhs++; - PRUnichar r = *rhs++; + char16_t l = *lhs++; + char16_t r = *rhs++; if (l != r) { l = ToLowerCaseASCII_inline(l); r = ToLowerCaseASCII_inline(r); @@ -158,7 +158,7 @@ ToLowerCase(uint32_t aChar) } void -ToLowerCase(const PRUnichar *aIn, PRUnichar *aOut, uint32_t aLen) +ToLowerCase(const char16_t *aIn, char16_t *aOut, uint32_t aLen) { for (uint32_t i = 0; i < aLen; i++) { uint32_t ch = aIn[i]; @@ -188,7 +188,7 @@ ToUpperCase(uint32_t aChar) } void -ToUpperCase(const PRUnichar *aIn, PRUnichar *aOut, uint32_t aLen) +ToUpperCase(const char16_t *aIn, char16_t *aOut, uint32_t aLen) { for (uint32_t i = 0; i < aLen; i++) { uint32_t ch = aIn[i]; @@ -215,8 +215,8 @@ ToTitleCase(uint32_t aChar) } int32_t -CaseInsensitiveCompare(const PRUnichar *a, - const PRUnichar *b, +CaseInsensitiveCompare(const char16_t *a, + const char16_t *b, uint32_t len) { NS_ASSERTION(a && b, "Do not pass in invalid pointers!"); diff --git a/intl/unicharutil/util/nsUnicharUtils.h b/intl/unicharutil/util/nsUnicharUtils.h index 77fb6307a590..3f33c851da83 100644 --- a/intl/unicharutil/util/nsUnicharUtils.h +++ b/intl/unicharutil/util/nsUnicharUtils.h @@ -26,8 +26,8 @@ uint32_t ToLowerCase(uint32_t); uint32_t ToUpperCase(uint32_t); uint32_t ToTitleCase(uint32_t); -void ToLowerCase(const PRUnichar*, PRUnichar*, uint32_t); -void ToUpperCase(const PRUnichar*, PRUnichar*, uint32_t); +void ToLowerCase(const char16_t*, char16_t*, uint32_t); +void ToUpperCase(const char16_t*, char16_t*, uint32_t); inline bool IsUpperCase(uint32_t c) { return ToLowerCase(c) != c; @@ -42,8 +42,8 @@ inline bool IsLowerCase(uint32_t c) { class nsCaseInsensitiveStringComparator : public nsStringComparator { public: - virtual int32_t operator() (const PRUnichar*, - const PRUnichar*, + virtual int32_t operator() (const char16_t*, + const char16_t*, uint32_t, uint32_t) const; }; @@ -70,8 +70,8 @@ class nsASCIICaseInsensitiveStringComparator : public nsStringComparator { public: nsASCIICaseInsensitiveStringComparator() {} - virtual int operator() (const PRUnichar*, - const PRUnichar*, + virtual int operator() (const char16_t*, + const char16_t*, uint32_t, uint32_t) const; }; @@ -98,7 +98,7 @@ CaseInsensitiveFindInReadable(const nsAString& aPattern, #endif // MOZILLA_INTERNAL_API int32_t -CaseInsensitiveCompare(const PRUnichar *a, const PRUnichar *b, uint32_t len); +CaseInsensitiveCompare(const char16_t *a, const char16_t *b, uint32_t len); int32_t CaseInsensitiveCompare(const char* aLeft, const char* aRight, diff --git a/intl/unicharutil/util/nsUnicodeProperties.h b/intl/unicharutil/util/nsUnicodeProperties.h index 1ce40418c735..67307b5c4488 100644 --- a/intl/unicharutil/util/nsUnicodeProperties.h +++ b/intl/unicharutil/util/nsUnicodeProperties.h @@ -131,19 +131,19 @@ enum ShapingType { int32_t ScriptShapingType(int32_t aScriptCode); -// A simple iterator for a string of PRUnichar codepoints that advances +// A simple iterator for a string of char16_t codepoints that advances // by Unicode grapheme clusters class ClusterIterator { public: - ClusterIterator(const PRUnichar* aText, uint32_t aLength) + ClusterIterator(const char16_t* aText, uint32_t aLength) : mPos(aText), mLimit(aText + aLength) #ifdef DEBUG , mText(aText) #endif { } - operator const PRUnichar* () const { + operator const char16_t* () const { return mPos; } @@ -154,10 +154,10 @@ public: void Next(); private: - const PRUnichar* mPos; - const PRUnichar* mLimit; + const char16_t* mPos; + const char16_t* mLimit; #ifdef DEBUG - const PRUnichar* mText; + const char16_t* mText; #endif }; diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 16ab5e402bc2..2a897277058b 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -265,7 +265,7 @@ struct ParamTraits uint32_t length = aParam.Length(); WriteParam(aMsg, length); - aMsg->WriteBytes(aParam.BeginReading(), length * sizeof(PRUnichar)); + aMsg->WriteBytes(aParam.BeginReading(), length * sizeof(char16_t)); } static bool Read(const Message* aMsg, void** aIter, paramType* aResult) @@ -281,9 +281,9 @@ struct ParamTraits uint32_t length; if (ReadParam(aMsg, aIter, &length)) { - const PRUnichar* buf; + const char16_t* buf; if (aMsg->ReadBytes(aIter, reinterpret_cast(&buf), - length * sizeof(PRUnichar))) { + length * sizeof(char16_t))) { aResult->Assign(buf, length); return true; } diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index 25261f4c13e9..c67c005000cb 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -90,7 +90,7 @@ const wchar_t kOldWndProcProp[] = L"MozillaIPCOldWndProc"; // This isn't defined before Windows XP. enum { WM_XP_THEMECHANGED = 0x031A }; -PRUnichar gAppMessageWindowName[256] = { 0 }; +char16_t gAppMessageWindowName[256] = { 0 }; int32_t gAppMessageWindowNameLength = 0; nsTArray* gNeuteredWindows = nullptr; @@ -300,7 +300,7 @@ ProcessOrDeferMessage(HWND hwnd, wchar_t className[256] = { 0 }; if (GetClassNameW(hwnd, className, sizeof(className) - 1) > 0) { log.AppendLiteral(" (\""); - log.Append(NS_ConvertUTF16toUTF8((PRUnichar*)className)); + log.Append(NS_ConvertUTF16toUTF8((char16_t*)className)); log.AppendLiteral("\")"); } @@ -357,7 +357,7 @@ WindowIsDeferredWindow(HWND hWnd) return false; } - PRUnichar buffer[256] = { 0 }; + char16_t buffer[256] = { 0 }; int length = GetClassNameW(hWnd, (wchar_t*)buffer, sizeof(buffer) - 1); if (length <= 0) { NS_WARNING("Failed to get class name!"); diff --git a/js/jsd/jsd_xpc.cpp b/js/jsd/jsd_xpc.cpp index 13da92e6f91f..966329693be8 100644 --- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -1213,7 +1213,7 @@ jsdScript::GetFunctionName(nsACString &_rval) } NS_IMETHODIMP -jsdScript::GetParameterNames(uint32_t* count, PRUnichar*** paramNames) +jsdScript::GetParameterNames(uint32_t* count, char16_t*** paramNames) { ASSERT_VALID_EPHEMERAL; AutoSafeJSContext cx; @@ -1234,8 +1234,8 @@ jsdScript::GetParameterNames(uint32_t* count, PRUnichar*** paramNames) return NS_OK; } - PRUnichar **ret = - static_cast(NS_Alloc(nargs * sizeof(PRUnichar*))); + char16_t **ret = + static_cast(NS_Alloc(nargs * sizeof(char16_t*))); if (!ret) return NS_ERROR_OUT_OF_MEMORY; @@ -3329,7 +3329,7 @@ NS_IMPL_ISUPPORTS1(jsdASObserver, nsIObserver) NS_IMETHODIMP jsdASObserver::Observe (nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { nsresult rv; diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index c1a7d1034eea..f3ee4cff3161 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -107,7 +107,7 @@ Library::Create(JSContext* cx, jsval path_, JSCTypesCallbacks* callbacks) #ifdef XP_WIN // On Windows, converting to native charset may corrupt path string. // So, we have to use Unicode path directly. - const PRUnichar* pathChars = JS_GetFlatStringChars(pathStr); + const char16_t* pathChars = JS_GetFlatStringChars(pathStr); if (!pathChars) return nullptr; diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 5c4e465ec997..2f58835b2e8d 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -121,7 +121,7 @@ Dump(JSContext *cx, unsigned argc, Value *vp) if (!chars) return false; - NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast(chars)); + NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast(chars)); #ifdef ANDROID __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", utf8str.get()); #endif @@ -1385,7 +1385,7 @@ mozJSComponentLoader::Unload(const nsACString & aLocation) NS_IMETHODIMP mozJSComponentLoader::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, "xpcom-shutdown-loaders")) { UnloadModules(); diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 155e72560952..94a2b0cb3085 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -70,7 +70,7 @@ xpc::CloneAllAccess() } char * -xpc::CheckAccessList(const PRUnichar *wideName, const char *const list[]) +xpc::CheckAccessList(const char16_t *wideName, const char *const list[]) { nsAutoCString asciiName; CopyUTF16toUTF8(nsDependentString(wideName), asciiName); @@ -344,7 +344,7 @@ nsXPCComponents_Interfaces::CanCreateWrapper(const nsIID * iid, char **_retval) /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ NS_IMETHODIMP -nsXPCComponents_Interfaces::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) +nsXPCComponents_Interfaces::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -353,7 +353,7 @@ nsXPCComponents_Interfaces::CanCallMethod(const nsIID * iid, const PRUnichar *me /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_Interfaces::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_Interfaces::CanGetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -362,7 +362,7 @@ nsXPCComponents_Interfaces::CanGetProperty(const nsIID * iid, const PRUnichar *p /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_Interfaces::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_Interfaces::CanSetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -637,7 +637,7 @@ nsXPCComponents_InterfacesByID::CanCreateWrapper(const nsIID * iid, char **_retv /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ NS_IMETHODIMP -nsXPCComponents_InterfacesByID::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) +nsXPCComponents_InterfacesByID::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -646,7 +646,7 @@ nsXPCComponents_InterfacesByID::CanCallMethod(const nsIID * iid, const PRUnichar /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_InterfacesByID::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_InterfacesByID::CanGetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -655,7 +655,7 @@ nsXPCComponents_InterfacesByID::CanGetProperty(const nsIID * iid, const PRUnicha /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_InterfacesByID::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_InterfacesByID::CanSetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -2647,10 +2647,10 @@ nsXPCComponents_Utils::ReportError(const Value &errorArg, JSContext *cx) uint32_t column = err->uctokenptr - err->uclinebuf; - const PRUnichar* ucmessage = - static_cast(err->ucmessage); - const PRUnichar* uclinebuf = - static_cast(err->uclinebuf); + const char16_t* ucmessage = + static_cast(err->ucmessage); + const char16_t* uclinebuf = + static_cast(err->uclinebuf); nsresult rv = scripterr->InitWithWindowID( ucmessage ? nsDependentString(ucmessage) : EmptyString(), @@ -2685,7 +2685,7 @@ nsXPCComponents_Utils::ReportError(const Value &errorArg, JSContext *cx) return NS_OK; nsresult rv = scripterr->InitWithWindowID( - nsDependentString(static_cast(msgchars)), + nsDependentString(static_cast(msgchars)), NS_ConvertUTF8toUTF16(fileName), EmptyString(), lineNo, 0, 0, "XPConnect JavaScript", innerWindowID); NS_ENSURE_SUCCESS(rv, NS_OK); @@ -3333,7 +3333,7 @@ nsXPCComponents_Utils::CanCreateWrapper(const nsIID * iid, char **_retval) /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ NS_IMETHODIMP -nsXPCComponents_Utils::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) +nsXPCComponents_Utils::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { static const char* const allowed[] = { "evalInSandbox", nullptr }; *_retval = CheckAccessList(methodName, allowed); @@ -3342,7 +3342,7 @@ nsXPCComponents_Utils::CanCallMethod(const nsIID * iid, const PRUnichar *methodN /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_Utils::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_Utils::CanGetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { *_retval = nullptr; return NS_OK; @@ -3350,7 +3350,7 @@ nsXPCComponents_Utils::CanGetProperty(const nsIID * iid, const PRUnichar *proper /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents_Utils::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents_Utils::CanSetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; @@ -3909,7 +3909,7 @@ nsXPCComponents::CanCreateWrapper(const nsIID * iid, char **_retval) /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ NS_IMETHODIMP -nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) +nsXPCComponents::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { static const char* const allowed[] = { "isSuccessCode", nullptr }; *_retval = CheckAccessList(methodName, allowed); @@ -3918,7 +3918,7 @@ nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, c /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents::CanGetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { static const char* const allowed[] = { "interfaces", "interfacesByID", "results", nullptr}; *_retval = CheckAccessList(propertyName, allowed); @@ -3927,7 +3927,7 @@ nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsXPCComponents::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsXPCComponents::CanSetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; diff --git a/js/xpconnect/src/XPCConvert.cpp b/js/xpconnect/src/XPCConvert.cpp index a0e6b707ddaf..c8b6c294e307 100644 --- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -257,9 +257,9 @@ XPCConvert::NativeData2JS(MutableHandleValue d, const void* s, if (!len) return false; - const size_t buffer_size = (len + 1) * sizeof(PRUnichar); - PRUnichar* buffer = - static_cast(JS_malloc(cx, buffer_size)); + const size_t buffer_size = (len + 1) * sizeof(char16_t); + char16_t* buffer = + static_cast(JS_malloc(cx, buffer_size)); if (!buffer) return false; @@ -478,10 +478,10 @@ XPCConvert::JSData2Native(void* d, HandleValue s, } case nsXPTType::T_DOMSTRING: { - static const PRUnichar EMPTY_STRING[] = { '\0' }; - static const PRUnichar VOID_STRING[] = { 'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd', '\0' }; + static const char16_t EMPTY_STRING[] = { '\0' }; + static const char16_t VOID_STRING[] = { 'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd', '\0' }; - const PRUnichar* chars = nullptr; + const char16_t* chars = nullptr; JSString* str = nullptr; bool isNewString = false; uint32_t length = 0; @@ -661,8 +661,8 @@ XPCConvert::JSData2Native(void* d, HandleValue s, } else { rs = *((nsCString**)d); } - const PRUnichar* start = (const PRUnichar*)chars; - const PRUnichar* end = start + length; + const char16_t* start = (const char16_t*)chars; + const char16_t* end = start + length; CopyUTF16toUTF8(nsDependentSubstring(start, end), *rs); return true; } @@ -730,7 +730,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s, JSVAL_IS_STRING(s)) { // We're trying to pass a string as an nsIAtom. Let's atomize! JSString* str = JSVAL_TO_STRING(s); - const PRUnichar* chars = JS_GetStringCharsZ(cx, str); + const char16_t* chars = JS_GetStringCharsZ(cx, str); if (!chars) { if (pErr) *pErr = NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF; @@ -1305,15 +1305,15 @@ XPCConvert::JSErrorToXPCException(const char* message, if (report) { nsAutoString bestMessage; if (report && report->ucmessage) { - bestMessage = static_cast(report->ucmessage); + bestMessage = static_cast(report->ucmessage); } else if (message) { CopyASCIItoUTF16(message, bestMessage); } else { bestMessage.AssignLiteral("JavaScript Error"); } - const PRUnichar* uclinebuf = - static_cast(report->uclinebuf); + const char16_t* uclinebuf = + static_cast(report->uclinebuf); data = new nsScriptError(); data->InitWithWindowID( diff --git a/js/xpconnect/src/XPCJSID.cpp b/js/xpconnect/src/XPCJSID.cpp index 8f5b8cb1cf37..8ae56312785c 100644 --- a/js/xpconnect/src/XPCJSID.cpp +++ b/js/xpconnect/src/XPCJSID.cpp @@ -572,7 +572,7 @@ nsJSIID::CanCreateWrapper(const nsIID * iid, char **_retval) /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ NS_IMETHODIMP -nsJSIID::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) +nsJSIID::CanCallMethod(const nsIID * iid, const char16_t *methodName, char **_retval) { static const char* const allowed[] = {"equals", "toString", nullptr}; @@ -582,7 +582,7 @@ nsJSIID::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_r /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsJSIID::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsJSIID::CanGetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { static const char* const allowed[] = {"name", "number", "valid", nullptr}; *_retval = xpc::CheckAccessList(propertyName, allowed); @@ -591,7 +591,7 @@ nsJSIID::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char * /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ NS_IMETHODIMP -nsJSIID::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) +nsJSIID::CanSetProperty(const nsIID * iid, const char16_t *propertyName, char **_retval) { // If you have to ask, then the answer is NO *_retval = nullptr; diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 8eac009d628e..4935354f06a7 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1139,7 +1139,7 @@ class WatchdogManager : public nsIObserver } NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { RefreshWatchdog(); return NS_OK; @@ -1414,7 +1414,7 @@ XPCJSRuntime::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) } XPCReadableJSStringWrapper * -XPCJSRuntime::NewStringWrapper(const PRUnichar *str, uint32_t len) +XPCJSRuntime::NewStringWrapper(const char16_t *str, uint32_t len) { for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) { StringWrapperEntry& ent = mScratchStrings[i]; diff --git a/js/xpconnect/src/XPCLocale.cpp b/js/xpconnect/src/XPCLocale.cpp index e5bf3ad57a54..6bb3527ce7b9 100644 --- a/js/xpconnect/src/XPCLocale.cpp +++ b/js/xpconnect/src/XPCLocale.cpp @@ -206,8 +206,8 @@ private: if (mDecoder) { int32_t unicharLength = srcLength; - PRUnichar *unichars = - (PRUnichar *)JS_malloc(cx, (srcLength + 1) * sizeof(PRUnichar)); + char16_t *unichars = + (char16_t *)JS_malloc(cx, (srcLength + 1) * sizeof(char16_t)); if (unichars) { rv = mDecoder->Convert(src, &srcLength, unichars, &unicharLength); if (NS_SUCCEEDED(rv)) { @@ -216,9 +216,9 @@ private: // nsIUnicodeDecoder::Convert may use fewer than srcLength PRUnichars if (unicharLength + 1 < srcLength + 1) { - PRUnichar *shrunkUnichars = - (PRUnichar *)JS_realloc(cx, unichars, - (unicharLength + 1) * sizeof(PRUnichar)); + char16_t *shrunkUnichars = + (char16_t *)JS_realloc(cx, unichars, + (unicharLength + 1) * sizeof(char16_t)); if (shrunkUnichars) unichars = shrunkUnichars; } diff --git a/js/xpconnect/src/XPCQuickStubs.cpp b/js/xpconnect/src/XPCQuickStubs.cpp index d1c3481991b2..cf5b5952e523 100644 --- a/js/xpconnect/src/XPCQuickStubs.cpp +++ b/js/xpconnect/src/XPCQuickStubs.cpp @@ -463,14 +463,14 @@ xpc_qsACString::xpc_qsACString(JSContext *cx, HandleValue v, xpc_qsAUTF8String::xpc_qsAUTF8String(JSContext *cx, HandleValue v, MutableHandleValue pval, bool notpassed) { - typedef nsCharTraits traits; + typedef nsCharTraits traits; // From the T_UTF8STRING case in XPCConvert::JSData2Native. JSString *s = InitOrStringify(cx, v, pval, notpassed, eNull, eNull); if (!s) return; size_t len; - const PRUnichar *chars = JS_GetStringCharsZAndLength(cx, s, &len); + const char16_t *chars = JS_GetStringCharsZAndLength(cx, s, &len); if (!chars) { mValid = false; return; diff --git a/js/xpconnect/src/XPCQuickStubs.h b/js/xpconnect/src/XPCQuickStubs.h index 6c3de2d596ec..82133d627970 100644 --- a/js/xpconnect/src/XPCQuickStubs.h +++ b/js/xpconnect/src/XPCQuickStubs.h @@ -351,7 +351,7 @@ bool xpc_qsJsvalToCharStr(JSContext *cx, jsval v, JSAutoByteString *bytes); bool -xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, JS::MutableHandleValue pval, const PRUnichar **pstr); +xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, JS::MutableHandleValue pval, const char16_t **pstr); nsresult diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index d17987a05b2b..8c4340016cbd 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -144,8 +144,8 @@ GetLocationProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleV // replace forward slashes with backslashes, // since nsLocalFileWin chokes on them - PRUnichar* start = filenameString.BeginWriting(); - PRUnichar* end = filenameString.EndWriting(); + char16_t* start = filenameString.BeginWriting(); + char16_t* end = filenameString.EndWriting(); while (start != end) { if (*start == L'/') diff --git a/js/xpconnect/src/XPCVariant.cpp b/js/xpconnect/src/XPCVariant.cpp index a688bcef6c36..cdfb24ad06c5 100644 --- a/js/xpconnect/src/XPCVariant.cpp +++ b/js/xpconnect/src/XPCVariant.cpp @@ -456,7 +456,7 @@ XPCVariant::VariantDataToJS(nsIVariant* variant, } case nsIDataType::VTYPE_WCHAR: { - PRUnichar wc; + char16_t wc; if (NS_FAILED(variant->GetAsWChar(&wc))) return false; return XPCConvert::NativeData2JS(pJSVal, (const void*)&wc, TD_WCHAR, &iid, pErr); @@ -526,7 +526,7 @@ XPCVariant::VariantDataToJS(nsIVariant* variant, } case nsIDataType::VTYPE_WCHAR_STR: { - PRUnichar *pwc; + char16_t *pwc; if (NS_FAILED(variant->GetAsWString(&pwc))) return false; bool success = XPCConvert::NativeData2JS(pJSVal, (const void*)&pwc, @@ -536,7 +536,7 @@ XPCVariant::VariantDataToJS(nsIVariant* variant, } case nsIDataType::VTYPE_WSTRING_SIZE_IS: { - PRUnichar *pwc; + char16_t *pwc; uint32_t size; if (NS_FAILED(variant->GetAsWStringWithSize(&size, &pwc))) return false; @@ -748,7 +748,7 @@ NS_IMETHODIMP XPCVariant::GetAsChar(char *_retval) } /* wchar getAsWChar (); */ -NS_IMETHODIMP XPCVariant::GetAsWChar(PRUnichar *_retval) +NS_IMETHODIMP XPCVariant::GetAsWChar(char16_t *_retval) { return nsVariant::ConvertToWChar(mData, _retval); } @@ -792,7 +792,7 @@ NS_IMETHODIMP XPCVariant::GetAsString(char **_retval) } /* wstring getAsWString (); */ -NS_IMETHODIMP XPCVariant::GetAsWString(PRUnichar **_retval) +NS_IMETHODIMP XPCVariant::GetAsWString(char16_t **_retval) { return nsVariant::ConvertToWString(mData, _retval); } @@ -823,7 +823,7 @@ NS_IMETHODIMP XPCVariant::GetAsStringWithSize(uint32_t *size, char **str) } /* void getAsWStringWithSize (out uint32_t size, [size_is (size), retval] out wstring str); */ -NS_IMETHODIMP XPCVariant::GetAsWStringWithSize(uint32_t *size, PRUnichar **str) +NS_IMETHODIMP XPCVariant::GetAsWStringWithSize(uint32_t *size, char16_t **str) { return nsVariant::ConvertToWStringWithSize(mData, size, str); } diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 823fc761aa22..a4af49e708a8 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -404,7 +404,7 @@ nsXPCWrappedJSClass::BuildPropertyEnumerator(XPCCallContext& ccx, NS_IMPL_ISUPPORTS1(xpcProperty, nsIProperty) -xpcProperty::xpcProperty(const PRUnichar* aName, uint32_t aNameLen, +xpcProperty::xpcProperty(const char16_t* aName, uint32_t aNameLen, nsIVariant* aValue) : mName(aName, aNameLen), mValue(aValue) { @@ -525,7 +525,7 @@ SameOriginCheckedComponent::CanCreateWrapper(const nsIID * iid, NS_IMETHODIMP SameOriginCheckedComponent::CanCallMethod(const nsIID * iid, - const PRUnichar *methodName, + const char16_t *methodName, char **_retval) { *_retval = NS_strdup("sameOrigin"); @@ -534,7 +534,7 @@ SameOriginCheckedComponent::CanCallMethod(const nsIID * iid, NS_IMETHODIMP SameOriginCheckedComponent::CanGetProperty(const nsIID * iid, - const PRUnichar *propertyName, + const char16_t *propertyName, char **_retval) { *_retval = NS_strdup("sameOrigin"); @@ -543,7 +543,7 @@ SameOriginCheckedComponent::CanGetProperty(const nsIID * iid, NS_IMETHODIMP SameOriginCheckedComponent::CanSetProperty(const nsIID * iid, - const PRUnichar *propertyName, + const char16_t *propertyName, char **_retval) { *_retval = NS_strdup("sameOrigin"); diff --git a/js/xpconnect/src/nsScriptError.cpp b/js/xpconnect/src/nsScriptError.cpp index 0f4d437b901c..60f9938ba1a0 100644 --- a/js/xpconnect/src/nsScriptError.cpp +++ b/js/xpconnect/src/nsScriptError.cpp @@ -36,7 +36,7 @@ nsScriptError::~nsScriptError() {} // nsIConsoleMessage methods NS_IMETHODIMP -nsScriptError::GetMessageMoz(PRUnichar **result) { +nsScriptError::GetMessageMoz(char16_t **result) { nsresult rv; nsAutoCString message; diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index a5af112ea910..d742790269af 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -230,10 +230,10 @@ xpc::SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep) if (consoleService && errorObject) { uint32_t column = rep->uctokenptr - rep->uclinebuf; - const PRUnichar* ucmessage = - static_cast(rep->ucmessage); - const PRUnichar* uclinebuf = - static_cast(rep->uclinebuf); + const char16_t* ucmessage = + static_cast(rep->ucmessage); + const char16_t* uclinebuf = + static_cast(rep->uclinebuf); rv = errorObject->Init( ucmessage ? nsDependentString(ucmessage) : EmptyString(), diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index e0bd54c9174f..55e7509774d3 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -406,7 +406,7 @@ class XPCReadableJSStringWrapper : public nsDependentString public: typedef nsDependentString::char_traits char_traits; - XPCReadableJSStringWrapper(const PRUnichar *chars, size_t length) : + XPCReadableJSStringWrapper(const char16_t *chars, size_t length) : nsDependentString(chars, length) { } @@ -584,7 +584,7 @@ public: ~XPCJSRuntime(); - XPCReadableJSStringWrapper *NewStringWrapper(const PRUnichar *str, uint32_t len); + XPCReadableJSStringWrapper *NewStringWrapper(const char16_t *str, uint32_t len); void DeleteString(nsAString *string); void AddGCCallback(xpcGCCallback cb); @@ -2588,7 +2588,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIPROPERTY - xpcProperty(const PRUnichar* aName, uint32_t aNameLen, nsIVariant* aValue); + xpcProperty(const char16_t* aName, uint32_t aNameLen, nsIVariant* aValue); virtual ~xpcProperty() {} private: @@ -3234,7 +3234,7 @@ CloneAllAccess(); // Returns access if wideName is in list char * -CheckAccessList(const PRUnichar *wideName, const char *const list[]); +CheckAccessList(const char16_t *wideName, const char *const list[]); } /* namespace xpc */ /***************************************************************************/ diff --git a/js/xpconnect/tests/components/native/xpctest_params.cpp b/js/xpconnect/tests/components/native/xpctest_params.cpp index 4248ca17cc5a..d83de8828338 100644 --- a/js/xpconnect/tests/components/native/xpctest_params.cpp +++ b/js/xpconnect/tests/components/native/xpctest_params.cpp @@ -152,13 +152,13 @@ NS_IMETHODIMP nsXPCTestParams::TestString(const char * a, char * *b, char * *_re } /* wchar testWchar (in wchar a, inout wchar b); */ -NS_IMETHODIMP nsXPCTestParams::TestWchar(PRUnichar a, PRUnichar *b, PRUnichar *_retval) +NS_IMETHODIMP nsXPCTestParams::TestWchar(char16_t a, char16_t *b, char16_t *_retval) { GENERIC_METHOD_IMPL; } /* wstring testWstring (in wstring a, inout wstring b); */ -NS_IMETHODIMP nsXPCTestParams::TestWstring(const PRUnichar * a, PRUnichar * *b, PRUnichar * *_retval) +NS_IMETHODIMP nsXPCTestParams::TestWstring(const char16_t * a, char16_t * *b, char16_t * *_retval) { nsDependentString aprime(a); nsDependentString bprime(*b); @@ -238,11 +238,11 @@ NS_IMETHODIMP nsXPCTestParams::TestStringArray(uint32_t aLength, const char * *a /* void testWstringArray (in unsigned long aLength, [array, size_is (aLength)] in wstring a, * inout unsigned long bLength, [array, size_is (bLength)] inout wstring b, * out unsigned long rvLength, [array, size_is (rvLength), retval] out wstring rv); */ -NS_IMETHODIMP nsXPCTestParams::TestWstringArray(uint32_t aLength, const PRUnichar * *a, - uint32_t *bLength, PRUnichar * **b, - uint32_t *rvLength, PRUnichar * **rv) +NS_IMETHODIMP nsXPCTestParams::TestWstringArray(uint32_t aLength, const char16_t * *a, + uint32_t *bLength, char16_t * **b, + uint32_t *rvLength, char16_t * **rv) { - BUFFER_METHOD_IMPL(PRUnichar*, 0, TAKE_OWNERSHIP_WSTRING); + BUFFER_METHOD_IMPL(char16_t*, 0, TAKE_OWNERSHIP_WSTRING); } /* void testInterfaceArray (in unsigned long aLength, [array, size_is (aLength)] in nsIXPCTestInterfaceA a, @@ -268,11 +268,11 @@ NS_IMETHODIMP nsXPCTestParams::TestSizedString(uint32_t aLength, const char * a, /* void testSizedWstring (in unsigned long aLength, [size_is (aLength)] in wstring a, * inout unsigned long bLength, [size_is (bLength)] inout wstring b, * out unsigned long rvLength, [size_is (rvLength), retval] out wstring rv); */ -NS_IMETHODIMP nsXPCTestParams::TestSizedWstring(uint32_t aLength, const PRUnichar * a, - uint32_t *bLength, PRUnichar * *b, - uint32_t *rvLength, PRUnichar * *rv) +NS_IMETHODIMP nsXPCTestParams::TestSizedWstring(uint32_t aLength, const char16_t * a, + uint32_t *bLength, char16_t * *b, + uint32_t *rvLength, char16_t * *rv) { - BUFFER_METHOD_IMPL(PRUnichar, 1, TAKE_OWNERSHIP_NOOP); + BUFFER_METHOD_IMPL(char16_t, 1, TAKE_OWNERSHIP_NOOP); } /* void testInterfaceIs (in nsIIDPtr aIID, [iid_is (aIID)] in nsQIResult a, diff --git a/layout/base/nsBidi.cpp b/layout/base/nsBidi.cpp index ffaf5358053d..7891e57e5a68 100644 --- a/layout/base/nsBidi.cpp +++ b/layout/base/nsBidi.cpp @@ -236,7 +236,7 @@ void nsBidi::Free() /* SetPara ------------------------------------------------------------ */ -nsresult nsBidi::SetPara(const PRUnichar *aText, int32_t aLength, +nsresult nsBidi::SetPara(const char16_t *aText, int32_t aLength, nsBidiLevel aParaLevel, nsBidiLevel *aEmbeddingLevels) { nsBidiDirection direction; @@ -416,13 +416,13 @@ nsresult nsBidi::SetPara(const PRUnichar *aText, int32_t aLength, * calculate the flags bit-set, and * determine the partagraph level if necessary. */ -void nsBidi::GetDirProps(const PRUnichar *aText) +void nsBidi::GetDirProps(const char16_t *aText) { DirProp *dirProps=mDirPropsMemory; /* mDirProps is const */ int32_t i=0, length=mLength; Flags flags=0; /* collect all directionalities in the text */ - PRUnichar uchar; + char16_t uchar; DirProp dirProp; if(IS_DEFAULT_LEVEL(mParaLevel)) { @@ -2056,8 +2056,8 @@ nsresult nsBidi::InvertMap(const int32_t *aSrcMap, int32_t *aDestMap, int32_t aL return NS_OK; } -int32_t nsBidi::doWriteReverse(const PRUnichar *src, int32_t srcLength, - PRUnichar *dest, uint16_t options) { +int32_t nsBidi::doWriteReverse(const char16_t *src, int32_t srcLength, + char16_t *dest, uint16_t options) { /* * RTL run - * @@ -2145,7 +2145,7 @@ int32_t nsBidi::doWriteReverse(const PRUnichar *src, int32_t srcLength, /* we need to find out the destination length of the run, which will not include the Bidi control characters */ int32_t length=srcLength; - PRUnichar ch; + char16_t ch; i=0; do { @@ -2197,7 +2197,7 @@ int32_t nsBidi::doWriteReverse(const PRUnichar *src, int32_t srcLength, return destSize; } -nsresult nsBidi::WriteReverse(const PRUnichar *aSrc, int32_t aSrcLength, PRUnichar *aDest, uint16_t aOptions, int32_t *aDestSize) +nsresult nsBidi::WriteReverse(const char16_t *aSrc, int32_t aSrcLength, char16_t *aDest, uint16_t aOptions, int32_t *aDestSize) { if( aSrc==nullptr || aSrcLength<0 || aDest==nullptr diff --git a/layout/base/nsBidi.h b/layout/base/nsBidi.h index 219fed4ba4c4..000ccadb371a 100644 --- a/layout/base/nsBidi.h +++ b/layout/base/nsBidi.h @@ -245,10 +245,10 @@ typedef uint8_t DirProp; #define UTF16_APPEND_CHAR_UNSAFE(s, i, c){ \ if((uint32_t)(c)<=0xffff) { \ - (s)[(i)++]=(PRUnichar)(c); \ + (s)[(i)++]=(char16_t)(c); \ } else { \ - (s)[(i)++]=(PRUnichar)((c)>>10)+0xd7c0; \ - (s)[(i)++]=(PRUnichar)(c)&0x3ff|0xdc00; \ + (s)[(i)++]=(char16_t)((c)>>10)+0xd7c0; \ + (s)[(i)++]=(char16_t)(c)&0x3ff|0xdc00; \ } \ } @@ -256,11 +256,11 @@ typedef uint8_t DirProp; #define UTF16_APPEND_CHAR_SAFE(s, i, length, c) { \ if((PRUInt32)(c)<=0xffff) { \ - (s)[(i)++]=(PRUnichar)(c); \ + (s)[(i)++]=(char16_t)(c); \ } else if((PRUInt32)(c)<=0x10ffff) { \ if((i)+1<(length)) { \ - (s)[(i)++]=(PRUnichar)((c)>>10)+0xd7c0; \ - (s)[(i)++]=(PRUnichar)(c)&0x3ff|0xdc00; \ + (s)[(i)++]=(char16_t)((c)>>10)+0xd7c0; \ + (s)[(i)++]=(char16_t)(c)&0x3ff|0xdc00; \ } else /* not enough space */ { \ (s)[(i)++]=UTF_ERROR_VALUE; \ } \ @@ -311,7 +311,7 @@ typedef uint8_t DirProp; #define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) { \ (c)=(s)[--(i)]; \ if(IS_SECOND_SURROGATE(c)) { \ - PRUnichar __c2; \ + char16_t __c2; \ if((i)>(start) && IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ --(i); \ (c)=GET_UTF_32(__c2, (c)); \ @@ -473,7 +473,7 @@ public: * The aEmbeddingLevels array must be * at least aLength long. */ - nsresult SetPara(const PRUnichar *aText, int32_t aLength, nsBidiLevel aParaLevel, nsBidiLevel *aEmbeddingLevels); + nsresult SetPara(const char16_t *aText, int32_t aLength, nsBidiLevel aParaLevel, nsBidiLevel *aEmbeddingLevels); /** * Get the directionality of the text. @@ -812,7 +812,7 @@ public: * * @param aDestSize will receive the number of characters that were written to aDest. */ - nsresult WriteReverse(const PRUnichar *aSrc, int32_t aSrcLength, PRUnichar *aDest, uint16_t aOptions, int32_t *aDestSize); + nsresult WriteReverse(const char16_t *aSrc, int32_t aSrcLength, char16_t *aDest, uint16_t aOptions, int32_t *aDestSize); protected: friend class nsBidiPresUtils; @@ -862,7 +862,7 @@ private: void Free(); - void GetDirProps(const PRUnichar *aText); + void GetDirProps(const char16_t *aText); nsBidiDirection ResolveExplicitLevels(); @@ -884,8 +884,8 @@ private: static bool PrepareReorder(const nsBidiLevel *aLevels, int32_t aLength, int32_t *aIndexMap, nsBidiLevel *aMinLevel, nsBidiLevel *aMaxLevel); - int32_t doWriteReverse(const PRUnichar *src, int32_t srcLength, - PRUnichar *dest, uint16_t options); + int32_t doWriteReverse(const char16_t *src, int32_t srcLength, + char16_t *dest, uint16_t options); }; diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index f9e84089aabe..d73bf6817877 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -26,21 +26,21 @@ using namespace mozilla; -static const PRUnichar kSpace = 0x0020; -static const PRUnichar kZWSP = 0x200B; -static const PRUnichar kLineSeparator = 0x2028; -static const PRUnichar kObjectSubstitute = 0xFFFC; -static const PRUnichar kLRE = 0x202A; -static const PRUnichar kRLE = 0x202B; -static const PRUnichar kLRO = 0x202D; -static const PRUnichar kRLO = 0x202E; -static const PRUnichar kPDF = 0x202C; +static const char16_t kSpace = 0x0020; +static const char16_t kZWSP = 0x200B; +static const char16_t kLineSeparator = 0x2028; +static const char16_t kObjectSubstitute = 0xFFFC; +static const char16_t kLRE = 0x202A; +static const char16_t kRLE = 0x202B; +static const char16_t kLRO = 0x202D; +static const char16_t kRLO = 0x202E; +static const char16_t kPDF = 0x202C; #define NS_BIDI_CONTROL_FRAME ((nsIFrame*)0xfffb1d1) struct BidiParagraphData { nsString mBuffer; - nsAutoTArray mEmbeddingStack; + nsAutoTArray mEmbeddingStack; nsTArray mLogicalFrames; nsTArray mLinePerFrame; nsDataHashtable mContentToFrameIndex; @@ -251,18 +251,18 @@ struct BidiParagraphData { nsLineBox* GetLineForFrameAt(int32_t aIndex){ return mLinePerFrame[aIndex]; } - void AppendUnichar(PRUnichar aCh){ mBuffer.Append(aCh); } + void AppendUnichar(char16_t aCh){ mBuffer.Append(aCh); } void AppendString(const nsDependentSubstring& aString){ mBuffer.Append(aString); } - void AppendControlChar(PRUnichar aCh) + void AppendControlChar(char16_t aCh) { mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME); mLinePerFrame.AppendElement((nsLineBox*)nullptr); AppendUnichar(aCh); } - void PushBidiControl(PRUnichar aCh) + void PushBidiControl(char16_t aCh) { AppendControlChar(aCh); mEmbeddingStack.AppendElement(aCh); @@ -588,7 +588,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame) // Handle bidi-override being set on the block itself before calling // TraverseFrames. const nsStyleTextReset* text = aBlockFrame->StyleTextReset(); - PRUnichar ch = 0; + char16_t ch = 0; if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) { const nsStyleVisibility* vis = aBlockFrame->StyleVisibility(); if (NS_STYLE_DIRECTION_RTL == vis->mDirection) { @@ -974,7 +974,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame, } } - PRUnichar ch = 0; + char16_t ch = 0; if (frame->IsFrameOfType(nsIFrame::eBidiInlineContainer)) { if (!(frame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) { nsContainerFrame* c = static_cast(frame); @@ -1637,7 +1637,7 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd, nsresult nsBidiPresUtils::FormatUnicodeText(nsPresContext* aPresContext, - PRUnichar* aText, + char16_t* aText, int32_t& aTextLength, nsCharType aCharType, bool aIsOddLevel) @@ -1701,7 +1701,7 @@ nsBidiPresUtils::FormatUnicodeText(nsPresContext* aPresContext, } void -nsBidiPresUtils::StripBidiControlCharacters(PRUnichar* aText, +nsBidiPresUtils::StripBidiControlCharacters(char16_t* aText, int32_t& aTextLength) { if ( (nullptr == aText) || (aTextLength < 1) ) { @@ -1725,7 +1725,7 @@ nsBidiPresUtils::StripBidiControlCharacters(PRUnichar* aText, #if 0 // XXX: for the future use ??? void -RemoveDiacritics(PRUnichar* aText, +RemoveDiacritics(char16_t* aText, int32_t& aTextLength) { if (aText && (aTextLength > 0) ) { @@ -1746,7 +1746,7 @@ RemoveDiacritics(PRUnichar* aText, void nsBidiPresUtils::CalculateCharType(nsBidi* aBidiEngine, - const PRUnichar* aText, + const char16_t* aText, int32_t& aOffset, int32_t aCharTypeLimit, int32_t& aRunLimit, @@ -1808,7 +1808,7 @@ nsBidiPresUtils::CalculateCharType(nsBidi* aBidiEngine, aOffset = offset; } -nsresult nsBidiPresUtils::ProcessText(const PRUnichar* aText, +nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -1968,7 +1968,7 @@ nsresult nsBidiPresUtils::ProcessText(const PRUnichar* aText, */ nscoord subWidth; // The position in the text where this run's "left part" begins. - const PRUnichar* visualLeftPart, *visualRightSide; + const char16_t* visualLeftPart, *visualRightSide; if (level & 1) { // One day, son, this could all be replaced with mBidiEngine.GetVisualIndex ... posResolve->visualIndex = visualStart + (subRunLength - (posResolve->logicalIndex + 1 - start)); @@ -2029,7 +2029,7 @@ public: mCtx->SetTextRunRTL(false); } - virtual void SetText(const PRUnichar* aText, + virtual void SetText(const char16_t* aText, int32_t aLength, nsBidiDirection aDirection) { @@ -2054,11 +2054,11 @@ private: nsRenderingContext* mCtx; nsRenderingContext* mTextRunConstructionContext; nsPoint mPt; - const PRUnichar* mText; + const char16_t* mText; int32_t mLength; }; -nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const PRUnichar* aText, +nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -2078,16 +2078,16 @@ nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const PRUnichar* } /* static */ -void nsBidiPresUtils::WriteReverse(const PRUnichar* aSrc, +void nsBidiPresUtils::WriteReverse(const char16_t* aSrc, uint32_t aSrcLength, - PRUnichar* aDest) + char16_t* aDest) { - PRUnichar* dest = aDest + aSrcLength; + char16_t* dest = aDest + aSrcLength; mozilla::unicode::ClusterIterator iter(aSrc, aSrcLength); while (!iter.AtEnd()) { iter.Next(); - for (const PRUnichar *cp = iter; cp > aSrc; ) { + for (const char16_t *cp = iter; cp > aSrc; ) { // Here we rely on the fact that there are no non-BMP mirrored pairs // currently in Unicode, so we don't need to look for surrogates *--dest = mozilla::unicode::GetMirroredChar(*--cp); @@ -2099,13 +2099,13 @@ void nsBidiPresUtils::WriteReverse(const PRUnichar* aSrc, } /* static */ -bool nsBidiPresUtils::WriteLogicalToVisual(const PRUnichar* aSrc, +bool nsBidiPresUtils::WriteLogicalToVisual(const char16_t* aSrc, uint32_t aSrcLength, - PRUnichar* aDest, + char16_t* aDest, nsBidiLevel aBaseDirection, nsBidi* aBidiEngine) { - const PRUnichar* src = aSrc; + const char16_t* src = aSrc; nsresult rv = aBidiEngine->SetPara(src, aSrcLength, aBaseDirection, nullptr); if (NS_FAILED(rv)) { return false; @@ -2125,7 +2125,7 @@ bool nsBidiPresUtils::WriteLogicalToVisual(const PRUnichar* aSrc, } int32_t runIndex, start, length; - PRUnichar* dest = aDest; + char16_t* dest = aDest; for (runIndex = 0; runIndex < runCount; ++runIndex) { rv = aBidiEngine->GetVisualRun(runIndex, &start, &length, &dir); diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h index 7eb4b5c3c3ad..39965adaa6a1 100644 --- a/layout/base/nsBidiPresUtils.h +++ b/layout/base/nsBidiPresUtils.h @@ -113,7 +113,7 @@ public: * @param aDirection The direction of the text. The string will never have * mixed direction. */ - virtual void SetText(const PRUnichar* aText, + virtual void SetText(const char16_t* aText, int32_t aLength, nsBidiDirection aDirection) = 0; @@ -169,7 +169,7 @@ public: * @lina 06/18/2000 */ static nsresult FormatUnicodeText(nsPresContext* aPresContext, - PRUnichar* aText, + char16_t* aText, int32_t& aTextLength, nsCharType aCharType, bool aIsOddLevel); @@ -198,7 +198,7 @@ public: * @param[in,out] aPosResolve array of logical positions to resolve into visual positions; can be nullptr if this functionality is not required * @param aPosResolveCount number of items in the aPosResolve array */ - static nsresult RenderText(const PRUnichar* aText, + static nsresult RenderText(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -213,7 +213,7 @@ public: aTextRunConstructionContext, MODE_DRAW, aX, aY, aPosResolve, aPosResolveCount, nullptr); } - static nscoord MeasureTextWidth(const PRUnichar* aText, + static nscoord MeasureTextWidth(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -307,7 +307,7 @@ public: * @param aPosResolveCount number of items in the aPosResolve array * @param[out] aWidth Pointer to where the width will be stored (may be null) */ - static nsresult ProcessText(const PRUnichar* aText, + static nsresult ProcessText(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -352,7 +352,7 @@ public: private: static nsresult - ProcessTextForRenderingContext(const PRUnichar* aText, + ProcessTextForRenderingContext(const char16_t* aText, int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, @@ -481,7 +481,7 @@ private: int32_t aLastIndex, int32_t& aOffset); static void CalculateCharType(nsBidi* aBidiEngine, - const PRUnichar* aText, + const char16_t* aText, int32_t& aOffset, int32_t aCharTypeLimit, int32_t& aRunLimit, @@ -490,18 +490,18 @@ private: uint8_t& aCharType, uint8_t& aPrevCharType); - static void StripBidiControlCharacters(PRUnichar* aText, + static void StripBidiControlCharacters(char16_t* aText, int32_t& aTextLength); - static bool WriteLogicalToVisual(const PRUnichar* aSrc, + static bool WriteLogicalToVisual(const char16_t* aSrc, uint32_t aSrcLength, - PRUnichar* aDest, + char16_t* aDest, nsBidiLevel aBaseDirection, nsBidi* aBidiEngine); - static void WriteReverse(const PRUnichar* aSrc, + static void WriteReverse(const char16_t* aSrc, uint32_t aSrcLength, - PRUnichar* aDest); + char16_t* aDest); }; #endif // IBMBIDI diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index e98a4010d5b5..f576fe340d0d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -9414,7 +9414,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState, if (!aFrame->IsGeneratedContentFrame()) { nsIContent *badKid = AnyKidsNeedBlockParent(aFrameItems.FirstChild()); nsDependentAtomString parentTag(aContent->Tag()), kidTag(badKid->Tag()); - const PRUnichar* params[] = { parentTag.get(), kidTag.get() }; + const char16_t* params[] = { parentTag.get(), kidTag.get() }; const nsStyleDisplay *display = frameStyleContext->StyleDisplay(); const char *message = (display->mDisplay == NS_STYLE_DISPLAY_INLINE_BOX) @@ -9710,7 +9710,7 @@ FirstLetterCount(const nsTextFragment* aFragment) int32_t i, n = aFragment->GetLength(); for (i = 0; i < n; i++) { - PRUnichar ch = aFragment->CharAt(i); + char16_t ch = aFragment->CharAt(i); // FIXME: take content language into account when deciding whitespace. if (dom::IsSpaceCharacter(ch)) { if (firstLetterLength) { diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index f95eee361e48..85046d182c1a 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -196,7 +196,7 @@ DrawCJKCaret(nsIFrame* aFrame, int32_t aOffset) return false; if (aOffset < 0 || uint32_t(aOffset) >= frag->GetLength()) return false; - PRUnichar ch = frag->CharAt(aOffset); + char16_t ch = frag->CharAt(aOffset); return 0x2e80 <= ch && ch <= 0xd7ff; } diff --git a/layout/base/nsCounterManager.cpp b/layout/base/nsCounterManager.cpp index cb5a887a8b3a..b05953a3a2f0 100644 --- a/layout/base/nsCounterManager.cpp +++ b/layout/base/nsCounterManager.cpp @@ -79,7 +79,7 @@ nsCounterUseNode::GetText(nsString& aResult) const nsCSSValue& styleItem = mCounterStyle->Item(mAllCounters ? 2 : 1); int32_t style = styleItem.GetIntValue(); - const PRUnichar* separator; + const char16_t* separator; if (mAllCounters) separator = mCounterStyle->Item(1).GetStringBufferValue(); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index ee428a0919fb..8e14e1910813 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -3848,7 +3848,7 @@ nsDocumentViewer::ExitPrintPreview() // Enumerate all the documents for their titles NS_IMETHODIMP nsDocumentViewer::EnumerateDocumentNames(uint32_t* aCount, - PRUnichar*** aResult) + char16_t*** aResult) { #ifdef NS_PRINTING NS_ENSURE_ARG(aCount); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index c9f8ee3caa20..a4c6f24fc816 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2436,7 +2436,7 @@ nsLayoutUtils::GetZIndex(nsIFrame* aFrame) { */ bool nsLayoutUtils::BinarySearchForPosition(nsRenderingContext* aRendContext, - const PRUnichar* aText, + const char16_t* aText, int32_t aBaseWidth, int32_t aBaseInx, int32_t aStartInx, @@ -3761,7 +3761,7 @@ nsLayoutUtils::GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext, void nsLayoutUtils::DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, - const PRUnichar* aString, + const char16_t* aString, int32_t aLength, nsPoint aPoint, nsStyleContext* aStyleContext) @@ -3788,7 +3788,7 @@ nsLayoutUtils::DrawString(const nsIFrame* aFrame, nscoord nsLayoutUtils::GetStringWidth(const nsIFrame* aFrame, nsRenderingContext* aContext, - const PRUnichar* aString, + const char16_t* aString, int32_t aLength) { #ifdef IBMBIDI diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 5284dd6670c5..3afd4a13140f 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -837,7 +837,7 @@ public: */ static bool BinarySearchForPosition(nsRenderingContext* acx, - const PRUnichar* aText, + const char16_t* aText, int32_t aBaseWidth, int32_t aBaseInx, int32_t aStartInx, @@ -1170,14 +1170,14 @@ public: static void DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, - const PRUnichar* aString, + const char16_t* aString, int32_t aLength, nsPoint aPoint, nsStyleContext* aStyleContext = nullptr); static nscoord GetStringWidth(const nsIFrame* aFrame, nsRenderingContext* aContext, - const PRUnichar* aString, + const char16_t* aString, int32_t aLength); /** diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 3d747ccbef87..2b21ff29b8c0 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1240,7 +1240,7 @@ nsPresContext::UpdateCharSet(const nsCString& aCharSet) NS_IMETHODIMP nsPresContext::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!nsCRT::strcmp(aTopic, "charset")) { nsRefPtr runnable = diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 2a2af1c9cfc0..aa24ae8aec96 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8367,7 +8367,7 @@ WalkFramesThroughPlaceholders(nsPresContext *aPresContext, nsIFrame *aFrame, NS_IMETHODIMP PresShell::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { #ifdef MOZ_XUL if (!nsCRT::strcmp(aTopic, "chrome-flush-skin-caches")) { diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index ac705fdd0f2f..0e7495c35b4c 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -374,7 +374,7 @@ NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver) NS_IMETHODIMP LayoutShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { Shutdown(); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 06f8f803ccae..deadec043499 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1013,7 +1013,7 @@ nsComboboxControlFrame::ActuallyDisplayText(bool aNotify) if (mDisplayedOptionText.IsEmpty()) { // Have to use a non-breaking space for line-height calculations // to be right - static const PRUnichar space = 0xA0; + static const char16_t space = 0xA0; mDisplayContent->SetText(&space, 1, aNotify); } else { mDisplayContent->SetText(mDisplayedOptionText, aNotify); diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index e0a31e5e549b..175309245abf 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2289,7 +2289,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) gLastKeyTime = keyEvent->time; // Append this keystroke to the search string. - PRUnichar uniChar = ToLowerCase(static_cast(keyEvent->charCode)); + char16_t uniChar = ToLowerCase(static_cast(keyEvent->charCode)); GetIncrementalString().Append(uniChar); // See bug 188199, if all letters in incremental string are same, just try to diff --git a/layout/generic/MathVariantTextRunFactory.cpp b/layout/generic/MathVariantTextRunFactory.cpp index 70866775364f..e2fd7727ecda 100644 --- a/layout/generic/MathVariantTextRunFactory.cpp +++ b/layout/generic/MathVariantTextRunFactory.cpp @@ -534,7 +534,7 @@ nsMathVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SINGLE_CHAR_MI; uint32_t length = aTextRun->GetLength(); - const PRUnichar* str = aTextRun->mString.BeginReading(); + const char16_t* str = aTextRun->mString.BeginReading(); nsRefPtr* styles = aTextRun->mStyles.Elements(); uint8_t mathVar; diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 3bc677f99192..72305ed87019 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -55,9 +55,9 @@ static const int MIN_LINES_NEEDING_CURSOR = 20; -static const PRUnichar kDiscCharacter = 0x2022; -static const PRUnichar kCircleCharacter = 0x25e6; -static const PRUnichar kSquareCharacter = 0x25aa; +static const char16_t kDiscCharacter = 0x2022; +static const char16_t kCircleCharacter = 0x25e6; +static const char16_t kSquareCharacter = 0x25aa; #define DISABLE_FLOAT_BREAKING_IN_COLUMNS diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 96df89562bd2..182226f25c6e 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -469,15 +469,15 @@ static bool DecimalLeadingZeroToText(int32_t ordinal, nsString& result) result.AppendASCII(cbuf); return true; } -static bool OtherDecimalToText(int32_t ordinal, PRUnichar zeroChar, nsString& result) +static bool OtherDecimalToText(int32_t ordinal, char16_t zeroChar, nsString& result) { - PRUnichar diff = zeroChar - PRUnichar('0'); + char16_t diff = zeroChar - char16_t('0'); // We're going to be appending to whatever is in "result" already, so make // sure to only munge the new bits. Note that we can't just grab the pointer // to the new stuff here, since appending to the string can realloc. size_t offset = result.Length(); DecimalToText(ordinal, result); - PRUnichar* p = result.BeginWriting() + offset; + char16_t* p = result.BeginWriting() + offset; if (ordinal < 0) { // skip the leading '-' ++p; @@ -492,15 +492,15 @@ static bool TamilToText(int32_t ordinal, nsString& result) // Can't do those in this system. return false; } - PRUnichar diff = 0x0BE6 - PRUnichar('0'); + char16_t diff = 0x0BE6 - char16_t('0'); // We're going to be appending to whatever is in "result" already, so make // sure to only munge the new bits. Note that we can't just grab the pointer // to the new stuff here, since appending to the string can realloc. size_t offset = result.Length(); DecimalToText(ordinal, result); - PRUnichar* p = result.BeginWriting() + offset; + char16_t* p = result.BeginWriting() + offset; for(; '\0' != *p ; p++) - if(*p != PRUnichar('0')) + if(*p != char16_t('0')) *p += diff; return true; } @@ -519,8 +519,8 @@ static bool RomanToText(int32_t ordinal, nsString& result, const char* achars, c nsAutoString addOn, decStr; decStr.AppendInt(ordinal, 10); int len = decStr.Length(); - const PRUnichar* dp = decStr.get(); - const PRUnichar* end = dp + len; + const char16_t* dp = decStr.get(); + const char16_t* end = dp + len; int romanPos = len; int n; @@ -529,27 +529,27 @@ static bool RomanToText(int32_t ordinal, nsString& result, const char* achars, c addOn.SetLength(0); switch(*dp) { case '3': - addOn.Append(PRUnichar(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos])); // FALLTHROUGH case '2': - addOn.Append(PRUnichar(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos])); // FALLTHROUGH case '1': - addOn.Append(PRUnichar(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos])); break; case '4': - addOn.Append(PRUnichar(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos])); // FALLTHROUGH case '5': case '6': case '7': case '8': - addOn.Append(PRUnichar(bchars[romanPos])); + addOn.Append(char16_t(bchars[romanPos])); for(n=0;'5'+n<*dp;n++) { - addOn.Append(PRUnichar(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos])); } break; case '9': - addOn.Append(PRUnichar(achars[romanPos])); - addOn.Append(PRUnichar(achars[romanPos+1])); + addOn.Append(char16_t(achars[romanPos])); + addOn.Append(char16_t(achars[romanPos+1])); break; default: break; @@ -560,7 +560,7 @@ static bool RomanToText(int32_t ordinal, nsString& result, const char* achars, c } #define ALPHA_SIZE 26 -static const PRUnichar gLowerAlphaChars[ALPHA_SIZE] = +static const char16_t gLowerAlphaChars[ALPHA_SIZE] = { 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, // A B C D E 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, // F G H I J @@ -570,7 +570,7 @@ static const PRUnichar gLowerAlphaChars[ALPHA_SIZE] = 0x007A // Z }; -static const PRUnichar gUpperAlphaChars[ALPHA_SIZE] = +static const char16_t gUpperAlphaChars[ALPHA_SIZE] = { 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, // A B C D E 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, // F G H I J @@ -584,7 +584,7 @@ static const PRUnichar gUpperAlphaChars[ALPHA_SIZE] = #define KATAKANA_CHARS_SIZE 48 // Page 94 Writing Systems of The World // after modification by momoi -static const PRUnichar gKatakanaChars[KATAKANA_CHARS_SIZE] = +static const char16_t gKatakanaChars[KATAKANA_CHARS_SIZE] = { 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, // a i u e o 0x30AB, 0x30AD, 0x30AF, 0x30B1, 0x30B3, // ka ki ku ke ko @@ -600,7 +600,7 @@ static const PRUnichar gKatakanaChars[KATAKANA_CHARS_SIZE] = }; #define HIRAGANA_CHARS_SIZE 48 -static const PRUnichar gHiraganaChars[HIRAGANA_CHARS_SIZE] = +static const char16_t gHiraganaChars[HIRAGANA_CHARS_SIZE] = { 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, // a i u e o 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, // ka ki ku ke ko @@ -618,7 +618,7 @@ static const PRUnichar gHiraganaChars[HIRAGANA_CHARS_SIZE] = #define HIRAGANA_IROHA_CHARS_SIZE 47 // Page 94 Writing Systems of The World -static const PRUnichar gHiraganaIrohaChars[HIRAGANA_IROHA_CHARS_SIZE] = +static const char16_t gHiraganaIrohaChars[HIRAGANA_IROHA_CHARS_SIZE] = { 0x3044, 0x308D, 0x306F, 0x306B, 0x307B, // i ro ha ni ho 0x3078, 0x3068, 0x3061, 0x308A, 0x306C, // he to chi ri nu @@ -633,7 +633,7 @@ static const PRUnichar gHiraganaIrohaChars[HIRAGANA_IROHA_CHARS_SIZE] = }; #define KATAKANA_IROHA_CHARS_SIZE 47 -static const PRUnichar gKatakanaIrohaChars[KATAKANA_IROHA_CHARS_SIZE] = +static const char16_t gKatakanaIrohaChars[KATAKANA_IROHA_CHARS_SIZE] = { 0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, // i ro ha ni ho 0x30D8, 0x30C8, 0x30C1, 0x30EA, 0x30CC, // he to chi ri nu @@ -649,7 +649,7 @@ static const PRUnichar gKatakanaIrohaChars[KATAKANA_IROHA_CHARS_SIZE] = #define LOWER_GREEK_CHARS_SIZE 24 // Note: 0x03C2 GREEK FINAL SIGMA is not used in here.... -static const PRUnichar gLowerGreekChars[LOWER_GREEK_CHARS_SIZE] = +static const char16_t gLowerGreekChars[LOWER_GREEK_CHARS_SIZE] = { 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, // alpha beta gamma delta epsilon 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, // zeta eta theta iota kappa @@ -659,26 +659,26 @@ static const PRUnichar gLowerGreekChars[LOWER_GREEK_CHARS_SIZE] = }; #define CJK_HEAVENLY_STEM_CHARS_SIZE 10 -static const PRUnichar gCJKHeavenlyStemChars[CJK_HEAVENLY_STEM_CHARS_SIZE] = +static const char16_t gCJKHeavenlyStemChars[CJK_HEAVENLY_STEM_CHARS_SIZE] = { 0x7532, 0x4e59, 0x4e19, 0x4e01, 0x620a, 0x5df1, 0x5e9a, 0x8f9b, 0x58ec, 0x7678 }; #define CJK_EARTHLY_BRANCH_CHARS_SIZE 12 -static const PRUnichar gCJKEarthlyBranchChars[CJK_EARTHLY_BRANCH_CHARS_SIZE] = +static const char16_t gCJKEarthlyBranchChars[CJK_EARTHLY_BRANCH_CHARS_SIZE] = { 0x5b50, 0x4e11, 0x5bc5, 0x536f, 0x8fb0, 0x5df3, 0x5348, 0x672a, 0x7533, 0x9149, 0x620c, 0x4ea5 }; #define HANGUL_CHARS_SIZE 14 -static const PRUnichar gHangulChars[HANGUL_CHARS_SIZE] = +static const char16_t gHangulChars[HANGUL_CHARS_SIZE] = { 0xac00, 0xb098, 0xb2e4, 0xb77c, 0xb9c8, 0xbc14, 0xc0ac, 0xc544, 0xc790, 0xcc28, 0xce74, 0xd0c0, 0xd30c, 0xd558 }; #define HANGUL_CONSONANT_CHARS_SIZE 14 -static const PRUnichar gHangulConsonantChars[HANGUL_CONSONANT_CHARS_SIZE] = +static const char16_t gHangulConsonantChars[HANGUL_CONSONANT_CHARS_SIZE] = { 0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x3148, 0x314a, 0x314b, 0x314c, @@ -690,7 +690,7 @@ static const PRUnichar gHangulConsonantChars[HANGUL_CONSONANT_CHARS_SIZE] = // per Momoi san's suggestion in bug 102252. // For details, refer to http://www.ethiopic.org/Collation/OrderedLists.html. #define ETHIOPIC_HALEHAME_CHARS_SIZE 26 -static const PRUnichar gEthiopicHalehameChars[ETHIOPIC_HALEHAME_CHARS_SIZE] = +static const char16_t gEthiopicHalehameChars[ETHIOPIC_HALEHAME_CHARS_SIZE] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1240, 0x1260, 0x1270, 0x1280, 0x1290, @@ -699,7 +699,7 @@ static const PRUnichar gEthiopicHalehameChars[ETHIOPIC_HALEHAME_CHARS_SIZE] = 0x1348, 0x1350 }; #define ETHIOPIC_HALEHAME_AM_CHARS_SIZE 33 -static const PRUnichar gEthiopicHalehameAmChars[ETHIOPIC_HALEHAME_AM_CHARS_SIZE] = +static const char16_t gEthiopicHalehameAmChars[ETHIOPIC_HALEHAME_AM_CHARS_SIZE] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 0x1270, 0x1278, @@ -709,7 +709,7 @@ static const PRUnichar gEthiopicHalehameAmChars[ETHIOPIC_HALEHAME_AM_CHARS_SIZE] 0x1340, 0x1348, 0x1350 }; #define ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE 31 -static const PRUnichar gEthiopicHalehameTiErChars[ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE] = +static const char16_t gEthiopicHalehameTiErChars[ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250, 0x1260, 0x1270, 0x1278, @@ -719,7 +719,7 @@ static const PRUnichar gEthiopicHalehameTiErChars[ETHIOPIC_HALEHAME_TI_ER_CHARS_ 0x1350 }; #define ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE 34 -static const PRUnichar gEthiopicHalehameTiEtChars[ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE] = +static const char16_t gEthiopicHalehameTiEtChars[ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250, 0x1260, 0x1270, @@ -737,9 +737,9 @@ static const PRUnichar gEthiopicHalehameTiEtChars[ETHIOPIC_HALEHAME_TI_ET_CHARS_ #define NUM_BUF_SIZE 34 -static bool CharListToText(int32_t ordinal, nsString& result, const PRUnichar* chars, int32_t aBase) +static bool CharListToText(int32_t ordinal, nsString& result, const char16_t* chars, int32_t aBase) { - PRUnichar buf[NUM_BUF_SIZE]; + char16_t buf[NUM_BUF_SIZE]; int32_t idx = NUM_BUF_SIZE; if (ordinal < 1) { return false; @@ -754,17 +754,17 @@ static bool CharListToText(int32_t ordinal, nsString& result, const PRUnichar* c return true; } -static const PRUnichar gCJKDecimalChars[10] = +static const char16_t gCJKDecimalChars[10] = { 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d }; -static bool CharListDecimalToText(int32_t ordinal, nsString& result, const PRUnichar* chars) +static bool CharListDecimalToText(int32_t ordinal, nsString& result, const char16_t* chars) { if (ordinal < 0) { return false; } - PRUnichar buf[NUM_BUF_SIZE]; + char16_t buf[NUM_BUF_SIZE]; int32_t idx = NUM_BUF_SIZE; do { buf[--idx] = chars[ordinal % 10]; @@ -778,14 +778,14 @@ enum CJKIdeographicLang { CHINESE, KOREAN, JAPANESE }; struct CJKIdeographicData { - const PRUnichar *negative; - PRUnichar digit[10]; - PRUnichar unit[3]; - PRUnichar unit10K[2]; + const char16_t *negative; + char16_t digit[10]; + char16_t unit[3]; + char16_t unit10K[2]; uint8_t lang; bool informal; }; -static const PRUnichar gJapaneseNegative[] = { +static const char16_t gJapaneseNegative[] = { 0x30de, 0x30a4, 0x30ca, 0x30b9, 0x0000 }; static const CJKIdeographicData gDataJapaneseInformal = { @@ -810,7 +810,7 @@ static const CJKIdeographicData gDataJapaneseFormal = { JAPANESE, // lang false // informal }; -static const PRUnichar gKoreanNegative[] = { +static const char16_t gKoreanNegative[] = { 0xb9c8, 0xc774, 0xb108, 0xc2a4, 0x0020, 0x0000 }; static const CJKIdeographicData gDataKoreanHangulFormal = { @@ -846,7 +846,7 @@ static const CJKIdeographicData gDataKoreanHanjaFormal = { KOREAN, // lang false // informal }; -static const PRUnichar gSimpChineseNegative[] = { +static const char16_t gSimpChineseNegative[] = { 0x8d1f, 0x0000 }; static const CJKIdeographicData gDataSimpChineseInformal = { @@ -871,7 +871,7 @@ static const CJKIdeographicData gDataSimpChineseFormal = { CHINESE, // lang false // informal }; -static const PRUnichar gTradChineseNegative[] = { +static const char16_t gTradChineseNegative[] = { 0x8ca0, 0x0000 }; static const CJKIdeographicData gDataTradChineseInformal = { @@ -900,7 +900,7 @@ static const CJKIdeographicData gDataTradChineseFormal = { static const bool CJKIdeographicToText(int32_t ordinal, nsString& result, const CJKIdeographicData& data) { - PRUnichar buf[NUM_BUF_SIZE]; + char16_t buf[NUM_BUF_SIZE]; int32_t idx = NUM_BUF_SIZE; int32_t pos = 0; bool isNegative = (ordinal < 0); @@ -975,7 +975,7 @@ static const bool CJKIdeographicToText(int32_t ordinal, nsString& result, } #define HEBREW_GERESH 0x05F3 -static const PRUnichar gHebrewDigit[22] = +static const char16_t gHebrewDigit[22] = { // 1 2 3 4 5 6 7 8 9 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, @@ -1029,7 +1029,7 @@ static bool HebrewToText(int32_t ordinal, nsString& result) if ( n3 > 0) thousandsGroup.Append(gHebrewDigit[n3-1]); if (outputSep) - thousandsGroup.Append((PRUnichar)HEBREW_GERESH); + thousandsGroup.Append((char16_t)HEBREW_GERESH); if (allText.IsEmpty()) allText = thousandsGroup; else @@ -1049,14 +1049,14 @@ static bool ArmenianToText(int32_t ordinal, nsString& result) return false; } - PRUnichar buf[NUM_BUF_SIZE]; + char16_t buf[NUM_BUF_SIZE]; int32_t idx = NUM_BUF_SIZE; int32_t d = 0; do { int32_t cur = ordinal % 10; if (cur > 0) { - PRUnichar u = 0x0530 + (d * 9) + cur; + char16_t u = 0x0530 + (d * 9) + cur; buf[--idx] = u; } ++d; @@ -1067,7 +1067,7 @@ static bool ArmenianToText(int32_t ordinal, nsString& result) } -static const PRUnichar gGeorgianValue [ 37 ] = { // 4 * 9 + 1 = 37 +static const char16_t gGeorgianValue [ 37 ] = { // 4 * 9 + 1 = 37 // 1 2 3 4 5 6 7 8 9 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10F1, 0x10D7, // 10 20 30 40 50 60 70 80 90 @@ -1085,14 +1085,14 @@ static bool GeorgianToText(int32_t ordinal, nsString& result) return false; } - PRUnichar buf[NUM_BUF_SIZE]; + char16_t buf[NUM_BUF_SIZE]; int32_t idx = NUM_BUF_SIZE; int32_t d = 0; do { int32_t cur = ordinal % 10; if (cur > 0) { - PRUnichar u = gGeorgianValue[(d * 9 ) + ( cur - 1)]; + char16_t u = gGeorgianValue[(d * 9 ) + ( cur - 1)]; buf[--idx] = u; } ++d; @@ -1154,21 +1154,21 @@ static bool EthiopicToText(int32_t ordinal, nsString& result) // put it all together... if (tensValue) { // map onto Ethiopic "tens": - result.Append((PRUnichar) (tensValue + ETHIOPIC_TEN - 1)); + result.Append((char16_t) (tensValue + ETHIOPIC_TEN - 1)); } if (unitsValue) { //map onto Ethiopic "units": - result.Append((PRUnichar) (unitsValue + ETHIOPIC_ONE - 1)); + result.Append((char16_t) (unitsValue + ETHIOPIC_ONE - 1)); } // Add a separator for all even groups except the last, // and for odd groups with non-zero value. if (oddGroup) { if (groupValue) { - result.Append((PRUnichar) ETHIOPIC_HUNDRED); + result.Append((char16_t) ETHIOPIC_HUNDRED); } } else { if (groupIndexFromRight) { - result.Append((PRUnichar) ETHIOPIC_TEN_THOUSAND); + result.Append((char16_t) ETHIOPIC_TEN_THOUSAND); } } } @@ -1192,17 +1192,17 @@ nsBulletFrame::AppendCounterText(int32_t aListStyleType, case NS_STYLE_LIST_STYLE_DISC: // used by counters code only // XXX We really need to do this the same way we do list bullets. - result.Append(PRUnichar(0x2022)); + result.Append(char16_t(0x2022)); break; case NS_STYLE_LIST_STYLE_CIRCLE: // used by counters code only // XXX We really need to do this the same way we do list bullets. - result.Append(PRUnichar(0x25E6)); + result.Append(char16_t(0x25E6)); break; case NS_STYLE_LIST_STYLE_SQUARE: // used by counters code only // XXX We really need to do this the same way we do list bullets. - result.Append(PRUnichar(0x25FE)); + result.Append(char16_t(0x25FE)); break; case NS_STYLE_LIST_STYLE_DECIMAL: diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 658e2f67c807..450029b494df 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5410,7 +5410,7 @@ nsFrame::XMLQuote(nsString& aString) { int32_t i, len = aString.Length(); for (i = 0; i < len; i++) { - PRUnichar ch = aString.CharAt(i); + char16_t ch = aString.CharAt(i); if (ch == '<') { nsAutoString tmp(NS_LITERAL_STRING("<")); aString.Cut(i, 1); diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 2cd7b8e12ddc..9bf447525541 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -559,7 +559,7 @@ void nsHTMLFramesetFrame::GenerateRowCol(nsPresContext* aPresContext, for (i = 0; i < aNumSpecs; i++) { if (!aNewAttr.IsEmpty()) - aNewAttr.Append(PRUnichar(',')); + aNewAttr.Append(char16_t(',')); switch (aSpecs[i].mUnit) { case eFramesetUnit_Fixed: @@ -569,7 +569,7 @@ void nsHTMLFramesetFrame::GenerateRowCol(nsPresContext* aPresContext, case eFramesetUnit_Relative: // Add 0.5 to the percentage to make rounding work right. aNewAttr.AppendInt(uint32_t((100.0*aValues[i])/aSize + 0.5)); - aNewAttr.Append(PRUnichar('%')); + aNewAttr.Append(char16_t('%')); break; } } diff --git a/layout/generic/nsFrameUtil.cpp b/layout/generic/nsFrameUtil.cpp index f5f98ef012be..7e05850f3ad4 100644 --- a/layout/generic/nsFrameUtil.cpp +++ b/layout/generic/nsFrameUtil.cpp @@ -448,27 +448,27 @@ void nsFrameUtil::Tag::ToString(nsString& aResult) { aResult.Truncate(); - aResult.Append(PRUnichar('<')); + aResult.Append(char16_t('<')); if (type == close) { - aResult.Append(PRUnichar('/')); + aResult.Append(char16_t('/')); } aResult.AppendASCII(name); if (0 != num) { int32_t i, n = num; for (i = 0; i < n; i++) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); aResult.AppendASCII(attributes[i]); if (values[i]) { aResult.AppendLiteral("=\""); aResult.AppendASCII(values[i]); - aResult.Append(PRUnichar('\"')); + aResult.Append(char16_t('\"')); } } } if (type == openClose) { - aResult.Append(PRUnichar('/')); + aResult.Append(char16_t('/')); } - aResult.Append(PRUnichar('>')); + aResult.Append(char16_t('>')); } //---------------------------------------------------------------------- diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 116bc6867fbf..6c455a1dc1de 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -925,7 +925,7 @@ nsImageFrame::ReflowCallbackCanceled() // aMaxFit. NOTE: it is assumed that the fontmetrics have already been selected // into the rendering context before this is called (for performance). MMP nscoord -nsImageFrame::MeasureString(const PRUnichar* aString, +nsImageFrame::MeasureString(const char16_t* aString, int32_t aLength, nscoord aMaxWidth, uint32_t& aMaxFit, @@ -1008,7 +1008,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext, // XXX It would be nice if there was a way to have the font metrics tell // use where to break the text given a maximum width. At a minimum we need // to be able to get the break character... - const PRUnichar* str = aAltText.get(); + const char16_t* str = aAltText.get(); int32_t strLen = aAltText.Length(); nscoord y = aRect.y; @@ -1944,7 +1944,7 @@ nsImageFrame::IconLoad::Shutdown() NS_IMETHODIMP nsImageFrame::IconLoad::Observe(nsISupports *aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { NS_ASSERTION(!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID), "wrong topic"); diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 6702e77e9116..41390a212b86 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -200,7 +200,7 @@ protected: * in PRUnichars * @return width of the string that fits within aMaxWidth */ - nscoord MeasureString(const PRUnichar* aString, + nscoord MeasureString(const char16_t* aString, int32_t aLength, nscoord aMaxWidth, uint32_t& aMaxFit, diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index b9a7a7649340..a046b400c4f8 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -196,7 +196,7 @@ nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) // values NS_NAMED_LITERAL_STRING(kPageAndTotal, "&PT"); if (aStr.Find(kPageAndTotal) != kNotFound) { - PRUnichar * uStr = nsTextFormatter::smprintf(mPD->mPageNumAndTotalsFormat.get(), mPageNum, mTotNumPages); + char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumAndTotalsFormat.get(), mPageNum, mTotNumPages); aNewStr.ReplaceSubstring(kPageAndTotal.get(), uStr); nsMemory::Free(uStr); } @@ -205,7 +205,7 @@ nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) // and replace the page number code with the actual value NS_NAMED_LITERAL_STRING(kPage, "&P"); if (aStr.Find(kPage) != kNotFound) { - PRUnichar * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mPageNum); + char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mPageNum); aNewStr.ReplaceSubstring(kPage.get(), uStr); nsMemory::Free(uStr); } @@ -222,7 +222,7 @@ nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) NS_NAMED_LITERAL_STRING(kPageTotal, "&L"); if (aStr.Find(kPageTotal) != kNotFound) { - PRUnichar * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mTotNumPages); + char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mTotNumPages); aNewStr.ReplaceSubstring(kPageTotal.get(), uStr); nsMemory::Free(uStr); } @@ -329,7 +329,7 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext, int32_t indx; int32_t textWidth = 0; - const PRUnichar* text = str.get(); + const char16_t* text = str.get(); int32_t len = (int32_t)str.Length(); if (len == 0) { diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 7d07d6534f97..01d04a6fb5ab 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -729,7 +729,7 @@ static bool IsCSSWordSpacingSpace(const nsTextFragment* aFrag, { NS_ASSERTION(aPos < aFrag->GetLength(), "No text for IsSpace!"); - PRUnichar ch = aFrag->CharAt(aPos); + char16_t ch = aFrag->CharAt(aPos); switch (ch) { case ' ': case CH_NBSP: @@ -744,11 +744,11 @@ static bool IsCSSWordSpacingSpace(const nsTextFragment* aFrag, // Check whether the string aChars/aLength starts with space that's // trimmable according to CSS 'white-space:normal/nowrap'. -static bool IsTrimmableSpace(const PRUnichar* aChars, uint32_t aLength) +static bool IsTrimmableSpace(const char16_t* aChars, uint32_t aLength) { NS_ASSERTION(aLength > 0, "No text for IsSpace!"); - PRUnichar ch = *aChars; + char16_t ch = *aChars; if (ch == ' ') return !nsTextFrameUtils::IsSpaceCombiningSequenceTail(aChars + 1, aLength - 1); return ch == '\t' || ch == '\f' || ch == '\n' || ch == '\r'; @@ -781,7 +781,7 @@ static bool IsTrimmableSpace(const nsTextFragment* aFrag, uint32_t aPos, static bool IsSelectionSpace(const nsTextFragment* aFrag, uint32_t aPos) { NS_ASSERTION(aPos < aFrag->GetLength(), "No text for IsSpace!"); - PRUnichar ch = aFrag->CharAt(aPos); + char16_t ch = aFrag->CharAt(aPos); if (ch == ' ' || ch == CH_NBSP) return !IsSpaceCombiningSequenceTail(aFrag, aPos + 1); return ch == '\t' || ch == '\n' || ch == '\f' || ch == '\r'; @@ -799,7 +799,7 @@ GetTrimmableWhitespaceCount(const nsTextFragment* aFrag, { int32_t count = 0; if (aFrag->Is2b()) { - const PRUnichar* str = aFrag->Get2b() + aStartOffset; + const char16_t* str = aFrag->Get2b() + aStartOffset; int32_t fragLen = aFrag->GetLength() - aStartOffset; for (; count < aLength; ++count) { if (!IsTrimmableSpace(str, fragLen)) @@ -1110,7 +1110,7 @@ FindLineContainer(nsIFrame* aFrame) } static bool -IsLineBreakingWhiteSpace(PRUnichar aChar) +IsLineBreakingWhiteSpace(char16_t aChar) { // 0x0A (\n) is not handled as white-space by the line breaker, since // we break before it, if it isn't transformed to a normal space. @@ -1126,7 +1126,7 @@ TextContainsLineBreakerWhiteSpace(const void* aText, uint32_t aLength, bool aIsDoubleByte) { if (aIsDoubleByte) { - const PRUnichar* chars = static_cast(aText); + const char16_t* chars = static_cast(aText); for (uint32_t i = 0; i < aLength; ++i) { if (IsLineBreakingWhiteSpace(chars[i])) return true; @@ -1470,8 +1470,8 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame, scanner.FlushFrames(true, false); } -static PRUnichar* -ExpandBuffer(PRUnichar* aDest, uint8_t* aSrc, uint32_t aCount) +static char16_t* +ExpandBuffer(char16_t* aDest, uint8_t* aSrc, uint32_t aCount) { while (aCount) { *aDest = *aSrc; @@ -2000,12 +2000,12 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) uint32_t analysisFlags; if (frag->Is2b()) { NS_ASSERTION(mDoubleByteText, "Wrong buffer char size!"); - PRUnichar* bufStart = static_cast(aTextBuffer); - PRUnichar* bufEnd = nsTextFrameUtils::TransformText( + char16_t* bufStart = static_cast(aTextBuffer); + char16_t* bufEnd = nsTextFrameUtils::TransformText( frag->Get2b() + contentStart, contentLength, bufStart, compression, &mNextRunContextInfo, &builder, &analysisFlags); aTextBuffer = bufEnd; - currentTransformedTextOffset = bufEnd - static_cast(textPtr); + currentTransformedTextOffset = bufEnd - static_cast(textPtr); } else { if (mDoubleByteText) { // Need to expand the text. First transform it into a temporary buffer, @@ -2019,10 +2019,10 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) uint8_t* end = nsTextFrameUtils::TransformText( reinterpret_cast(frag->Get1b()) + contentStart, contentLength, bufStart, compression, &mNextRunContextInfo, &builder, &analysisFlags); - aTextBuffer = ExpandBuffer(static_cast(aTextBuffer), + aTextBuffer = ExpandBuffer(static_cast(aTextBuffer), tempBuf.Elements(), end - tempBuf.Elements()); currentTransformedTextOffset = - static_cast(aTextBuffer) - static_cast(textPtr); + static_cast(aTextBuffer) - static_cast(textPtr); } else { uint8_t* bufStart = static_cast(aTextBuffer); uint8_t* end = nsTextFrameUtils::TransformText( @@ -2153,7 +2153,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) int32_t(firstFrame->PresContext()->AppUnitsPerDevPixel())}; if (mDoubleByteText) { - const PRUnichar* text = static_cast(textPtr); + const char16_t* text = static_cast(textPtr); if (transformingFactory) { textRun = transformingFactory->MakeTextRun(text, transformedLength, ¶ms, fontGroup, textFlags, styles.Elements()); @@ -2293,8 +2293,8 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) uint32_t analysisFlags; if (frag->Is2b()) { NS_ASSERTION(mDoubleByteText, "Wrong buffer char size!"); - PRUnichar* bufStart = static_cast(textPtr); - PRUnichar* bufEnd = nsTextFrameUtils::TransformText( + char16_t* bufStart = static_cast(textPtr); + char16_t* bufEnd = nsTextFrameUtils::TransformText( frag->Get2b() + contentStart, contentLength, bufStart, compression, &mNextRunContextInfo, &builder, &analysisFlags); textPtr = bufEnd; @@ -2311,7 +2311,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) uint8_t* end = nsTextFrameUtils::TransformText( reinterpret_cast(frag->Get1b()) + contentStart, contentLength, bufStart, compression, &mNextRunContextInfo, &builder, &analysisFlags); - textPtr = ExpandBuffer(static_cast(textPtr), + textPtr = ExpandBuffer(static_cast(textPtr), tempBuf.Elements(), end - tempBuf.Elements()); } else { uint8_t* bufStart = static_cast(textPtr); @@ -2424,7 +2424,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, BreakSink* sink = (aFlags & SBS_SUPPRESS_SINK) ? nullptr : (*breakSink).get(); if (aFlags & SBS_DOUBLE_BYTE) { - const PRUnichar* text = reinterpret_cast(aTextPtr); + const char16_t* text = reinterpret_cast(aTextPtr); mLineBreaker.AppendText(hyphenationLanguage, text + offset, length, flags, sink); } else { @@ -2706,7 +2706,7 @@ nsTextFrame::GetTrimmedOffsets(const nsTextFragment* aFrag, static bool IsJustifiableCharacter(const nsTextFragment* aFrag, int32_t aPos, bool aLangIsCJ) { - PRUnichar ch = aFrag->CharAt(aPos); + char16_t ch = aFrag->CharAt(aPos); if (ch == '\n' || ch == '\t' || ch == '\r') return true; if (ch == ' ' || ch == CH_NBSP) { @@ -2749,11 +2749,11 @@ nsTextFrame::ClearMetrics(nsHTMLReflowMetrics& aMetrics) } static int32_t FindChar(const nsTextFragment* frag, - int32_t aOffset, int32_t aLength, PRUnichar ch) + int32_t aOffset, int32_t aLength, char16_t ch) { int32_t i = 0; if (frag->Is2b()) { - const PRUnichar* str = frag->Get2b() + aOffset; + const char16_t* str = frag->Get2b() + aOffset; for (; i < aLength; ++i) { if (*str == ch) return i + aOffset; @@ -2776,7 +2776,7 @@ static bool IsChineseOrJapanese(nsIFrame* aFrame) if (!language) { return false; } - const PRUnichar *lang = language->GetUTF16String(); + const char16_t *lang = language->GetUTF16String(); return (!nsCRT::strncmp(lang, MOZ_UTF16("ja"), 2) || !nsCRT::strncmp(lang, MOZ_UTF16("zh"), 2)) && (language->GetLength() == 2 || lang[2] == '-'); @@ -8300,8 +8300,8 @@ nsTextFrame::RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState) &vis, true); return result; } -static PRUnichar TransformChar(const nsStyleText* aStyle, gfxTextRun* aTextRun, - uint32_t aSkippedOffset, PRUnichar aChar) +static char16_t TransformChar(const nsStyleText* aStyle, gfxTextRun* aTextRun, + uint32_t aSkippedOffset, char16_t aChar) { if (aChar == '\n') { return aStyle->NewlineIsSignificant() || aStyle->NewlineIsDiscarded() ? @@ -8421,7 +8421,7 @@ nsTextFrame::ToCString(nsCString& aBuf, int32_t* aTotalContentLength) const int32_t fragOffset = GetContentOffset(); int32_t n = fragOffset + contentLength; while (fragOffset < n) { - PRUnichar ch = frag->CharAt(fragOffset++); + char16_t ch = frag->CharAt(fragOffset++); if (ch == '\r') { aBuf.AppendLiteral("\\r"); } else if (ch == '\n') { diff --git a/layout/generic/nsTextFrameUtils.cpp b/layout/generic/nsTextFrameUtils.cpp index 71050c3b4ba0..272280fdfea9 100644 --- a/layout/generic/nsTextFrameUtils.cpp +++ b/layout/generic/nsTextFrameUtils.cpp @@ -12,7 +12,7 @@ #include "nsTextFragment.h" #include -static bool IsDiscardable(PRUnichar ch, uint32_t* aFlags) +static bool IsDiscardable(char16_t ch, uint32_t* aFlags) { // Unlike IS_DISCARDABLE, we don't discard \r. \r will be ignored by gfxTextRun // and discarding it would force us to copy text in many cases of preformatted @@ -33,16 +33,16 @@ static bool IsDiscardable(uint8_t ch, uint32_t* aFlags) return false; } -PRUnichar* -nsTextFrameUtils::TransformText(const PRUnichar* aText, uint32_t aLength, - PRUnichar* aOutput, +char16_t* +nsTextFrameUtils::TransformText(const char16_t* aText, uint32_t aLength, + char16_t* aOutput, CompressionMode aCompression, uint8_t* aIncomingFlags, gfxSkipCharsBuilder* aSkipChars, uint32_t* aAnalysisFlags) { uint32_t flags = 0; - PRUnichar* outputStart = aOutput; + char16_t* outputStart = aOutput; bool lastCharArabic = false; @@ -51,7 +51,7 @@ nsTextFrameUtils::TransformText(const PRUnichar* aText, uint32_t aLength, // Skip discardables. uint32_t i; for (i = 0; i < aLength; ++i) { - PRUnichar ch = *aText++; + char16_t ch = *aText++; if (IsDiscardable(ch, &flags) || (ch == '\n' && aCompression == DISCARD_NEWLINE)) { aSkipChars->SkipChar(); @@ -75,7 +75,7 @@ nsTextFrameUtils::TransformText(const PRUnichar* aText, uint32_t aLength, bool inWhitespace = (*aIncomingFlags & INCOMING_WHITESPACE) != 0; uint32_t i; for (i = 0; i < aLength; ++i) { - PRUnichar ch = *aText++; + char16_t ch = *aText++; bool nowInWhitespace; if (ch == ' ' && (i + 1 >= aLength || @@ -221,7 +221,7 @@ nsTextFrameUtils::ComputeApproximateLengthWithWhitespaceCompression( bool is2b = frag->Is2b(); union { const char *s1b; - const PRUnichar *s2b; + const char16_t *s2b; } u; if (is2b) { u.s2b = frag->Get2b(); @@ -233,7 +233,7 @@ nsTextFrameUtils::ComputeApproximateLengthWithWhitespaceCompression( // exactly right len = 0; for (uint32_t i = 0, i_end = frag->GetLength(); i < i_end; ++i) { - PRUnichar c = is2b ? u.s2b[i] : u.s1b[i]; + char16_t c = is2b ? u.s2b[i] : u.s1b[i]; if (c == ' ' || c == '\n' || c == '\t' || c == '\r') { if (!prevWS) { ++len; diff --git a/layout/generic/nsTextFrameUtils.h b/layout/generic/nsTextFrameUtils.h index e04198242492..eb2e9413b160 100644 --- a/layout/generic/nsTextFrameUtils.h +++ b/layout/generic/nsTextFrameUtils.h @@ -71,7 +71,7 @@ public: * is what Uniscribe assumes.) */ static bool - IsSpaceCombiningSequenceTail(const PRUnichar* aChars, int32_t aLength) { + IsSpaceCombiningSequenceTail(const char16_t* aChars, int32_t aLength) { return aLength > 0 && aChars[0] == 0x200D; // ZWJ } @@ -96,8 +96,8 @@ public: * or an Arabic character preceding this text. We set it to indicate if * there's an Arabic character or whitespace preceding the end of this text. */ - static PRUnichar* TransformText(const PRUnichar* aText, uint32_t aLength, - PRUnichar* aOutput, + static char16_t* TransformText(const char16_t* aText, uint32_t aLength, + char16_t* aOutput, CompressionMode aCompression, uint8_t * aIncomingFlags, gfxSkipCharsBuilder* aSkipChars, diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 9381e82bad8d..3794f05e451c 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -314,7 +314,7 @@ nsTransformedTextRun * nsTransformedTextRun::Create(const gfxTextRunFactory::Parameters* aParams, nsTransformingTextRunFactory* aFactory, gfxFontGroup* aFontGroup, - const PRUnichar* aString, uint32_t aLength, + const char16_t* aString, uint32_t aLength, const uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory) { @@ -377,7 +377,7 @@ nsTransformedTextRun::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) } nsTransformedTextRun* -nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, uint32_t aLength, +nsTransformingTextRunFactory::MakeTextRun(const char16_t* aString, uint32_t aLength, const gfxTextRunFactory::Parameters* aParams, gfxFontGroup* aFontGroup, uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory) @@ -514,7 +514,7 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, GetParametersForInner(aTextRun, &flags, aRefContext); uint32_t length = aTextRun->GetLength(); - const PRUnichar* str = aTextRun->mString.BeginReading(); + const char16_t* str = aTextRun->mString.BeginReading(); nsRefPtr* styles = aTextRun->mStyles.Elements(); // Create a textrun so we can check cluster-start properties nsAutoPtr inner(fontGroup->MakeTextRun(str, length, &innerParams, flags)); @@ -641,7 +641,7 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext) { uint32_t length = aTextRun->GetLength(); - const PRUnichar* str = aTextRun->mString.BeginReading(); + const char16_t* str = aTextRun->mString.BeginReading(); nsRefPtr* styles = aTextRun->mStyles.Elements(); nsAutoString convertedString; diff --git a/layout/generic/nsTextRunTransformations.h b/layout/generic/nsTextRunTransformations.h index f64bce3954e1..22b80b00c6f3 100644 --- a/layout/generic/nsTextRunTransformations.h +++ b/layout/generic/nsTextRunTransformations.h @@ -22,7 +22,7 @@ public: const gfxFontGroup::Parameters* aParams, gfxFontGroup* aFontGroup, uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory = true); - nsTransformedTextRun* MakeTextRun(const PRUnichar* aString, uint32_t aLength, + nsTransformedTextRun* MakeTextRun(const char16_t* aString, uint32_t aLength, const gfxFontGroup::Parameters* aParams, gfxFontGroup* aFontGroup, uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory = true); @@ -73,7 +73,7 @@ public: static nsTransformedTextRun *Create(const gfxTextRunFactory::Parameters* aParams, nsTransformingTextRunFactory* aFactory, gfxFontGroup* aFontGroup, - const PRUnichar* aString, uint32_t aLength, + const char16_t* aString, uint32_t aLength, const uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory); @@ -117,7 +117,7 @@ private: nsTransformedTextRun(const gfxTextRunFactory::Parameters* aParams, nsTransformingTextRunFactory* aFactory, gfxFontGroup* aFontGroup, - const PRUnichar* aString, uint32_t aLength, + const char16_t* aString, uint32_t aLength, const uint32_t aFlags, nsStyleContext** aStyles, bool aOwnsFactory) : gfxTextRun(aParams, aLength, aFontGroup, aFlags), diff --git a/layout/inspector/inCSSValueSearch.cpp b/layout/inspector/inCSSValueSearch.cpp index a0dff78adff2..a00a81d9f6c1 100644 --- a/layout/inspector/inCSSValueSearch.cpp +++ b/layout/inspector/inCSSValueSearch.cpp @@ -180,7 +180,7 @@ inCSSValueSearch::SetDocument(nsIDOMDocument* aDocument) } NS_IMETHODIMP -inCSSValueSearch::GetBaseURL(PRUnichar** aBaseURL) +inCSSValueSearch::GetBaseURL(char16_t** aBaseURL) { if (!(*aBaseURL = ToNewUnicode(mBaseURL))) return NS_ERROR_OUT_OF_MEMORY; @@ -188,7 +188,7 @@ inCSSValueSearch::GetBaseURL(PRUnichar** aBaseURL) } NS_IMETHODIMP -inCSSValueSearch::SetBaseURL(const PRUnichar* aBaseURL) +inCSSValueSearch::SetBaseURL(const char16_t* aBaseURL) { mBaseURL.Assign(aBaseURL); return NS_OK; @@ -223,7 +223,7 @@ inCSSValueSearch::SetNormalizeChromeURLs(bool aNormalizeChromeURLs) } NS_IMETHODIMP -inCSSValueSearch::AddPropertyCriteria(const PRUnichar *aPropName) +inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName) { nsCSSProperty prop = nsCSSProps::LookupProperty(nsDependentString(aPropName), @@ -234,7 +234,7 @@ inCSSValueSearch::AddPropertyCriteria(const PRUnichar *aPropName) } NS_IMETHODIMP -inCSSValueSearch::GetTextCriteria(PRUnichar** aTextCriteria) +inCSSValueSearch::GetTextCriteria(char16_t** aTextCriteria) { if (!(*aTextCriteria = ToNewUnicode(mTextCriteria))) return NS_ERROR_OUT_OF_MEMORY; @@ -242,7 +242,7 @@ inCSSValueSearch::GetTextCriteria(PRUnichar** aTextCriteria) } NS_IMETHODIMP -inCSSValueSearch::SetTextCriteria(const PRUnichar* aTextCriteria) +inCSSValueSearch::SetTextCriteria(const char16_t* aTextCriteria) { mTextCriteria.Assign(aTextCriteria); return NS_OK; @@ -381,8 +381,8 @@ inCSSValueSearch::EqualizeURL(nsAutoString* aURL) if (mNormalizeChromeURLs) { if (aURL->Find("chrome://", false, 0, 1) >= 0) { uint32_t len = aURL->Length(); - PRUnichar* result = new PRUnichar[len-8]; - const PRUnichar* src = aURL->get(); + char16_t* result = new char16_t[len-8]; + const char16_t* src = aURL->get(); uint32_t i = 9; uint32_t milestone = 0; uint32_t s = 0; diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index a847c7dab734..7242490cce97 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -406,7 +406,7 @@ extern const char* const kCSSRawProperties[]; NS_IMETHODIMP inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount, - PRUnichar*** aProps) + char16_t*** aProps) { // maxCount is the largest number of properties we could have; our actual // number might be smaller because properties might be disabled. @@ -421,8 +421,8 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount, maxCount += (eCSSProperty_COUNT_with_aliases - eCSSProperty_COUNT); } - PRUnichar** props = - static_cast(nsMemory::Alloc(maxCount * sizeof(PRUnichar*))); + char16_t** props = + static_cast(nsMemory::Alloc(maxCount * sizeof(char16_t*))); #define DO_PROP(_prop) \ PR_BEGIN_MACRO \ @@ -559,7 +559,7 @@ static void GetOtherValuesForProperty(const uint32_t aParserVariant, NS_IMETHODIMP inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty, uint32_t* aLength, - PRUnichar*** aValues) + char16_t*** aValues) { nsCSSProperty propertyID = nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabled); @@ -605,8 +605,8 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty, InsertNoDuplicates(array, NS_LITERAL_STRING("unset")); *aLength = array.Length(); - PRUnichar** ret = - static_cast(NS_Alloc(*aLength * sizeof(PRUnichar*))); + char16_t** ret = + static_cast(NS_Alloc(*aLength * sizeof(char16_t*))); for (uint32_t i = 0; i < *aLength; ++i) { ret[i] = ToNewUnicode(array[i]); } diff --git a/layout/inspector/inDOMView.cpp b/layout/inspector/inDOMView.cpp index 26c19d7f8618..1526594c96c6 100644 --- a/layout/inspector/inDOMView.cpp +++ b/layout/inspector/inDOMView.cpp @@ -606,19 +606,19 @@ inDOMView::Drop(int32_t row, int32_t orientation, nsIDOMDataTransfer* aDataTrans } NS_IMETHODIMP -inDOMView::PerformAction(const PRUnichar *action) +inDOMView::PerformAction(const char16_t *action) { return NS_OK; } NS_IMETHODIMP -inDOMView::PerformActionOnRow(const PRUnichar *action, int32_t row) +inDOMView::PerformActionOnRow(const char16_t *action, int32_t row) { return NS_OK; } NS_IMETHODIMP -inDOMView::PerformActionOnCell(const PRUnichar* action, int32_t row, nsITreeColumn* col) +inDOMView::PerformActionOnCell(const char16_t* action, int32_t row, nsITreeColumn* col) { return NS_OK; } diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index d91ed07d18e4..dc6c4fe5ec35 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -198,7 +198,7 @@ private: // table. Other digits map to the "external" fonts that may have been // specified in the MathFont Property File. nsString mGlyphCache; - PRUnichar mCharCache; + char16_t mCharCache; }; nsGlyphCode @@ -239,7 +239,7 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, } // Update our cache if it is not associated to this character - PRUnichar uchar = aChar->mData[0]; + char16_t uchar = aChar->mData[0]; if (mCharCache != uchar) { // The key in the property file is interpreted as ASCII and kept // as such ... @@ -262,7 +262,7 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, int32_t length = value.Length(); int32_t i = 0; // index in value while (i < length) { - PRUnichar code = value[i]; + char16_t code = value[i]; ++i; buffer.Append(code); // Read the next word if we have a non-BMP character. @@ -270,15 +270,15 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, code = value[i]; ++i; } else { - code = PRUnichar('\0'); + code = char16_t('\0'); } buffer.Append(code); // See if an external font is needed for the code point. // Limit of 9 external fonts - PRUnichar font = 0; - if (i+1 < length && value[i] == PRUnichar('@') && - value[i+1] >= PRUnichar('0') && value[i+1] <= PRUnichar('9')) { + char16_t font = 0; + if (i+1 < length && value[i] == char16_t('@') && + value[i+1] >= char16_t('0') && value[i+1] <= char16_t('9')) { ++i; font = value[i] - '0'; ++i; @@ -305,7 +305,7 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, ch.code[0] = mGlyphCache.CharAt(index); ch.code[1] = mGlyphCache.CharAt(index + 1); ch.font = mGlyphCache.CharAt(index + 2); - return ch.code[0] == PRUnichar(0xFFFD) ? kNullGlyph : ch; + return ch.code[0] == char16_t(0xFFFD) ? kNullGlyph : ch; } bool @@ -396,7 +396,7 @@ static bool gGlyphTableInitialized = false; NS_IMETHODIMP nsGlyphTableList::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* someData) + const char16_t* someData) { Finalize(); return NS_OK; @@ -487,7 +487,7 @@ nsGlyphTableList::GetGlyphTableFor(const nsAString& aFamily) // Given the char code and mode of stretch, retrieve the preferred extension // font families. static bool -GetFontExtensionPref(PRUnichar aChar, +GetFontExtensionPref(char16_t aChar, nsMathfontPrefExtension aExtension, nsString& aValue) { // initialize OUT param @@ -844,16 +844,16 @@ AddFallbackFonts(nsAString& aFontName, const nsAString& aFallbackFamilies) return; } - static const PRUnichar kSingleQuote = PRUnichar('\''); - static const PRUnichar kDoubleQuote = PRUnichar('\"'); - static const PRUnichar kComma = PRUnichar(','); + static const char16_t kSingleQuote = char16_t('\''); + static const char16_t kDoubleQuote = char16_t('\"'); + static const char16_t kComma = char16_t(','); - const PRUnichar *p_begin, *p_end; + const char16_t *p_begin, *p_end; aFontName.BeginReading(p_begin); aFontName.EndReading(p_end); - const PRUnichar *p = p_begin; - const PRUnichar *p_name = nullptr; + const char16_t *p = p_begin; + const char16_t *p_name = nullptr; while (p < p_end) { while (nsCRT::IsAsciiSpace(*p)) if (++p == p_end) @@ -862,7 +862,7 @@ AddFallbackFonts(nsAString& aFontName, const nsAString& aFallbackFamilies) p_name = p; if (*p == kSingleQuote || *p == kDoubleQuote) { // quoted font family - PRUnichar quoteMark = *p; + char16_t quoteMark = *p; if (++p == p_end) goto insert; @@ -876,7 +876,7 @@ AddFallbackFonts(nsAString& aFontName, const nsAString& aFallbackFamilies) } else { // unquoted font family - const PRUnichar *nameStart = p; + const char16_t *nameStart = p; while (++p != p_end && *p != kComma) /* nothing */ ; diff --git a/layout/mathml/nsMathMLChar.h b/layout/mathml/nsMathMLChar.h index 87185db025f5..cd8b8afd5870 100644 --- a/layout/mathml/nsMathMLChar.h +++ b/layout/mathml/nsMathMLChar.h @@ -47,10 +47,10 @@ enum { // from). The 'font' is a numeric identifier given to the font to which the // glyph belongs. struct nsGlyphCode { - PRUnichar code[2]; + char16_t code[2]; int32_t font; - int32_t Length() { return (code[1] == PRUnichar('\0') ? 1 : 2); } + int32_t Length() { return (code[1] == char16_t('\0') ? 1 : 2); } bool Exists() const { return (code[0] != 0); @@ -128,7 +128,7 @@ public: // Sometimes we only want to pass the data to another routine, // this function helps to avoid copying - const PRUnichar* + const char16_t* get() { return mData.get(); } diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index c9f99643e10b..1b60eaee421e 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -1532,7 +1532,7 @@ nsMathMLContainerFrame::TransmitAutomaticDataForMrowLikeElement() nsresult nsMathMLContainerFrame::ReportErrorToConsole(const char* errorMsgId, - const PRUnichar** aParams, + const char16_t** aParams, uint32_t aParamCount) { return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag, @@ -1542,10 +1542,10 @@ nsMathMLContainerFrame::ReportErrorToConsole(const char* errorMsgId, } nsresult -nsMathMLContainerFrame::ReportParseError(const PRUnichar* aAttribute, - const PRUnichar* aValue) +nsMathMLContainerFrame::ReportParseError(const char16_t* aAttribute, + const char16_t* aValue) { - const PRUnichar* argv[] = + const char16_t* argv[] = { aValue, aAttribute, mContent->Tag()->GetUTF16String() }; return ReportErrorToConsole("AttributeParsingError", argv, 3); } @@ -1553,14 +1553,14 @@ nsMathMLContainerFrame::ReportParseError(const PRUnichar* aAttribute, nsresult nsMathMLContainerFrame::ReportChildCountError() { - const PRUnichar* arg = mContent->Tag()->GetUTF16String(); + const char16_t* arg = mContent->Tag()->GetUTF16String(); return ReportErrorToConsole("ChildCountIncorrect", &arg, 1); } nsresult nsMathMLContainerFrame::ReportInvalidChildError(nsIAtom* aChildTag) { - const PRUnichar* argv[] = + const char16_t* argv[] = { aChildTag->GetUTF16String(), mContent->Tag()->GetUTF16String() }; return ReportErrorToConsole("InvalidChild", argv, 2); } diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h index 694080522d11..9e6a91808ac7 100644 --- a/layout/mathml/nsMathMLContainerFrame.h +++ b/layout/mathml/nsMathMLContainerFrame.h @@ -247,8 +247,8 @@ public: * @param aValue The value for which the parse error occured. */ nsresult - ReportParseError(const PRUnichar* aAttribute, - const PRUnichar* aValue); + ReportParseError(const char16_t* aAttribute, + const char16_t* aValue); /* * Helper to call ReportErrorToConsole when certain tags @@ -271,7 +271,7 @@ public: */ nsresult ReportErrorToConsole(const char* aErrorMsgId, - const PRUnichar** aParams = nullptr, + const char16_t** aParams = nullptr, uint32_t aParamCount = 0); // helper method to reflow a child frame. We are inline frames, and we don't diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index d04de6c6a812..74e6c681baa7 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -248,7 +248,7 @@ nsMathMLFrame::GetRuleThickness(nsRenderingContext& aRenderingContext, "unexpected state"); nscoord xHeight = aFontMetrics->XHeight(); - PRUnichar overBar = 0x00AF; + char16_t overBar = 0x00AF; nsBoundingMetrics bm = aRenderingContext.GetBoundingMetrics(&overBar, 1); aRuleThickness = bm.ascent + bm.descent; if (aRuleThickness <= 0 || aRuleThickness >= xHeight) { @@ -269,7 +269,7 @@ nsMathMLFrame::GetAxisHeight(nsRenderingContext& aRenderingContext, "unexpected state"); nscoord xHeight = aFontMetrics->XHeight(); - PRUnichar minus = 0x2212; // not '-', but official Unicode minus sign + char16_t minus = 0x2212; // not '-', but official Unicode minus sign nsBoundingMetrics bm = aRenderingContext.GetBoundingMetrics(&minus, 1); aAxisHeight = bm.ascent - (bm.ascent + bm.descent)/2; if (aAxisHeight <= 0 || aAxisHeight >= xHeight) { diff --git a/layout/mathml/nsMathMLOperators.cpp b/layout/mathml/nsMathMLOperators.cpp index 85acaecc3a6a..5ffec1672fd4 100644 --- a/layout/mathml/nsMathMLOperators.cpp +++ b/layout/mathml/nsMathMLOperators.cpp @@ -34,8 +34,8 @@ static OperatorData* gOperatorArray = nullptr; static nsHashtable* gOperatorTable = nullptr; static bool gGlobalsInitialized = false; -static const PRUnichar kDashCh = PRUnichar('#'); -static const PRUnichar kColonCh = PRUnichar(':'); +static const char16_t kDashCh = char16_t('#'); +static const char16_t kColonCh = char16_t(':'); static void SetBooleanProperty(OperatorData* aOperatorData, @@ -110,16 +110,16 @@ SetOperator(OperatorData* aOperatorData, nsString& aAttributes) { - static const PRUnichar kNullCh = PRUnichar('\0'); + static const char16_t kNullCh = char16_t('\0'); // aOperator is in the expanded format \uNNNN\uNNNN ... // First compress these Unicode points to the internal nsString format int32_t i = 0; nsAutoString name, value; int32_t len = aOperator.Length(); - PRUnichar c = aOperator[i++]; + char16_t c = aOperator[i++]; uint32_t state = 0; - PRUnichar uchar = 0; + char16_t uchar = 0; while (i <= len) { if (0 == state) { if (c != '\\') @@ -172,8 +172,8 @@ SetOperator(OperatorData* aOperatorData, #endif // Loop over the space-delimited list of attributes to get the name:value pairs aAttributes.Append(kNullCh); // put an extra null at the end - PRUnichar* start = aAttributes.BeginWriting(); - PRUnichar* end = start; + char16_t* start = aAttributes.BeginWriting(); + char16_t* end = start; while ((kNullCh != *start) && (kDashCh != *start)) { name.SetLength(0); value.SetLength(0); diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index c28ce76d0585..b873682c21be 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -20,10 +20,10 @@ // longdiv: // Unicode 5.1 assigns U+27CC to LONG DIVISION, but a right parenthesis // renders better with current font support. -static const PRUnichar kLongDivChar = ')'; +static const char16_t kLongDivChar = ')'; // radical: 'SQUARE ROOT' -static const PRUnichar kRadicalChar = 0x221A; +static const char16_t kRadicalChar = 0x221A; // updiagonalstrike static const uint8_t kArrowHeadSize = 10; @@ -334,7 +334,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext, GetRuleThickness(aRenderingContext, fm, mRuleThickness); GetEmHeight(fm, mEmHeight); - PRUnichar one = '1'; + char16_t one = '1'; nsBoundingMetrics bmOne = aRenderingContext.GetBoundingMetrics(&one, 1); /////////////// diff --git a/layout/mathml/nsMathMLmfencedFrame.cpp b/layout/mathml/nsMathMLmfencedFrame.cpp index 2706b29cfd81..ac0d1804f70b 100644 --- a/layout/mathml/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/nsMathMLmfencedFrame.cpp @@ -103,7 +103,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext) // see if the opening fence is there ... if (!GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::open, value)) { - value = PRUnichar('('); // default as per the MathML REC + value = char16_t('('); // default as per the MathML REC } else { value.CompressWhitespace(); } @@ -119,7 +119,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext) // see if the closing fence is there ... if(!GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::close, value)) { - value = PRUnichar(')'); // default as per the MathML REC + value = char16_t(')'); // default as per the MathML REC } else { value.CompressWhitespace(); } @@ -135,7 +135,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext) // see if separators are there ... if (!GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::separators_, value)) { - value = PRUnichar(','); // default as per the MathML REC + value = char16_t(','); // default as per the MathML REC } else { value.StripWhitespace(); } diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index c3bffa58f179..21081e43e2ff 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -30,9 +30,9 @@ nsMathMLmoFrame::~nsMathMLmoFrame() { } -static const PRUnichar kInvisibleComma = PRUnichar(0x200B); // a.k.a. ZERO WIDTH SPACE -static const PRUnichar kApplyFunction = PRUnichar(0x2061); -static const PRUnichar kInvisibleTimes = PRUnichar(0x2062); +static const char16_t kInvisibleComma = char16_t(0x200B); // a.k.a. ZERO WIDTH SPACE +static const char16_t kApplyFunction = char16_t(0x2061); +static const char16_t kInvisibleTimes = char16_t(0x2062); eMathMLFrameType nsMathMLmoFrame::GetMathMLFrameType() @@ -118,7 +118,7 @@ nsMathMLmoFrame::ProcessTextData() nsContentUtils::GetNodeTextContent(mContent, false, data); data.CompressWhitespace(); int32_t length = data.Length(); - PRUnichar ch = (length == 0) ? PRUnichar('\0') : data[0]; + char16_t ch = (length == 0) ? char16_t('\0') : data[0]; if ((length == 1) && (ch == kInvisibleComma || diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index 2b458334ee27..e6cb42390d57 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -161,7 +161,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, // get the number bool gotDot = false, gotPercent = false; for (; i < stringLength; i++) { - PRUnichar c = aString[i]; + char16_t c = aString[i]; if (gotDot && c == '.') { // error - two dots encountered aSign = NS_MATHML_SIGN_INVALID; diff --git a/layout/mathml/nsMathMLmrootFrame.cpp b/layout/mathml/nsMathMLmrootFrame.cpp index 556ded28e787..0e90d2a4bf06 100644 --- a/layout/mathml/nsMathMLmrootFrame.cpp +++ b/layout/mathml/nsMathMLmrootFrame.cpp @@ -24,7 +24,7 @@ // additional style context to be used by our MathMLChar. #define NS_SQR_CHAR_STYLE_CONTEXT_INDEX 0 -static const PRUnichar kSqrChar = PRUnichar(0x221A); +static const char16_t kSqrChar = char16_t(0x221A); nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -222,7 +222,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext, nscoord ruleThickness, leading, em; GetRuleThickness(renderingContext, fm, ruleThickness); - PRUnichar one = '1'; + char16_t one = '1'; nsBoundingMetrics bmOne = renderingContext.GetBoundingMetrics(&one, 1); // get the leading to be left at the top of the resulting frame diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index 793f555a62ae..ce4b9552aaa1 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -67,8 +67,8 @@ ExtractStyleValues(const nsAString& aString, nsIAtom* aAttribute, { nsTArray* styleArray = nullptr; - const PRUnichar* start = aString.BeginReading(); - const PRUnichar* end = aString.EndReading(); + const char16_t* start = aString.BeginReading(); + const char16_t* end = aString.EndReading(); int32_t startIndex = 0; int32_t count = 0; @@ -109,12 +109,12 @@ ExtractStyleValues(const nsAString& aString, nsIAtom* aAttribute, return styleArray; } -static nsresult ReportParseError(nsIFrame* aFrame, const PRUnichar* aAttribute, - const PRUnichar* aValue) +static nsresult ReportParseError(nsIFrame* aFrame, const char16_t* aAttribute, + const char16_t* aValue) { nsIContent* content = aFrame->GetContent(); - const PRUnichar* params[] = + const char16_t* params[] = { aValue, aAttribute, content->Tag()->GetUTF16String() }; return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag, diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index 5c913d99cf26..a2823130ca1e 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -82,7 +82,7 @@ public: nsCOMPtr mPrintSettings; nsPrintPreviewListener* mPPEventListeners; - PRUnichar* mBrandName; // needed as a substitute name for a document + char16_t* mBrandName; // needed as a substitute name for a document private: nsPrintData() MOZ_DELETE; diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index e24b1fb8c5c9..43735f6ee573 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -483,7 +483,7 @@ nsPrintEngine::DoCommonPrint(bool aIsPrintPreview, if (mNoMarginBoxes) { // Set the footer/header to blank. - const PRUnichar* emptyString = EmptyString().get(); + const char16_t* emptyString = EmptyString().get(); mPrt->mPrintSettings->SetHeaderStrLeft(emptyString); mPrt->mPrintSettings->SetHeaderStrCenter(emptyString); mPrt->mPrintSettings->SetHeaderStrRight(emptyString); @@ -893,7 +893,7 @@ nsPrintEngine::GetPrintPreviewNumPages(int32_t *aPrintPreviewNumPages) // Enumerate all the documents for their titles NS_IMETHODIMP nsPrintEngine::EnumerateDocumentNames(uint32_t* aCount, - PRUnichar*** aResult) + char16_t*** aResult) { NS_ENSURE_ARG(aCount); NS_ENSURE_ARG_POINTER(aResult); @@ -902,7 +902,7 @@ nsPrintEngine::EnumerateDocumentNames(uint32_t* aCount, *aResult = nullptr; int32_t numDocs = mPrt->mPrintDocList.Length(); - PRUnichar** array = (PRUnichar**) nsMemory::Alloc(numDocs * sizeof(PRUnichar*)); + char16_t** array = (char16_t**) nsMemory::Alloc(numDocs * sizeof(char16_t*)); if (!array) return NS_ERROR_OUT_OF_MEMORY; @@ -1445,8 +1445,8 @@ nsPrintEngine::GetDisplayTitleAndURL(nsPrintObject* aPO, // First check to see if the PrintSettings has defined an alternate title // and use that if it did if (mPrt->mPrintSettings) { - PRUnichar * docTitleStrPS = nullptr; - PRUnichar * docURLStrPS = nullptr; + char16_t * docTitleStrPS = nullptr; + char16_t * docURLStrPS = nullptr; mPrt->mPrintSettings->GetTitle(&docTitleStrPS); mPrt->mPrintSettings->GetDocURL(&docURLStrPS); @@ -1759,7 +1759,7 @@ nsPrintEngine::SetupToPrintContent() mPrt->OnStartPrinting(); } - PRUnichar* fileName = nullptr; + char16_t* fileName = nullptr; // check to see if we are printing to a file bool isPrintToFile = false; mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); @@ -1964,7 +1964,7 @@ NS_IMETHODIMP nsPrintEngine::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; @@ -3014,7 +3014,7 @@ void nsPrintEngine::SetIsPrintPreview(bool aIsPrintPreview) //--------------------------------------------------------------------- void -nsPrintEngine::CleanupDocTitleArray(PRUnichar**& aArray, int32_t& aCount) +nsPrintEngine::CleanupDocTitleArray(char16_t**& aArray, int32_t& aCount) { for (int32_t i = aCount - 1; i >= 0; i--) { nsMemory::Free(aArray[i]); @@ -3573,7 +3573,7 @@ nsPrintEngine::StartPagePrintTimer(nsPrintObject* aPO) /*=============== nsIObserver Interface ======================*/ NS_IMETHODIMP -nsPrintEngine::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +nsPrintEngine::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { nsresult rv = NS_ERROR_FAILURE; diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index ec1b5c5daec8..d3e9f8550859 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -61,7 +61,7 @@ public: NS_IMETHOD GetIsRangeSelection(bool *aIsRangeSelection); NS_IMETHOD GetIsFramesetFrameSelected(bool *aIsFramesetFrameSelected); NS_IMETHOD GetPrintPreviewNumPages(int32_t *aPrintPreviewNumPages); - NS_IMETHOD EnumerateDocumentNames(uint32_t* aCount, PRUnichar*** aResult); + NS_IMETHOD EnumerateDocumentNames(uint32_t* aCount, char16_t*** aResult); static nsresult GetGlobalPrintSettings(nsIPrintSettings** aPrintSettings); NS_IMETHOD GetDoingPrint(bool *aDoingPrint); NS_IMETHOD GetDoingPrintPreview(bool *aDoingPrintPreview); @@ -136,7 +136,7 @@ public: nsIPrintProgressParams* aParams); void EllipseLongString(nsAString& aStr, const uint32_t aLen, bool aDoFront); nsresult CheckForPrinters(nsIPrintSettings* aPrintSettings); - void CleanupDocTitleArray(PRUnichar**& aArray, int32_t& aCount); + void CleanupDocTitleArray(char16_t**& aArray, int32_t& aCount); bool IsThereARangeSelection(nsIDOMWindow * aDOMWin); diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 87b38494e4dc..39f81808959c 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -129,15 +129,15 @@ AppendSidesShorthandToString(const nsCSSProperty aProperties[], NS_ABORT_IF_FALSE(value1.GetUnit() != eCSSUnit_Null, "null value 1"); value1.AppendToString(aProperties[0], aString, aSerialization); if (value1 != value2 || value1 != value3 || value1 != value4) { - aString.Append(PRUnichar(' ')); + aString.Append(char16_t(' ')); NS_ABORT_IF_FALSE(value2.GetUnit() != eCSSUnit_Null, "null value 2"); value2.AppendToString(aProperties[1], aString, aSerialization); if (value1 != value3 || value2 != value4) { - aString.Append(PRUnichar(' ')); + aString.Append(char16_t(' ')); NS_ABORT_IF_FALSE(value3.GetUnit() != eCSSUnit_Null, "null value 3"); value3.AppendToString(aProperties[2], aString, aSerialization); if (value2 != value4) { - aString.Append(PRUnichar(' ')); + aString.Append(char16_t(' ')); NS_ABORT_IF_FALSE(value4.GetUnit() != eCSSUnit_Null, "null value 4"); value4.AppendToString(aProperties[3], aString, aSerialization); } @@ -338,13 +338,13 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, bool outsetDefault = data->HasDefaultBorderImageOutset(); if (!sliceDefault || !widthDefault || !outsetDefault) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(eCSSProperty_border_image_slice, aValue, aSerialization); if (!widthDefault || !outsetDefault) { aValue.Append(NS_LITERAL_STRING(" /")); if (!widthDefault) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(eCSSProperty_border_image_width, aValue, aSerialization); } @@ -358,7 +358,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, bool repeatDefault = data->HasDefaultBorderImageRepeat(); if (!repeatDefault) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(eCSSProperty_border_image_repeat, aValue, aSerialization); } @@ -431,11 +431,11 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, colorValue->GetUnit() == eCSSUnit_Enumerated && colorValue->GetIntValue() == NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR; if (!AppendValueToString(subprops[0], aValue, aSerialization) || - !(aValue.Append(PRUnichar(' ')), + !(aValue.Append(char16_t(' ')), AppendValueToString(subprops[1], aValue, aSerialization)) || // Don't output a third value when it's -moz-use-text-color. !(isMozUseTextColor || - (aValue.Append(PRUnichar(' ')), + (aValue.Append(char16_t(' ')), AppendValueToString(subprops[2], aValue, aSerialization)))) { aValue.Truncate(); } @@ -500,28 +500,28 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, for (;;) { image->mValue.AppendToString(eCSSProperty_background_image, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); repeat->mXValue.AppendToString(eCSSProperty_background_repeat, aValue, aSerialization); if (repeat->mYValue.GetUnit() != eCSSUnit_Null) { repeat->mYValue.AppendToString(eCSSProperty_background_repeat, aValue, aSerialization); } - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); attachment->mValue.AppendToString(eCSSProperty_background_attachment, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); position->mValue.AppendToString(eCSSProperty_background_position, aValue, aSerialization); if (size->mXValue.GetUnit() != eCSSUnit_Auto || size->mYValue.GetUnit() != eCSSUnit_Auto) { - aValue.Append(PRUnichar(' ')); - aValue.Append(PRUnichar('/')); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); + aValue.Append(char16_t('/')); + aValue.Append(char16_t(' ')); size->mXValue.AppendToString(eCSSProperty_background_size, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); size->mYValue.AppendToString(eCSSProperty_background_size, aValue, aSerialization); } @@ -545,12 +545,12 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, NS_STYLE_BG_CLIP_CONTENT == NS_STYLE_BG_ORIGIN_CONTENT, "bg-clip and bg-origin style constants must agree"); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); origin->mValue.AppendToString(eCSSProperty_background_origin, aValue, aSerialization); if (clip->mValue != origin->mValue) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); clip->mValue.AppendToString(eCSSProperty_background_clip, aValue, aSerialization); } @@ -577,11 +577,11 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, aValue.Truncate(); return; } - aValue.Append(PRUnichar(',')); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(',')); + aValue.Append(char16_t(' ')); } - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(eCSSProperty_background_color, aValue, aSerialization); break; @@ -688,26 +688,26 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, style->GetIntValue() != NS_FONT_STYLE_NORMAL) { style->AppendToString(eCSSProperty_font_style, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } if (variant->GetUnit() != eCSSUnit_Enumerated || variant->GetIntValue() != NS_FONT_VARIANT_NORMAL) { variant->AppendToString(eCSSProperty_font_variant, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } if (weight->GetUnit() != eCSSUnit_Enumerated || weight->GetIntValue() != NS_FONT_WEIGHT_NORMAL) { weight->AppendToString(eCSSProperty_font_weight, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } size->AppendToString(eCSSProperty_font_size, aValue, aSerialization); if (lh->GetUnit() != eCSSUnit_Normal) { - aValue.Append(PRUnichar('/')); + aValue.Append(char16_t('/')); lh->AppendToString(eCSSProperty_line_height, aValue, aSerialization); } - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); family->AppendToString(eCSSProperty_font_family, aValue, aSerialization); } @@ -716,11 +716,11 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_list_style: if (AppendValueToString(eCSSProperty_list_style_type, aValue, aSerialization)) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } if (AppendValueToString(eCSSProperty_list_style_position, aValue, aSerialization)) { - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } AppendValueToString(eCSSProperty_list_style_image, aValue, aSerialization); @@ -791,16 +791,16 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, if (!dur->mNext && !tim->mNext && !del->mNext) { transProp->AppendToString(eCSSProperty_transition_property, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); dur->mValue.AppendToString(eCSSProperty_transition_duration,aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); tim->mValue.AppendToString(eCSSProperty_transition_timing_function, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); del->mValue.AppendToString(eCSSProperty_transition_delay, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } else { aValue.Truncate(); } @@ -813,13 +813,13 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, for (;;) { pro->mValue.AppendToString(eCSSProperty_transition_property, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); dur->mValue.AppendToString(eCSSProperty_transition_duration, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); tim->mValue.AppendToString(eCSSProperty_transition_timing_function, aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); del->mValue.AppendToString(eCSSProperty_transition_delay, aValue, aSerialization); pro = pro->mNext; @@ -872,7 +872,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, if (++i == numProps) { break; } - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); } if (done) { break; @@ -904,7 +904,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); AppendValueToString(subprops[0], aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(subprops[1], aValue, aSerialization); break; } @@ -914,9 +914,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, nsCSSProps::SubpropertyEntryFor(aProperty); AppendValueToString(subprops[0], aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(subprops[1], aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(subprops[2], aValue, aSerialization); break; } @@ -928,7 +928,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, "must have exactly two subproperties"); AppendValueToString(subprops[0], aValue, aSerialization); - aValue.Append(PRUnichar(' ')); + aValue.Append(char16_t(' ')); AppendValueToString(subprops[1], aValue, aSerialization); break; } diff --git a/layout/style/ErrorReporter.cpp b/layout/style/ErrorReporter.cpp index 5c4bc89dfc53..5dd563ddc653 100644 --- a/layout/style/ErrorReporter.cpp +++ b/layout/style/ErrorReporter.cpp @@ -271,7 +271,7 @@ ErrorReporter::ReportUnexpected(const char *aMessage, nsAutoString qparam; nsStyleUtil::AppendEscapedCSSIdent(aParam, qparam); - const PRUnichar *params[1] = { qparam.get() }; + const char16_t *params[1] = { qparam.get() }; nsAutoString str; sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(), @@ -288,7 +288,7 @@ ErrorReporter::ReportUnexpected(const char *aMessage, nsAutoString tokenString; aToken.AppendToString(tokenString); - const PRUnichar *params[1] = { tokenString.get() }; + const char16_t *params[1] = { tokenString.get() }; nsAutoString str; sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(), @@ -300,14 +300,14 @@ ErrorReporter::ReportUnexpected(const char *aMessage, void ErrorReporter::ReportUnexpected(const char *aMessage, const nsCSSToken &aToken, - PRUnichar aChar) + char16_t aChar) { if (!ShouldReportErrors()) return; nsAutoString tokenString; aToken.AppendToString(tokenString); - const PRUnichar charStr[2] = { aChar, 0 }; - const PRUnichar *params[2] = { tokenString.get(), charStr }; + const char16_t charStr[2] = { aChar, 0 }; + const char16_t *params[2] = { tokenString.get(), charStr }; nsAutoString str; sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(), @@ -324,7 +324,7 @@ ErrorReporter::ReportUnexpectedEOF(const char *aMessage) nsAutoString innerStr; sStringBundle->GetStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(), getter_Copies(innerStr)); - const PRUnichar *params[1] = { innerStr.get() }; + const char16_t *params[1] = { innerStr.get() }; nsAutoString str; sStringBundle->FormatStringFromName(MOZ_UTF16("PEUnexpEOF2"), @@ -334,14 +334,14 @@ ErrorReporter::ReportUnexpectedEOF(const char *aMessage) } void -ErrorReporter::ReportUnexpectedEOF(PRUnichar aExpected) +ErrorReporter::ReportUnexpectedEOF(char16_t aExpected) { if (!ShouldReportErrors()) return; - const PRUnichar expectedStr[] = { - PRUnichar('\''), aExpected, PRUnichar('\''), PRUnichar(0) + const char16_t expectedStr[] = { + char16_t('\''), aExpected, char16_t('\''), char16_t(0) }; - const PRUnichar *params[1] = { expectedStr }; + const char16_t *params[1] = { expectedStr }; nsAutoString str; sStringBundle->FormatStringFromName(MOZ_UTF16("PEUnexpEOF2"), diff --git a/layout/style/ErrorReporter.h b/layout/style/ErrorReporter.h index 9158a2cbb83f..b5c21fdd6866 100644 --- a/layout/style/ErrorReporter.h +++ b/layout/style/ErrorReporter.h @@ -51,13 +51,13 @@ public: void ReportUnexpected(const char *aMessage, const nsCSSToken& aToken); // two parameters, a token and a character, in that order void ReportUnexpected(const char *aMessage, const nsCSSToken& aToken, - PRUnichar aChar); + char16_t aChar); // for ReportUnexpectedEOF, aExpected can be either a stringbundle // name or a single character. In the former case there may not be // any format parameters. void ReportUnexpectedEOF(const char *aExpected); - void ReportUnexpectedEOF(PRUnichar aExpected); + void ReportUnexpectedEOF(char16_t aExpected); private: void AddToError(const nsString &aErrorText); @@ -93,10 +93,10 @@ inline void ErrorReporter::ReportUnexpected(const char *) {} inline void ErrorReporter::ReportUnexpected(const char *, const nsString &) {} inline void ErrorReporter::ReportUnexpected(const char *, const nsCSSToken &) {} inline void ErrorReporter::ReportUnexpected(const char *, const nsCSSToken &, - PRUnichar) {} + char16_t) {} inline void ErrorReporter::ReportUnexpectedEOF(const char *) {} -inline void ErrorReporter::ReportUnexpectedEOF(PRUnichar) {} +inline void ErrorReporter::ReportUnexpectedEOF(char16_t) {} inline void ErrorReporter::AddToError(const nsString &) {} #endif diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 74d47ca8f3b9..a21743b08f7f 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -916,7 +916,7 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader, const nsAFlatString& specUTF16 = NS_ConvertUTF8toUTF16(spec); const nsAFlatString& ctypeUTF16 = NS_ConvertASCIItoUTF16(contentType); - const PRUnichar *strings[] = { specUTF16.get(), ctypeUTF16.get() }; + const char16_t *strings[] = { specUTF16.get(), ctypeUTF16.get() }; nsCOMPtr referrer = GetReferrerURI(); nsContentUtils::ReportToConsole(errorFlag, diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 4e1d6d49a035..683a9e5fc28d 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -117,7 +117,7 @@ nsPseudoClassList::nsPseudoClassList(nsCSSPseudoClasses::Type aType) } nsPseudoClassList::nsPseudoClassList(nsCSSPseudoClasses::Type aType, - const PRUnichar* aString) + const char16_t* aString) : mType(aType), mNext(nullptr) { @@ -364,7 +364,7 @@ void nsCSSSelector::Reset(void) NS_ASSERTION(!mNegations || !mNegations->mNext, "mNegations can't have non-null mNext"); NS_CSS_DELETE_LIST_MEMBER(nsCSSSelector, this, mNegations); - mOperator = PRUnichar(0); + mOperator = char16_t(0); } void nsCSSSelector::SetNameSpace(int32_t aNameSpace) @@ -414,7 +414,7 @@ void nsCSSSelector::AddPseudoClass(nsCSSPseudoClasses::Type aType) } void nsCSSSelector::AddPseudoClass(nsCSSPseudoClasses::Type aType, - const PRUnichar* aString) + const char16_t* aString) { AddPseudoClassInternal(new nsPseudoClassList(aType, aString)); } @@ -464,7 +464,7 @@ void nsCSSSelector::AddAttribute(int32_t aNameSpace, const nsString& aAttr, uint } } -void nsCSSSelector::SetOperator(PRUnichar aOperator) +void nsCSSSelector::SetOperator(char16_t aOperator) { mOperator = aOperator; } @@ -548,18 +548,18 @@ nsCSSSelector::ToString(nsAString& aString, nsCSSStyleSheet* aSheet, // Append the combinator, if needed. if (!stack.IsEmpty()) { const nsCSSSelector *next = stack.ElementAt(index - 1); - PRUnichar oper = s->mOperator; + char16_t oper = s->mOperator; if (next->IsPseudoElement()) { - NS_ASSERTION(oper == PRUnichar(':'), + NS_ASSERTION(oper == char16_t(':'), "improperly chained pseudo element"); } else { - NS_ASSERTION(oper != PRUnichar(0), + NS_ASSERTION(oper != char16_t(0), "compound selector without combinator"); - aString.Append(PRUnichar(' ')); - if (oper != PRUnichar(' ')) { + aString.Append(char16_t(' ')); + if (oper != char16_t(' ')) { aString.Append(oper); - aString.Append(PRUnichar(' ')); + aString.Append(char16_t(' ')); } } } @@ -577,7 +577,7 @@ nsCSSSelector::AppendToStringWithoutCombinators aString.AppendLiteral(":not("); negation->AppendToStringWithoutCombinatorsOrNegations(aString, aSheet, true); - aString.Append(PRUnichar(')')); + aString.Append(char16_t(')')); } } @@ -605,7 +605,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations mNameSpace == kNameSpaceID_None, "How did we get this namespace?"); if (mNameSpace == kNameSpaceID_None) { - aString.Append(PRUnichar('|')); + aString.Append(char16_t('|')); wroteNamespace = true; } } else if (sheetNS->FindNameSpaceID(nullptr) == mNameSpace) { @@ -617,7 +617,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations } else if (mNameSpace == kNameSpaceID_None) { NS_ASSERTION(CanBeNamespaced(aIsNegated), "How did we end up with this namespace?"); - aString.Append(PRUnichar('|')); + aString.Append(char16_t('|')); wroteNamespace = true; } else if (mNameSpace != kNameSpaceID_Unknown) { NS_ASSERTION(CanBeNamespaced(aIsNegated), @@ -627,7 +627,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations "without a prefix?"); nsStyleUtil::AppendEscapedCSSIdent(nsDependentAtomString(prefixAtom), aString); - aString.Append(PRUnichar('|')); + aString.Append(char16_t('|')); wroteNamespace = true; } else { // A selector for an element in any namespace, while the default @@ -649,7 +649,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations if (wroteNamespace || (!mIDList && !mClassList && !mPseudoClassList && !mAttrList && (aIsNegated || !mNegations))) { - aString.Append(PRUnichar('*')); + aString.Append(char16_t('*')); } } else { // Append the tag name @@ -659,10 +659,10 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations if (!mNext) { // Lone pseudo-element selector -- toss in a wildcard type selector // XXXldb Why? - aString.Append(PRUnichar('*')); + aString.Append(char16_t('*')); } if (!nsCSSPseudoElements::IsCSS2PseudoElement(mLowercaseTag)) { - aString.Append(PRUnichar(':')); + aString.Append(char16_t(':')); } // This should not be escaped since (a) the pseudo-element string // has a ":" that can't be escaped and (b) all pseudo-elements at @@ -679,7 +679,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations nsAtomList* list = mIDList; while (list != nullptr) { list->mAtom->ToString(temp); - aString.Append(PRUnichar('#')); + aString.Append(char16_t('#')); nsStyleUtil::AppendEscapedCSSIdent(temp, aString); list = list->mNext; } @@ -692,13 +692,13 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations NS_ABORT_IF_FALSE(nsCSSAnonBoxes::IsTreePseudoElement(mLowercaseTag), "must be tree pseudo-element"); - aString.Append(PRUnichar('(')); + aString.Append(char16_t('(')); for (nsAtomList* list = mClassList; list; list = list->mNext) { nsStyleUtil::AppendEscapedCSSIdent(nsDependentAtomString(list->mAtom), aString); - aString.Append(PRUnichar(',')); + aString.Append(char16_t(',')); } // replace the final comma with a close-paren - aString.Replace(aString.Length() - 1, 1, PRUnichar(')')); + aString.Replace(aString.Length() - 1, 1, char16_t(')')); #else NS_ERROR("Can't happen"); #endif @@ -706,7 +706,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations nsAtomList* list = mClassList; while (list != nullptr) { list->mAtom->ToString(temp); - aString.Append(PRUnichar('.')); + aString.Append(char16_t('.')); nsStyleUtil::AppendEscapedCSSIdent(temp, aString); list = list->mNext; } @@ -717,11 +717,11 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations if (mAttrList) { nsAttrSelector* list = mAttrList; while (list != nullptr) { - aString.Append(PRUnichar('[')); + aString.Append(char16_t('[')); // Append the namespace prefix if (list->mNameSpace == kNameSpaceID_Unknown) { - aString.Append(PRUnichar('*')); - aString.Append(PRUnichar('|')); + aString.Append(char16_t('*')); + aString.Append(char16_t('|')); } else if (list->mNameSpace != kNameSpaceID_None) { if (aSheet) { nsXMLNameSpaceMap *sheetNS = aSheet->GetNameSpaceMap(); @@ -734,7 +734,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations nsAutoString prefix; prefixAtom->ToString(prefix); nsStyleUtil::AppendEscapedCSSIdent(prefix, aString); - aString.Append(PRUnichar('|')); + aString.Append(char16_t('|')); } } // Append the attribute name @@ -744,23 +744,23 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations if (list->mFunction != NS_ATTR_FUNC_SET) { // Append the function if (list->mFunction == NS_ATTR_FUNC_INCLUDES) - aString.Append(PRUnichar('~')); + aString.Append(char16_t('~')); else if (list->mFunction == NS_ATTR_FUNC_DASHMATCH) - aString.Append(PRUnichar('|')); + aString.Append(char16_t('|')); else if (list->mFunction == NS_ATTR_FUNC_BEGINSMATCH) - aString.Append(PRUnichar('^')); + aString.Append(char16_t('^')); else if (list->mFunction == NS_ATTR_FUNC_ENDSMATCH) - aString.Append(PRUnichar('$')); + aString.Append(char16_t('$')); else if (list->mFunction == NS_ATTR_FUNC_CONTAINSMATCH) - aString.Append(PRUnichar('*')); + aString.Append(char16_t('*')); - aString.Append(PRUnichar('=')); + aString.Append(char16_t('=')); // Append the value nsStyleUtil::AppendEscapedCSSString(list->mValue, aString); } - aString.Append(PRUnichar(']')); + aString.Append(char16_t(']')); list = list->mNext; } @@ -775,7 +775,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations // escaping. aString.Append(temp); if (list->u.mMemory) { - aString.Append(PRUnichar('(')); + aString.Append(char16_t('(')); if (nsCSSPseudoClasses::HasStringArg(list->mType)) { nsStyleUtil::AppendEscapedCSSIdent( nsDependentString(list->u.mString), aString); @@ -785,15 +785,15 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations temp.Truncate(); if (a != 0) { if (a == -1) { - temp.Append(PRUnichar('-')); + temp.Append(char16_t('-')); } else if (a != 1) { temp.AppendInt(a); } - temp.Append(PRUnichar('n')); + temp.Append(char16_t('n')); } if (b != 0 || a == 0) { if (b >= 0 && a != 0) // check a != 0 for whether we printed above - temp.Append(PRUnichar('+')); + temp.Append(char16_t('+')); temp.AppendInt(b); } aString.Append(temp); @@ -804,7 +804,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations list->u.mSelectors->ToString(tmp, aSheet); aString.Append(tmp); } - aString.Append(PRUnichar(')')); + aString.Append(char16_t(')')); } } } @@ -862,15 +862,15 @@ nsCSSSelectorList::~nsCSSSelectorList() } nsCSSSelector* -nsCSSSelectorList::AddSelector(PRUnichar aOperator) +nsCSSSelectorList::AddSelector(char16_t aOperator) { nsCSSSelector* newSel = new nsCSSSelector(); if (mSelectors) { - NS_ASSERTION(aOperator != PRUnichar(0), "chaining without combinator"); + NS_ASSERTION(aOperator != char16_t(0), "chaining without combinator"); mSelectors->SetOperator(aOperator); } else { - NS_ASSERTION(aOperator == PRUnichar(0), "combinator without chaining"); + NS_ASSERTION(aOperator == char16_t(0), "combinator without chaining"); } newSel->mNext = mSelectors; @@ -1473,18 +1473,18 @@ StyleRule::GetCssText(nsAString& aCssText) { if (mSelector) { mSelector->ToString(aCssText, GetStyleSheet()); - aCssText.Append(PRUnichar(' ')); + aCssText.Append(char16_t(' ')); } - aCssText.Append(PRUnichar('{')); - aCssText.Append(PRUnichar(' ')); + aCssText.Append(char16_t('{')); + aCssText.Append(char16_t(' ')); if (mDeclaration) { nsAutoString tempString; mDeclaration->ToString( tempString ); aCssText.Append( tempString ); } - aCssText.Append(PRUnichar(' ')); - aCssText.Append(PRUnichar('}')); + aCssText.Append(char16_t(' ')); + aCssText.Append(char16_t('}')); } void diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index cf018e23bd9a..117637494456 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -48,7 +48,7 @@ private: struct nsPseudoClassList { public: nsPseudoClassList(nsCSSPseudoClasses::Type aType); - nsPseudoClassList(nsCSSPseudoClasses::Type aType, const PRUnichar *aString); + nsPseudoClassList(nsCSSPseudoClasses::Type aType, const char16_t *aString); nsPseudoClassList(nsCSSPseudoClasses::Type aType, const int32_t *aIntPair); nsPseudoClassList(nsCSSPseudoClasses::Type aType, nsCSSSelectorList *aSelectorList /* takes ownership */); @@ -70,7 +70,7 @@ public: // d. a selector list, which means mSelectors is non-null // (if nsCSSPseudoClasses::HasSelectorListArg(mType)) void* mMemory; // mString and mNumbers use NS_Alloc/NS_Free - PRUnichar* mString; + char16_t* mString; int32_t* mNumbers; nsCSSSelectorList* mSelectors; } u; @@ -133,7 +133,7 @@ public: void AddID(const nsString& aID); void AddClass(const nsString& aClass); void AddPseudoClass(nsCSSPseudoClasses::Type aType); - void AddPseudoClass(nsCSSPseudoClasses::Type aType, const PRUnichar* aString); + void AddPseudoClass(nsCSSPseudoClasses::Type aType, const char16_t* aString); void AddPseudoClass(nsCSSPseudoClasses::Type aType, const int32_t* aIntPair); // takes ownership of aSelectorList void AddPseudoClass(nsCSSPseudoClasses::Type aType, @@ -141,7 +141,7 @@ public: void AddAttribute(int32_t aNameSpace, const nsString& aAttr); void AddAttribute(int32_t aNameSpace, const nsString& aAttr, uint8_t aFunc, const nsString& aValue, bool aCaseSensitive); - void SetOperator(PRUnichar aOperator); + void SetOperator(char16_t aOperator); inline bool HasTagSelector() const { return !!mCasedTag; @@ -203,7 +203,7 @@ public: nsCSSSelector* mNegations; nsCSSSelector* mNext; int32_t mNameSpace; - PRUnichar mOperator; + char16_t mOperator; private: // int16_t to make sure it packs well with mOperator int16_t mPseudoType; @@ -228,12 +228,12 @@ struct nsCSSSelectorList { * Create a new selector and push it onto the beginning of |mSelectors|, * setting its |mNext| to the current value of |mSelectors|. If there is an * earlier selector, set its |mOperator| to |aOperator|; else |aOperator| - * must be PRUnichar(0). + * must be char16_t(0). * Returns the new selector. * The list owns the new selector. * The caller is responsible for updating |mWeight|. */ - nsCSSSelector* AddSelector(PRUnichar aOperator); + nsCSSSelector* AddSelector(char16_t aOperator); /** * Should be used only on the first in the list diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index c41eefbb3767..46f9e9ff773e 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -357,22 +357,22 @@ protected: void UngetToken(); bool GetNextTokenLocation(bool aSkipWS, uint32_t *linenum, uint32_t *colnum); - bool ExpectSymbol(PRUnichar aSymbol, bool aSkipWS); + bool ExpectSymbol(char16_t aSymbol, bool aSkipWS); bool ExpectEndProperty(); bool CheckEndProperty(); nsSubstring* NextIdent(); // returns true when the stop symbol is found, and false for EOF - bool SkipUntil(PRUnichar aStopSymbol); - void SkipUntilOneOf(const PRUnichar* aStopSymbolChars); + bool SkipUntil(char16_t aStopSymbol); + void SkipUntilOneOf(const char16_t* aStopSymbolChars); // For each character in aStopSymbolChars from the end of the array // to the start, calls SkipUntil with that character. - typedef nsAutoTArray StopSymbolCharStack; + typedef nsAutoTArray StopSymbolCharStack; void SkipUntilAllOf(const StopSymbolCharStack& aStopSymbolChars); // returns true if the stop symbol or EOF is found, and false for an // unexpected ')', ']' or '}'; this not safe to call outside variable // resolution, as it doesn't handle mismatched content - bool SkipBalancedContentUntil(PRUnichar aStopSymbol); + bool SkipBalancedContentUntil(char16_t aStopSymbol); void SkipRuleSet(bool aInsideBraces); bool SkipAtRule(bool aInsideBlock); @@ -502,9 +502,9 @@ protected: // If aStopChar is non-zero, the selector list is done when we hit // aStopChar. Otherwise, it's done when we hit EOF. bool ParseSelectorList(nsCSSSelectorList*& aListHead, - PRUnichar aStopChar); + char16_t aStopChar); bool ParseSelectorGroup(nsCSSSelectorList*& aListHead); - bool ParseSelector(nsCSSSelectorList* aList, PRUnichar aPrevCombinator); + bool ParseSelector(nsCSSSelectorList* aList, char16_t aPrevCombinator); enum { eParseDeclaration_InBraces = 1 << 0, @@ -1134,9 +1134,9 @@ CSSParserImpl::ParseSheet(const nsAString& aInput, static bool NonMozillaVendorIdentifier(const nsAString& ident) { - return (ident.First() == PRUnichar('-') && + return (ident.First() == char16_t('-') && !StringBeginsWith(ident, NS_LITERAL_STRING("-moz-"))) || - ident.First() == PRUnichar('_'); + ident.First() == char16_t('_'); } @@ -1472,7 +1472,7 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString, css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURI); InitScanner(scanner, reporter, aURI, aURI, nullptr); - bool success = ParseSelectorList(*aSelectorList, PRUnichar(0)); + bool success = ParseSelectorList(*aSelectorList, char16_t(0)); // We deliberately do not call OUTPUT_ERROR here, because all our // callers map a failure return to a JS exception, and if that JS @@ -1787,7 +1787,7 @@ CSSParserImpl::ResolveValueWithVariableReferencesRec( MOZ_ASSERT(aResult.IsEmpty()); // Stack of closing characters for currently open constructs. - nsAutoTArray stack; + nsAutoTArray stack; // The resolved value for this ResolveValueWithVariableReferencesRec call. nsString value; @@ -2249,7 +2249,7 @@ CSSParserImpl::GetNextTokenLocation(bool aSkipWS, uint32_t *linenum, uint32_t *c } bool -CSSParserImpl::ExpectSymbol(PRUnichar aSymbol, +CSSParserImpl::ExpectSymbol(char16_t aSymbol, bool aSkipWS) { if (!GetToken(aSkipWS)) { @@ -2358,7 +2358,7 @@ CSSParserImpl::SkipAtRule(bool aInsideBlock) return false; } if (eCSSToken_Symbol == mToken.mType) { - PRUnichar symbol = mToken.mSymbol; + char16_t symbol = mToken.mSymbol; if (symbol == ';') { break; } @@ -2646,8 +2646,8 @@ CSSParserImpl::GatherMedia(nsMediaList* aMedia, query->SetHadUnknownExpression(); } if (aInAtRule) { - const PRUnichar stopChars[] = - { PRUnichar(','), PRUnichar('{'), PRUnichar(';'), PRUnichar('}'), PRUnichar(0) }; + const char16_t stopChars[] = + { char16_t(','), char16_t('{'), char16_t(';'), char16_t('}'), char16_t(0) }; SkipUntilOneOf(stopChars); } else { SkipUntil(','); @@ -2691,7 +2691,7 @@ CSSParserImpl::ParseMediaQueryExpression(nsMediaQuery* aQuery) // case insensitive from CSS - must be lower cased nsContentUtils::ASCIIToLower(mToken.mIdent); - const PRUnichar *featureString; + const char16_t *featureString; if (StringBeginsWith(mToken.mIdent, NS_LITERAL_STRING("min-"))) { expr->mRange = nsMediaExpression::eMin; featureString = mToken.mIdent.get() + 4; @@ -3807,17 +3807,17 @@ CSSParserImpl::ParseSupportsConditionTermsAfterOperator( } bool -CSSParserImpl::SkipUntil(PRUnichar aStopSymbol) +CSSParserImpl::SkipUntil(char16_t aStopSymbol) { nsCSSToken* tk = &mToken; - nsAutoTArray stack; + nsAutoTArray stack; stack.AppendElement(aStopSymbol); for (;;) { if (!GetToken(true)) { return false; } if (eCSSToken_Symbol == tk->mType) { - PRUnichar symbol = tk->mSymbol; + char16_t symbol = tk->mSymbol; uint32_t stackTopIndex = stack.Length() - 1; if (symbol == stack.ElementAt(stackTopIndex)) { stack.RemoveElementAt(stackTopIndex); @@ -3843,17 +3843,17 @@ CSSParserImpl::SkipUntil(PRUnichar aStopSymbol) } bool -CSSParserImpl::SkipBalancedContentUntil(PRUnichar aStopSymbol) +CSSParserImpl::SkipBalancedContentUntil(char16_t aStopSymbol) { nsCSSToken* tk = &mToken; - nsAutoTArray stack; + nsAutoTArray stack; stack.AppendElement(aStopSymbol); for (;;) { if (!GetToken(true)) { return true; } if (eCSSToken_Symbol == tk->mType) { - PRUnichar symbol = tk->mSymbol; + char16_t symbol = tk->mSymbol; uint32_t stackTopIndex = stack.Length() - 1; if (symbol == stack.ElementAt(stackTopIndex)) { stack.RemoveElementAt(stackTopIndex); @@ -3884,7 +3884,7 @@ CSSParserImpl::SkipBalancedContentUntil(PRUnichar aStopSymbol) } void -CSSParserImpl::SkipUntilOneOf(const PRUnichar* aStopSymbolChars) +CSSParserImpl::SkipUntilOneOf(const char16_t* aStopSymbolChars) { nsCSSToken* tk = &mToken; nsDependentString stopSymbolChars(aStopSymbolChars); @@ -3893,7 +3893,7 @@ CSSParserImpl::SkipUntilOneOf(const PRUnichar* aStopSymbolChars) break; } if (eCSSToken_Symbol == tk->mType) { - PRUnichar symbol = tk->mSymbol; + char16_t symbol = tk->mSymbol; if (stopSymbolChars.FindChar(symbol) != -1) { break; } else if ('{' == symbol) { @@ -3931,7 +3931,7 @@ CSSParserImpl::SkipDeclaration(bool aCheckForBraces) return false; } if (eCSSToken_Symbol == tk->mType) { - PRUnichar symbol = tk->mSymbol; + char16_t symbol = tk->mSymbol; if (';' == symbol) { break; } @@ -3966,7 +3966,7 @@ CSSParserImpl::SkipRuleSet(bool aInsideBraces) break; } if (eCSSToken_Symbol == tk->mType) { - PRUnichar symbol = tk->mSymbol; + char16_t symbol = tk->mSymbol; if ('}' == symbol && aInsideBraces) { // leave block closer for higher-level grammar to consume UngetToken(); @@ -4021,7 +4021,7 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData, nsCSSSelectorList* slist = nullptr; uint32_t linenum, colnum; if (!GetNextTokenLocation(true, &linenum, &colnum) || - !ParseSelectorList(slist, PRUnichar('{'))) { + !ParseSelectorList(slist, char16_t('{'))) { REPORT_UNEXPECTED(PEBadSelectorRSIgnored); OUTPUT_ERROR(); SkipRuleSet(aInsideBraces); @@ -4057,7 +4057,7 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData, bool CSSParserImpl::ParseSelectorList(nsCSSSelectorList*& aListHead, - PRUnichar aStopChar) + char16_t aStopChar) { nsCSSSelectorList* list = nullptr; if (! ParseSelectorGroup(list)) { @@ -4073,7 +4073,7 @@ CSSParserImpl::ParseSelectorList(nsCSSSelectorList*& aListHead, nsCSSToken* tk = &mToken; for (;;) { if (! GetToken(true)) { - if (aStopChar == PRUnichar(0)) { + if (aStopChar == char16_t(0)) { return true; } @@ -4092,7 +4092,7 @@ CSSParserImpl::ParseSelectorList(nsCSSSelectorList*& aListHead, list->mNext = newList; list = newList; continue; - } else if (aStopChar == tk->mSymbol && aStopChar != PRUnichar(0)) { + } else if (aStopChar == tk->mSymbol && aStopChar != char16_t(0)) { UngetToken(); return true; } @@ -4121,7 +4121,7 @@ static bool IsUniversalSelector(const nsCSSSelector& aSelector) bool CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList) { - PRUnichar combinator = 0; + char16_t combinator = 0; nsAutoPtr list(new nsCSSSelectorList()); for (;;) { @@ -4134,18 +4134,18 @@ CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList) break; // EOF ok here } - combinator = PRUnichar(0); + combinator = char16_t(0); if (mToken.mType == eCSSToken_Whitespace) { if (!GetToken(true)) { break; // EOF ok here } - combinator = PRUnichar(' '); + combinator = char16_t(' '); } if (mToken.mType != eCSSToken_Symbol) { UngetToken(); // not a combinator } else { - PRUnichar symbol = mToken.mSymbol; + char16_t symbol = mToken.mSymbol; if (symbol == '+' || symbol == '>' || symbol == '~') { combinator = mToken.mSymbol; } else { @@ -4592,7 +4592,7 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask, // OK, now we know we have an mIdent. Atomize it. All the atoms, for // pseudo-classes as well as pseudo-elements, start with a single ':'. nsAutoString buffer; - buffer.Append(PRUnichar(':')); + buffer.Append(char16_t(':')); buffer.Append(mToken.mIdent); nsContentUtils::ASCIIToLower(buffer); nsCOMPtr pseudo = do_GetAtom(buffer); @@ -5107,7 +5107,7 @@ CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, nsCSSPseudoClasses::Type aType) { nsAutoPtr slist; - if (! ParseSelectorList(*getter_Transfers(slist), PRUnichar(')'))) { + if (! ParseSelectorList(*getter_Transfers(slist), char16_t(')'))) { return eSelectorParsingStatus_Error; // our caller calls SkipUntil(')') } @@ -5139,7 +5139,7 @@ CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, */ bool CSSParserImpl::ParseSelector(nsCSSSelectorList* aList, - PRUnichar aPrevCombinator) + char16_t aPrevCombinator) { if (! GetToken(true)) { REPORT_UNEXPECTED_EOF(PESelectorEOF); @@ -6438,7 +6438,7 @@ CSSParserImpl::ParseAttr(nsCSSValue& aValue) return false; } attr.AppendInt(nameSpaceID, 10); - attr.Append(PRUnichar('|')); + attr.Append(char16_t('|')); if (! GetToken(false)) { REPORT_UNEXPECTED_EOF(PEAttributeNameEOF); return false; @@ -7541,7 +7541,7 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID) CSSParserInputState stateAtError; SaveInputState(stateAtError); - const PRUnichar stopChars[] = { ';', '!', '}', ')', 0 }; + const char16_t stopChars[] = { ';', '!', '}', ')', 0 }; SkipUntilOneOf(stopChars); UngetToken(); parseAsTokenStream = mScanner->SeenVariableReference(); @@ -10318,7 +10318,7 @@ CSSParserImpl::ParseOneFamily(nsAString& aFamily, bool& aOneKeyword) // -- CSS 2.1, section 15.3 // Whitespace tokens do not actually matter, // identifier tokens can be separated by comments. - aFamily.Append(PRUnichar(' ')); + aFamily.Append(char16_t(' ')); aFamily.Append(tk->mIdent); } else if (eCSSToken_Whitespace != tk->mType) { UngetToken(); @@ -10381,7 +10381,7 @@ CSSParserImpl::ParseFamily(nsCSSValue& aValue) if (!ExpectSymbol(',', true)) break; - family.Append(PRUnichar(',')); + family.Append(char16_t(',')); nsAutoString nextFamily; if (!ParseOneFamily(nextFamily, single)) @@ -12594,7 +12594,7 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType, *aDropBackslash = false; return true; } - PRUnichar c = stack.LastElement(); + char16_t c = stack.LastElement(); stack.TruncateLength(stack.Length() - 1); if (!references.IsEmpty() && references.LastElement() == stack.Length()) { diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 339cd4ef3b9c..f608d906ff19 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -81,7 +81,7 @@ struct RuleSelectorPair { }; #define NS_IS_ANCESTOR_OPERATOR(ch) \ - ((ch) == PRUnichar(' ') || (ch) == PRUnichar('>')) + ((ch) == char16_t(' ') || (ch) == char16_t('>')) /** * A struct representing a particular rule in an ordered list of rules @@ -1404,7 +1404,7 @@ static bool ValueIncludes(const nsSubstring& aValueList, const nsSubstring& aValue, const nsStringComparator& aComparator) { - const PRUnichar *p = aValueList.BeginReading(), + const char16_t *p = aValueList.BeginReading(), *p_end = aValueList.EndReading(); while (p < p_end) { @@ -1412,13 +1412,13 @@ static bool ValueIncludes(const nsSubstring& aValueList, while (p != p_end && nsContentUtils::IsHTMLWhitespace(*p)) ++p; - const PRUnichar *val_start = p; + const char16_t *val_start = p; // look for space or end while (p != p_end && !nsContentUtils::IsHTMLWhitespace(*p)) ++p; - const PRUnichar *val_end = p; + const char16_t *val_end = p; if (val_start < val_end && aValue.Equals(Substring(val_start, val_end), aComparator)) @@ -1892,7 +1892,7 @@ static bool SelectorMatches(Element* aElement, int32_t begin = 0; int32_t len = language.Length(); while (begin < len) { - int32_t end = language.FindChar(PRUnichar(','), begin); + int32_t end = language.FindChar(char16_t(','), begin); if (end == kNotFound) { end = len; } @@ -2298,7 +2298,7 @@ static bool SelectorMatches(Element* aElement, // '~', the indirect adjacent sibling combinator, is greedy // '+' and '>', the direct adjacent sibling and child combinators, are not #define NS_IS_GREEDY_OPERATOR(ch) \ - ((ch) == PRUnichar(' ') || (ch) == PRUnichar('~')) + ((ch) == char16_t(' ') || (ch) == char16_t('~')) static bool SelectorMatchesTree(Element* aPrevElement, nsCSSSelector* aSelector, @@ -2310,7 +2310,7 @@ static bool SelectorMatchesTree(Element* aPrevElement, Element* prevElement = aPrevElement; while (selector) { // check compound selectors NS_ASSERTION(!selector->mNext || - selector->mNext->mOperator != PRUnichar(0), + selector->mNext->mOperator != char16_t(0), "compound selector without combinator"); // If after the previous selector match we are now outside the @@ -2323,8 +2323,8 @@ static bool SelectorMatchesTree(Element* aPrevElement, // for adjacent sibling combinators, the content to test against the // selector is the previous sibling *element* Element* element = nullptr; - if (PRUnichar('+') == selector->mOperator || - PRUnichar('~') == selector->mOperator) { + if (char16_t('+') == selector->mOperator || + char16_t('~') == selector->mOperator) { // The relevant link must be an ancestor of the node being matched. aLookForRelevantLink = false; nsIContent* parent = prevElement->GetParent(); @@ -2556,13 +2556,13 @@ nsCSSRuleProcessor::RulesMatching(XULTreeRuleProcessorData* aData) } #endif -static inline nsRestyleHint RestyleHintForOp(PRUnichar oper) +static inline nsRestyleHint RestyleHintForOp(char16_t oper) { - if (oper == PRUnichar('+') || oper == PRUnichar('~')) { + if (oper == char16_t('+') || oper == char16_t('~')) { return eRestyle_LaterSiblings; } - if (oper != PRUnichar(0)) { + if (oper != char16_t(0)) { return eRestyle_Subtree; } diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 2c7f9a8a8520..73e22d444d8e 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -2359,7 +2359,7 @@ nsCSSKeyframeRule::DoGetKeyText(nsAString& aKeyText) const NS_ABORT_IF_FALSE(i_end != 0, "must have some keys"); for (;;) { aKeyText.AppendFloat(mKeys[i] * 100.0f); - aKeyText.Append(PRUnichar('%')); + aKeyText.Append(char16_t('%')); if (++i == i_end) { break; } diff --git a/layout/style/nsCSSScanner.cpp b/layout/style/nsCSSScanner.cpp index f427d0a8e5e6..9f2bd7e8d4fd 100644 --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -259,13 +259,13 @@ nsCSSToken::AppendToString(nsString& aBuffer) const case eCSSToken_URL: case eCSSToken_Bad_URL: aBuffer.AppendLiteral("url("); - if (mSymbol != PRUnichar(0)) { + if (mSymbol != char16_t(0)) { nsStyleUtil::AppendEscapedCSSString(mIdent, aBuffer, mSymbol); } else { aBuffer.Append(mIdent); } if (mType == eCSSToken_URL) { - aBuffer.Append(PRUnichar(')')); + aBuffer.Append(char16_t(')')); } break; @@ -279,7 +279,7 @@ nsCSSToken::AppendToString(nsString& aBuffer) const case eCSSToken_Percentage: aBuffer.AppendFloat(mNumber * 100.0f); - aBuffer.Append(PRUnichar('%')); + aBuffer.Append(char16_t('%')); break; case eCSSToken_Dimension: @@ -960,7 +960,7 @@ nsCSSScanner::ScanString(nsCSSToken& aToken) int32_t aStop = Peek(); MOZ_ASSERT(aStop == '"' || aStop == '\'', "should not have been called"); aToken.mType = eCSSToken_String; - aToken.mSymbol = PRUnichar(aStop); // Remember how it's quoted. + aToken.mSymbol = char16_t(aStop); // Remember how it's quoted. Advance(); for (;;) { @@ -1119,7 +1119,7 @@ nsCSSScanner::AddEOFCharacters(uint32_t aEOFCharacters) mEOFCharacters = EOFCharacters(mEOFCharacters | aEOFCharacters); } -static const PRUnichar kImpliedEOFCharacters[] = { +static const char16_t kImpliedEOFCharacters[] = { UCS2_REPLACEMENT_CHAR, '*', '/', '"', '\'', ')', 0 }; @@ -1132,7 +1132,7 @@ nsCSSScanner::AppendImpliedEOFCharacters(EOFCharacters aEOFCharacters, // All of the remaining EOFCharacters bits represent appended characters, // and the bits are in the order that they need appending. - for (const PRUnichar* p = kImpliedEOFCharacters; *p && c; p++, c >>= 1) { + for (const char16_t* p = kImpliedEOFCharacters; *p && c; p++, c >>= 1) { if (c & 1) { aResult.Append(*p); } @@ -1173,7 +1173,7 @@ nsCSSScanner::NextURL(nsCSSToken& aToken) } else { // Otherwise, this is the start of a non-quoted url (which may be empty). - aToken.mSymbol = PRUnichar(0); + aToken.mSymbol = char16_t(0); GatherText(IS_URL_CHAR, aToken.mIdent); } diff --git a/layout/style/nsCSSScanner.h b/layout/style/nsCSSScanner.h index 737a9e507872..c9f8ec776d66 100644 --- a/layout/style/nsCSSScanner.h +++ b/layout/style/nsCSSScanner.h @@ -140,7 +140,7 @@ struct nsCSSToken { int32_t mInteger; int32_t mInteger2; nsCSSTokenType mType; - PRUnichar mSymbol; + char16_t mSymbol; bool mIntegerValid; bool mHasSign; @@ -149,7 +149,7 @@ struct nsCSSToken { mSymbol('\0'), mIntegerValid(false), mHasSign(false) {} - bool IsSymbol(PRUnichar aSymbol) const { + bool IsSymbol(char16_t aSymbol) const { return mType == eCSSToken_Symbol && mSymbol == aSymbol; } @@ -330,7 +330,7 @@ protected: void SetEOFCharacters(uint32_t aEOFCharacters); void AddEOFCharacters(uint32_t aEOFCharacters); - const PRUnichar *mBuffer; + const char16_t *mBuffer; uint32_t mOffset; uint32_t mCount; diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 0a0f5284bf89..9d661b7b1686 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -723,13 +723,13 @@ nsCSSValue::BufferFromString(const nsString& aValue) // NOTE: Alloc prouduces a new, already-addref'd (refcnt = 1) buffer. // NOTE: String buffer allocation is currently fallible. - buffer = nsStringBuffer::Alloc((length + 1) * sizeof(PRUnichar)); + buffer = nsStringBuffer::Alloc((length + 1) * sizeof(char16_t)); if (MOZ_UNLIKELY(!buffer)) { NS_RUNTIMEABORT("out of memory"); } - PRUnichar* data = static_cast(buffer->Data()); - nsCharTraits::copy(data, aValue.get(), length); + char16_t* data = static_cast(buffer->Data()); + nsCharTraits::copy(data, aValue.get(), length); // Null-terminate. data[length] = 0; return buffer.forget(); @@ -879,20 +879,20 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSKeyword_scalex: case eCSSKeyword_skewx: case eCSSKeyword_translatex: - ident.Replace(ident.Length() - 1, 1, PRUnichar('X')); + ident.Replace(ident.Length() - 1, 1, char16_t('X')); break; case eCSSKeyword_rotatey: case eCSSKeyword_scaley: case eCSSKeyword_skewy: case eCSSKeyword_translatey: - ident.Replace(ident.Length() - 1, 1, PRUnichar('Y')); + ident.Replace(ident.Length() - 1, 1, char16_t('Y')); break; case eCSSKeyword_rotatez: case eCSSKeyword_scalez: case eCSSKeyword_translatez: - ident.Replace(ident.Length() - 1, 1, PRUnichar('Z')); + ident.Replace(ident.Length() - 1, 1, char16_t('Z')); break; default: @@ -1056,7 +1056,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.Append(comma); aResult.AppendFloat(nsStyleUtil::ColorComponentToFloat(a)); } - aResult.Append(PRUnichar(')')); + aResult.Append(char16_t(')')); } } else if (eCSSUnit_HexColor == unit) { nscolor color = GetColorValue(); @@ -1327,7 +1327,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSUnit_Cubic_Bezier: case eCSSUnit_Steps: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; + case eCSSUnit_Counters: aResult.Append(char16_t(')')); break; case eCSSUnit_Local_Font: break; case eCSSUnit_Font_Format: break; case eCSSUnit_Function: break; @@ -1348,7 +1348,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSUnit_PercentageRGBAColor: break; case eCSSUnit_HSLColor: break; case eCSSUnit_HSLAColor: break; - case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; + case eCSSUnit_Percent: aResult.Append(char16_t('%')); break; case eCSSUnit_Number: break; case eCSSUnit_Gradient: break; case eCSSUnit_TokenStream: break; @@ -1388,7 +1388,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSUnit_Hertz: aResult.AppendLiteral("Hz"); break; case eCSSUnit_Kilohertz: aResult.AppendLiteral("kHz"); break; - case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Seconds: aResult.Append(char16_t('s')); break; case eCSSUnit_Milliseconds: aResult.AppendLiteral("ms"); break; } } @@ -1599,8 +1599,8 @@ nsCSSValueList::AppendToString(nsCSSProperty aProperty, nsAString& aResult, if (nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_VALUE_LIST_USES_COMMAS)) - aResult.Append(PRUnichar(',')); - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(',')); + aResult.Append(char16_t(' ')); } } @@ -1730,7 +1730,7 @@ nsCSSRect::AppendToString(nsCSSProperty aProperty, nsAString& aResult, mBottom.AppendToString(aProperty, aResult, aSerialization); aResult.Append(comma); mLeft.AppendToString(aProperty, aResult, aSerialization); - aResult.Append(PRUnichar(')')); + aResult.Append(char16_t(')')); } } @@ -1773,7 +1773,7 @@ nsCSSValuePair::AppendToString(nsCSSProperty aProperty, { mXValue.AppendToString(aProperty, aResult, aSerialization); if (mYValue.GetUnit() != eCSSUnit_Null) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); mYValue.AppendToString(aProperty, aResult, aSerialization); } } @@ -1805,10 +1805,10 @@ nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty, { mXValue.AppendToString(aProperty, aResult, aSerialization); if (mYValue.GetUnit() != eCSSUnit_Null) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); mYValue.AppendToString(aProperty, aResult, aSerialization); if (mZValue.GetUnit() != eCSSUnit_Null) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); mZValue.AppendToString(aProperty, aResult, aSerialization); } } @@ -1860,7 +1860,7 @@ nsCSSValuePairList::AppendToString(nsCSSProperty aProperty, item->mXValue.GetUnit() != eCSSUnit_Initial && item->mXValue.GetUnit() != eCSSUnit_Unset && item->mYValue.GetUnit() != eCSSUnit_Null) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); item->mYValue.AppendToString(aProperty, aResult, aSerialization); } item = item->mNext; @@ -1869,8 +1869,8 @@ nsCSSValuePairList::AppendToString(nsCSSProperty aProperty, if (nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_VALUE_LIST_USES_COMMAS)) - aResult.Append(PRUnichar(',')); - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(',')); + aResult.Append(char16_t(' ')); } } diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index bb4d1bec80ab..4e9af5429b15 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -154,13 +154,13 @@ enum nsCSSUnit { eCSSUnit_DummyInherit = 10, // (n/a) a fake but specified value, used // only in temporary values - eCSSUnit_String = 11, // (PRUnichar*) a string value - eCSSUnit_Ident = 12, // (PRUnichar*) a string value - eCSSUnit_Families = 13, // (PRUnichar*) a string value - eCSSUnit_Attr = 14, // (PRUnichar*) a attr(string) value - eCSSUnit_Local_Font = 15, // (PRUnichar*) a local font name - eCSSUnit_Font_Format = 16, // (PRUnichar*) a font format name - eCSSUnit_Element = 17, // (PRUnichar*) an element id + eCSSUnit_String = 11, // (char16_t*) a string value + eCSSUnit_Ident = 12, // (char16_t*) a string value + eCSSUnit_Families = 13, // (char16_t*) a string value + eCSSUnit_Attr = 14, // (char16_t*) a attr(string) value + eCSSUnit_Local_Font = 15, // (char16_t*) a local font name + eCSSUnit_Font_Format = 16, // (char16_t*) a font format name + eCSSUnit_Element = 17, // (char16_t*) an element id eCSSUnit_Array = 20, // (nsCSSValue::Array*) a list of values eCSSUnit_Counter = 21, // (nsCSSValue::Array*) a counter(string,[string]) value @@ -437,7 +437,7 @@ public: return aBuffer; } - const PRUnichar* GetStringBufferValue() const + const char16_t* GetStringBufferValue() const { NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value"); return GetBufferValue(mValue.mString); @@ -508,7 +508,7 @@ public: return mValue.mImage; } - const PRUnichar* GetOriginalURLValue() const + const char16_t* GetOriginalURLValue() const { NS_ABORT_IF_FALSE(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image, "not a URL value"); @@ -588,8 +588,8 @@ public: size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: - static const PRUnichar* GetBufferValue(nsStringBuffer* aBuffer) { - return static_cast(aBuffer->Data()); + static const char16_t* GetBufferValue(nsStringBuffer* aBuffer) { + return static_cast(aBuffer->Data()); } protected: diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index ad768ab1f201..5fe5e210c7ef 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -244,7 +244,7 @@ nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement, mContent = aElement; if (!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty() && - aPseudoElt.First() == PRUnichar(':')) { + aPseudoElt.First() == char16_t(':')) { // deal with two-colon forms of aPseudoElt nsAString::const_iterator start, end; aPseudoElt.BeginReading(start); @@ -252,7 +252,7 @@ nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement, NS_ASSERTION(start != end, "aPseudoElt is not empty!"); ++start; bool haveTwoColons = true; - if (start == end || *start != PRUnichar(':')) { + if (start == end || *start != char16_t(':')) { --start; haveTwoColons = false; } @@ -1107,7 +1107,7 @@ nsComputedDOMStyle::DoGetContent() str); } - str.Append(PRUnichar(')')); + str.Append(char16_t(')')); val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_COUNTER); } break; diff --git a/layout/style/nsDOMCSSValueList.cpp b/layout/style/nsDOMCSSValueList.cpp index d5bb8fb4fd5e..afd9c3ef40ad 100644 --- a/layout/style/nsDOMCSSValueList.cpp +++ b/layout/style/nsDOMCSSValueList.cpp @@ -59,7 +59,7 @@ nsDOMCSSValueList::GetCssText(nsAString& aCssText) separator.AssignLiteral(", "); } else { - separator.Assign(PRUnichar(' ')); + separator.Assign(char16_t(' ')); } nsAutoString tmpStr; diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 226560658fcf..73dbb59342c6 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -22,7 +22,7 @@ NS_IMPL_ISUPPORTS2( nsresult nsLayoutStylesheetCache::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "profile-before-change")) { mUserContentSheet = nullptr; diff --git a/layout/style/nsROCSSPrimitiveValue.cpp b/layout/style/nsROCSSPrimitiveValue.cpp index 1380eb6b3399..5f9d79f4278c 100644 --- a/layout/style/nsROCSSPrimitiveValue.cpp +++ b/layout/style/nsROCSSPrimitiveValue.cpp @@ -128,13 +128,13 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText) { tmpStr.AppendLiteral("attr("); tmpStr.Append(mValue.mString); - tmpStr.Append(PRUnichar(')')); + tmpStr.Append(char16_t(')')); break; } case CSS_PERCENTAGE : { nsStyleUtil::AppendCSSNumber(mValue.mFloat * 100, tmpStr); - tmpStr.Append(PRUnichar('%')); + tmpStr.Append(char16_t('%')); break; } case CSS_NUMBER : diff --git a/layout/style/nsROCSSPrimitiveValue.h b/layout/style/nsROCSSPrimitiveValue.h index d6bd3db4a7bb..eac24ea22774 100644 --- a/layout/style/nsROCSSPrimitiveValue.h +++ b/layout/style/nsROCSSPrimitiveValue.h @@ -102,7 +102,7 @@ private: float mFloat; nsDOMCSSRGBColor* mColor; nsDOMCSSRect* mRect; - PRUnichar* mString; + char16_t* mString; nsIURI* mURI; nsCSSKeyword mKeyword; } mValue; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 91a9b758480d..821333cccfaa 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -3296,7 +3296,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, if (aGenericFontID == kGenericFont_NONE) { // only bother appending fallback fonts if this isn't a fallback generic font itself if (!aFont->mFont.name.IsEmpty()) - aFont->mFont.name.Append((PRUnichar)','); + aFont->mFont.name.Append((char16_t)','); // defaultVariableFont.name should always be "serif" or "sans-serif". aFont->mFont.name.Append(defaultVariableFont->name); } diff --git a/layout/style/nsStyleAnimation.h b/layout/style/nsStyleAnimation.h index 34d95111c861..c25fac0b8e27 100644 --- a/layout/style/nsStyleAnimation.h +++ b/layout/style/nsStyleAnimation.h @@ -306,7 +306,7 @@ public: NS_ASSERTION(IsCSSValuePairListUnit(mUnit), "unit mismatch"); return mValue.mCSSValuePairList; } - const PRUnichar* GetStringBufferValue() const { + const char16_t* GetStringBufferValue() const { NS_ASSERTION(IsStringUnit(mUnit), "unit mismatch"); return GetBufferValue(mValue.mString); } @@ -367,8 +367,8 @@ public: private: void FreeValue(); - static const PRUnichar* GetBufferValue(nsStringBuffer* aBuffer) { - return static_cast(aBuffer->Data()); + static const char16_t* GetBufferValue(nsStringBuffer* aBuffer) { + return static_cast(aBuffer->Data()); } static bool IsIntUnit(Unit aUnit) { diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index fcbb3baeb29a..9e438e20d0b8 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -73,7 +73,7 @@ static bool EqualImages(imgIRequest *aImage1, imgIRequest* aImage2) } // A nullsafe wrapper for strcmp. We depend on null-safety. -static int safe_strcmp(const PRUnichar* a, const PRUnichar* b) +static int safe_strcmp(const char16_t* a, const char16_t* b) { if (!a || !b) { return (int)(a - b); @@ -142,7 +142,7 @@ nsStyleFont::Init(nsPresContext* aPresContext) // Content-Language may be a comma-separated list of language codes, // in which case the HTML5 spec says to treat it as unknown if (!language.IsEmpty() && - language.FindChar(PRUnichar(',')) == kNotFound) { + language.FindChar(char16_t(',')) == kNotFound) { mLanguage = do_GetAtom(language); // NOTE: This does *not* count as an explicit language; in other // words, it doesn't trigger language-specific hyphenation. @@ -1735,7 +1735,7 @@ nsStyleImage::SetGradientData(nsStyleGradient* aGradient) } void -nsStyleImage::SetElementId(const PRUnichar* aElementId) +nsStyleImage::SetElementId(const char16_t* aElementId) { if (mType != eStyleImageType_Null) SetNull(); @@ -2857,7 +2857,7 @@ nsStyleQuotes::SetInitial() // The initial value for quotes is the en-US typographic convention: // outermost are LEFT and RIGHT DOUBLE QUOTATION MARK, alternating // with LEFT and RIGHT SINGLE QUOTATION MARK. - static const PRUnichar initialQuotes[8] = { + static const char16_t initialQuotes[8] = { 0x201C, 0, 0x201D, 0, 0x2018, 0, 0x2019, 0 }; diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 7e5e37636d53..451fed8027f7 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -198,7 +198,7 @@ struct nsStyleImage { void TrackImage(nsPresContext* aContext); void UntrackImage(nsPresContext* aContext); void SetGradientData(nsStyleGradient* aGradient); - void SetElementId(const PRUnichar* aElementId); + void SetElementId(const char16_t* aElementId); void SetCropRect(nsStyleSides* aCropRect); nsStyleImageType GetType() const { @@ -214,7 +214,7 @@ struct nsStyleImage { NS_ASSERTION(mType == eStyleImageType_Gradient, "Data is not a gradient!"); return mGradient; } - const PRUnichar* GetElementId() const { + const char16_t* GetElementId() const { NS_ASSERTION(mType == eStyleImageType_Element, "Data is not an element!"); return mElementId; } @@ -291,7 +291,7 @@ private: union { imgIRequest* mImage; nsStyleGradient* mGradient; - PRUnichar* mElementId; + char16_t* mElementId; }; // This is _currently_ used only in conjunction with eStyleImageType_Image. nsAutoPtr mCropRect; @@ -1997,7 +1997,7 @@ enum nsStyleContentType { struct nsStyleContentData { nsStyleContentType mType; union { - PRUnichar *mString; + char16_t *mString; imgRequestProxy *mImage; nsCSSValue::Array* mCounters; } mContent; diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index a3045156871c..1b1d2f1342be 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -35,7 +35,7 @@ bool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue, nsAString::const_iterator iter; if (selectorLen != attributeLen && *aAttributeValue.BeginReading(iter).advance(selectorLen) != - PRUnichar('-')) { + char16_t('-')) { // to match, the aAttributeValue must have a dash after the end of // the aSelectorValue's text (unless the aSelectorValue and the // aAttributeValue have the same text) @@ -50,14 +50,14 @@ bool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue, void nsStyleUtil::AppendEscapedCSSString(const nsAString& aString, nsAString& aReturn, - PRUnichar quoteChar) + char16_t quoteChar) { NS_PRECONDITION(quoteChar == '\'' || quoteChar == '"', "CSS strings must be quoted with ' or \""); aReturn.Append(quoteChar); - const PRUnichar* in = aString.BeginReading(); - const PRUnichar* const end = aString.EndReading(); + const char16_t* in = aString.BeginReading(); + const char16_t* const end = aString.EndReading(); for (; in != end; in++) { if (*in < 0x20 || (*in >= 0x7F && *in < 0xA0)) { // Escape U+0000 through U+001F and U+007F through U+009F numerically. @@ -68,7 +68,7 @@ void nsStyleUtil::AppendEscapedCSSString(const nsAString& aString, // It's not technically necessary to escape the quote // character that isn't being used to delimit the string, // but we do it anyway because that makes testing simpler. - aReturn.Append(PRUnichar('\\')); + aReturn.Append(char16_t('\\')); } aReturn.Append(*in); } @@ -89,8 +89,8 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn) // unicode \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])? // from http://www.w3.org/TR/CSS21/syndata.html#tokenization - const PRUnichar* in = aIdent.BeginReading(); - const PRUnichar* const end = aIdent.EndReading(); + const char16_t* in = aIdent.BeginReading(); + const char16_t* const end = aIdent.EndReading(); if (in == end) return; @@ -98,7 +98,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn) // A leading dash does not need to be escaped as long as it is not the // *only* character in the identifier. if (in + 1 != end && *in == '-') { - aReturn.Append(PRUnichar('-')); + aReturn.Append(char16_t('-')); ++in; } @@ -110,8 +110,8 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn) if (in != end && (*in == '-' || ('0' <= *in && *in <= '9'))) { if (*in == '-') { - aReturn.Append(PRUnichar('\\')); - aReturn.Append(PRUnichar('-')); + aReturn.Append(char16_t('\\')); + aReturn.Append(char16_t('-')); } else { aReturn.AppendPrintf("\\%hX ", *in); } @@ -119,7 +119,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn) } for (; in != end; ++in) { - PRUnichar ch = *in; + char16_t ch = *in; if (ch < 0x20 || (0x7F <= ch && ch < 0xA0)) { // Escape U+0000 through U+001F and U+007F through U+009F numerically. aReturn.AppendPrintf("\\%hX ", *in); @@ -131,7 +131,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn) (ch < '0' || '9' < ch) && (ch < 'A' || 'Z' < ch) && (ch < 'a' || 'z' < ch)) { - aReturn.Append(PRUnichar('\\')); + aReturn.Append(char16_t('\\')); } aReturn.Append(ch); } @@ -151,7 +151,7 @@ nsStyleUtil::AppendBitmaskCSSValue(nsCSSProperty aProperty, aResult); aMaskedValue &= ~mask; if (aMaskedValue) { // more left - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); } } } @@ -318,14 +318,14 @@ nsStyleUtil::SerializeFunctionalAlternates( feature = v.alternate; if (!funcName.IsEmpty() && !funcParams.IsEmpty()) { if (!aResult.IsEmpty()) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); } // append the previous functional value aResult.Append(funcName); - aResult.Append(PRUnichar('(')); + aResult.Append(char16_t('(')); aResult.Append(funcParams); - aResult.Append(PRUnichar(')')); + aResult.Append(char16_t(')')); } // function name @@ -346,13 +346,13 @@ nsStyleUtil::SerializeFunctionalAlternates( // append the previous functional value if (!funcName.IsEmpty() && !funcParams.IsEmpty()) { if (!aResult.IsEmpty()) { - aResult.Append(PRUnichar(' ')); + aResult.Append(char16_t(' ')); } aResult.Append(funcName); - aResult.Append(PRUnichar('(')); + aResult.Append(char16_t('(')); aResult.Append(funcParams); - aResult.Append(PRUnichar(')')); + aResult.Append(char16_t(')')); } } diff --git a/layout/style/nsStyleUtil.h b/layout/style/nsStyleUtil.h index d1aab3366195..dd6117ec5d6d 100644 --- a/layout/style/nsStyleUtil.h +++ b/layout/style/nsStyleUtil.h @@ -32,7 +32,7 @@ public: // to aResult. 'quoteChar' must be ' or ". static void AppendEscapedCSSString(const nsAString& aString, nsAString& aResult, - PRUnichar quoteChar = '"'); + char16_t quoteChar = '"'); // Append the identifier given by |aIdent| to |aResult|, with // appropriate escaping so that it can be reparsed to the same diff --git a/layout/xul/nsBoxObject.cpp b/layout/xul/nsBoxObject.cpp index 90c9ad7477be..ad27f49e1ee3 100644 --- a/layout/xul/nsBoxObject.cpp +++ b/layout/xul/nsBoxObject.cpp @@ -290,7 +290,7 @@ nsBoxObject::GetScreenY(int32_t *_retval) } NS_IMETHODIMP -nsBoxObject::GetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports** aResult) +nsBoxObject::GetPropertyAsSupports(const char16_t* aPropertyName, nsISupports** aResult) { NS_ENSURE_ARG(aPropertyName && *aPropertyName); if (!mPropertyTable) { @@ -303,7 +303,7 @@ nsBoxObject::GetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports** } NS_IMETHODIMP -nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue) +nsBoxObject::SetPropertyAsSupports(const char16_t* aPropertyName, nsISupports* aValue) { NS_ENSURE_ARG(aPropertyName && *aPropertyName); @@ -317,7 +317,7 @@ nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* } NS_IMETHODIMP -nsBoxObject::GetProperty(const PRUnichar* aPropertyName, PRUnichar** aResult) +nsBoxObject::GetProperty(const char16_t* aPropertyName, char16_t** aResult) { nsCOMPtr data; nsresult rv = GetPropertyAsSupports(aPropertyName,getter_AddRefs(data)); @@ -336,7 +336,7 @@ nsBoxObject::GetProperty(const PRUnichar* aPropertyName, PRUnichar** aResult) } NS_IMETHODIMP -nsBoxObject::SetProperty(const PRUnichar* aPropertyName, const PRUnichar* aPropertyValue) +nsBoxObject::SetProperty(const char16_t* aPropertyName, const char16_t* aPropertyValue) { NS_ENSURE_ARG(aPropertyName && *aPropertyName); @@ -356,7 +356,7 @@ nsBoxObject::SetProperty(const PRUnichar* aPropertyName, const PRUnichar* aPrope } NS_IMETHODIMP -nsBoxObject::RemoveProperty(const PRUnichar* aPropertyName) +nsBoxObject::RemoveProperty(const char16_t* aPropertyName) { NS_ENSURE_ARG(aPropertyName && *aPropertyName); diff --git a/layout/xul/nsMenuBarFrame.cpp b/layout/xul/nsMenuBarFrame.cpp index 0b2ab17fba00..a98281edc14f 100644 --- a/layout/xul/nsMenuBarFrame.cpp +++ b/layout/xul/nsMenuBarFrame.cpp @@ -213,8 +213,8 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent) current->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, shortcutKey); if (!shortcutKey.IsEmpty()) { ToLowerCase(shortcutKey); - const PRUnichar* start = shortcutKey.BeginReading(); - const PRUnichar* end = shortcutKey.EndReading(); + const char16_t* start = shortcutKey.BeginReading(); + const char16_t* end = shortcutKey.EndReading(); uint32_t ch = UTF16CharEnumerator::NextChar(&start, end); uint32_t index = accessKeys.IndexOf(ch); if (index != accessKeys.NoIndex && diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index f307e35ddd08..784f1162b584 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -1665,7 +1665,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction return nullptr; } else { - PRUnichar uniChar = ToLowerCase(static_cast(charCode)); + char16_t uniChar = ToLowerCase(static_cast(charCode)); if (isMenu || // Menu supports only first-letter navigation keyTime - lastKeyTime > INC_TYP_INTERVAL) // Interval too long, treat as new typing mIncrementalString = uniChar; diff --git a/layout/xul/nsPopupBoxObject.cpp b/layout/xul/nsPopupBoxObject.cpp index 70b8101f8134..c34a9f75f870 100644 --- a/layout/xul/nsPopupBoxObject.cpp +++ b/layout/xul/nsPopupBoxObject.cpp @@ -59,9 +59,9 @@ NS_IMETHODIMP nsPopupBoxObject::ShowPopup(nsIDOMElement* aAnchorElement, nsIDOMElement* aPopupElement, int32_t aXPos, int32_t aYPos, - const PRUnichar *aPopupType, - const PRUnichar *aAnchorAlignment, - const PRUnichar *aPopupAlignment) + const char16_t *aPopupType, + const char16_t *aAnchorAlignment, + const char16_t *aPopupAlignment) { NS_ENSURE_TRUE(aPopupElement, NS_ERROR_INVALID_ARG); // srcContent can be null. diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index 9690d8d4c745..2ee95c92dfae 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -582,7 +582,7 @@ nsTextBoxFrame::CalculateUnderline(nsRenderingContext& aRenderingContext) if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) { // Calculate all fields of mAccessKeyInfo which // are the same for both BiDi and non-BiDi frames. - const PRUnichar *titleString = mCroppedTitle.get(); + const char16_t *titleString = mCroppedTitle.get(); aRenderingContext.SetTextRunRTL(false); mAccessKeyInfo->mAccessWidth = aRenderingContext.GetWidth(titleString[mAccessKeyInfo-> @@ -657,7 +657,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext, int length = mTitle.Length(); int i; for (i = 0; i < length; ++i) { - PRUnichar ch = mTitle.CharAt(i); + char16_t ch = mTitle.CharAt(i); // still in LTR mode cwidth = aRenderingContext.GetWidth(ch); if (twidth + cwidth > aWidth) @@ -688,7 +688,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext, int length = mTitle.Length(); int i; for (i=length-1; i >= 0; --i) { - PRUnichar ch = mTitle.CharAt(i); + char16_t ch = mTitle.CharAt(i); cwidth = aRenderingContext.GetWidth(ch); if (twidth + cwidth > aWidth) break; @@ -724,7 +724,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext, // determine how much of the string will fit in the max width nscoord charWidth = 0; nscoord totalWidth = 0; - PRUnichar ch; + char16_t ch; int leftPos, rightPos; nsAutoString leftString, rightString; @@ -819,8 +819,8 @@ nsTextBoxFrame::UpdateAccessTitle() } else { // Try to check with // our default ellipsis (for non-localized addons) or ':' - const PRUnichar kLastChar = mTitle.Last(); - if (kLastChar == PRUnichar(0x2026) || kLastChar == PRUnichar(':')) + const char16_t kLastChar = mTitle.Last(); + if (kLastChar == char16_t(0x2026) || kLastChar == char16_t(':')) offset--; } diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index 5a5e1f3abf42..061ba9ddbb38 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -152,7 +152,7 @@ nsXULPopupManager::Shutdown() NS_IMETHODIMP nsXULPopupManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) { if (mKeyListener) { diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 90a8623aa805..cfd710a2c474 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -1399,7 +1399,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText, uint32_t length = aText.Length(); uint32_t i; for (i = 0; i < length; ++i) { - PRUnichar ch = aText[i]; + char16_t ch = aText[i]; // XXX this is horrible and doesn't handle clusters cwidth = aRenderingContext.GetWidth(ch); if (twidth + cwidth > width) @@ -1418,7 +1418,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText, int32_t length = aText.Length(); int32_t i; for (i=length-1; i >= 0; --i) { - PRUnichar ch = aText[i]; + char16_t ch = aText[i]; cwidth = aRenderingContext.GetWidth(ch); if (twidth + cwidth > width) break; @@ -1440,7 +1440,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText, int32_t length = aText.Length(); int32_t rightPos = length - 1; for (int32_t leftPos = 0; leftPos < rightPos; ++leftPos) { - PRUnichar ch = aText[leftPos]; + char16_t ch = aText[leftPos]; cwidth = aRenderingContext.GetWidth(ch); twidth += cwidth; if (twidth > width) diff --git a/layout/xul/tree/nsTreeColumns.cpp b/layout/xul/tree/nsTreeColumns.cpp index b8652707a8ae..aff40493082c 100644 --- a/layout/xul/tree/nsTreeColumns.cpp +++ b/layout/xul/tree/nsTreeColumns.cpp @@ -194,7 +194,7 @@ nsTreeColumn::GetId(nsAString& aId) } NS_IMETHODIMP -nsTreeColumn::GetIdConst(const PRUnichar** aIdConst) +nsTreeColumn::GetIdConst(const char16_t** aIdConst) { *aIdConst = mId.get(); return NS_OK; diff --git a/layout/xul/tree/nsTreeContentView.cpp b/layout/xul/tree/nsTreeContentView.cpp index 4c19848cb731..57eb9e23af97 100644 --- a/layout/xul/tree/nsTreeContentView.cpp +++ b/layout/xul/tree/nsTreeContentView.cpp @@ -674,19 +674,19 @@ nsTreeContentView::SetCellText(int32_t aRow, nsITreeColumn* aCol, const nsAStrin } NS_IMETHODIMP -nsTreeContentView::PerformAction(const PRUnichar* aAction) +nsTreeContentView::PerformAction(const char16_t* aAction) { return NS_OK; } NS_IMETHODIMP -nsTreeContentView::PerformActionOnRow(const PRUnichar* aAction, int32_t aRow) +nsTreeContentView::PerformActionOnRow(const char16_t* aAction, int32_t aRow) { return NS_OK; } NS_IMETHODIMP -nsTreeContentView::PerformActionOnCell(const PRUnichar* aAction, int32_t aRow, nsITreeColumn* aCol) +nsTreeContentView::PerformActionOnCell(const char16_t* aAction, int32_t aRow, nsITreeColumn* aCol) { return NS_OK; } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index 43295a0c471a..a31887f2819e 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -137,7 +137,7 @@ public: } NS_IMETHODIMP Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) { + const char16_t* aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { CSFLogDebug(logTag, "Shutting down PeerConnectionCtx"); sipcc::PeerConnectionCtx::Destroy(); diff --git a/mfbt/HashFunctions.h b/mfbt/HashFunctions.h index b228955ce5bb..06da7ab3d24c 100644 --- a/mfbt/HashFunctions.h +++ b/mfbt/HashFunctions.h @@ -344,7 +344,7 @@ HashString(const char16_t* str, size_t length) #endif /* - * On Windows, wchar_t (PRUnichar) is not the same as uint16_t, even though it's + * On Windows, wchar_t (char16_t) is not the same as uint16_t, even though it's * the same width! */ #ifdef WIN32 diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index f574229acbf7..a88b2f3ba18a 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -1314,7 +1314,7 @@ FindFlushableZip(nsHashKey *aKey, void *aData, void* closure) NS_IMETHODIMP nsZipReaderCache::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aSomeData) + const char16_t *aSomeData) { if (strcmp(aTopic, "memory-pressure") == 0) { MutexAutoLock lock(mLock); diff --git a/modules/libpref/public/Preferences.h b/modules/libpref/public/Preferences.h index 20a6aa6e0b7d..37a57df3c02b 100644 --- a/modules/libpref/public/Preferences.h +++ b/modules/libpref/public/Preferences.h @@ -204,7 +204,7 @@ public: } static nsresult SetCString(const char* aPref, const char* aValue); static nsresult SetCString(const char* aPref, const nsACString &aValue); - static nsresult SetString(const char* aPref, const PRUnichar* aValue); + static nsresult SetString(const char* aPref, const char16_t* aValue); static nsresult SetString(const char* aPref, const nsAString &aValue); static nsresult SetComplex(const char* aPref, const nsIID &aType, diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index ca07ca8913f2..0dba48ce32d9 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -155,7 +155,7 @@ NS_IMPL_ISUPPORTS1(ValueObserver, nsIObserver) NS_IMETHODIMP ValueObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID), "invalid topic"); @@ -538,7 +538,7 @@ Preferences::ResetAndReadUserPrefs() NS_IMETHODIMP Preferences::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { if (XRE_GetProcessType() == GeckoProcessType_Content) return NS_ERROR_NOT_AVAILABLE; @@ -1464,7 +1464,7 @@ Preferences::SetCString(const char* aPref, const nsACString &aValue) // static nsresult -Preferences::SetString(const char* aPref, const PRUnichar* aValue) +Preferences::SetString(const char* aPref, const char16_t* aValue) { ENSURE_MAIN_PROCESS("Cannot SetString from content process:", aPref); NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE); diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/src/nsPrefBranch.cpp index 87a9ab03039a..7efb201e0acd 100644 --- a/modules/libpref/src/nsPrefBranch.cpp +++ b/modules/libpref/src/nsPrefBranch.cpp @@ -671,7 +671,7 @@ NS_IMETHODIMP nsPrefBranch::RemoveObserver(const char *aDomain, nsIObserver *aOb return rv; } -NS_IMETHODIMP nsPrefBranch::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP nsPrefBranch::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { // watch for xpcom shutdown and free our observers to eliminate any cyclic references if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { @@ -738,7 +738,7 @@ nsPrefBranch::RemoveExpiredCallback(PrefCallback *aCallback) mObservers.Remove(aCallback); } -nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName, PRUnichar **return_buf) +nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf) { nsresult rv; @@ -828,7 +828,7 @@ nsresult nsPrefLocalizedString::Init() } NS_IMETHODIMP -nsPrefLocalizedString::GetData(PRUnichar **_retval) +nsPrefLocalizedString::GetData(char16_t **_retval) { nsAutoString data; @@ -844,7 +844,7 @@ nsPrefLocalizedString::GetData(PRUnichar **_retval) } NS_IMETHODIMP -nsPrefLocalizedString::SetData(const PRUnichar *aData) +nsPrefLocalizedString::SetData(const char16_t *aData) { if (!aData) return SetData(EmptyString()); @@ -853,7 +853,7 @@ nsPrefLocalizedString::SetData(const PRUnichar *aData) NS_IMETHODIMP nsPrefLocalizedString::SetDataWithLength(uint32_t aLength, - const PRUnichar *aData) + const char16_t *aData) { if (!aData) return SetData(EmptyString()); diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/src/nsPrefBranch.h index 6fe2bcab0cc3..d85acf62ddb3 100644 --- a/modules/libpref/src/nsPrefBranch.h +++ b/modules/libpref/src/nsPrefBranch.h @@ -202,7 +202,7 @@ protected: nsPrefBranch() /* disallow use of this constructer */ { } - nsresult GetDefaultFromPropertiesFile(const char *aPrefName, PRUnichar **return_buf); + nsresult GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf); // As SetCharPref, but without any check on the length of |aValue| nsresult SetCharPrefInternal(const char *aPrefName, const char *aValue); // Reject strings that are more than 1Mb, warn if strings are more than 16kb @@ -242,9 +242,9 @@ public: nsresult Init(); private: - NS_IMETHOD GetData(PRUnichar**); - NS_IMETHOD SetData(const PRUnichar* aData); - NS_IMETHOD SetDataWithLength(uint32_t aLength, const PRUnichar *aData); + NS_IMETHOD GetData(char16_t**); + NS_IMETHOD SetData(const char16_t* aData); + NS_IMETHOD SetDataWithLength(uint32_t aLength, const char16_t *aData); nsCOMPtr mUnicodeString; }; diff --git a/modules/libpref/src/prefread.h b/modules/libpref/src/prefread.h index 3e30f170b928..4d5ce1e958f3 100644 --- a/modules/libpref/src/prefread.h +++ b/modules/libpref/src/prefread.h @@ -42,7 +42,7 @@ typedef struct PrefParseState { const char *smatch; /* string to match */ int sindex; /* next char of smatch to check */ /* also, counter in \u parsing */ - PRUnichar utf16[2]; /* parsing UTF16 (\u) escape */ + char16_t utf16[2]; /* parsing UTF16 (\u) escape */ int esclen; /* length in esctmp */ char esctmp[6]; /* raw escape to put back if err */ char quotechar; /* char delimiter for quotations */ diff --git a/netwerk/base/src/Seer.cpp b/netwerk/base/src/Seer.cpp index 2a34f1799048..390c58ebea9d 100644 --- a/netwerk/base/src/Seer.cpp +++ b/netwerk/base/src/Seer.cpp @@ -292,7 +292,7 @@ Seer::RemoveObserver() NS_IMETHODIMP Seer::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data_unicode) + const char16_t *data_unicode) { nsresult rv = NS_OK; diff --git a/netwerk/base/src/nsAutodialQt.cpp b/netwerk/base/src/nsAutodialQt.cpp index 7f65bdb16fce..ca247ad19658 100644 --- a/netwerk/base/src/nsAutodialQt.cpp +++ b/netwerk/base/src/nsAutodialQt.cpp @@ -26,7 +26,7 @@ nsAutodial::Init() } nsresult -nsAutodial::DialDefault(const PRUnichar* hostName) +nsAutodial::DialDefault(const char16_t* hostName) { if (nsQtNetworkManager::get()->openConnection(QString::fromUtf16(hostName))) { return NS_OK; diff --git a/netwerk/base/src/nsAutodialQt.h b/netwerk/base/src/nsAutodialQt.h index 4dce027a5882..dafcd9c06757 100644 --- a/netwerk/base/src/nsAutodialQt.h +++ b/netwerk/base/src/nsAutodialQt.h @@ -17,7 +17,7 @@ public: nsresult Init(); // Dial the default RAS dialup connection. - nsresult DialDefault(const PRUnichar* hostName); + nsresult DialDefault(const char16_t* hostName); // Should we try to dial on network error? bool ShouldDialOnNetworkError(); diff --git a/netwerk/base/src/nsAutodialWin.cpp b/netwerk/base/src/nsAutodialWin.cpp index 6ab81580f4a4..d5a083565aeb 100644 --- a/netwerk/base/src/nsAutodialWin.cpp +++ b/netwerk/base/src/nsAutodialWin.cpp @@ -207,7 +207,7 @@ int nsAutodial::QueryAutodialBehavior() // Return values: // NS_OK: dialing was successful and caller should retry // all other values indicate that the caller should not retry -nsresult nsAutodial::DialDefault(const PRUnichar* hostName) +nsresult nsAutodial::DialDefault(const char16_t* hostName) { mDontRetryUntil = 0; diff --git a/netwerk/base/src/nsAutodialWin.h b/netwerk/base/src/nsAutodialWin.h index 4ba30036c007..7da4a0cf22b3 100644 --- a/netwerk/base/src/nsAutodialWin.h +++ b/netwerk/base/src/nsAutodialWin.h @@ -106,7 +106,7 @@ public: nsresult Init(); // Dial the default RAS dialup connection. - nsresult DialDefault(const PRUnichar* hostName); + nsresult DialDefault(const char16_t* hostName); // Should we try to dial on network error? bool ShouldDialOnNetworkError(); diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index 6a48894beae2..d682239e0302 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -900,7 +900,7 @@ nsIOService::GetPrefBranch(nsIPrefBranch **result) NS_IMETHODIMP nsIOService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsCOMPtr prefBranch = do_QueryInterface(subject); diff --git a/netwerk/base/src/nsIncrementalDownload.cpp b/netwerk/base/src/nsIncrementalDownload.cpp index 7cec530c58a8..b7cdd009441c 100644 --- a/netwerk/base/src/nsIncrementalDownload.cpp +++ b/netwerk/base/src/nsIncrementalDownload.cpp @@ -780,7 +780,7 @@ nsIncrementalDownload::OnDataAvailable(nsIRequest *request, NS_IMETHODIMP nsIncrementalDownload::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { Cancel(NS_ERROR_ABORT); diff --git a/netwerk/base/src/nsNativeConnectionHelper.cpp b/netwerk/base/src/nsNativeConnectionHelper.cpp index 1a464ee0ef0e..3c5b7cdb2828 100644 --- a/netwerk/base/src/nsNativeConnectionHelper.cpp +++ b/netwerk/base/src/nsNativeConnectionHelper.cpp @@ -11,7 +11,7 @@ //----------------------------------------------------------------------------- bool -nsNativeConnectionHelper::OnConnectionFailed(const PRUnichar* hostName) +nsNativeConnectionHelper::OnConnectionFailed(const char16_t* hostName) { if (gIOService->IsLinkUp()) return false; diff --git a/netwerk/base/src/nsNativeConnectionHelper.h b/netwerk/base/src/nsNativeConnectionHelper.h index a77e510ddc36..e86852d412b4 100644 --- a/netwerk/base/src/nsNativeConnectionHelper.h +++ b/netwerk/base/src/nsNativeConnectionHelper.h @@ -17,7 +17,7 @@ public: * * Return true if the connection should be re-attempted. */ - static bool OnConnectionFailed(const PRUnichar* hostName); + static bool OnConnectionFailed(const char16_t* hostName); /** * IsAutoDialEnabled diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp index 8005b3a4ef1a..4347e13a1068 100644 --- a/netwerk/base/src/nsProtocolProxyService.cpp +++ b/netwerk/base/src/nsProtocolProxyService.cpp @@ -413,7 +413,7 @@ nsProtocolProxyService::Init() NS_IMETHODIMP nsProtocolProxyService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { // cleanup diff --git a/netwerk/base/src/nsSocketTransportService2.cpp b/netwerk/base/src/nsSocketTransportService2.cpp index d4af9a08a0fc..96f1e201a7ae 100644 --- a/netwerk/base/src/nsSocketTransportService2.cpp +++ b/netwerk/base/src/nsSocketTransportService2.cpp @@ -912,7 +912,7 @@ nsSocketTransportService::UpdatePrefs() NS_IMETHODIMP nsSocketTransportService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { UpdatePrefs(); diff --git a/netwerk/base/src/nsStandardURL.cpp b/netwerk/base/src/nsStandardURL.cpp index 809d6e3860aa..e7e72eedf306 100644 --- a/netwerk/base/src/nsStandardURL.cpp +++ b/netwerk/base/src/nsStandardURL.cpp @@ -117,7 +117,7 @@ NS_IMPL_ISUPPORTS1(nsStandardURL::nsPrefObserver, nsIObserver) NS_IMETHODIMP nsStandardURL:: nsPrefObserver::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsCOMPtr prefBranch( do_QueryInterface(subject) ); diff --git a/netwerk/base/src/nsStreamTransportService.cpp b/netwerk/base/src/nsStreamTransportService.cpp index 9d9df2722f50..55116b5f5ec5 100644 --- a/netwerk/base/src/nsStreamTransportService.cpp +++ b/netwerk/base/src/nsStreamTransportService.cpp @@ -541,7 +541,7 @@ nsStreamTransportService::CreateOutputTransport(nsIOutputStream *stream, NS_IMETHODIMP nsStreamTransportService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { NS_ASSERTION(strcmp(topic, "xpcom-shutdown-threads") == 0, "oops"); diff --git a/netwerk/base/src/nsURLHelper.cpp b/netwerk/base/src/nsURLHelper.cpp index eab4a6a39fca..0452de546d12 100644 --- a/netwerk/base/src/nsURLHelper.cpp +++ b/netwerk/base/src/nsURLHelper.cpp @@ -393,7 +393,7 @@ net_ResolveRelativePath(const nsACString &relativePath, bool needsDelim = false; if ( !path.IsEmpty() ) { - PRUnichar last = path.Last(); + char16_t last = path.Last(); needsDelim = !(last == '/'); } diff --git a/netwerk/base/src/nsURLHelperOS2.cpp b/netwerk/base/src/nsURLHelperOS2.cpp index fb7f0b20f82f..1abd5fd934a5 100644 --- a/netwerk/base/src/nsURLHelperOS2.cpp +++ b/netwerk/base/src/nsURLHelperOS2.cpp @@ -23,7 +23,7 @@ net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result) if (NS_FAILED(rv)) return rv; // Replace \ with / to convert to an url - path.ReplaceChar(PRUnichar(0x5Cu), PRUnichar(0x2Fu)); + path.ReplaceChar(char16_t(0x5Cu), char16_t(0x2Fu)); nsAutoCString escPath; NS_NAMED_LITERAL_CSTRING(prefix, "file:///"); diff --git a/netwerk/base/src/nsURLHelperOSX.cpp b/netwerk/base/src/nsURLHelperOSX.cpp index 8a75a8c1ec2b..dadba1c33ee7 100644 --- a/netwerk/base/src/nsURLHelperOSX.cpp +++ b/netwerk/base/src/nsURLHelperOSX.cpp @@ -39,8 +39,8 @@ static bool pathBeginsWithVolName(const nsACString& path, nsACString& firstPathC err = ::FSGetVolumeInfo(0, volumeIndex, nullptr, kFSVolInfoNone, nullptr, &volName, &rootDirectory); if (err == noErr) { - NS_ConvertUTF16toUTF8 volNameStr(Substring((PRUnichar *)volName.unicode, - (PRUnichar *)volName.unicode + volName.length)); + NS_ConvertUTF16toUTF8 volNameStr(Substring((char16_t *)volName.unicode, + (char16_t *)volName.unicode + volName.length)); gVolumeList->AppendElement(volNameStr); volumeIndex++; } diff --git a/netwerk/base/src/nsURLHelperWin.cpp b/netwerk/base/src/nsURLHelperWin.cpp index 508de197b4a2..ba9324483fd5 100644 --- a/netwerk/base/src/nsURLHelperWin.cpp +++ b/netwerk/base/src/nsURLHelperWin.cpp @@ -21,7 +21,7 @@ net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result) if (NS_FAILED(rv)) return rv; // Replace \ with / to convert to an url - path.ReplaceChar(PRUnichar(0x5Cu), PRUnichar(0x2Fu)); + path.ReplaceChar(char16_t(0x5Cu), char16_t(0x2Fu)); nsAutoCString escPath; diff --git a/netwerk/cache/nsApplicationCacheService.cpp b/netwerk/cache/nsApplicationCacheService.cpp index b3e4daa5373d..9d5b26fdf107 100644 --- a/netwerk/cache/nsApplicationCacheService.cpp +++ b/netwerk/cache/nsApplicationCacheService.cpp @@ -209,7 +209,7 @@ public: // nsIObserver implementation. NS_IMETHODIMP - Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) + Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { MOZ_ASSERT(!nsCRT::strcmp(aTopic, TOPIC_WEB_APP_CLEAR_DATA)); diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index d18b0db47b73..f7bf797a9334 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -380,7 +380,7 @@ nsCacheProfilePrefObserver::SetDiskCacheCapacity(int32_t capacity) NS_IMETHODIMP nsCacheProfilePrefObserver::Observe(nsISupports * subject, const char * topic, - const PRUnichar * data_unicode) + const char16_t * data_unicode) { nsresult rv; NS_ConvertUTF16toUTF8 data(data_unicode); diff --git a/netwerk/cache2/CacheObserver.cpp b/netwerk/cache2/CacheObserver.cpp index 6a4926ba65ef..d457e255aad6 100644 --- a/netwerk/cache2/CacheObserver.cpp +++ b/netwerk/cache2/CacheObserver.cpp @@ -175,7 +175,7 @@ CacheStorageEvictHelper::ClearStorage(bool const aPrivate, NS_IMETHODIMP CacheObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "prefservice:after-app-defaults")) { CacheFileIOManager::Init(); diff --git a/netwerk/cookie/CookieServiceChild.cpp b/netwerk/cookie/CookieServiceChild.cpp index 40b51502781e..b2dbe0ecac8c 100644 --- a/netwerk/cookie/CookieServiceChild.cpp +++ b/netwerk/cookie/CookieServiceChild.cpp @@ -159,7 +159,7 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI, NS_IMETHODIMP CookieServiceChild::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0, "not a pref change topic!"); diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index e30470e0c977..6b665c3ac033 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -577,7 +577,7 @@ public: // nsIObserver implementation. NS_IMETHODIMP - Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *data) + Observe(nsISupports *aSubject, const char *aTopic, const char16_t *data) { MOZ_ASSERT(!nsCRT::strcmp(aTopic, TOPIC_WEB_APP_CLEAR_DATA)); @@ -1555,7 +1555,7 @@ nsCookieService::~nsCookieService() NS_IMETHODIMP nsCookieService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // check the topic if (!strcmp(aTopic, "profile-before-change")) { @@ -1877,7 +1877,7 @@ nsCookieService::NotifyThirdParty(nsIURI *aHostURI, bool aIsAccepted, nsIChannel // cookies. void nsCookieService::NotifyChanged(nsISupports *aSubject, - const PRUnichar *aData) + const char16_t *aData) { const char* topic = mDBState == mPrivateDBState ? "private-cookie-changed" : "cookie-changed"; diff --git a/netwerk/cookie/nsCookieService.h b/netwerk/cookie/nsCookieService.h index 341728595dd3..1e5ed63ae0ff 100644 --- a/netwerk/cookie/nsCookieService.h +++ b/netwerk/cookie/nsCookieService.h @@ -303,7 +303,7 @@ class nsCookieService : public nsICookieService static void FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsListIter &aIter); void NotifyRejected(nsIURI *aHostURI); void NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel); - void NotifyChanged(nsISupports *aSubject, const PRUnichar *aData); + void NotifyChanged(nsISupports *aSubject, const char16_t *aData); void NotifyPurged(nsICookie2* aCookie); already_AddRefed CreatePurgeList(nsICookie2* aCookie); diff --git a/netwerk/dns/ChildDNSService.cpp b/netwerk/dns/ChildDNSService.cpp index 52463cb28c5d..b19067e1afbd 100644 --- a/netwerk/dns/ChildDNSService.cpp +++ b/netwerk/dns/ChildDNSService.cpp @@ -216,7 +216,7 @@ ChildDNSService::SetOffline(bool value) NS_IMETHODIMP ChildDNSService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { // we are only getting called if a preference has changed. NS_ASSERTION(strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0, diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 4f08d41fc301..fc34949d6425 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -799,7 +799,7 @@ nsDNSService::GetMyHostName(nsACString &result) } NS_IMETHODIMP -nsDNSService::Observe(nsISupports *subject, const char *topic, const PRUnichar *data) +nsDNSService::Observe(nsISupports *subject, const char *topic, const char16_t *data) { // we are only getting called if a preference has changed. NS_ASSERTION(strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0 || diff --git a/netwerk/dns/nsIDNService.cpp b/netwerk/dns/nsIDNService.cpp index a8909a367a47..02acef2b294f 100644 --- a/netwerk/dns/nsIDNService.cpp +++ b/netwerk/dns/nsIDNService.cpp @@ -73,7 +73,7 @@ nsresult nsIDNService::Init() NS_IMETHODIMP nsIDNService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsCOMPtr prefBranch( do_QueryInterface(aSubject) ); @@ -83,7 +83,7 @@ NS_IMETHODIMP nsIDNService::Observe(nsISupports *aSubject, return NS_OK; } -void nsIDNService::prefsChanged(nsIPrefBranch *prefBranch, const PRUnichar *pref) +void nsIDNService::prefsChanged(nsIPrefBranch *prefBranch, const char16_t *pref) { if (!pref || NS_LITERAL_STRING(NS_NET_PREF_IDNTESTBED).Equals(pref)) { bool val; @@ -186,7 +186,7 @@ nsresult nsIDNService::UTF8toACE(const nsACString & input, nsACString & ace, boo // encode nodes if non ASCII while (start != end) { len++; - if (*start++ == (PRUnichar)'.') { + if (*start++ == (char16_t)'.') { rv = stringPrepAndACE(Substring(ustr, offset, len - 1), encodedBuf, allowUnassigned, convertAllLabels); NS_ENSURE_SUCCESS(rv, rv); @@ -306,12 +306,12 @@ NS_IMETHODIMP nsIDNService::Normalize(const nsACString & input, nsACString & out while (start != end) { len++; - if (*start++ == PRUnichar('.')) { + if (*start++ == char16_t('.')) { rv = stringPrep(Substring(inUTF16, offset, len - 1), outLabel, true); NS_ENSURE_SUCCESS(rv, rv); outUTF16.Append(outLabel); - outUTF16.Append(PRUnichar('.')); + outUTF16.Append(char16_t('.')); offset += len; len = 0; } @@ -413,7 +413,7 @@ static nsresult utf16ToUcs4(const nsAString& in, in.EndReading(end); while (start != end) { - PRUnichar curChar; + char16_t curChar; curChar= *start++; @@ -439,11 +439,11 @@ static void ucs4toUtf16(const uint32_t *in, nsAString& out) { while (*in) { if (!IS_IN_BMP(*in)) { - out.Append((PRUnichar) H_SURROGATE(*in)); - out.Append((PRUnichar) L_SURROGATE(*in)); + out.Append((char16_t) H_SURROGATE(*in)); + out.Append((char16_t) L_SURROGATE(*in)); } else - out.Append((PRUnichar) *in); + out.Append((char16_t) *in); in++; } } @@ -484,9 +484,9 @@ static nsresult encodeToRACE(const char* prefix, const nsAString& in, nsACString const uint32_t kEncodedBufSize = kMaxDNSNodeLen * 20 / 8 + 1 + 1; // set up a work buffer for RACE encoder - PRUnichar temp[kMaxDNSNodeLen + 2]; + char16_t temp[kMaxDNSNodeLen + 2]; temp[0] = 0xFFFF; // set a place holder (to be filled by get_compress_mode) - temp[in.Length() + 1] = (PRUnichar)'\0'; + temp[in.Length() + 1] = (char16_t)'\0'; nsAString::const_iterator start, end; in.BeginReading(start); diff --git a/netwerk/dns/nsIDNService.h b/netwerk/dns/nsIDNService.h index 75c0637fd3fc..bf54c0d0d553 100644 --- a/netwerk/dns/nsIDNService.h +++ b/netwerk/dns/nsIDNService.h @@ -52,7 +52,7 @@ private: nsresult ACEtoUTF8(const nsACString& input, nsACString& _retval, bool allowUnassigned, bool convertAllLabels); bool isInWhitelist(const nsACString &host); - void prefsChanged(nsIPrefBranch *prefBranch, const PRUnichar *pref); + void prefsChanged(nsIPrefBranch *prefBranch, const char16_t *pref); bool isLabelSafe(const nsAString &label); bool illegalScriptCombo(int32_t script, int32_t& savedScript); diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index bc7a74299286..4f6f83a4628c 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -900,8 +900,8 @@ nsFtpState::R_syst() { if (NS_FAILED(rv)) return FTP_ERROR; - PRUnichar* ucs2Response = ToNewUnicode(mResponseMsg); - const PRUnichar *formatStrings[1] = { ucs2Response }; + char16_t* ucs2Response = ToNewUnicode(mResponseMsg); + const char16_t *formatStrings[1] = { ucs2Response }; NS_NAMED_LITERAL_STRING(name, "UnsupportedFTPServer"); nsXPIDLString formattedString; diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp index c1ab51fc2590..36a6f47ae3dc 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp @@ -364,7 +364,7 @@ nsFtpProtocolHandler::InsertConnection(nsIURI *aKey, nsFtpControlConnection *aCo NS_IMETHODIMP nsFtpProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { LOG(("FTP:observing [%s]\n", aTopic)); diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 45bcee52219e..cc72539169ca 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -565,7 +565,7 @@ NS_IMETHODIMP HttpChannelParent::OnStatus(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus, - const PRUnichar *aStatusArg) + const char16_t *aStatusArg) { // If this precedes OnDataAvailable, store and ODA will send to child. if (aStatus == NS_NET_STATUS_RECEIVING_FROM || diff --git a/netwerk/protocol/http/nsHttpAuthCache.cpp b/netwerk/protocol/http/nsHttpAuthCache.cpp index 5dce5ebf8985..430703bedebe 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.cpp +++ b/netwerk/protocol/http/nsHttpAuthCache.cpp @@ -36,9 +36,9 @@ GetAuthKey(const char *scheme, const char *host, int32_t port, uint32_t appId, b // return true if the two strings are equal or both empty. an empty string // is either null or zero length. static bool -StrEquivalent(const PRUnichar *a, const PRUnichar *b) +StrEquivalent(const char16_t *a, const char16_t *b) { - static const PRUnichar emptyStr[] = {0}; + static const char16_t emptyStr[] = {0}; if (!a) a = emptyStr; @@ -270,7 +270,7 @@ NS_IMPL_ISUPPORTS1(nsHttpAuthCache::AppDataClearObserver, nsIObserver) NS_IMETHODIMP nsHttpAuthCache::AppDataClearObserver::Observe(nsISupports *subject, const char * topic, - const PRUnichar * data_unicode) + const char16_t * data_unicode) { NS_ENSURE_TRUE(mOwner, NS_ERROR_NOT_AVAILABLE); @@ -326,33 +326,33 @@ nsHttpAuthCache::ClearAppData(uint32_t appId, bool browserOnly) //----------------------------------------------------------------------------- nsresult -nsHttpAuthIdentity::Set(const PRUnichar *domain, - const PRUnichar *user, - const PRUnichar *pass) +nsHttpAuthIdentity::Set(const char16_t *domain, + const char16_t *user, + const char16_t *pass) { - PRUnichar *newUser, *newPass, *newDomain; + char16_t *newUser, *newPass, *newDomain; int domainLen = domain ? NS_strlen(domain) : 0; int userLen = user ? NS_strlen(user) : 0; int passLen = pass ? NS_strlen(pass) : 0; int len = userLen + 1 + passLen + 1 + domainLen + 1; - newUser = (PRUnichar *) malloc(len * sizeof(PRUnichar)); + newUser = (char16_t *) malloc(len * sizeof(char16_t)); if (!newUser) return NS_ERROR_OUT_OF_MEMORY; if (user) - memcpy(newUser, user, userLen * sizeof(PRUnichar)); + memcpy(newUser, user, userLen * sizeof(char16_t)); newUser[userLen] = 0; newPass = &newUser[userLen + 1]; if (pass) - memcpy(newPass, pass, passLen * sizeof(PRUnichar)); + memcpy(newPass, pass, passLen * sizeof(char16_t)); newPass[passLen] = 0; newDomain = &newPass[passLen + 1]; if (domain) - memcpy(newDomain, domain, domainLen * sizeof(PRUnichar)); + memcpy(newDomain, domain, domainLen * sizeof(char16_t)); newDomain[domainLen] = 0; // wait until the end to clear member vars in case input params diff --git a/netwerk/protocol/http/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h index 933098f346a3..cbc5df5332b3 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.h +++ b/netwerk/protocol/http/nsHttpAuthCache.h @@ -33,9 +33,9 @@ public: , mDomain(nullptr) { } - nsHttpAuthIdentity(const PRUnichar *domain, - const PRUnichar *user, - const PRUnichar *password) + nsHttpAuthIdentity(const char16_t *domain, + const char16_t *user, + const char16_t *password) : mUser(nullptr) { Set(domain, user, password); @@ -45,13 +45,13 @@ public: Clear(); } - const PRUnichar *Domain() const { return mDomain; } - const PRUnichar *User() const { return mUser; } - const PRUnichar *Password() const { return mPass; } + const char16_t *Domain() const { return mDomain; } + const char16_t *User() const { return mUser; } + const char16_t *Password() const { return mPass; } - nsresult Set(const PRUnichar *domain, - const PRUnichar *user, - const PRUnichar *password); + nsresult Set(const char16_t *domain, + const char16_t *user, + const char16_t *password); nsresult Set(const nsHttpAuthIdentity &other) { return Set(other.mDomain, other.mUser, other.mPass); } void Clear(); @@ -60,9 +60,9 @@ public: private: // allocated as one contiguous blob, starting at mUser. - PRUnichar *mUser; - PRUnichar *mPass; - PRUnichar *mDomain; + char16_t *mUser; + char16_t *mPass; + char16_t *mDomain; }; //----------------------------------------------------------------------------- @@ -75,9 +75,9 @@ public: const char *Realm() const { return mRealm; } const char *Creds() const { return mCreds; } const char *Challenge() const { return mChallenge; } - const PRUnichar *Domain() const { return mIdent.Domain(); } - const PRUnichar *User() const { return mIdent.User(); } - const PRUnichar *Pass() const { return mIdent.Password(); } + const char16_t *Domain() const { return mIdent.Domain(); } + const char16_t *User() const { return mIdent.User(); } + const char16_t *Pass() const { return mIdent.Password(); } nsHttpAuthPath *RootPath() { return mRoot; } const nsHttpAuthIdentity &Identity() const { return mIdent; } diff --git a/netwerk/protocol/http/nsHttpBasicAuth.cpp b/netwerk/protocol/http/nsHttpBasicAuth.cpp index d9537d5a46fd..3b29e70cb204 100644 --- a/netwerk/protocol/http/nsHttpBasicAuth.cpp +++ b/netwerk/protocol/http/nsHttpBasicAuth.cpp @@ -50,9 +50,9 @@ NS_IMETHODIMP nsHttpBasicAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, const char *challenge, bool isProxyAuth, - const PRUnichar *domain, - const PRUnichar *user, - const PRUnichar *password, + const char16_t *domain, + const char16_t *user, + const char16_t *password, nsISupports **sessionState, nsISupports **continuationState, uint32_t *aFlags, diff --git a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp index 4ff537007638..e24817d8cb46 100644 --- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp +++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp @@ -254,11 +254,11 @@ nsHttpChannelAuthProvider::Disconnect(nsresult status) // buf contains "domain\user" static void -ParseUserDomain(PRUnichar *buf, - const PRUnichar **user, - const PRUnichar **domain) +ParseUserDomain(char16_t *buf, + const char16_t **user, + const char16_t **domain) { - PRUnichar *p = buf; + char16_t *p = buf; while (*p && *p != '\\') ++p; if (!*p) return; @@ -271,11 +271,11 @@ ParseUserDomain(PRUnichar *buf, static void SetIdent(nsHttpAuthIdentity &ident, uint32_t authFlags, - PRUnichar *userBuf, - PRUnichar *passBuf) + char16_t *userBuf, + char16_t *passBuf) { - const PRUnichar *user = userBuf; - const PRUnichar *domain = nullptr; + const char16_t *user = userBuf; + const char16_t *domain = nullptr; if (authFlags & nsIHttpAuthenticator::IDENTITY_INCLUDES_DOMAIN) ParseUserDomain(userBuf, &user, &domain); @@ -832,8 +832,8 @@ nsHttpChannelAuthProvider::GetIdentityFromURI(uint32_t authFlags, } if (!userBuf.IsEmpty()) { - SetIdent(ident, authFlags, (PRUnichar *) userBuf.get(), - (PRUnichar *) passBuf.get()); + SetIdent(ident, authFlags, (char16_t *) userBuf.get(), + (char16_t *) passBuf.get()); } } @@ -1170,7 +1170,7 @@ nsHttpChannelAuthProvider::ConfirmAuth(const nsString &bundleKey, return true; NS_ConvertUTF8toUTF16 ucsHost(host), ucsUser(user); - const PRUnichar *strs[2] = { ucsHost.get(), ucsUser.get() }; + const char16_t *strs[2] = { ucsHost.get(), ucsUser.get() }; nsXPIDLString msg; bundle->FormatStringFromName(bundleKey.get(), strs, 2, getter_Copies(msg)); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 05cd4c8ee39e..b58042397ff0 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -238,7 +238,7 @@ nsHttpConnectionMgr::ConditionallyStopTimeoutTick() NS_IMETHODIMP nsHttpConnectionMgr::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { LOG(("nsHttpConnectionMgr::Observe [topic=\"%s\"]\n", topic)); diff --git a/netwerk/protocol/http/nsHttpDigestAuth.cpp b/netwerk/protocol/http/nsHttpDigestAuth.cpp index 11739c8ed48b..7ed72a5d05ca 100644 --- a/netwerk/protocol/http/nsHttpDigestAuth.cpp +++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp @@ -158,9 +158,9 @@ NS_IMETHODIMP nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, const char *challenge, bool isProxyAuth, - const PRUnichar *userdomain, - const PRUnichar *username, - const PRUnichar *password, + const char16_t *userdomain, + const char16_t *username, + const char16_t *password, nsISupports **sessionState, nsISupports **continuationState, uint32_t *aFlags, diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 785d76f6f95e..0e2bc4b9438d 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -1747,7 +1747,7 @@ nsHttpHandler::GetCacheSessionNameForStoragePolicy( NS_IMETHODIMP nsHttpHandler::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { LOG(("nsHttpHandler::Observe [topic=\"%s\"]\n", topic)); diff --git a/netwerk/protocol/http/nsHttpNTLMAuth.cpp b/netwerk/protocol/http/nsHttpNTLMAuth.cpp index b35c86d53154..23a24039bcb2 100644 --- a/netwerk/protocol/http/nsHttpNTLMAuth.cpp +++ b/netwerk/protocol/http/nsHttpNTLMAuth.cpp @@ -321,9 +321,9 @@ NS_IMETHODIMP nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, const char *challenge, bool isProxyAuth, - const PRUnichar *domain, - const PRUnichar *user, - const PRUnichar *pass, + const char16_t *domain, + const char16_t *user, + const char16_t *pass, nsISupports **sessionState, nsISupports **continuationState, uint32_t *aFlags, diff --git a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp index bfccebc86c6f..030559e96fb9 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp +++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp @@ -491,13 +491,13 @@ nsWyciwygChannel::WriteToCacheEntryInternal(const nsAString &aData) // Write out a Byte Order Mark, so that we'll know if the data is // BE or LE when we go to read it. - PRUnichar bom = 0xFEFF; + char16_t bom = 0xFEFF; rv = mCacheOutputStream->Write((char *)&bom, sizeof(bom), &out); if (NS_FAILED(rv)) return rv; } return mCacheOutputStream->Write((const char *)PromiseFlatString(aData).get(), - aData.Length() * sizeof(PRUnichar), &out); + aData.Length() * sizeof(char16_t), &out); } diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index dcaab4370dd4..4a4675bf1c98 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -117,7 +117,7 @@ public: } NS_IMETHODIMP Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) { + const char16_t* aData) { if (strcmp(aTopic, "profile-change-net-teardown") == 0) { LOG(("Shutting down SCTP")); if (sctp_initialized) { diff --git a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp index 8d81208fee9e..70b70f2b51ef 100644 --- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp @@ -21,7 +21,7 @@ const double growthRate = 1.2; // 0xA0's and a single ending space, so need to treat 0xA0's as spaces. // 0xA0 is the Latin1/Unicode character for "non-breaking space (nbsp)" // Also recognize the Japanese ideographic space 0x3000 as a space. -static inline bool IsSpace(const PRUnichar aChar) +static inline bool IsSpace(const char16_t aChar) { return (nsCRT::IsAsciiSpace(aChar) || aChar == 0xA0 || aChar == 0x3000); } @@ -29,7 +29,7 @@ static inline bool IsSpace(const PRUnichar aChar) // Escape Char will take ch, escape it and append the result to // aStringToAppendTo void -mozTXTToHTMLConv::EscapeChar(const PRUnichar ch, nsString& aStringToAppendTo, +mozTXTToHTMLConv::EscapeChar(const char16_t ch, nsString& aStringToAppendTo, bool inAttribute) { switch (ch) @@ -104,9 +104,9 @@ mozTXTToHTMLConv::EscapeStr(nsString& aInString, bool inAttribute) } void -mozTXTToHTMLConv::UnescapeStr(const PRUnichar * aInString, int32_t aStartPos, int32_t aLength, nsString& aOutString) +mozTXTToHTMLConv::UnescapeStr(const char16_t * aInString, int32_t aStartPos, int32_t aLength, nsString& aOutString) { - const PRUnichar * subString = nullptr; + const char16_t * subString = nullptr; for (uint32_t i = aStartPos; int32_t(i) - aStartPos < aLength;) { int32_t remainingChars = i - aStartPos; @@ -115,22 +115,22 @@ mozTXTToHTMLConv::UnescapeStr(const PRUnichar * aInString, int32_t aStartPos, in subString = &aInString[i]; if (!nsCRT::strncmp(subString, MOZ_UTF16("<"), MinInt(4, aLength - remainingChars))) { - aOutString.Append(PRUnichar('<')); + aOutString.Append(char16_t('<')); i += 4; } else if (!nsCRT::strncmp(subString, MOZ_UTF16(">"), MinInt(4, aLength - remainingChars))) { - aOutString.Append(PRUnichar('>')); + aOutString.Append(char16_t('>')); i += 4; } else if (!nsCRT::strncmp(subString, MOZ_UTF16("&"), MinInt(5, aLength - remainingChars))) { - aOutString.Append(PRUnichar('&')); + aOutString.Append(char16_t('&')); i += 5; } else if (!nsCRT::strncmp(subString, MOZ_UTF16("""), MinInt(6, aLength - remainingChars))) { - aOutString.Append(PRUnichar('"')); + aOutString.Append(char16_t('"')); i += 6; } else @@ -148,7 +148,7 @@ mozTXTToHTMLConv::UnescapeStr(const PRUnichar * aInString, int32_t aStartPos, in } void -mozTXTToHTMLConv::CompleteAbbreviatedURL(const PRUnichar * aInString, int32_t aInLength, +mozTXTToHTMLConv::CompleteAbbreviatedURL(const char16_t * aInString, int32_t aInLength, const uint32_t pos, nsString& aOutString) { NS_ASSERTION(int32_t(pos) < aInLength, "bad args to CompleteAbbreviatedURL, see bug #190851"); @@ -183,7 +183,7 @@ mozTXTToHTMLConv::CompleteAbbreviatedURL(const PRUnichar * aInString, int32_t aI } bool -mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, int32_t aInLength, +mozTXTToHTMLConv::FindURLStart(const char16_t * aInString, int32_t aInLength, const uint32_t pos, const modetype check, uint32_t& start) { @@ -236,7 +236,7 @@ mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, int32_t aInLength, int32_t i = pos - 1; // This disallows non-ascii-characters for email. // Currently correct, but revisit later after standards changed. - bool isEmail = aInString[pos] == (PRUnichar)'@'; + bool isEmail = aInString[pos] == (char16_t)'@'; // These chars mark the start of the URL for (; i >= 0 && aInString[uint32_t(i)] != '>' && aInString[uint32_t(i)] != '<' @@ -271,7 +271,7 @@ mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, int32_t aInLength, } bool -mozTXTToHTMLConv::FindURLEnd(const PRUnichar * aInString, int32_t aInStringLength, const uint32_t pos, +mozTXTToHTMLConv::FindURLEnd(const char16_t * aInString, int32_t aInStringLength, const uint32_t pos, const modetype check, const uint32_t start, uint32_t& end) { switch(check) @@ -294,7 +294,7 @@ mozTXTToHTMLConv::FindURLEnd(const PRUnichar * aInString, int32_t aInStringLengt case abbreviated: { uint32_t i = pos + 1; - bool isEmail = aInString[pos] == (PRUnichar)'@'; + bool isEmail = aInString[pos] == (char16_t)'@'; bool seenOpeningParenthesis = false; // there is a '(' earlier in the URL bool seenOpeningSquareBracket = false; // there is a '[' earlier in the URL for (; int32_t(i) < aInStringLength; i++) @@ -343,7 +343,7 @@ mozTXTToHTMLConv::FindURLEnd(const PRUnichar * aInString, int32_t aInStringLengt } void -mozTXTToHTMLConv::CalculateURLBoundaries(const PRUnichar * aInString, int32_t aInStringLength, +mozTXTToHTMLConv::CalculateURLBoundaries(const char16_t * aInString, int32_t aInStringLength, const uint32_t pos, const uint32_t whathasbeendone, const modetype check, const uint32_t start, const uint32_t end, nsString& txtURL, nsString& desc, @@ -473,7 +473,7 @@ mozTXTToHTMLConv::CheckURLAndCreateHTML( return false; } -NS_IMETHODIMP mozTXTToHTMLConv::FindURLInPlaintext(const PRUnichar * aInString, int32_t aInLength, int32_t aPos, int32_t * aStartPos, int32_t * aEndPos) +NS_IMETHODIMP mozTXTToHTMLConv::FindURLInPlaintext(const char16_t * aInString, int32_t aInLength, int32_t aPos, int32_t * aStartPos, int32_t * aEndPos) { // call FindURL on the passed in string nsAutoString outputHTML; // we'll ignore the generated output HTML @@ -487,7 +487,7 @@ NS_IMETHODIMP mozTXTToHTMLConv::FindURLInPlaintext(const PRUnichar * aInString, } bool -mozTXTToHTMLConv::FindURL(const PRUnichar * aInString, int32_t aInLength, const uint32_t pos, +mozTXTToHTMLConv::FindURL(const char16_t * aInString, int32_t aInLength, const uint32_t pos, const uint32_t whathasbeendone, nsString& outputHTML, int32_t& replaceBefore, int32_t& replaceAfter) { @@ -568,8 +568,8 @@ mozTXTToHTMLConv::FindURL(const PRUnichar * aInString, int32_t aInLength, const } bool -mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString, - int32_t aInLength, const PRUnichar* rep, int32_t aRepLen, +mozTXTToHTMLConv::ItMatchesDelimited(const char16_t * aInString, + int32_t aInLength, const char16_t* rep, int32_t aRepLen, LIMTYPE before, LIMTYPE after) { @@ -590,8 +590,8 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString, ) return false; - PRUnichar text0 = aInString[0]; - PRUnichar textAfterPos = aInString[aRepLen + (before == LT_IGNORE ? 0 : 1)]; + char16_t text0 = aInString[0]; + char16_t textAfterPos = aInString[aRepLen + (before == LT_IGNORE ? 0 : 1)]; if ( @@ -628,14 +628,14 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString, } uint32_t -mozTXTToHTMLConv::NumberOfMatches(const PRUnichar * aInString, int32_t aInStringLength, - const PRUnichar* rep, int32_t aRepLen, LIMTYPE before, LIMTYPE after) +mozTXTToHTMLConv::NumberOfMatches(const char16_t * aInString, int32_t aInStringLength, + const char16_t* rep, int32_t aRepLen, LIMTYPE before, LIMTYPE after) { uint32_t result = 0; for (int32_t i = 0; i < aInStringLength; i++) { - const PRUnichar * indexIntoString = &aInString[i]; + const char16_t * indexIntoString = &aInString[i]; if (ItMatchesDelimited(indexIntoString, aInStringLength - i, rep, aRepLen, before, after)) result++; } @@ -646,8 +646,8 @@ mozTXTToHTMLConv::NumberOfMatches(const PRUnichar * aInString, int32_t aInString // NOTE: the converted html for the phrase is appended to aOutString // tagHTML and attributeHTML are plain ASCII (literal strings, in fact) bool -mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, int32_t aInStringLength, bool col0, - const PRUnichar* tagTXT, int32_t aTagTXTLen, +mozTXTToHTMLConv::StructPhraseHit(const char16_t * aInString, int32_t aInStringLength, bool col0, + const char16_t* tagTXT, int32_t aTagTXTLen, const char* tagHTML, const char* attributeHTML, nsString& aOutString, uint32_t& openTags) { @@ -657,7 +657,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, int32_t aInString is only inserted, if existence of a pair could be verified We use the first opening/closing tag, if we can choose */ - const PRUnichar * newOffset = aInString; + const char16_t * newOffset = aInString; int32_t newLength = aInStringLength; if (!col0) // skip the first element? { @@ -678,7 +678,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, int32_t aInString openTags++; aOutString.AppendLiteral("<"); aOutString.AppendASCII(tagHTML); - aOutString.Append(PRUnichar(' ')); + aOutString.Append(char16_t(' ')); aOutString.AppendASCII(attributeHTML); aOutString.AppendLiteral(">"); aOutString.Append(tagTXT); @@ -695,7 +695,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, int32_t aInString aOutString.Append(tagTXT); aOutString.AppendLiteral("')); + aOutString.Append(char16_t('>')); return true; } @@ -704,7 +704,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, int32_t aInString bool -mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, int32_t aLength, bool col0, +mozTXTToHTMLConv::SmilyHit(const char16_t * aInString, int32_t aLength, bool col0, const char* tagTXT, const char* imageName, nsString& outputHTML, int32_t& glyphTextLen) { @@ -743,7 +743,7 @@ mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, int32_t aLength, bool co if (!col0) { outputHTML.Truncate(); - outputHTML.Append(PRUnichar(' ')); + outputHTML.Append(char16_t(' ')); } outputHTML.AppendLiteral("" and "&". All others stay as they are.

@@ -112,7 +112,7 @@ private: @param inAttribute (in) - will escape quotes, too (which is only needed for attribute values) */ - void EscapeChar(const PRUnichar ch, nsString& aStringToAppendto, + void EscapeChar(const char16_t ch, nsString& aStringToAppendto, bool inAttribute); /** @@ -127,7 +127,7 @@ private: @param aLength (in) length of the buffer @param aOutString (out) unescaped buffer */ - void UnescapeStr(const PRUnichar * aInString, int32_t aStartPos, + void UnescapeStr(const char16_t * aInString, int32_t aStartPos, int32_t aLength, nsString& aOutString); /** @@ -153,7 +153,7 @@ private: @param replaceAfter (out): Number of chars of URL after pos @return URL found */ - bool FindURL(const PRUnichar * aInString, int32_t aInLength, const uint32_t pos, + bool FindURL(const char16_t * aInString, int32_t aInLength, const uint32_t pos, const uint32_t whathasbeendone, nsString& outputHTML, int32_t& replaceBefore, int32_t& replaceAfter); @@ -187,7 +187,7 @@ private: * similar) starts * @return |check|-conform start has been found */ - bool FindURLStart(const PRUnichar * aInString, int32_t aInLength, const uint32_t pos, + bool FindURLStart(const char16_t * aInString, int32_t aInLength, const uint32_t pos, const modetype check, uint32_t& start); /** @@ -197,7 +197,7 @@ private: * @param end (out): Similar to |start| param of FindURLStart * @return |check|-conform end has been found */ - bool FindURLEnd(const PRUnichar * aInString, int32_t aInStringLength, const uint32_t pos, + bool FindURLEnd(const char16_t * aInString, int32_t aInStringLength, const uint32_t pos, const modetype check, const uint32_t start, uint32_t& end); /** @@ -210,7 +210,7 @@ private: * Should be placed between the and tags. * @param replaceBefore(out), replaceAfter (out): see FindURL */ - void CalculateURLBoundaries(const PRUnichar * aInString, int32_t aInStringLength, + void CalculateURLBoundaries(const char16_t * aInString, int32_t aInStringLength, const uint32_t pos, const uint32_t whathasbeendone, const modetype check, const uint32_t start, const uint32_t end, nsString& txtURL, nsString& desc, @@ -243,8 +243,8 @@ private: @param open (in/out): Number of currently open tags of type tagHTML @return Conversion succeeded */ - bool StructPhraseHit(const PRUnichar * aInString, int32_t aInStringLength, bool col0, - const PRUnichar* tagTXT, + bool StructPhraseHit(const char16_t * aInString, int32_t aInStringLength, bool col0, + const char16_t* tagTXT, int32_t aTagTxtLen, const char* tagHTML, const char* attributeHTML, nsString& aOutputString, uint32_t& openTags); @@ -257,7 +257,7 @@ private: @param glyphTextLen (out): see GlyphHit */ bool - SmilyHit(const PRUnichar * aInString, int32_t aLength, bool col0, + SmilyHit(const char16_t * aInString, int32_t aLength, bool col0, const char* tagTXT, const char* imageName, nsString& outputHTML, int32_t& glyphTextLen); @@ -276,7 +276,7 @@ private: @param glyphTextLen (out): Length of original text to replace @return see StructPhraseHit */ - bool GlyphHit(const PRUnichar * aInString, int32_t aInLength, bool col0, + bool GlyphHit(const char16_t * aInString, int32_t aInLength, bool col0, nsString& aOutString, int32_t& glyphTextLen); /** diff --git a/netwerk/streamconv/converters/nsDirIndex.cpp b/netwerk/streamconv/converters/nsDirIndex.cpp index 213c60be7fe8..825e6e443b78 100644 --- a/netwerk/streamconv/converters/nsDirIndex.cpp +++ b/netwerk/streamconv/converters/nsDirIndex.cpp @@ -51,7 +51,7 @@ nsDirIndex::SetLocation(const char* aLocation) { } NS_IMETHODIMP -nsDirIndex::GetDescription(PRUnichar* *aDescription) { +nsDirIndex::GetDescription(char16_t* *aDescription) { *aDescription = ToNewUnicode(mDescription); if (!*aDescription) return NS_ERROR_OUT_OF_MEMORY; @@ -60,7 +60,7 @@ nsDirIndex::GetDescription(PRUnichar* *aDescription) { } NS_IMETHODIMP -nsDirIndex::SetDescription(const PRUnichar* aDescription) { +nsDirIndex::SetDescription(const char16_t* aDescription) { mDescription.Assign(aDescription); return NS_OK; } diff --git a/netwerk/streamconv/converters/nsDirIndexParser.cpp b/netwerk/streamconv/converters/nsDirIndexParser.cpp index e1a6e1bb9f0a..e3efc6e3749e 100644 --- a/netwerk/streamconv/converters/nsDirIndexParser.cpp +++ b/netwerk/streamconv/converters/nsDirIndexParser.cpp @@ -131,7 +131,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { const char* pos = aFormatStr; unsigned int num = 0; do { - while (*pos && nsCRT::IsAsciiSpace(PRUnichar(*pos))) + while (*pos && nsCRT::IsAsciiSpace(char16_t(*pos))) ++pos; ++num; @@ -143,7 +143,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { if (! *pos) break; - while (*pos && !nsCRT::IsAsciiSpace(PRUnichar(*pos))) + while (*pos && !nsCRT::IsAsciiSpace(char16_t(*pos))) ++pos; } while (*pos); @@ -157,7 +157,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { int formatNum=0; do { - while (*aFormatStr && nsCRT::IsAsciiSpace(PRUnichar(*aFormatStr))) + while (*aFormatStr && nsCRT::IsAsciiSpace(char16_t(*aFormatStr))) ++aFormatStr; if (! *aFormatStr) @@ -165,7 +165,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { nsAutoCString name; int32_t len = 0; - while (aFormatStr[len] && !nsCRT::IsAsciiSpace(PRUnichar(aFormatStr[len]))) + while (aFormatStr[len] && !nsCRT::IsAsciiSpace(char16_t(aFormatStr[len]))) ++len; name.SetCapacity(len + 1); name.Append(aFormatStr, len); @@ -246,7 +246,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr) { nsAutoString entryuri; if (gTextToSubURI) { - PRUnichar *result = nullptr; + char16_t *result = nullptr; if (NS_SUCCEEDED(rv = gTextToSubURI->UnEscapeAndConvert(mEncoding.get(), filename.get(), &result)) && (result)) { if (*result) { @@ -362,7 +362,7 @@ nsDirIndexParser::ProcessData(nsIRequest *aRequest, nsISupports *aCtxt) { int32_t eol = mBuf.FindCharInSet("\n\r", mLineStart); if (eol < 0) break; - mBuf.SetCharAt(PRUnichar('\0'), eol); + mBuf.SetCharAt(char16_t('\0'), eol); const char *line = mBuf.get() + mLineStart; diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index 2cf7cf4d5d93..1dd7cbbb5ce3 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -46,7 +46,7 @@ static void AppendNonAsciiToNCR(const nsAString& in, nsAFlatString& out) nsAutoString hex; hex.AppendInt(*start++, 16); out.Append(hex); - out.Append((PRUnichar)';'); + out.Append((char16_t)';'); } } } @@ -533,13 +533,13 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, unEscapeSpec.Length())); nsXPIDLString title; - const PRUnichar* formatTitle[] = { + const char16_t* formatTitle[] = { htmlEscSpec.get() }; rv = mBundle->FormatStringFromName(MOZ_UTF16("DirTitle"), formatTitle, - sizeof(formatTitle)/sizeof(PRUnichar*), + sizeof(formatTitle)/sizeof(char16_t*), getter_Copies(title)); if (NS_FAILED(rv)) return rv; @@ -590,13 +590,13 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, buffer.Append(direction); buffer.AppendLiteral("\">\n

"); - const PRUnichar* formatHeading[] = { + const char16_t* formatHeading[] = { htmlEscSpec.get() }; rv = mBundle->FormatStringFromName(MOZ_UTF16("DirTitle"), formatHeading, - sizeof(formatHeading)/sizeof(PRUnichar*), + sizeof(formatHeading)/sizeof(char16_t*), getter_Copies(title)); if (NS_FAILED(rv)) return rv; @@ -698,7 +698,7 @@ nsIndexedToHTML::FormatInputStream(nsIRequest* aRequest, nsISupports *aContext, getter_AddRefs(mUnicodeEncoder)); if (NS_SUCCEEDED(rv)) rv = mUnicodeEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, - nullptr, (PRUnichar)'?'); + nullptr, (char16_t)'?'); } } @@ -773,7 +773,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest, nsXPIDLString description; aIndex->GetDescription(getter_Copies(description)); - if (description.First() == PRUnichar('.')) + if (description.First() == char16_t('.')) pushBuffer.AppendLiteral(" class=\"hidden-object\""); pushBuffer.AppendLiteral(">\n outbuf(new PRUnichar[outlen]); + nsAutoArrayPtr outbuf(new char16_t[outlen]); rv = decoder->Convert(locEscaped.get(), &len, outbuf, &outlen); // Use the result only if the sequence is valid as UTF-8. if (rv == NS_OK) { @@ -1002,7 +1002,7 @@ nsIndexedToHTML::OnInformationAvailable(nsIRequest *aRequest, nsISupports *aCtxt, const nsAString& aInfo) { nsAutoString pushBuffer; - PRUnichar* escaped = nsEscapeHTML2(PromiseFlatString(aInfo).get()); + char16_t* escaped = nsEscapeHTML2(PromiseFlatString(aInfo).get()); if (!escaped) return NS_ERROR_OUT_OF_MEMORY; pushBuffer.AppendLiteral("\n "); diff --git a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp index 362f6c788f3e..b0e58cb01ef8 100644 --- a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp @@ -111,7 +111,7 @@ nsTXTToHTMLConv::OnStopRequest(nsIRequest* request, nsISupports *aContext, // nsITXTToHTMLConv methods NS_IMETHODIMP -nsTXTToHTMLConv::SetTitle(const PRUnichar *aTitle) +nsTXTToHTMLConv::SetTitle(const char16_t *aTitle) { mPageTitle.Assign(aTitle); return NS_OK; @@ -211,21 +211,21 @@ nsTXTToHTMLConv::Init() convToken *token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = false; - token->token.Assign(PRUnichar('<')); + token->token.Assign(char16_t('<')); token->modText.AssignLiteral("<"); mTokens.AppendElement(token); token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = false; - token->token.Assign(PRUnichar('>')); + token->token.Assign(char16_t('>')); token->modText.AssignLiteral(">"); mTokens.AppendElement(token); token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = false; - token->token.Assign(PRUnichar('&')); + token->token.Assign(char16_t('&')); token->modText.AssignLiteral("&"); mTokens.AppendElement(token); @@ -238,7 +238,7 @@ nsTXTToHTMLConv::Init() token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = true; - token->token.Assign(PRUnichar('@')); + token->token.Assign(char16_t('@')); token->modText.AssignLiteral("mailto:"); mTokens.AppendElement(token); diff --git a/netwerk/system/mac/nsNetworkLinkService.mm b/netwerk/system/mac/nsNetworkLinkService.mm index 802db2693b8f..7b61a35cbce1 100644 --- a/netwerk/system/mac/nsNetworkLinkService.mm +++ b/netwerk/system/mac/nsNetworkLinkService.mm @@ -56,7 +56,7 @@ nsNetworkLinkService::GetLinkType(uint32_t *aLinkType) NS_IMETHODIMP nsNetworkLinkService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, "xpcom-shutdown")) { Shutdown(); diff --git a/netwerk/system/qt/nsQtNetworkLinkService.cpp b/netwerk/system/qt/nsQtNetworkLinkService.cpp index 82cba50cf737..888dfd1c2dd5 100644 --- a/netwerk/system/qt/nsQtNetworkLinkService.cpp +++ b/netwerk/system/qt/nsQtNetworkLinkService.cpp @@ -50,7 +50,7 @@ nsQtNetworkLinkService::GetLinkType(uint32_t *aLinkType) NS_IMETHODIMP nsQtNetworkLinkService::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown")) { Shutdown(); diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp index 9642a0bb739c..f37abcc554a6 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.cpp +++ b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -135,7 +135,7 @@ nsNotifyAddrListener::Run() NS_IMETHODIMP nsNotifyAddrListener::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp("xpcom-shutdown-threads", topic)) Shutdown(); diff --git a/netwerk/test/TestHttp.cpp b/netwerk/test/TestHttp.cpp index a6f0764ddd8d..7e8f270b8df1 100644 --- a/netwerk/test/TestHttp.cpp +++ b/netwerk/test/TestHttp.cpp @@ -108,7 +108,7 @@ MyNotifications::GetInterface(const nsIID &iid, void **result) NS_IMETHODIMP MyNotifications::OnStatus(nsIRequest *req, nsISupports *ctx, - nsresult status, const PRUnichar *statusText) + nsresult status, const char16_t *statusText) { printf("status: %x\n", status); return NS_OK; diff --git a/netwerk/test/TestIDN.cpp b/netwerk/test/TestIDN.cpp index a586f5d0458b..77d57f14d6e6 100644 --- a/netwerk/test/TestIDN.cpp +++ b/netwerk/test/TestIDN.cpp @@ -37,7 +37,7 @@ int main(int argc, char **argv) { "decode result incorrect"); printf("decoded = "); NS_ConvertUTF8toUTF16 utf(buf); - const PRUnichar *u = utf.get(); + const char16_t *u = utf.get(); for (int i = 0; u[i]; i++) { printf("U+%.4X ", u[i]); } diff --git a/netwerk/test/TestIncrementalDownload.cpp b/netwerk/test/TestIncrementalDownload.cpp index 37e99f9b5f7b..46dd1527d88d 100644 --- a/netwerk/test/TestIncrementalDownload.cpp +++ b/netwerk/test/TestIncrementalDownload.cpp @@ -48,7 +48,7 @@ FetchObserver::OnProgress(nsIRequest *request, nsISupports *context, NS_IMETHODIMP FetchObserver::OnStatus(nsIRequest *request, nsISupports *context, - nsresult status, const PRUnichar *statusText) + nsresult status, const char16_t *statusText) { return NS_OK; } diff --git a/netwerk/test/TestPageLoad.cpp b/netwerk/test/TestPageLoad.cpp index 62e4dd744d86..8b8072fbf795 100644 --- a/netwerk/test/TestPageLoad.cpp +++ b/netwerk/test/TestPageLoad.cpp @@ -216,7 +216,7 @@ MyNotifications::GetInterface(const nsIID &iid, void **result) NS_IMETHODIMP MyNotifications::OnStatus(nsIRequest *req, nsISupports *ctx, - nsresult status, const PRUnichar *statusText) + nsresult status, const char16_t *statusText) { //printf("status: %x\n", status); return NS_OK; diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index 1a4161b6ce55..0c367f4872b8 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -280,12 +280,12 @@ TestAuthPrompt::~TestAuthPrompt() } NS_IMETHODIMP -TestAuthPrompt::Prompt(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *passwordRealm, +TestAuthPrompt::Prompt(const char16_t *dialogTitle, + const char16_t *text, + const char16_t *passwordRealm, uint32_t savePassword, - const PRUnichar *defaultText, - PRUnichar **result, + const char16_t *defaultText, + char16_t **result, bool *_retval) { *_retval = false; @@ -293,12 +293,12 @@ TestAuthPrompt::Prompt(const PRUnichar *dialogTitle, } NS_IMETHODIMP -TestAuthPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, - const PRUnichar *dialogText, - const PRUnichar *passwordRealm, +TestAuthPrompt::PromptUsernameAndPassword(const char16_t *dialogTitle, + const char16_t *dialogText, + const char16_t *passwordRealm, uint32_t savePassword, - PRUnichar **user, - PRUnichar **pwd, + char16_t **user, + char16_t **pwd, bool *_retval) { NS_ConvertUTF16toUTF8 text(passwordRealm); @@ -335,11 +335,11 @@ TestAuthPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, } NS_IMETHODIMP -TestAuthPrompt::PromptPassword(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *passwordRealm, +TestAuthPrompt::PromptPassword(const char16_t *dialogTitle, + const char16_t *text, + const char16_t *passwordRealm, uint32_t savePassword, - PRUnichar **pwd, + char16_t **pwd, bool *_retval) { *_retval = false; diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp index f45a5b91d766..8de4f49747e2 100644 --- a/netwerk/test/TestStreamChannel.cpp +++ b/netwerk/test/TestStreamChannel.cpp @@ -109,7 +109,7 @@ public: } NS_IMETHOD OnStatus(nsIRequest *req, nsISupports *ctx, nsresult status, - const PRUnichar *statusArg) + const char16_t *statusArg) { LOG(("MyCallbacks::OnStatus [status=%x]\n", status)); return NS_OK; diff --git a/netwerk/test/TestThreadedIO.cpp b/netwerk/test/TestThreadedIO.cpp index f270b3c1d97a..286c462d89b3 100644 --- a/netwerk/test/TestThreadedIO.cpp +++ b/netwerk/test/TestThreadedIO.cpp @@ -114,7 +114,7 @@ NS_IMETHODIMP TestListener::OnStopRequest( nsIChannel *aChannel, nsISupports *aContext, nsresult aStatus, - const PRUnichar *aMsg ) { + const char16_t *aMsg ) { nsresult rv = NS_OK; printf( "TestListener::OnStopRequest called on thread %d\n", mThreadNo ); diff --git a/netwerk/wifi/nsWifiMonitor.cpp b/netwerk/wifi/nsWifiMonitor.cpp index ed4882bc3af7..b1e595be7592 100644 --- a/netwerk/wifi/nsWifiMonitor.cpp +++ b/netwerk/wifi/nsWifiMonitor.cpp @@ -50,7 +50,7 @@ nsWifiMonitor::~nsWifiMonitor() NS_IMETHODIMP nsWifiMonitor::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, "xpcom-shutdown")) { LOG(("Shutting down\n")); diff --git a/netwerk/wifi/nsWifiMonitorGonk.cpp b/netwerk/wifi/nsWifiMonitorGonk.cpp index c7766be2a60b..1c26fa30d1fe 100644 --- a/netwerk/wifi/nsWifiMonitorGonk.cpp +++ b/netwerk/wifi/nsWifiMonitorGonk.cpp @@ -90,7 +90,7 @@ nsWifiMonitor::StopWatching(nsIWifiListener *aListener) NS_IMETHODIMP nsWifiMonitor::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (!strcmp(topic, "timer-callback")) { LOG(("timer callback\n")); diff --git a/parser/expat/expat_config.h b/parser/expat/expat_config.h index fad2c06bd580..388f5622e312 100644 --- a/parser/expat/expat_config.h +++ b/parser/expat/expat_config.h @@ -27,9 +27,9 @@ #define XMLIMPORT #define XML_UNICODE -typedef PRUnichar XML_Char; +typedef char16_t XML_Char; typedef char XML_LChar; -#define XML_T(x) (PRUnichar)x +#define XML_T(x) (char16_t)x #define XML_L(x) x #define XML_DTD diff --git a/parser/expat/lib/expat_external.h b/parser/expat/lib/expat_external.h index e257c15f293a..70c630bc928f 100644 --- a/parser/expat/lib/expat_external.h +++ b/parser/expat/lib/expat_external.h @@ -82,7 +82,7 @@ extern "C" { #define XML_UNICODE #endif -/* BEGIN MOZILLA CHANGE (typedef XML_Char to PRUnichar) */ +/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */ #if 0 #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c index 0f03c42ac211..70acf1aae5aa 100644 --- a/parser/expat/lib/xmlparse.c +++ b/parser/expat/lib/xmlparse.c @@ -49,7 +49,7 @@ typedef char ICHAR; #endif -/* BEGIN MOZILLA CHANGE (typedef XML_Char to PRUnichar) */ +/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */ #if 0 #ifdef XML_UNICODE diff --git a/parser/html/nsHtml5ArrayCopy.h b/parser/html/nsHtml5ArrayCopy.h index b277a9513e31..e74602cd03b2 100644 --- a/parser/html/nsHtml5ArrayCopy.h +++ b/parser/html/nsHtml5ArrayCopy.h @@ -34,15 +34,15 @@ class nsHtml5ArrayCopy { public: static inline void - arraycopy(PRUnichar* source, int32_t sourceOffset, PRUnichar* target, int32_t targetOffset, int32_t length) + arraycopy(char16_t* source, int32_t sourceOffset, char16_t* target, int32_t targetOffset, int32_t length) { - memcpy(&(target[targetOffset]), &(source[sourceOffset]), length * sizeof(PRUnichar)); + memcpy(&(target[targetOffset]), &(source[sourceOffset]), length * sizeof(char16_t)); } static inline void - arraycopy(PRUnichar* source, PRUnichar* target, int32_t length) + arraycopy(char16_t* source, char16_t* target, int32_t length) { - memcpy(target, source, length * sizeof(PRUnichar)); + memcpy(target, source, length * sizeof(char16_t)); } static inline void diff --git a/parser/html/nsHtml5Atom.cpp b/parser/html/nsHtml5Atom.cpp index bb8d062ad3d7..7c69ac0afb28 100644 --- a/parser/html/nsHtml5Atom.cpp +++ b/parser/html/nsHtml5Atom.cpp @@ -10,16 +10,16 @@ nsHtml5Atom::nsHtml5Atom(const nsAString& aString) mLength = aString.Length(); nsRefPtr buf = nsStringBuffer::FromString(aString); if (buf) { - mString = static_cast(buf->Data()); + mString = static_cast(buf->Data()); } else { - buf = nsStringBuffer::Alloc((mLength + 1) * sizeof(PRUnichar)); - mString = static_cast(buf->Data()); + buf = nsStringBuffer::Alloc((mLength + 1) * sizeof(char16_t)); + mString = static_cast(buf->Data()); CopyUnicodeTo(aString, 0, mString, mLength); - mString[mLength] = PRUnichar(0); + mString[mLength] = char16_t(0); } - NS_ASSERTION(mString[mLength] == PRUnichar(0), "null terminated"); - NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(PRUnichar), + NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated"); + NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(char16_t), "enough storage"); NS_ASSERTION(Equals(aString), "correct data"); diff --git a/parser/html/nsHtml5AttributeName.cpp b/parser/html/nsHtml5AttributeName.cpp index 6416e503ed0a..67b361a4af9d 100644 --- a/parser/html/nsHtml5AttributeName.cpp +++ b/parser/html/nsHtml5AttributeName.cpp @@ -103,7 +103,7 @@ nsHtml5AttributeName::SAME_LOCAL(nsIAtom* name) } nsHtml5AttributeName* -nsHtml5AttributeName::nameByBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) +nsHtml5AttributeName::nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) { int32_t hash = nsHtml5AttributeName::bufToHash(buf, length); int32_t index = nsHtml5AttributeName::ATTRIBUTE_HASHES.binarySearch(hash); @@ -120,7 +120,7 @@ nsHtml5AttributeName::nameByBuffer(PRUnichar* buf, int32_t offset, int32_t lengt } int32_t -nsHtml5AttributeName::bufToHash(PRUnichar* buf, int32_t len) +nsHtml5AttributeName::bufToHash(char16_t* buf, int32_t len) { int32_t hash2 = 0; int32_t hash = len; diff --git a/parser/html/nsHtml5AttributeName.h b/parser/html/nsHtml5AttributeName.h index a5a4f7c020b9..0d3d7add4568 100644 --- a/parser/html/nsHtml5AttributeName.h +++ b/parser/html/nsHtml5AttributeName.h @@ -73,9 +73,9 @@ class nsHtml5AttributeName static nsIAtom** COLONIFIED_LOCAL(nsIAtom* name, nsIAtom* suffix); public: static nsIAtom** SAME_LOCAL(nsIAtom* name); - static nsHtml5AttributeName* nameByBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); + static nsHtml5AttributeName* nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); private: - static int32_t bufToHash(PRUnichar* buf, int32_t len); + static int32_t bufToHash(char16_t* buf, int32_t len); int32_t* uri; nsIAtom** local; nsIAtom** prefix; diff --git a/parser/html/nsHtml5DependentUTF16Buffer.cpp b/parser/html/nsHtml5DependentUTF16Buffer.cpp index 181ee0f05b6b..a09add1fed43 100644 --- a/parser/html/nsHtml5DependentUTF16Buffer.cpp +++ b/parser/html/nsHtml5DependentUTF16Buffer.cpp @@ -5,7 +5,7 @@ #include "nsHtml5DependentUTF16Buffer.h" nsHtml5DependentUTF16Buffer::nsHtml5DependentUTF16Buffer(const nsAString& aToWrap) - : nsHtml5UTF16Buffer(const_cast (aToWrap.BeginReading()), + : nsHtml5UTF16Buffer(const_cast (aToWrap.BeginReading()), aToWrap.Length()) { MOZ_COUNT_CTOR(nsHtml5DependentUTF16Buffer); @@ -28,6 +28,6 @@ nsHtml5DependentUTF16Buffer::FalliblyCopyAsOwningBuffer() newObj->setEnd(newLength); memcpy(newObj->getBuffer(), getBuffer() + getStart(), - newLength * sizeof(PRUnichar)); + newLength * sizeof(char16_t)); return newObj.forget(); } diff --git a/parser/html/nsHtml5ElementName.cpp b/parser/html/nsHtml5ElementName.cpp index 9778da8e5e43..db1b953b11a2 100644 --- a/parser/html/nsHtml5ElementName.cpp +++ b/parser/html/nsHtml5ElementName.cpp @@ -68,7 +68,7 @@ nsHtml5ElementName::isCustom() } nsHtml5ElementName* -nsHtml5ElementName::elementNameByBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) +nsHtml5ElementName::elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) { int32_t hash = nsHtml5ElementName::bufToHash(buf, length); int32_t index = nsHtml5ElementName::ELEMENT_HASHES.binarySearch(hash); @@ -85,7 +85,7 @@ nsHtml5ElementName::elementNameByBuffer(PRUnichar* buf, int32_t offset, int32_t } int32_t -nsHtml5ElementName::bufToHash(PRUnichar* buf, int32_t len) +nsHtml5ElementName::bufToHash(char16_t* buf, int32_t len) { int32_t hash = len; hash <<= 5; diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index ced77109975c..fdfd0625deb7 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -68,9 +68,9 @@ class nsHtml5ElementName int32_t getGroup(); bool isCustom(); - static nsHtml5ElementName* elementNameByBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); + static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); private: - static int32_t bufToHash(PRUnichar* buf, int32_t len); + static int32_t bufToHash(char16_t* buf, int32_t len); nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); protected: nsHtml5ElementName(nsIAtom* name); diff --git a/parser/html/nsHtml5Highlighter.cpp b/parser/html/nsHtml5Highlighter.cpp index b704f9cdd859..654eaa5c57a0 100644 --- a/parser/html/nsHtml5Highlighter.cpp +++ b/parser/html/nsHtml5Highlighter.cpp @@ -17,32 +17,32 @@ using namespace mozilla; // the size of 16 tokens on cnn.com. #define NS_HTML5_HIGHLIGHTER_PRE_BREAK_THRESHOLD 1300 -PRUnichar nsHtml5Highlighter::sComment[] = +char16_t nsHtml5Highlighter::sComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 }; -PRUnichar nsHtml5Highlighter::sCdata[] = +char16_t nsHtml5Highlighter::sCdata[] = { 'c', 'd', 'a', 't', 'a', 0 }; -PRUnichar nsHtml5Highlighter::sEntity[] = +char16_t nsHtml5Highlighter::sEntity[] = { 'e', 'n', 't', 'i', 't', 'y', 0 }; -PRUnichar nsHtml5Highlighter::sEndTag[] = +char16_t nsHtml5Highlighter::sEndTag[] = { 'e', 'n', 'd', '-', 't', 'a', 'g', 0 }; -PRUnichar nsHtml5Highlighter::sStartTag[] = +char16_t nsHtml5Highlighter::sStartTag[] = { 's', 't', 'a', 'r', 't', '-', 't', 'a', 'g', 0 }; -PRUnichar nsHtml5Highlighter::sAttributeName[] = +char16_t nsHtml5Highlighter::sAttributeName[] = { 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', '-', 'n', 'a', 'm', 'e', 0 }; -PRUnichar nsHtml5Highlighter::sAttributeValue[] = +char16_t nsHtml5Highlighter::sAttributeValue[] = { 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', '-', 'v', 'a', 'l', 'u', 'e', 0 }; -PRUnichar nsHtml5Highlighter::sDoctype[] = +char16_t nsHtml5Highlighter::sDoctype[] = { 'd', 'o', 'c', 't', 'y', 'p', 'e', 0 }; -PRUnichar nsHtml5Highlighter::sPi[] = +char16_t nsHtml5Highlighter::sPi[] = { 'p', 'i', 0 }; nsHtml5Highlighter::nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink) @@ -496,7 +496,7 @@ nsHtml5Highlighter::StartSpan() } void -nsHtml5Highlighter::StartSpan(const PRUnichar* aClass) +nsHtml5Highlighter::StartSpan(const char16_t* aClass) { StartSpan(); AddClass(aClass); @@ -557,10 +557,10 @@ void nsHtml5Highlighter::FlushChars() { if (mCStart < mPos) { - PRUnichar* buf = mBuffer->getBuffer(); + char16_t* buf = mBuffer->getBuffer(); int32_t i = mCStart; while (i < mPos) { - PRUnichar c = buf[i]; + char16_t c = buf[i]; switch (c) { case '\r': // The input this code sees has been normalized so that there are @@ -691,14 +691,14 @@ nsHtml5Highlighter::Pop() } void -nsHtml5Highlighter::AppendCharacters(const PRUnichar* aBuffer, +nsHtml5Highlighter::AppendCharacters(const char16_t* aBuffer, int32_t aStart, int32_t aLength) { NS_PRECONDITION(aBuffer, "Null buffer"); - PRUnichar* bufferCopy = new PRUnichar[aLength]; - memcpy(bufferCopy, aBuffer + aStart, aLength * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aLength]; + memcpy(bufferCopy, aBuffer + aStart, aLength * sizeof(char16_t)); mOpQueue.AppendElement()->Init(eTreeOpAppendText, bufferCopy, @@ -708,7 +708,7 @@ nsHtml5Highlighter::AppendCharacters(const PRUnichar* aBuffer, void -nsHtml5Highlighter::AddClass(const PRUnichar* aClass) +nsHtml5Highlighter::AddClass(const char16_t* aClass) { if (!mSyntaxHighlight) { return; @@ -719,8 +719,8 @@ nsHtml5Highlighter::AddClass(const PRUnichar* aClass) void nsHtml5Highlighter::AddViewSourceHref(const nsString& aValue) { - PRUnichar* bufferCopy = new PRUnichar[aValue.Length() + 1]; - memcpy(bufferCopy, aValue.get(), aValue.Length() * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aValue.Length() + 1]; + memcpy(bufferCopy, aValue.get(), aValue.Length() * sizeof(char16_t)); bufferCopy[aValue.Length()] = 0; mOpQueue.AppendElement()->Init(eTreeOpAddViewSourceHref, diff --git a/parser/html/nsHtml5Highlighter.h b/parser/html/nsHtml5Highlighter.h index f869b6c667c4..4c1afa3c049e 100644 --- a/parser/html/nsHtml5Highlighter.h +++ b/parser/html/nsHtml5Highlighter.h @@ -155,7 +155,7 @@ class nsHtml5Highlighter * @param aClass the class to set (MUST be a static string that does not * need to be released!) */ - void StartSpan(const PRUnichar* aClass); + void StartSpan(const char16_t* aClass); /** * End the current or in the highlighter output. @@ -201,7 +201,7 @@ class nsHtml5Highlighter * @param aClass the class to set (MUST be a static string that does not * need to be released!) */ - void AddClass(const PRUnichar* aClass); + void AddClass(const char16_t* aClass); /** * Allocates a handle for an element. @@ -253,7 +253,7 @@ class nsHtml5Highlighter * @param aStart the index of the first code unit to copy * @param aLength the number of code units to copy */ - void AppendCharacters(const PRUnichar* aBuffer, + void AppendCharacters(const char16_t* aBuffer, int32_t aStart, int32_t aLength); @@ -358,47 +358,47 @@ class nsHtml5Highlighter /** * The string "comment" */ - static PRUnichar sComment[]; + static char16_t sComment[]; /** * The string "cdata" */ - static PRUnichar sCdata[]; + static char16_t sCdata[]; /** * The string "start-tag" */ - static PRUnichar sStartTag[]; + static char16_t sStartTag[]; /** * The string "attribute-name" */ - static PRUnichar sAttributeName[]; + static char16_t sAttributeName[]; /** * The string "attribute-value" */ - static PRUnichar sAttributeValue[]; + static char16_t sAttributeValue[]; /** * The string "end-tag" */ - static PRUnichar sEndTag[]; + static char16_t sEndTag[]; /** * The string "doctype" */ - static PRUnichar sDoctype[]; + static char16_t sDoctype[]; /** * The string "entity" */ - static PRUnichar sEntity[]; + static char16_t sEntity[]; /** * The string "pi" */ - static PRUnichar sPi[]; + static char16_t sPi[]; }; #endif // nsHtml5Highlighter_h diff --git a/parser/html/nsHtml5MetaScanner.cpp b/parser/html/nsHtml5MetaScanner.cpp index 312b2c1bdd5a..7b79c9c0eb62 100644 --- a/parser/html/nsHtml5MetaScanner.cpp +++ b/parser/html/nsHtml5MetaScanner.cpp @@ -54,14 +54,14 @@ #include "nsHtml5MetaScanner.h" -static PRUnichar const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' }; -staticJArray nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) }; -static PRUnichar const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' }; -staticJArray nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) }; -static PRUnichar const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' }; -staticJArray nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) }; -static PRUnichar const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' }; -staticJArray nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) }; +static char16_t const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' }; +staticJArray nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) }; +static char16_t const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' }; +staticJArray nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) }; +static char16_t const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' }; +staticJArray nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) }; +static char16_t const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' }; +staticJArray nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) }; nsHtml5MetaScanner::nsHtml5MetaScanner() : readable(nullptr), @@ -72,7 +72,7 @@ nsHtml5MetaScanner::nsHtml5MetaScanner() contentTypeIndex(INT32_MAX), stateSave(NS_HTML5META_SCANNER_DATA), strBufLen(0), - strBuf(jArray::newJArray(36)), + strBuf(jArray::newJArray(36)), content(nullptr), charset(nullptr), httpEquivState(NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN) @@ -738,11 +738,11 @@ void nsHtml5MetaScanner::addToBuffer(int32_t c) { if (strBufLen == strBuf.length) { - jArray newBuf = jArray::newJArray(strBuf.length + (strBuf.length << 1)); + jArray newBuf = jArray::newJArray(strBuf.length + (strBuf.length << 1)); nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length); strBuf = newBuf; } - strBuf[strBufLen++] = (PRUnichar) c; + strBuf[strBufLen++] = (char16_t) c; } void diff --git a/parser/html/nsHtml5MetaScanner.h b/parser/html/nsHtml5MetaScanner.h index 7e5a734c3f9c..8091b83513b0 100644 --- a/parser/html/nsHtml5MetaScanner.h +++ b/parser/html/nsHtml5MetaScanner.h @@ -58,10 +58,10 @@ class nsHtml5Portability; class nsHtml5MetaScanner { private: - static staticJArray CHARSET; - static staticJArray CONTENT; - static staticJArray HTTP_EQUIV; - static staticJArray CONTENT_TYPE; + static staticJArray CHARSET; + static staticJArray CONTENT; + static staticJArray HTTP_EQUIV; + static staticJArray CONTENT_TYPE; protected: nsHtml5ByteReadable* readable; private: @@ -74,7 +74,7 @@ class nsHtml5MetaScanner int32_t stateSave; private: int32_t strBufLen; - autoJArray strBuf; + autoJArray strBuf; nsString* content; nsString* charset; int32_t httpEquivState; diff --git a/parser/html/nsHtml5Module.cpp b/parser/html/nsHtml5Module.cpp index f7c975097596..f228279968f1 100644 --- a/parser/html/nsHtml5Module.cpp +++ b/parser/html/nsHtml5Module.cpp @@ -92,7 +92,7 @@ class nsHtml5ParserThreadTerminator MOZ_FINAL : public nsIObserver nsHtml5ParserThreadTerminator(nsIThread* aThread) : mThread(aThread) {} - NS_IMETHODIMP Observe(nsISupports *, const char *topic, const PRUnichar *) + NS_IMETHODIMP Observe(nsISupports *, const char *topic, const char16_t *) { NS_ASSERTION(!strcmp(topic, "xpcom-shutdown-threads"), "Unexpected topic"); diff --git a/parser/html/nsHtml5NamedCharacters.cpp b/parser/html/nsHtml5NamedCharacters.cpp index 2c486cca634b..8ee48ee658ce 100644 --- a/parser/html/nsHtml5NamedCharacters.cpp +++ b/parser/html/nsHtml5NamedCharacters.cpp @@ -29,15 +29,15 @@ #include "nsHtml5NamedCharacters.h" -const PRUnichar nsHtml5NamedCharacters::VALUES[][2] = { +const char16_t nsHtml5NamedCharacters::VALUES[][2] = { #define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, FLAG, VALUE) \ { VALUE }, #include "nsHtml5NamedCharactersInclude.h" #undef NAMED_CHARACTER_REFERENCE {0, 0} }; -PRUnichar** nsHtml5NamedCharacters::WINDOWS_1252; -static PRUnichar const WINDOWS_1252_DATA[] = { +char16_t** nsHtml5NamedCharacters::WINDOWS_1252; +static char16_t const WINDOWS_1252_DATA[] = { 0x20AC, 0x0081, 0x201A, @@ -120,18 +120,18 @@ nsHtml5CharacterName::length() const return nameLen; } -PRUnichar +char16_t nsHtml5CharacterName::charAt(int32_t index) const { - return static_cast (ALL_NAMES[nameStart + index]); + return static_cast (ALL_NAMES[nameStart + index]); } void nsHtml5NamedCharacters::initializeStatics() { - WINDOWS_1252 = new PRUnichar*[32]; + WINDOWS_1252 = new char16_t*[32]; for (int32_t i = 0; i < 32; ++i) { - WINDOWS_1252[i] = (PRUnichar*)&(WINDOWS_1252_DATA[i]); + WINDOWS_1252[i] = (char16_t*)&(WINDOWS_1252_DATA[i]); } } diff --git a/parser/html/nsHtml5NamedCharacters.h b/parser/html/nsHtml5NamedCharacters.h index a0e812145872..e80655e37a37 100644 --- a/parser/html/nsHtml5NamedCharacters.h +++ b/parser/html/nsHtml5NamedCharacters.h @@ -36,15 +36,15 @@ struct nsHtml5CharacterName { int32_t n; #endif int32_t length() const; - PRUnichar charAt(int32_t index) const; + char16_t charAt(int32_t index) const; }; class nsHtml5NamedCharacters { public: static const nsHtml5CharacterName NAMES[]; - static const PRUnichar VALUES[][2]; - static PRUnichar** WINDOWS_1252; + static const char16_t VALUES[][2]; + static char16_t** WINDOWS_1252; static void initializeStatics(); static void releaseStatics(); }; diff --git a/parser/html/nsHtml5NamedCharactersInclude.h b/parser/html/nsHtml5NamedCharactersInclude.h index 710d619df242..0a6b0c11e931 100644 --- a/parser/html/nsHtml5NamedCharactersInclude.h +++ b/parser/html/nsHtml5NamedCharactersInclude.h @@ -19,7 +19,7 @@ * See Tokenizer.java. * 3. the length of this sequence of characters, * 4. placeholder flag (0 if argument #is not a placeholder and 1 if it is), - * 5. a comma-separated sequence of PRUnichar literals corresponding + * 5. a comma-separated sequence of char16_t literals corresponding * to the code-point(s) of the named character. * * The macro expansion doesn't have to refer to all or any of these parameters, diff --git a/parser/html/nsHtml5OwningUTF16Buffer.cpp b/parser/html/nsHtml5OwningUTF16Buffer.cpp index 65764db1a68b..dcd2aec196a7 100644 --- a/parser/html/nsHtml5OwningUTF16Buffer.cpp +++ b/parser/html/nsHtml5OwningUTF16Buffer.cpp @@ -4,7 +4,7 @@ #include "nsHtml5OwningUTF16Buffer.h" -nsHtml5OwningUTF16Buffer::nsHtml5OwningUTF16Buffer(PRUnichar* aBuffer) +nsHtml5OwningUTF16Buffer::nsHtml5OwningUTF16Buffer(char16_t* aBuffer) : nsHtml5UTF16Buffer(aBuffer, 0), next(nullptr), key(nullptr) @@ -40,7 +40,7 @@ already_AddRefed nsHtml5OwningUTF16Buffer::FalliblyCreate(int32_t aLength) { const mozilla::fallible_t fallible = mozilla::fallible_t(); - PRUnichar* newBuf = new (fallible) PRUnichar[aLength]; + char16_t* newBuf = new (fallible) char16_t[aLength]; if (!newBuf) { return nullptr; } diff --git a/parser/html/nsHtml5OwningUTF16Buffer.h b/parser/html/nsHtml5OwningUTF16Buffer.h index 59c70a17d595..e8efc26e5f61 100644 --- a/parser/html/nsHtml5OwningUTF16Buffer.h +++ b/parser/html/nsHtml5OwningUTF16Buffer.h @@ -14,7 +14,7 @@ class nsHtml5OwningUTF16Buffer : public nsHtml5UTF16Buffer /** * Passes a buffer and its length to the superclass constructor. */ - nsHtml5OwningUTF16Buffer(PRUnichar* aBuffer); + nsHtml5OwningUTF16Buffer(char16_t* aBuffer); public: diff --git a/parser/html/nsHtml5Portability.cpp b/parser/html/nsHtml5Portability.cpp index 618219f7339c..9aae4152c95f 100644 --- a/parser/html/nsHtml5Portability.cpp +++ b/parser/html/nsHtml5Portability.cpp @@ -8,7 +8,7 @@ #include "nsHtml5Portability.h" nsIAtom* -nsHtml5Portability::newLocalNameFromBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) +nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) { NS_ASSERTION(!offset, "The offset should always be zero here."); NS_ASSERTION(interner, "Didn't get an atom service."); @@ -16,7 +16,7 @@ nsHtml5Portability::newLocalNameFromBuffer(PRUnichar* buf, int32_t offset, int32 } nsString* -nsHtml5Portability::newStringFromBuffer(PRUnichar* buf, int32_t offset, int32_t length) +nsHtml5Portability::newStringFromBuffer(char16_t* buf, int32_t offset, int32_t length) { return new nsString(buf + offset, length); } @@ -42,23 +42,23 @@ nsHtml5Portability::newStringFromString(nsString* string) { return newStr; } -jArray +jArray nsHtml5Portability::newCharArrayFromLocal(nsIAtom* local) { nsAutoString temp; local->ToString(temp); int32_t len = temp.Length(); - jArray arr = jArray::newJArray(len); - memcpy(arr, temp.BeginReading(), len * sizeof(PRUnichar)); + jArray arr = jArray::newJArray(len); + memcpy(arr, temp.BeginReading(), len * sizeof(char16_t)); return arr; } -jArray +jArray nsHtml5Portability::newCharArrayFromString(nsString* string) { int32_t len = string->Length(); - jArray arr = jArray::newJArray(len); - memcpy(arr, string->BeginReading(), len * sizeof(PRUnichar)); + jArray arr = jArray::newJArray(len); + memcpy(arr, string->BeginReading(), len * sizeof(char16_t)); return arr; } @@ -82,7 +82,7 @@ nsHtml5Portability::releaseString(nsString* str) } bool -nsHtml5Portability::localEqualsBuffer(nsIAtom* local, PRUnichar* buf, int32_t offset, int32_t length) +nsHtml5Portability::localEqualsBuffer(nsIAtom* local, char16_t* buf, int32_t offset, int32_t length) { return local->Equals(nsDependentSubstring(buf + offset, buf + offset + length)); } @@ -94,15 +94,15 @@ nsHtml5Portability::lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(const char* return false; } const char* litPtr = lowerCaseLiteral; - const PRUnichar* strPtr = string->BeginReading(); - const PRUnichar* end = string->EndReading(); - PRUnichar litChar; + const char16_t* strPtr = string->BeginReading(); + const char16_t* end = string->EndReading(); + char16_t litChar; while ((litChar = *litPtr)) { NS_ASSERTION(!(litChar >= 'A' && litChar <= 'Z'), "Literal isn't in lower case."); if (strPtr == end) { return false; } - PRUnichar strChar = *strPtr; + char16_t strChar = *strPtr; if (strChar >= 'A' && strChar <= 'Z') { strChar += 0x20; } diff --git a/parser/html/nsHtml5Portability.h b/parser/html/nsHtml5Portability.h index 0040f5cf2dbf..9b7c0dc60e80 100644 --- a/parser/html/nsHtml5Portability.h +++ b/parser/html/nsHtml5Portability.h @@ -57,16 +57,16 @@ class nsHtml5StateSnapshot; class nsHtml5Portability { public: - static nsIAtom* newLocalNameFromBuffer(PRUnichar* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); - static nsString* newStringFromBuffer(PRUnichar* buf, int32_t offset, int32_t length); + static nsIAtom* newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); + static nsString* newStringFromBuffer(char16_t* buf, int32_t offset, int32_t length); static nsString* newEmptyString(); static nsString* newStringFromLiteral(const char* literal); static nsString* newStringFromString(nsString* string); - static jArray newCharArrayFromLocal(nsIAtom* local); - static jArray newCharArrayFromString(nsString* string); + static jArray newCharArrayFromLocal(nsIAtom* local); + static jArray newCharArrayFromString(nsString* string); static nsIAtom* newLocalFromLocal(nsIAtom* local, nsHtml5AtomTable* interner); static void releaseString(nsString* str); - static bool localEqualsBuffer(nsIAtom* local, PRUnichar* buf, int32_t offset, int32_t length); + static bool localEqualsBuffer(nsIAtom* local, char16_t* buf, int32_t offset, int32_t length); static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string); static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(const char* lowerCaseLiteral, nsString* string); static bool literalEqualsString(const char* literal, nsString* string); diff --git a/parser/html/nsHtml5SpeculativeLoad.h b/parser/html/nsHtml5SpeculativeLoad.h index 6835a15a114a..2b77ddb2da16 100644 --- a/parser/html/nsHtml5SpeculativeLoad.h +++ b/parser/html/nsHtml5SpeculativeLoad.h @@ -102,7 +102,7 @@ class nsHtml5SpeculativeLoad { "Trying to reinitialize a speculative load!"); mOpCode = eSpeculativeLoadSetDocumentCharset; CopyUTF8toUTF16(aCharset, mCharset); - mTypeOrCharsetSource.Assign((PRUnichar)aCharsetSource); + mTypeOrCharsetSource.Assign((char16_t)aCharsetSource); } void Perform(nsHtml5TreeOpExecutor* aExecutor); diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index 9d75eb552ff0..8abe297fc1a0 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -392,7 +392,7 @@ nsHtml5StreamParser::SniffBOMlessUTF16BasicLatin(const uint8_t* aFromSegment, } void -nsHtml5StreamParser::SetEncodingFromExpat(const PRUnichar* aEncoding) +nsHtml5StreamParser::SetEncodingFromExpat(const char16_t* aEncoding) { if (aEncoding) { nsDependentString utf16(aEncoding); @@ -432,7 +432,7 @@ HandleXMLDeclaration(void* aUserData, { UserData* ud = static_cast(aUserData); ud->mStreamParser->SetEncodingFromExpat( - reinterpret_cast(aEncoding)); + reinterpret_cast(aEncoding)); XML_StopParser(ud->mExpat, false); } @@ -487,9 +487,9 @@ nsHtml5StreamParser::FinalizeSniffing(const uint8_t* aFromSegment, // can be nul moz_free }; - static const PRUnichar kExpatSeparator[] = { 0xFFFF, '\0' }; + static const char16_t kExpatSeparator[] = { 0xFFFF, '\0' }; - static const PRUnichar kISO88591[] = + static const char16_t kISO88591[] = { 'I', 'S', 'O', '-', '8', '8', '5', '9', '-', '1', '\0' }; UserData ud; diff --git a/parser/html/nsHtml5StreamParser.h b/parser/html/nsHtml5StreamParser.h index 98100c5d5e35..85d2a640f42e 100644 --- a/parser/html/nsHtml5StreamParser.h +++ b/parser/html/nsHtml5StreamParser.h @@ -193,7 +193,7 @@ class nsHtml5StreamParser : public nsIStreamListener, * case if aEncoding names a supported rough ASCII superset and sets * the mCharset and mCharsetSource to the UTF-8 default otherwise. */ - void SetEncodingFromExpat(const PRUnichar* aEncoding); + void SetEncodingFromExpat(const char16_t* aEncoding); /** * Sets the URL for View Source title in case this parser ends up being diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index 4426e75274e9..000b43d36840 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -58,41 +58,41 @@ #include "nsHtml5Tokenizer.h" -PRUnichar nsHtml5Tokenizer::LT_GT[] = { '<', '>' }; -PRUnichar nsHtml5Tokenizer::LT_SOLIDUS[] = { '<', '/' }; -PRUnichar nsHtml5Tokenizer::RSQB_RSQB[] = { ']', ']' }; -PRUnichar nsHtml5Tokenizer::REPLACEMENT_CHARACTER[] = { 0xfffd }; -PRUnichar nsHtml5Tokenizer::LF[] = { '\n' }; -PRUnichar nsHtml5Tokenizer::CDATA_LSQB[] = { 'C', 'D', 'A', 'T', 'A', '[' }; -PRUnichar nsHtml5Tokenizer::OCTYPE[] = { 'o', 'c', 't', 'y', 'p', 'e' }; -PRUnichar nsHtml5Tokenizer::UBLIC[] = { 'u', 'b', 'l', 'i', 'c' }; -PRUnichar nsHtml5Tokenizer::YSTEM[] = { 'y', 's', 't', 'e', 'm' }; -static PRUnichar const TITLE_ARR_DATA[] = { 't', 'i', 't', 'l', 'e' }; -staticJArray nsHtml5Tokenizer::TITLE_ARR = { TITLE_ARR_DATA, MOZ_ARRAY_LENGTH(TITLE_ARR_DATA) }; -static PRUnichar const SCRIPT_ARR_DATA[] = { 's', 'c', 'r', 'i', 'p', 't' }; -staticJArray nsHtml5Tokenizer::SCRIPT_ARR = { SCRIPT_ARR_DATA, MOZ_ARRAY_LENGTH(SCRIPT_ARR_DATA) }; -static PRUnichar const STYLE_ARR_DATA[] = { 's', 't', 'y', 'l', 'e' }; -staticJArray nsHtml5Tokenizer::STYLE_ARR = { STYLE_ARR_DATA, MOZ_ARRAY_LENGTH(STYLE_ARR_DATA) }; -static PRUnichar const PLAINTEXT_ARR_DATA[] = { 'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't' }; -staticJArray nsHtml5Tokenizer::PLAINTEXT_ARR = { PLAINTEXT_ARR_DATA, MOZ_ARRAY_LENGTH(PLAINTEXT_ARR_DATA) }; -static PRUnichar const XMP_ARR_DATA[] = { 'x', 'm', 'p' }; -staticJArray nsHtml5Tokenizer::XMP_ARR = { XMP_ARR_DATA, MOZ_ARRAY_LENGTH(XMP_ARR_DATA) }; -static PRUnichar const TEXTAREA_ARR_DATA[] = { 't', 'e', 'x', 't', 'a', 'r', 'e', 'a' }; -staticJArray nsHtml5Tokenizer::TEXTAREA_ARR = { TEXTAREA_ARR_DATA, MOZ_ARRAY_LENGTH(TEXTAREA_ARR_DATA) }; -static PRUnichar const IFRAME_ARR_DATA[] = { 'i', 'f', 'r', 'a', 'm', 'e' }; -staticJArray nsHtml5Tokenizer::IFRAME_ARR = { IFRAME_ARR_DATA, MOZ_ARRAY_LENGTH(IFRAME_ARR_DATA) }; -static PRUnichar const NOEMBED_ARR_DATA[] = { 'n', 'o', 'e', 'm', 'b', 'e', 'd' }; -staticJArray nsHtml5Tokenizer::NOEMBED_ARR = { NOEMBED_ARR_DATA, MOZ_ARRAY_LENGTH(NOEMBED_ARR_DATA) }; -static PRUnichar const NOSCRIPT_ARR_DATA[] = { 'n', 'o', 's', 'c', 'r', 'i', 'p', 't' }; -staticJArray nsHtml5Tokenizer::NOSCRIPT_ARR = { NOSCRIPT_ARR_DATA, MOZ_ARRAY_LENGTH(NOSCRIPT_ARR_DATA) }; -static PRUnichar const NOFRAMES_ARR_DATA[] = { 'n', 'o', 'f', 'r', 'a', 'm', 'e', 's' }; -staticJArray nsHtml5Tokenizer::NOFRAMES_ARR = { NOFRAMES_ARR_DATA, MOZ_ARRAY_LENGTH(NOFRAMES_ARR_DATA) }; +char16_t nsHtml5Tokenizer::LT_GT[] = { '<', '>' }; +char16_t nsHtml5Tokenizer::LT_SOLIDUS[] = { '<', '/' }; +char16_t nsHtml5Tokenizer::RSQB_RSQB[] = { ']', ']' }; +char16_t nsHtml5Tokenizer::REPLACEMENT_CHARACTER[] = { 0xfffd }; +char16_t nsHtml5Tokenizer::LF[] = { '\n' }; +char16_t nsHtml5Tokenizer::CDATA_LSQB[] = { 'C', 'D', 'A', 'T', 'A', '[' }; +char16_t nsHtml5Tokenizer::OCTYPE[] = { 'o', 'c', 't', 'y', 'p', 'e' }; +char16_t nsHtml5Tokenizer::UBLIC[] = { 'u', 'b', 'l', 'i', 'c' }; +char16_t nsHtml5Tokenizer::YSTEM[] = { 'y', 's', 't', 'e', 'm' }; +static char16_t const TITLE_ARR_DATA[] = { 't', 'i', 't', 'l', 'e' }; +staticJArray nsHtml5Tokenizer::TITLE_ARR = { TITLE_ARR_DATA, MOZ_ARRAY_LENGTH(TITLE_ARR_DATA) }; +static char16_t const SCRIPT_ARR_DATA[] = { 's', 'c', 'r', 'i', 'p', 't' }; +staticJArray nsHtml5Tokenizer::SCRIPT_ARR = { SCRIPT_ARR_DATA, MOZ_ARRAY_LENGTH(SCRIPT_ARR_DATA) }; +static char16_t const STYLE_ARR_DATA[] = { 's', 't', 'y', 'l', 'e' }; +staticJArray nsHtml5Tokenizer::STYLE_ARR = { STYLE_ARR_DATA, MOZ_ARRAY_LENGTH(STYLE_ARR_DATA) }; +static char16_t const PLAINTEXT_ARR_DATA[] = { 'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't' }; +staticJArray nsHtml5Tokenizer::PLAINTEXT_ARR = { PLAINTEXT_ARR_DATA, MOZ_ARRAY_LENGTH(PLAINTEXT_ARR_DATA) }; +static char16_t const XMP_ARR_DATA[] = { 'x', 'm', 'p' }; +staticJArray nsHtml5Tokenizer::XMP_ARR = { XMP_ARR_DATA, MOZ_ARRAY_LENGTH(XMP_ARR_DATA) }; +static char16_t const TEXTAREA_ARR_DATA[] = { 't', 'e', 'x', 't', 'a', 'r', 'e', 'a' }; +staticJArray nsHtml5Tokenizer::TEXTAREA_ARR = { TEXTAREA_ARR_DATA, MOZ_ARRAY_LENGTH(TEXTAREA_ARR_DATA) }; +static char16_t const IFRAME_ARR_DATA[] = { 'i', 'f', 'r', 'a', 'm', 'e' }; +staticJArray nsHtml5Tokenizer::IFRAME_ARR = { IFRAME_ARR_DATA, MOZ_ARRAY_LENGTH(IFRAME_ARR_DATA) }; +static char16_t const NOEMBED_ARR_DATA[] = { 'n', 'o', 'e', 'm', 'b', 'e', 'd' }; +staticJArray nsHtml5Tokenizer::NOEMBED_ARR = { NOEMBED_ARR_DATA, MOZ_ARRAY_LENGTH(NOEMBED_ARR_DATA) }; +static char16_t const NOSCRIPT_ARR_DATA[] = { 'n', 'o', 's', 'c', 'r', 'i', 'p', 't' }; +staticJArray nsHtml5Tokenizer::NOSCRIPT_ARR = { NOSCRIPT_ARR_DATA, MOZ_ARRAY_LENGTH(NOSCRIPT_ARR_DATA) }; +static char16_t const NOFRAMES_ARR_DATA[] = { 'n', 'o', 'f', 'r', 'a', 'm', 'e', 's' }; +staticJArray nsHtml5Tokenizer::NOFRAMES_ARR = { NOFRAMES_ARR_DATA, MOZ_ARRAY_LENGTH(NOFRAMES_ARR_DATA) }; nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource) : tokenHandler(tokenHandler), encodingDeclarationHandler(nullptr), - bmpChar(jArray::newJArray(1)), - astralChar(jArray::newJArray(2)), + bmpChar(jArray::newJArray(1)), + astralChar(jArray::newJArray(2)), tagName(nullptr), attributeName(nullptr), doctypeName(nullptr), @@ -130,7 +130,7 @@ nsHtml5Tokenizer::setStateAndEndTagExpectation(int32_t specialTokenizerState, ns if (specialTokenizerState == NS_HTML5TOKENIZER_DATA) { return; } - autoJArray asArray = nsHtml5Portability::newCharArrayFromLocal(endTagExpectation); + autoJArray asArray = nsHtml5Portability::newCharArrayFromLocal(endTagExpectation); this->endTagExpectation = nsHtml5ElementName::elementNameByBuffer(asArray, 0, asArray.length, interner); endTagExpectationToArray(); } @@ -207,10 +207,10 @@ nsHtml5Tokenizer::emptyAttributes() } void -nsHtml5Tokenizer::appendStrBuf(PRUnichar c) +nsHtml5Tokenizer::appendStrBuf(char16_t c) { if (strBufLen == strBuf.length) { - jArray newBuf = jArray::newJArray(strBuf.length + NS_HTML5TOKENIZER_BUFFER_GROW_BY); + jArray newBuf = jArray::newJArray(strBuf.length + NS_HTML5TOKENIZER_BUFFER_GROW_BY); nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length); strBuf = newBuf; } @@ -238,10 +238,10 @@ nsHtml5Tokenizer::emitStrBuf() } void -nsHtml5Tokenizer::appendLongStrBuf(PRUnichar c) +nsHtml5Tokenizer::appendLongStrBuf(char16_t c) { if (longStrBufLen == longStrBuf.length) { - jArray newBuf = jArray::newJArray(longStrBufLen + (longStrBufLen >> 1)); + jArray newBuf = jArray::newJArray(longStrBufLen + (longStrBufLen >> 1)); nsHtml5ArrayCopy::arraycopy(longStrBuf, newBuf, longStrBuf.length); longStrBuf = newBuf; } @@ -249,11 +249,11 @@ nsHtml5Tokenizer::appendLongStrBuf(PRUnichar c) } void -nsHtml5Tokenizer::appendLongStrBuf(PRUnichar* buffer, int32_t offset, int32_t length) +nsHtml5Tokenizer::appendLongStrBuf(char16_t* buffer, int32_t offset, int32_t length) { int32_t reqLen = longStrBufLen + length; if (longStrBuf.length < reqLen) { - jArray newBuf = jArray::newJArray(reqLen + (reqLen >> 1)); + jArray newBuf = jArray::newJArray(reqLen + (reqLen >> 1)); nsHtml5ArrayCopy::arraycopy(longStrBuf, newBuf, longStrBuf.length); longStrBuf = newBuf; } @@ -275,7 +275,7 @@ nsHtml5Tokenizer::emitComment(int32_t provisionalHyphens, int32_t pos) } void -nsHtml5Tokenizer::flushChars(PRUnichar* buf, int32_t pos) +nsHtml5Tokenizer::flushChars(char16_t* buf, int32_t pos) { if (pos > cstart) { tokenHandler->characters(buf, cstart, pos - cstart); @@ -370,7 +370,7 @@ nsHtml5Tokenizer::tokenizeBuffer(nsHtml5UTF16Buffer* buffer) { int32_t state = stateSave; int32_t returnState = returnStateSave; - PRUnichar c = '\0'; + char16_t c = '\0'; shouldSuspend = false; lastCR = false; int32_t start = buffer->getStart(); @@ -418,7 +418,7 @@ nsHtml5Tokenizer::tokenizeBuffer(nsHtml5UTF16Buffer* buffer) template int32_t -nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* buf, bool reconsume, int32_t returnState, int32_t endPos) +nsHtml5Tokenizer::stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* buf, bool reconsume, int32_t returnState, int32_t endPos) { stateloop: for (; ; ) { switch(state) { @@ -472,7 +472,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* c = checkChar(buf, pos); if (c >= 'A' && c <= 'Z') { endTag = false; - clearStrBufAndAppend((PRUnichar) (c + 0x20)); + clearStrBufAndAppend((char16_t) (c + 0x20)); state = P::transition(mViewSource, NS_HTML5TOKENIZER_TAG_NAME, reconsume, pos); NS_HTML5_BREAK(tagopenloop); } else if (c >= 'a' && c <= 'z') { @@ -1605,7 +1605,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* const nsHtml5CharacterName& candidateName = nsHtml5NamedCharacters::NAMES[candidate]; if (!candidateName.length() || candidateName.charAt(candidateName.length() - 1) != ';') { if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) { - PRUnichar ch; + char16_t ch; if (strBufMark == strBufLen) { ch = c; } else { @@ -1632,7 +1632,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } } P::completedNamedCharacterReference(mViewSource); - const PRUnichar* val = nsHtml5NamedCharacters::VALUES[candidate]; + const char16_t* val = nsHtml5NamedCharacters::VALUES[candidate]; if (!val[1]) { emitOrAppendOne(val, returnState); } else { @@ -2010,8 +2010,8 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } c = checkChar(buf, pos); if (index < endTagExpectationAsArray.length) { - PRUnichar e = endTagExpectationAsArray[index]; - PRUnichar folded = c; + char16_t e = endTagExpectationAsArray[index]; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -2409,7 +2409,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* c = checkChar(buf, pos); MOZ_ASSERT(index > 0); if (index < 6) { - PRUnichar folded = c; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -2587,7 +2587,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } c = checkChar(buf, pos); if (index < 6) { - PRUnichar folded = c; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -2632,7 +2632,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } c = checkChar(buf, pos); if (index < 6) { - PRUnichar folded = c; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -2836,7 +2836,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } c = checkChar(buf, pos); if (index < 5) { - PRUnichar folded = c; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -3207,7 +3207,7 @@ nsHtml5Tokenizer::stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* } c = checkChar(buf, pos); if (index < 5) { - PRUnichar folded = c; + char16_t folded = c; if (c >= 'A' && c <= 'Z') { folded += 0x20; } @@ -3472,7 +3472,7 @@ nsHtml5Tokenizer::initDoctypeFields() } void -nsHtml5Tokenizer::emitCarriageReturn(PRUnichar* buf, int32_t pos) +nsHtml5Tokenizer::emitCarriageReturn(char16_t* buf, int32_t pos) { silentCarriageReturn(); flushChars(buf, pos); @@ -3481,7 +3481,7 @@ nsHtml5Tokenizer::emitCarriageReturn(PRUnichar* buf, int32_t pos) } void -nsHtml5Tokenizer::emitReplacementCharacter(PRUnichar* buf, int32_t pos) +nsHtml5Tokenizer::emitReplacementCharacter(char16_t* buf, int32_t pos) { flushChars(buf, pos); tokenHandler->zeroOriginatingReplacementCharacter(); @@ -3489,7 +3489,7 @@ nsHtml5Tokenizer::emitReplacementCharacter(PRUnichar* buf, int32_t pos) } void -nsHtml5Tokenizer::emitPlaintextReplacementCharacter(PRUnichar* buf, int32_t pos) +nsHtml5Tokenizer::emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos) { flushChars(buf, pos); tokenHandler->characters(REPLACEMENT_CHARACTER, 0, 1); @@ -3497,7 +3497,7 @@ nsHtml5Tokenizer::emitPlaintextReplacementCharacter(PRUnichar* buf, int32_t pos) } void -nsHtml5Tokenizer::setAdditionalAndRememberAmpersandLocation(PRUnichar add) +nsHtml5Tokenizer::setAdditionalAndRememberAmpersandLocation(char16_t add) { additional = add; } @@ -3532,7 +3532,7 @@ nsHtml5Tokenizer::handleNcrValue(int32_t returnState) if (value <= 0xFFFF) { if (value >= 0x80 && value <= 0x9f) { errNcrInC1Range(); - PRUnichar* val = nsHtml5NamedCharacters::WINDOWS_1252[value - 0x80]; + char16_t* val = nsHtml5NamedCharacters::WINDOWS_1252[value - 0x80]; emitOrAppendOne(val, returnState); } else if (value == 0x0) { errNcrZero(); @@ -3541,13 +3541,13 @@ nsHtml5Tokenizer::handleNcrValue(int32_t returnState) errNcrSurrogate(); emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); } else { - PRUnichar ch = (PRUnichar) value; + char16_t ch = (char16_t) value; bmpChar[0] = ch; emitOrAppendOne(bmpChar, returnState); } } else if (value <= 0x10FFFF) { - astralChar[0] = (PRUnichar) (NS_HTML5TOKENIZER_LEAD_OFFSET + (value >> 10)); - astralChar[1] = (PRUnichar) (0xDC00 + (value & 0x3FF)); + astralChar[0] = (char16_t) (NS_HTML5TOKENIZER_LEAD_OFFSET + (value >> 10)); + astralChar[1] = (char16_t) (0xDC00 + (value & 0x3FF)); emitOrAppendTwo(astralChar, returnState); } else { errNcrOutOfRange(); @@ -3745,7 +3745,7 @@ nsHtml5Tokenizer::eof() } case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL: { for (; ; ) { - PRUnichar c = '\0'; + char16_t c = '\0'; entCol++; for (; ; ) { if (hi == -1) { @@ -3795,7 +3795,7 @@ nsHtml5Tokenizer::eof() const nsHtml5CharacterName& candidateName = nsHtml5NamedCharacters::NAMES[candidate]; if (!candidateName.length() || candidateName.charAt(candidateName.length() - 1) != ';') { if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) { - PRUnichar ch; + char16_t ch; if (strBufMark == strBufLen) { ch = '\0'; } else { @@ -3814,7 +3814,7 @@ nsHtml5Tokenizer::eof() errNotSemicolonTerminated(); } } - const PRUnichar* val = nsHtml5NamedCharacters::VALUES[candidate]; + const char16_t* val = nsHtml5NamedCharacters::VALUES[candidate]; if (!val[1]) { emitOrAppendOne(val, returnState); } else { @@ -3889,7 +3889,7 @@ nsHtml5Tokenizer::internalEncodingDeclaration(nsString* internalCharset) } void -nsHtml5Tokenizer::emitOrAppendTwo(const PRUnichar* val, int32_t returnState) +nsHtml5Tokenizer::emitOrAppendTwo(const char16_t* val, int32_t returnState) { if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) { appendLongStrBuf(val[0]); @@ -3900,7 +3900,7 @@ nsHtml5Tokenizer::emitOrAppendTwo(const PRUnichar* val, int32_t returnState) } void -nsHtml5Tokenizer::emitOrAppendOne(const PRUnichar* val, int32_t returnState) +nsHtml5Tokenizer::emitOrAppendOne(const char16_t* val, int32_t returnState) { if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) { appendLongStrBuf(val[0]); @@ -3992,12 +3992,12 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other) { strBufLen = other->strBufLen; if (strBufLen > strBuf.length) { - strBuf = jArray::newJArray(strBufLen); + strBuf = jArray::newJArray(strBufLen); } nsHtml5ArrayCopy::arraycopy(other->strBuf, strBuf, strBufLen); longStrBufLen = other->longStrBufLen; if (longStrBufLen > longStrBuf.length) { - longStrBuf = jArray::newJArray(longStrBufLen); + longStrBuf = jArray::newJArray(longStrBufLen); } nsHtml5ArrayCopy::arraycopy(other->longStrBuf, longStrBuf, longStrBufLen); stateSave = other->stateSave; @@ -4064,8 +4064,8 @@ void nsHtml5Tokenizer::initializeWithoutStarting() { confident = false; - strBuf = jArray::newJArray(64); - longStrBuf = jArray::newJArray(1024); + strBuf = jArray::newJArray(64); + longStrBuf = jArray::newJArray(1024); line = 1; resetToDataState(); } diff --git a/parser/html/nsHtml5Tokenizer.h b/parser/html/nsHtml5Tokenizer.h index 247be4388a6d..86ca1bcd437b 100644 --- a/parser/html/nsHtml5Tokenizer.h +++ b/parser/html/nsHtml5Tokenizer.h @@ -62,25 +62,25 @@ class nsHtml5Portability; class nsHtml5Tokenizer { private: - static PRUnichar LT_GT[]; - static PRUnichar LT_SOLIDUS[]; - static PRUnichar RSQB_RSQB[]; - static PRUnichar REPLACEMENT_CHARACTER[]; - static PRUnichar LF[]; - static PRUnichar CDATA_LSQB[]; - static PRUnichar OCTYPE[]; - static PRUnichar UBLIC[]; - static PRUnichar YSTEM[]; - static staticJArray TITLE_ARR; - static staticJArray SCRIPT_ARR; - static staticJArray STYLE_ARR; - static staticJArray PLAINTEXT_ARR; - static staticJArray XMP_ARR; - static staticJArray TEXTAREA_ARR; - static staticJArray IFRAME_ARR; - static staticJArray NOEMBED_ARR; - static staticJArray NOSCRIPT_ARR; - static staticJArray NOFRAMES_ARR; + static char16_t LT_GT[]; + static char16_t LT_SOLIDUS[]; + static char16_t RSQB_RSQB[]; + static char16_t REPLACEMENT_CHARACTER[]; + static char16_t LF[]; + static char16_t CDATA_LSQB[]; + static char16_t OCTYPE[]; + static char16_t UBLIC[]; + static char16_t YSTEM[]; + static staticJArray TITLE_ARR; + static staticJArray SCRIPT_ARR; + static staticJArray STYLE_ARR; + static staticJArray PLAINTEXT_ARR; + static staticJArray XMP_ARR; + static staticJArray TEXTAREA_ARR; + static staticJArray IFRAME_ARR; + static staticJArray NOEMBED_ARR; + static staticJArray NOSCRIPT_ARR; + static staticJArray NOFRAMES_ARR; protected: nsHtml5TreeBuilder* tokenHandler; nsHtml5StreamParser* encodingDeclarationHandler; @@ -92,7 +92,7 @@ class nsHtml5Tokenizer int32_t index; private: bool forceQuirks; - PRUnichar additional; + char16_t additional; int32_t entCol; int32_t firstCharKey; int32_t lo; @@ -109,16 +109,16 @@ class nsHtml5Tokenizer private: nsString* publicId; nsString* systemId; - autoJArray strBuf; + autoJArray strBuf; int32_t strBufLen; - autoJArray longStrBuf; + autoJArray longStrBuf; int32_t longStrBufLen; - autoJArray bmpChar; - autoJArray astralChar; + autoJArray bmpChar; + autoJArray astralChar; protected: nsHtml5ElementName* endTagExpectation; private: - jArray endTagExpectationAsArray; + jArray endTagExpectationAsArray; protected: bool endTag; private: @@ -155,7 +155,7 @@ class nsHtml5Tokenizer nsHtml5HtmlAttributes* emptyAttributes(); private: - inline void clearStrBufAndAppend(PRUnichar c) + inline void clearStrBufAndAppend(char16_t c) { strBuf[0] = c; strBufLen = 1; @@ -166,7 +166,7 @@ class nsHtml5Tokenizer strBufLen = 0; } - void appendStrBuf(PRUnichar c); + void appendStrBuf(char16_t c); protected: nsString* strBufToString(); private: @@ -177,25 +177,25 @@ class nsHtml5Tokenizer longStrBufLen = 0; } - inline void clearLongStrBufAndAppend(PRUnichar c) + inline void clearLongStrBufAndAppend(char16_t c) { longStrBuf[0] = c; longStrBufLen = 1; } - void appendLongStrBuf(PRUnichar c); + void appendLongStrBuf(char16_t c); inline void appendSecondHyphenToBogusComment() { appendLongStrBuf('-'); } - inline void adjustDoubleHyphenAndAppendToLongStrBufAndErr(PRUnichar c) + inline void adjustDoubleHyphenAndAppendToLongStrBufAndErr(char16_t c) { errConsecutiveHyphens(); appendLongStrBuf(c); } - void appendLongStrBuf(PRUnichar* buffer, int32_t offset, int32_t length); + void appendLongStrBuf(char16_t* buffer, int32_t offset, int32_t length); inline void appendStrBufToLongStrBuf() { appendLongStrBuf(strBuf, 0, strBufLen); @@ -204,7 +204,7 @@ class nsHtml5Tokenizer nsString* longStrBufToString(); void emitComment(int32_t provisionalHyphens, int32_t pos); protected: - void flushChars(PRUnichar* buf, int32_t pos); + void flushChars(char16_t* buf, int32_t pos); private: void resetAttributes(); void strBufToElementNameString(); @@ -216,7 +216,7 @@ class nsHtml5Tokenizer void start(); bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer); private: - template int32_t stateLoop(int32_t state, PRUnichar c, int32_t pos, PRUnichar* buf, bool reconsume, int32_t returnState, int32_t endPos); + template int32_t stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* buf, bool reconsume, int32_t returnState, int32_t endPos); void initDoctypeFields(); inline void adjustDoubleHyphenAndAppendToLongStrBufCarriageReturn() { @@ -255,10 +255,10 @@ class nsHtml5Tokenizer } private: - void emitCarriageReturn(PRUnichar* buf, int32_t pos); - void emitReplacementCharacter(PRUnichar* buf, int32_t pos); - void emitPlaintextReplacementCharacter(PRUnichar* buf, int32_t pos); - void setAdditionalAndRememberAmpersandLocation(PRUnichar add); + void emitCarriageReturn(char16_t* buf, int32_t pos); + void emitReplacementCharacter(char16_t* buf, int32_t pos); + void emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos); + void setAdditionalAndRememberAmpersandLocation(char16_t add); void bogusDoctype(); void bogusDoctypeWithoutQuirks(); void emitOrAppendStrBuf(int32_t returnState); @@ -268,7 +268,7 @@ class nsHtml5Tokenizer private: void emitDoctypeToken(int32_t pos); protected: - inline PRUnichar checkChar(PRUnichar* buf, int32_t pos) + inline char16_t checkChar(char16_t* buf, int32_t pos) { return buf[pos]; } @@ -276,8 +276,8 @@ class nsHtml5Tokenizer public: bool internalEncodingDeclaration(nsString* internalCharset); private: - void emitOrAppendTwo(const PRUnichar* val, int32_t returnState); - void emitOrAppendOne(const PRUnichar* val, int32_t returnState); + void emitOrAppendTwo(const char16_t* val, int32_t returnState); + void emitOrAppendOne(const char16_t* val, int32_t returnState); public: void end(); void requestSuspension(); diff --git a/parser/html/nsHtml5TokenizerCppSupplement.h b/parser/html/nsHtml5TokenizerCppSupplement.h index b32776c6d481..5d30b5c8e826 100644 --- a/parser/html/nsHtml5TokenizerCppSupplement.h +++ b/parser/html/nsHtml5TokenizerCppSupplement.h @@ -42,7 +42,7 @@ nsHtml5Tokenizer::errWarnLtSlashInRcdata() // The null checks below annotated MOZ_LIKELY are not actually necessary. void -nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c) +nsHtml5Tokenizer::errUnquotedAttributeValOrNull(char16_t c) { if (MOZ_LIKELY(mViewSource)) { switch (c) { @@ -64,7 +64,7 @@ nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c) } void -nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c) +nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char16_t c) { if (MOZ_LIKELY(mViewSource)) { switch (c) { @@ -82,7 +82,7 @@ nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c) } void -nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c) +nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(char16_t c) { if (MOZ_LIKELY(mViewSource)) { if (c == '<') { @@ -96,7 +96,7 @@ nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c) } void -nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c) +nsHtml5Tokenizer::errBadCharAfterLt(char16_t c) { if (MOZ_LIKELY(mViewSource)) { mViewSource->AddErrorToCurrentNode("errBadCharAfterLt"); @@ -104,7 +104,7 @@ nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c) } void -nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(PRUnichar c) +nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(char16_t c) { if (MOZ_LIKELY(mViewSource)) { if (c == '<') { @@ -135,8 +135,8 @@ nsHtml5Tokenizer::maybeErrSlashInEndTag(bool selfClosing) } } -PRUnichar -nsHtml5Tokenizer::errNcrNonCharacter(PRUnichar ch) +char16_t +nsHtml5Tokenizer::errNcrNonCharacter(char16_t ch) { if (MOZ_UNLIKELY(mViewSource)) { mViewSource->AddErrorToCurrentNode("errNcrNonCharacter"); @@ -152,8 +152,8 @@ nsHtml5Tokenizer::errAstralNonCharacter(int32_t ch) } } -PRUnichar -nsHtml5Tokenizer::errNcrControlChar(PRUnichar ch) +char16_t +nsHtml5Tokenizer::errNcrControlChar(char16_t ch) { if (MOZ_UNLIKELY(mViewSource)) { mViewSource->AddErrorToCurrentNode("errNcrControlChar"); @@ -314,7 +314,7 @@ nsHtml5Tokenizer::errNoNamedCharacterMatch() } void -nsHtml5Tokenizer::errQuoteBeforeAttributeName(PRUnichar c) +nsHtml5Tokenizer::errQuoteBeforeAttributeName(char16_t c) { if (MOZ_LIKELY(mViewSource)) { mViewSource->AddErrorToCurrentNode("errQuoteBeforeAttributeName"); diff --git a/parser/html/nsHtml5TokenizerHSupplement.h b/parser/html/nsHtml5TokenizerHSupplement.h index 2bb89651cb8c..1d14c546ec8e 100644 --- a/parser/html/nsHtml5TokenizerHSupplement.h +++ b/parser/html/nsHtml5TokenizerHSupplement.h @@ -40,21 +40,21 @@ void errPrematureEndOfComment(); void errBogusComment(); -void errUnquotedAttributeValOrNull(PRUnichar c); +void errUnquotedAttributeValOrNull(char16_t c); void errSlashNotFollowedByGt(); void errNoSpaceBetweenAttributes(); -void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c); +void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char16_t c); void errAttributeValueMissing(); -void errBadCharBeforeAttributeNameOrNull(PRUnichar c); +void errBadCharBeforeAttributeNameOrNull(char16_t c); void errEqualsSignBeforeAttributeName(); -void errBadCharAfterLt(PRUnichar c); +void errBadCharAfterLt(char16_t c); void errLtGt(); @@ -66,9 +66,9 @@ void errNotSemicolonTerminated(); void errNoNamedCharacterMatch(); -void errQuoteBeforeAttributeName(PRUnichar c); +void errQuoteBeforeAttributeName(char16_t c); -void errQuoteOrLtInAttributeNameOrNull(PRUnichar c); +void errQuoteOrLtInAttributeNameOrNull(char16_t c); void errExpectedPublicId(); @@ -78,13 +78,13 @@ void maybeErrAttributesOnEndTag(nsHtml5HtmlAttributes* attrs); void maybeErrSlashInEndTag(bool selfClosing); -PRUnichar errNcrNonCharacter(PRUnichar ch); +char16_t errNcrNonCharacter(char16_t ch); void errAstralNonCharacter(int32_t ch); void errNcrSurrogate(); -PRUnichar errNcrControlChar(PRUnichar ch); +char16_t errNcrControlChar(char16_t ch); void errNcrCr(); diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index 5448c5f40c58..f4e1a5ae2a2b 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -66,7 +66,7 @@ #include "nsHtml5TreeBuilder.h" -PRUnichar nsHtml5TreeBuilder::REPLACEMENT_CHARACTER[] = { 0xfffd }; +char16_t nsHtml5TreeBuilder::REPLACEMENT_CHARACTER[] = { 0xfffd }; static const char* const QUIRKY_PUBLIC_IDS_DATA[] = { "+//silmaril//dtd html pro v0r11 19970101//", "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", "-//as//dtd html 3.0 aswedit + extensions//", "-//ietf//dtd html 2.0 level 1//", "-//ietf//dtd html 2.0 level 2//", "-//ietf//dtd html 2.0 strict level 1//", "-//ietf//dtd html 2.0 strict level 2//", "-//ietf//dtd html 2.0 strict//", "-//ietf//dtd html 2.0//", "-//ietf//dtd html 2.1e//", "-//ietf//dtd html 3.0//", "-//ietf//dtd html 3.2 final//", "-//ietf//dtd html 3.2//", "-//ietf//dtd html 3//", "-//ietf//dtd html level 0//", "-//ietf//dtd html level 1//", "-//ietf//dtd html level 2//", "-//ietf//dtd html level 3//", "-//ietf//dtd html strict level 0//", "-//ietf//dtd html strict level 1//", "-//ietf//dtd html strict level 2//", "-//ietf//dtd html strict level 3//", "-//ietf//dtd html strict//", "-//ietf//dtd html//", "-//metrius//dtd metrius presentational//", "-//microsoft//dtd internet explorer 2.0 html strict//", "-//microsoft//dtd internet explorer 2.0 html//", "-//microsoft//dtd internet explorer 2.0 tables//", "-//microsoft//dtd internet explorer 3.0 html strict//", "-//microsoft//dtd internet explorer 3.0 html//", "-//microsoft//dtd internet explorer 3.0 tables//", "-//netscape comm. corp.//dtd html//", "-//netscape comm. corp.//dtd strict html//", "-//o'reilly and associates//dtd html 2.0//", "-//o'reilly and associates//dtd html extended 1.0//", "-//o'reilly and associates//dtd html extended relaxed 1.0//", "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", "-//spyglass//dtd html 2.0 extended//", "-//sq//dtd html 2.0 hotmetal + extensions//", "-//sun microsystems corp.//dtd hotjava html//", "-//sun microsystems corp.//dtd hotjava strict html//", "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//", "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//", "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//", "-//w3c//dtd html 4.0 transitional//", "-//w3c//dtd html experimental 19960712//", "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//", "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//", "-//webtechs//dtd mozilla html//" }; staticJArray nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = { QUIRKY_PUBLIC_IDS_DATA, MOZ_ARRAY_LENGTH(QUIRKY_PUBLIC_IDS_DATA) }; void @@ -86,7 +86,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) deepTreeSurrogateParent = nullptr; start(fragment); charBufferLen = 0; - charBuffer = jArray::newJArray(1024); + charBuffer = jArray::newJArray(1024); framesetOk = true; if (fragment) { nsIContent** elt; @@ -151,7 +151,7 @@ nsHtml5TreeBuilder::doctype(nsIAtom* name, nsString* publicIdentifier, nsString* } void -nsHtml5TreeBuilder::comment(PRUnichar* buf, int32_t start, int32_t length) +nsHtml5TreeBuilder::comment(char16_t* buf, int32_t start, int32_t length) { needToDropLF = false; if (!isInForeign()) { @@ -179,7 +179,7 @@ nsHtml5TreeBuilder::comment(PRUnichar* buf, int32_t start, int32_t length) } void -nsHtml5TreeBuilder::characters(const PRUnichar* buf, int32_t start, int32_t length) +nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t length) { if (tokenizer->isViewingXmlSource()) { return; @@ -1227,7 +1227,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName::ELT_LABEL, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); int32_t promptIndex = attributes->getIndex(nsHtml5AttributeName::ATTR_PROMPT); if (promptIndex > -1) { - autoJArray prompt = nsHtml5Portability::newCharArrayFromString(attributes->getValueNoBoundsCheck(promptIndex)); + autoJArray prompt = nsHtml5Portability::newCharArrayFromString(attributes->getValueNoBoundsCheck(promptIndex)); appendCharacters(stack[currentPtr]->node, prompt, 0, prompt.length); } else { appendIsindexPrompt(stack[currentPtr]->node); @@ -1952,9 +1952,9 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue) int32_t charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; int32_t start = -1; int32_t end = -1; - autoJArray buffer = nsHtml5Portability::newCharArrayFromString(attributeValue); + autoJArray buffer = nsHtml5Portability::newCharArrayFromString(attributeValue); for (int32_t i = 0; i < buffer.length; i++) { - PRUnichar c = buffer[i]; + char16_t c = buffer[i]; switch(charsetState) { case NS_HTML5TREE_BUILDER_CHARSET_INITIAL: { switch(c) { diff --git a/parser/html/nsHtml5TreeBuilder.h b/parser/html/nsHtml5TreeBuilder.h index b956033d2a73..d11a4319943f 100644 --- a/parser/html/nsHtml5TreeBuilder.h +++ b/parser/html/nsHtml5TreeBuilder.h @@ -70,7 +70,7 @@ class nsHtml5Portability; class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState { private: - static PRUnichar REPLACEMENT_CHARACTER[]; + static char16_t REPLACEMENT_CHARACTER[]; static staticJArray QUIRKY_PUBLIC_IDS; int32_t mode; int32_t originalMode; @@ -94,7 +94,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState nsIContent** headPointer; nsIContent** deepTreeSurrogateParent; protected: - autoJArray charBuffer; + autoJArray charBuffer; int32_t charBufferLen; private: bool quirks; @@ -102,8 +102,8 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState public: void startTokenization(nsHtml5Tokenizer* self); void doctype(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, bool forceQuirks); - void comment(PRUnichar* buf, int32_t start, int32_t length); - void characters(const PRUnichar* buf, int32_t start, int32_t length); + void comment(char16_t* buf, int32_t start, int32_t length); + void characters(const char16_t* buf, int32_t start, int32_t length); void zeroOriginatingReplacementCharacter(); void eof(); void endTokenization(); @@ -200,7 +200,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState void appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form); void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes); protected: - void accumulateCharacters(const PRUnichar* buf, int32_t start, int32_t length); + void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length); void requestSuspension(); nsIContent** createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes); nsIContent** createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form); @@ -210,11 +210,11 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState void appendElement(nsIContent** child, nsIContent** newParent); void appendChildrenToNewParent(nsIContent** oldParent, nsIContent** newParent); void insertFosterParentedChild(nsIContent** child, nsIContent** table, nsIContent** stackParent); - void insertFosterParentedCharacters(PRUnichar* buf, int32_t start, int32_t length, nsIContent** table, nsIContent** stackParent); - void appendCharacters(nsIContent** parent, PRUnichar* buf, int32_t start, int32_t length); + void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContent** table, nsIContent** stackParent); + void appendCharacters(nsIContent** parent, char16_t* buf, int32_t start, int32_t length); void appendIsindexPrompt(nsIContent** parent); - void appendComment(nsIContent** parent, PRUnichar* buf, int32_t start, int32_t length); - void appendCommentToDocument(PRUnichar* buf, int32_t start, int32_t length); + void appendComment(nsIContent** parent, char16_t* buf, int32_t start, int32_t length); + void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length); void addAttributesToElement(nsIContent** element, nsHtml5HtmlAttributes* attributes); void markMalformedIfScript(nsIContent** elt); void start(bool fragmentMode); diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h index a2fd70495543..40fa7ebf0ac8 100644 --- a/parser/html/nsHtml5TreeBuilderCppSupplement.h +++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h @@ -266,14 +266,14 @@ nsHtml5TreeBuilder::appendChildrenToNewParent(nsIContent** aOldParent, nsIConten } void -nsHtml5TreeBuilder::insertFosterParentedCharacters(PRUnichar* aBuffer, int32_t aStart, int32_t aLength, nsIContent** aTable, nsIContent** aStackParent) +nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aStart, int32_t aLength, nsIContent** aTable, nsIContent** aStackParent) { NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aTable, "Null table"); NS_PRECONDITION(aStackParent, "Null stack parent"); - PRUnichar* bufferCopy = new PRUnichar[aLength]; - memcpy(bufferCopy, aBuffer, aLength * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aLength]; + memcpy(bufferCopy, aBuffer, aLength * sizeof(char16_t)); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); NS_ASSERTION(treeOp, "Tree op allocation failed."); @@ -293,13 +293,13 @@ nsHtml5TreeBuilder::insertFosterParentedChild(nsIContent** aChild, nsIContent** } void -nsHtml5TreeBuilder::appendCharacters(nsIContent** aParent, PRUnichar* aBuffer, int32_t aStart, int32_t aLength) +nsHtml5TreeBuilder::appendCharacters(nsIContent** aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength) { NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aParent, "Null parent"); - PRUnichar* bufferCopy = new PRUnichar[aLength]; - memcpy(bufferCopy, aBuffer, aLength * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aLength]; + memcpy(bufferCopy, aBuffer, aLength * sizeof(char16_t)); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); NS_ASSERTION(treeOp, "Tree op allocation failed."); @@ -318,7 +318,7 @@ nsHtml5TreeBuilder::appendIsindexPrompt(nsIContent** aParent) } void -nsHtml5TreeBuilder::appendComment(nsIContent** aParent, PRUnichar* aBuffer, int32_t aStart, int32_t aLength) +nsHtml5TreeBuilder::appendComment(nsIContent** aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength) { NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aParent, "Null parent"); @@ -326,8 +326,8 @@ nsHtml5TreeBuilder::appendComment(nsIContent** aParent, PRUnichar* aBuffer, int3 return; } - PRUnichar* bufferCopy = new PRUnichar[aLength]; - memcpy(bufferCopy, aBuffer, aLength * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aLength]; + memcpy(bufferCopy, aBuffer, aLength * sizeof(char16_t)); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); NS_ASSERTION(treeOp, "Tree op allocation failed."); @@ -335,12 +335,12 @@ nsHtml5TreeBuilder::appendComment(nsIContent** aParent, PRUnichar* aBuffer, int3 } void -nsHtml5TreeBuilder::appendCommentToDocument(PRUnichar* aBuffer, int32_t aStart, int32_t aLength) +nsHtml5TreeBuilder::appendCommentToDocument(char16_t* aBuffer, int32_t aStart, int32_t aLength) { NS_PRECONDITION(aBuffer, "Null buffer"); - PRUnichar* bufferCopy = new PRUnichar[aLength]; - memcpy(bufferCopy, aBuffer, aLength * sizeof(PRUnichar)); + char16_t* bufferCopy = new char16_t[aLength]; + memcpy(bufferCopy, aBuffer, aLength * sizeof(char16_t)); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); NS_ASSERTION(treeOp, "Tree op allocation failed."); @@ -555,16 +555,16 @@ nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsIAtom* aName, nsIContent } void -nsHtml5TreeBuilder::accumulateCharacters(const PRUnichar* aBuf, int32_t aStart, int32_t aLength) +nsHtml5TreeBuilder::accumulateCharacters(const char16_t* aBuf, int32_t aStart, int32_t aLength) { int32_t newFillLen = charBufferLen + aLength; if (newFillLen > charBuffer.length) { int32_t newAllocLength = newFillLen + (newFillLen >> 1); - jArray newBuf = jArray::newJArray(newAllocLength); - memcpy(newBuf, charBuffer, sizeof(PRUnichar) * charBufferLen); + jArray newBuf = jArray::newJArray(newAllocLength); + memcpy(newBuf, charBuffer, sizeof(char16_t) * charBufferLen); charBuffer = newBuf; } - memcpy(charBuffer + charBufferLen, aBuf + aStart, sizeof(PRUnichar) * aLength); + memcpy(charBuffer + charBufferLen, aBuf + aStart, sizeof(char16_t) * aLength); charBufferLen = newFillLen; } diff --git a/parser/html/nsHtml5TreeBuilderHSupplement.h b/parser/html/nsHtml5TreeBuilderHSupplement.h index 4481d477a494..c1d9fcd7c051 100644 --- a/parser/html/nsHtml5TreeBuilderHSupplement.h +++ b/parser/html/nsHtml5TreeBuilderHSupplement.h @@ -53,7 +53,7 @@ */ nsIContent** AllocateContentHandle(); - void accumulateCharactersForced(const PRUnichar* aBuf, int32_t aStart, int32_t aLength) + void accumulateCharactersForced(const char16_t* aBuf, int32_t aStart, int32_t aLength) { accumulateCharacters(aBuf, aStart, aLength); } diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index c369f338fc95..c3cb36a39151 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -117,7 +117,7 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation() } nsresult -nsHtml5TreeOperation::AppendTextToTextNode(const PRUnichar* aBuffer, +nsHtml5TreeOperation::AppendTextToTextNode(const char16_t* aBuffer, uint32_t aLength, nsIContent* aTextNode, nsHtml5TreeOpExecutor* aBuilder) @@ -149,7 +149,7 @@ nsHtml5TreeOperation::AppendTextToTextNode(const PRUnichar* aBuffer, nsresult -nsHtml5TreeOperation::AppendText(const PRUnichar* aBuffer, +nsHtml5TreeOperation::AppendText(const char16_t* aBuffer, uint32_t aLength, nsIContent* aParent, nsHtml5TreeOpExecutor* aBuilder) @@ -482,7 +482,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, } case eTreeOpAppendText: { nsIContent* parent = *mOne.node; - PRUnichar* buffer = mTwo.unicharPtr; + char16_t* buffer = mTwo.unicharPtr; uint32_t length = mFour.integer; return AppendText(buffer, length, parent, aBuilder); } @@ -504,7 +504,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, } case eTreeOpFosterParentText: { nsIContent* stackParent = *mOne.node; - PRUnichar* buffer = mTwo.unicharPtr; + char16_t* buffer = mTwo.unicharPtr; uint32_t length = mFour.integer; nsIContent* table = *mThree.node; nsIContent* foster = table->GetParent(); @@ -541,7 +541,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, } case eTreeOpAppendComment: { nsIContent* parent = *mOne.node; - PRUnichar* buffer = mTwo.unicharPtr; + char16_t* buffer = mTwo.unicharPtr; int32_t length = mFour.integer; nsRefPtr comment = @@ -553,7 +553,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, return Append(comment, parent, aBuilder); } case eTreeOpAppendCommentToDocument: { - PRUnichar* buffer = mTwo.unicharPtr; + char16_t* buffer = mTwo.unicharPtr; int32_t length = mFour.integer; nsRefPtr comment = @@ -658,7 +658,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, return rv; } case eTreeOpProcessOfflineManifest: { - PRUnichar* str = mOne.unicharPtr; + char16_t* str = mOne.unicharPtr; nsDependentString dependentString(str); aBuilder->ProcessOfflineManifest(dependentString); return rv; @@ -716,7 +716,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, } case eTreeOpAddClass: { nsIContent* node = *(mOne.node); - PRUnichar* str = mTwo.unicharPtr; + char16_t* str = mTwo.unicharPtr; nsDependentString depStr(str); // See viewsource.css for the possible classes nsAutoString klass; @@ -740,7 +740,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, } case eTreeOpAddViewSourceHref: { nsIContent* node = *mOne.node; - PRUnichar* buffer = mTwo.unicharPtr; + char16_t* buffer = mTwo.unicharPtr; int32_t length = mFour.integer; nsDependentString relative(buffer, length); @@ -813,13 +813,13 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, nsXPIDLString message; if (otherAtom) { - const PRUnichar* params[] = { atom->GetUTF16String(), + const char16_t* params[] = { atom->GetUTF16String(), otherAtom->GetUTF16String() }; rv = nsContentUtils::FormatLocalizedString( nsContentUtils::eHTMLPARSER_PROPERTIES, msgId, params, message); NS_ENSURE_SUCCESS(rv, rv); } else if (atom) { - const PRUnichar* params[] = { atom->GetUTF16String() }; + const char16_t* params[] = { atom->GetUTF16String() }; rv = nsContentUtils::FormatLocalizedString( nsContentUtils::eHTMLPARSER_PROPERTIES, msgId, params, message); NS_ENSURE_SUCCESS(rv, rv); diff --git a/parser/html/nsHtml5TreeOperation.h b/parser/html/nsHtml5TreeOperation.h index 577538a273d1..d03a06ce2f99 100644 --- a/parser/html/nsHtml5TreeOperation.h +++ b/parser/html/nsHtml5TreeOperation.h @@ -199,7 +199,7 @@ class nsHtml5TreeOperation { } inline void Init(eHtml5TreeOperation aOpCode, - PRUnichar* aBuffer, + char16_t* aBuffer, int32_t aLength, nsIContent** aStackParent, nsIContent** aTable) { @@ -214,7 +214,7 @@ class nsHtml5TreeOperation { } inline void Init(eHtml5TreeOperation aOpCode, - PRUnichar* aBuffer, + char16_t* aBuffer, int32_t aLength, nsIContent** aParent) { NS_PRECONDITION(mOpCode == eTreeOpUninitialized, @@ -227,7 +227,7 @@ class nsHtml5TreeOperation { } inline void Init(eHtml5TreeOperation aOpCode, - PRUnichar* aBuffer, + char16_t* aBuffer, int32_t aLength) { NS_PRECONDITION(mOpCode == eTreeOpUninitialized, "Op code must be uninitialized when initializing."); @@ -296,7 +296,7 @@ class nsHtml5TreeOperation { NS_PRECONDITION(mOpCode == eTreeOpUninitialized, "Op code must be uninitialized when initializing."); - PRUnichar* str = NS_StringCloneData(aString); + char16_t* str = NS_StringCloneData(aString); mOpCode = aOpCode; mOne.unicharPtr = str; } @@ -312,7 +312,7 @@ class nsHtml5TreeOperation { mFour.integer = aInt; } - inline void InitAddClass(nsIContent** aNode, const PRUnichar* aClass) { + inline void InitAddClass(nsIContent** aNode, const char16_t* aClass) { NS_PRECONDITION(mOpCode == eTreeOpUninitialized, "Op code must be uninitialized when initializing."); NS_PRECONDITION(aNode, "Initialized tree op with null node."); @@ -320,7 +320,7 @@ class nsHtml5TreeOperation { // aClass must be a literal string that does not need freeing mOpCode = eTreeOpAddClass; mOne.node = aNode; - mTwo.unicharPtr = (PRUnichar*)aClass; + mTwo.unicharPtr = (char16_t*)aClass; } inline void InitAddLineNumberId(nsIContent** aNode, @@ -360,12 +360,12 @@ class nsHtml5TreeOperation { private: - nsresult AppendTextToTextNode(const PRUnichar* aBuffer, + nsresult AppendTextToTextNode(const char16_t* aBuffer, uint32_t aLength, nsIContent* aTextNode, nsHtml5TreeOpExecutor* aBuilder); - nsresult AppendText(const PRUnichar* aBuffer, + nsresult AppendText(const char16_t* aBuffer, uint32_t aLength, nsIContent* aParent, nsHtml5TreeOpExecutor* aBuilder); @@ -386,7 +386,7 @@ class nsHtml5TreeOperation { nsIAtom* atom; nsHtml5HtmlAttributes* attributes; nsHtml5DocumentMode mode; - PRUnichar* unicharPtr; + char16_t* unicharPtr; char* charPtr; nsHtml5TreeOperationStringPair* stringPair; nsAHtml5TreeBuilderState* state; diff --git a/parser/html/nsHtml5UTF16Buffer.cpp b/parser/html/nsHtml5UTF16Buffer.cpp index bb3f6c9fede9..d42376a3e7d7 100644 --- a/parser/html/nsHtml5UTF16Buffer.cpp +++ b/parser/html/nsHtml5UTF16Buffer.cpp @@ -65,7 +65,7 @@ nsHtml5UTF16Buffer::setStart(int32_t start) this->start = start; } -PRUnichar* +char16_t* nsHtml5UTF16Buffer::getBuffer() { return buffer; diff --git a/parser/html/nsHtml5UTF16Buffer.h b/parser/html/nsHtml5UTF16Buffer.h index 9c4cade0dba5..22dc0cc92451 100644 --- a/parser/html/nsHtml5UTF16Buffer.h +++ b/parser/html/nsHtml5UTF16Buffer.h @@ -57,13 +57,13 @@ class nsHtml5Portability; class nsHtml5UTF16Buffer { private: - PRUnichar* buffer; + char16_t* buffer; int32_t start; int32_t end; public: int32_t getStart(); void setStart(int32_t start); - PRUnichar* getBuffer(); + char16_t* getBuffer(); int32_t getEnd(); bool hasMore(); void adjust(bool lastWasCR); diff --git a/parser/html/nsHtml5UTF16BufferCppSupplement.h b/parser/html/nsHtml5UTF16BufferCppSupplement.h index b719db0f79b8..4c374fecc4b3 100644 --- a/parser/html/nsHtml5UTF16BufferCppSupplement.h +++ b/parser/html/nsHtml5UTF16BufferCppSupplement.h @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRUnichar* aBuffer, int32_t aEnd) +nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(char16_t* aBuffer, int32_t aEnd) : buffer(aBuffer) , start(0) , end(aEnd) @@ -24,7 +24,7 @@ nsHtml5UTF16Buffer::DeleteBuffer() void nsHtml5UTF16Buffer::Swap(nsHtml5UTF16Buffer* aOther) { - PRUnichar* tempBuffer = buffer; + char16_t* tempBuffer = buffer; int32_t tempStart = start; int32_t tempEnd = end; buffer = aOther->buffer; diff --git a/parser/html/nsHtml5UTF16BufferHSupplement.h b/parser/html/nsHtml5UTF16BufferHSupplement.h index eff9af698908..938d164e8536 100644 --- a/parser/html/nsHtml5UTF16BufferHSupplement.h +++ b/parser/html/nsHtml5UTF16BufferHSupplement.h @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ protected: - nsHtml5UTF16Buffer(PRUnichar* aBuffer, int32_t aEnd); + nsHtml5UTF16Buffer(char16_t* aBuffer, int32_t aEnd); ~nsHtml5UTF16Buffer(); /** diff --git a/parser/htmlparser/public/nsHTMLTags.h b/parser/htmlparser/public/nsHTMLTags.h index 10ec895c3fb1..748ce77e670a 100644 --- a/parser/htmlparser/public/nsHTMLTags.h +++ b/parser/htmlparser/public/nsHTMLTags.h @@ -44,7 +44,7 @@ public: // Functions for converting string or atom to id static nsHTMLTag LookupTag(const nsAString& aTagName); - static nsHTMLTag CaseSensitiveLookupTag(const PRUnichar* aTagName) + static nsHTMLTag CaseSensitiveLookupTag(const char16_t* aTagName) { NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(aTagName, "null tagname!"); @@ -64,7 +64,7 @@ public: } // Functions for converting an id to a string or atom - static const PRUnichar *GetStringValue(nsHTMLTag aEnum) + static const char16_t *GetStringValue(nsHTMLTag aEnum) { return aEnum <= eHTMLTag_unknown || aEnum > NS_HTML_TAG_MAX ? nullptr : sTagUnicodeTable[aEnum - 1]; @@ -81,7 +81,7 @@ public: private: static nsIAtom* sTagAtomTable[eHTMLTag_userdefined - 1]; - static const PRUnichar* const sTagUnicodeTable[]; + static const char16_t* const sTagUnicodeTable[]; static int32_t gTableRefCount; static PLHashTable* gTagTable; diff --git a/parser/htmlparser/public/nsIParserService.h b/parser/htmlparser/public/nsIParserService.h index 328a2455f370..2906974e9755 100644 --- a/parser/htmlparser/public/nsIParserService.h +++ b/parser/htmlparser/public/nsIParserService.h @@ -63,12 +63,12 @@ class nsIParserService : public nsISupports { * * @param aId The nsHTMLTag enum value to get the tag for. * - * @return const PRUnichar* The tag corresponding to the nsHTMLTag enum + * @return const char16_t* The tag corresponding to the nsHTMLTag enum * value, or nullptr if the enum value doesn't * correspond to a tag (eHTMLTag_unknown, * eHTMLTag_userdefined, eHTMLTag_text, ...). */ - virtual const PRUnichar *HTMLIdToStringTag(int32_t aId) const = 0; + virtual const char16_t *HTMLIdToStringTag(int32_t aId) const = 0; /** * Gets the tag corresponding to the nsHTMLTag enum value in aId. The diff --git a/parser/htmlparser/public/nsParserConstants.h b/parser/htmlparser/public/nsParserConstants.h index bbc250597bd9..e07a7e8780de 100644 --- a/parser/htmlparser/public/nsParserConstants.h +++ b/parser/htmlparser/public/nsParserConstants.h @@ -6,34 +6,34 @@ #ifndef nsParserConstants_h_ #define nsParserConstants_h_ -const PRUnichar kNewLine = '\n'; -const PRUnichar kCR = '\r'; -const PRUnichar kLF = '\n'; -const PRUnichar kTab = '\t'; -const PRUnichar kSpace = ' '; -const PRUnichar kQuote = '"'; -const PRUnichar kApostrophe = '\''; -const PRUnichar kLessThan = '<'; -const PRUnichar kGreaterThan = '>'; -const PRUnichar kAmpersand = '&'; -const PRUnichar kForwardSlash = '/'; -const PRUnichar kBackSlash = '\\'; -const PRUnichar kEqual = '='; -const PRUnichar kMinus = '-'; -const PRUnichar kPlus = '+'; -const PRUnichar kExclamation = '!'; -const PRUnichar kSemicolon = ';'; -const PRUnichar kHashsign = '#'; -const PRUnichar kAsterisk = '*'; -const PRUnichar kUnderbar = '_'; -const PRUnichar kComma = ','; -const PRUnichar kLeftParen = '('; -const PRUnichar kRightParen = ')'; -const PRUnichar kLeftBrace = '{'; -const PRUnichar kRightBrace = '}'; -const PRUnichar kQuestionMark = '?'; -const PRUnichar kLeftSquareBracket = '['; -const PRUnichar kRightSquareBracket = ']'; -const PRUnichar kNullCh = '\0'; +const char16_t kNewLine = '\n'; +const char16_t kCR = '\r'; +const char16_t kLF = '\n'; +const char16_t kTab = '\t'; +const char16_t kSpace = ' '; +const char16_t kQuote = '"'; +const char16_t kApostrophe = '\''; +const char16_t kLessThan = '<'; +const char16_t kGreaterThan = '>'; +const char16_t kAmpersand = '&'; +const char16_t kForwardSlash = '/'; +const char16_t kBackSlash = '\\'; +const char16_t kEqual = '='; +const char16_t kMinus = '-'; +const char16_t kPlus = '+'; +const char16_t kExclamation = '!'; +const char16_t kSemicolon = ';'; +const char16_t kHashsign = '#'; +const char16_t kAsterisk = '*'; +const char16_t kUnderbar = '_'; +const char16_t kComma = ','; +const char16_t kLeftParen = '('; +const char16_t kRightParen = ')'; +const char16_t kLeftBrace = '{'; +const char16_t kRightBrace = '}'; +const char16_t kQuestionMark = '?'; +const char16_t kLeftSquareBracket = '['; +const char16_t kRightSquareBracket = ']'; +const char16_t kNullCh = '\0'; #endif // nsParserConstants_h_ diff --git a/parser/htmlparser/public/nsScannerString.h b/parser/htmlparser/public/nsScannerString.h index b9ebb1f40fc8..3de69f208178 100644 --- a/parser/htmlparser/public/nsScannerString.h +++ b/parser/htmlparser/public/nsScannerString.h @@ -70,11 +70,11 @@ class nsScannerBufferList bool IsInUse() const { return mUsageCount != 0; } - const PRUnichar* DataStart() const { return (const PRUnichar*) (this+1); } - PRUnichar* DataStart() { return ( PRUnichar*) (this+1); } + const char16_t* DataStart() const { return (const char16_t*) (this+1); } + char16_t* DataStart() { return ( char16_t*) (this+1); } - const PRUnichar* DataEnd() const { return mDataEnd; } - PRUnichar* DataEnd() { return mDataEnd; } + const char16_t* DataEnd() const { return mDataEnd; } + char16_t* DataEnd() { return mDataEnd; } const Buffer* Next() const { return getNext(); } Buffer* Next() { return getNext(); } @@ -90,7 +90,7 @@ class nsScannerBufferList friend class nsScannerBufferList; int32_t mUsageCount; - PRUnichar* mDataEnd; + char16_t* mDataEnd; }; /** @@ -104,7 +104,7 @@ class nsScannerBufferList Position() {} - Position( Buffer* buffer, PRUnichar* position ) + Position( Buffer* buffer, char16_t* position ) : mBuffer(buffer) , mPosition(position) {} @@ -118,7 +118,7 @@ class nsScannerBufferList static size_t Distance( const Position& p1, const Position& p2 ); Buffer* mBuffer; - PRUnichar* mPosition; + char16_t* mPosition; }; static Buffer* AllocBufferFromString( const nsAString& ); @@ -164,8 +164,8 @@ struct nsScannerFragment typedef nsScannerBufferList::Buffer Buffer; const Buffer* mBuffer; - const PRUnichar* mFragmentStart; - const PRUnichar* mFragmentEnd; + const char16_t* mFragmentStart; + const char16_t* mFragmentEnd; }; @@ -193,7 +193,7 @@ class nsScannerSubstring size_type Length() const { return mLength; } - int32_t CountChar( PRUnichar ) const; + int32_t CountChar( char16_t ) const; void Rebind( const nsScannerSubstring&, const nsScannerIterator&, const nsScannerIterator& ); void Rebind( const nsAString& ); @@ -267,7 +267,7 @@ class nsScannerString : public nsScannerSubstring // any other way you want to do this? void UngetReadable(const nsAString& aReadable, const nsScannerIterator& aCurrentPosition); - void ReplaceCharacter(nsScannerIterator& aPosition, PRUnichar aChar); + void ReplaceCharacter(nsScannerIterator& aPosition, char16_t aChar); }; @@ -326,15 +326,15 @@ class nsScannerIterator public: typedef nsScannerIterator self_type; typedef ptrdiff_t difference_type; - typedef PRUnichar value_type; - typedef const PRUnichar* pointer; - typedef const PRUnichar& reference; + typedef char16_t value_type; + typedef const char16_t* pointer; + typedef const char16_t& reference; typedef nsScannerSubstring::Buffer Buffer; protected: nsScannerFragment mFragment; - const PRUnichar* mPosition; + const char16_t* mPosition; const nsScannerSubstring* mOwner; friend class nsScannerSubstring; @@ -353,7 +353,7 @@ class nsScannerIterator return mPosition; } - PRUnichar operator*() const + char16_t operator*() const { return *get(); } @@ -516,7 +516,7 @@ operator!=( const nsScannerIterator& lhs, const nsScannerIterator& rhs ) inline nsScannerBufferList::Position::Position(const nsScannerIterator& aIter) : mBuffer(const_cast(aIter.buffer())) - , mPosition(const_cast(aIter.get())) + , mPosition(const_cast(aIter.get())) {} inline @@ -524,7 +524,7 @@ nsScannerBufferList::Position& nsScannerBufferList::Position::operator=(const nsScannerIterator& aIter) { mBuffer = const_cast(aIter.buffer()); - mPosition = const_cast(aIter.get()); + mPosition = const_cast(aIter.get()); return *this; } @@ -576,7 +576,7 @@ AppendUnicodeTo( const nsScannerIterator& aSrcStart, nsScannerSharedSubstring& aDest ); bool -FindCharInReadable( PRUnichar aChar, +FindCharInReadable( char16_t aChar, nsScannerIterator& aStart, const nsScannerIterator& aEnd ); diff --git a/parser/htmlparser/src/nsExpatDriver.cpp b/parser/htmlparser/src/nsExpatDriver.cpp index 306a9a0121c0..63f7713e5d4c 100644 --- a/parser/htmlparser/src/nsExpatDriver.cpp +++ b/parser/htmlparser/src/nsExpatDriver.cpp @@ -30,7 +30,7 @@ #define kExpatSeparatorChar 0xFFFF -static const PRUnichar kUTF16[] = { 'U', 'T', 'F', '-', '1', '6', '\0' }; +static const char16_t kUTF16[] = { 'U', 'T', 'F', '-', '1', '6', '\0' }; #ifdef PR_LOGGING static PRLogModuleInfo * @@ -272,7 +272,7 @@ static const nsCatalogData kCatalogTable[] = { }; static const nsCatalogData* -LookupCatalogData(const PRUnichar* aPublicID) +LookupCatalogData(const char16_t* aPublicID) { nsDependentString publicID(aPublicID); @@ -362,8 +362,8 @@ nsExpatDriver::~nsExpatDriver() } nsresult -nsExpatDriver::HandleStartElement(const PRUnichar *aValue, - const PRUnichar **aAtts) +nsExpatDriver::HandleStartElement(const char16_t *aValue, + const char16_t **aAtts) { NS_ASSERTION(mSink, "content sink not found!"); @@ -390,7 +390,7 @@ nsExpatDriver::HandleStartElement(const PRUnichar *aValue, } nsresult -nsExpatDriver::HandleEndElement(const PRUnichar *aValue) +nsExpatDriver::HandleEndElement(const char16_t *aValue) { NS_ASSERTION(mSink, "content sink not found!"); NS_ASSERTION(mInternalState != NS_ERROR_HTMLPARSER_BLOCK, @@ -405,7 +405,7 @@ nsExpatDriver::HandleEndElement(const PRUnichar *aValue) } nsresult -nsExpatDriver::HandleCharacterData(const PRUnichar *aValue, +nsExpatDriver::HandleCharacterData(const char16_t *aValue, const uint32_t aLength) { NS_ASSERTION(mSink, "content sink not found!"); @@ -422,7 +422,7 @@ nsExpatDriver::HandleCharacterData(const PRUnichar *aValue, } nsresult -nsExpatDriver::HandleComment(const PRUnichar *aValue) +nsExpatDriver::HandleComment(const char16_t *aValue) { NS_ASSERTION(mSink, "content sink not found!"); @@ -445,8 +445,8 @@ nsExpatDriver::HandleComment(const PRUnichar *aValue) } nsresult -nsExpatDriver::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +nsExpatDriver::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { NS_ASSERTION(mSink, "content sink not found!"); @@ -472,8 +472,8 @@ nsExpatDriver::HandleProcessingInstruction(const PRUnichar *aTarget, } nsresult -nsExpatDriver::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +nsExpatDriver::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { if (mSink) { @@ -485,7 +485,7 @@ nsExpatDriver::HandleXMLDeclaration(const PRUnichar *aVersion, } nsresult -nsExpatDriver::HandleDefault(const PRUnichar *aValue, +nsExpatDriver::HandleDefault(const char16_t *aValue, const uint32_t aLength) { NS_ASSERTION(mSink, "content sink not found!"); @@ -537,8 +537,8 @@ nsExpatDriver::HandleEndCdataSection() } nsresult -nsExpatDriver::HandleStartNamespaceDecl(const PRUnichar* aPrefix, - const PRUnichar* aUri) +nsExpatDriver::HandleStartNamespaceDecl(const char16_t* aPrefix, + const char16_t* aUri) { if (mExtendedSink) { nsresult rv = mExtendedSink->HandleStartNamespaceDecl(aPrefix, aUri); @@ -548,7 +548,7 @@ nsExpatDriver::HandleStartNamespaceDecl(const PRUnichar* aPrefix, } nsresult -nsExpatDriver::HandleEndNamespaceDecl(const PRUnichar* aPrefix) +nsExpatDriver::HandleEndNamespaceDecl(const char16_t* aPrefix) { if (mExtendedSink && mInternalState != NS_ERROR_HTMLPARSER_STOPPARSING) { nsresult rv = mExtendedSink->HandleEndNamespaceDecl(aPrefix); @@ -558,10 +558,10 @@ nsExpatDriver::HandleEndNamespaceDecl(const PRUnichar* aPrefix) } nsresult -nsExpatDriver::HandleNotationDecl(const PRUnichar* aNotationName, - const PRUnichar* aBase, - const PRUnichar* aSysid, - const PRUnichar* aPubid) +nsExpatDriver::HandleNotationDecl(const char16_t* aNotationName, + const char16_t* aBase, + const char16_t* aSysid, + const char16_t* aPubid) { if (mExtendedSink) { nsresult rv = mExtendedSink->HandleNotationDecl(aNotationName, aSysid, @@ -572,11 +572,11 @@ nsExpatDriver::HandleNotationDecl(const PRUnichar* aNotationName, } nsresult -nsExpatDriver::HandleUnparsedEntityDecl(const PRUnichar* aEntityName, - const PRUnichar* aBase, - const PRUnichar* aSysid, - const PRUnichar* aPubid, - const PRUnichar* aNotationName) +nsExpatDriver::HandleUnparsedEntityDecl(const char16_t* aEntityName, + const char16_t* aBase, + const char16_t* aSysid, + const char16_t* aPubid, + const char16_t* aNotationName) { if (mExtendedSink) { nsresult rv = mExtendedSink->HandleUnparsedEntityDecl(aEntityName, @@ -589,9 +589,9 @@ nsExpatDriver::HandleUnparsedEntityDecl(const PRUnichar* aEntityName, } nsresult -nsExpatDriver::HandleStartDoctypeDecl(const PRUnichar* aDoctypeName, - const PRUnichar* aSysid, - const PRUnichar* aPubid, +nsExpatDriver::HandleStartDoctypeDecl(const char16_t* aDoctypeName, + const char16_t* aSysid, + const char16_t* aPubid, bool aHasInternalSubset) { mDoctypeName = aDoctypeName; @@ -647,14 +647,14 @@ nsExpatDriver::HandleEndDoctypeDecl() static NS_METHOD ExternalDTDStreamReaderFunc(nsIUnicharInputStream* aIn, void* aClosure, - const PRUnichar* aFromSegment, + const char16_t* aFromSegment, uint32_t aToOffset, uint32_t aCount, uint32_t *aWriteCount) { // Pass the buffer to expat for parsing. if (XML_Parse((XML_Parser)aClosure, (const char *)aFromSegment, - aCount * sizeof(PRUnichar), 0) == XML_STATUS_OK) { + aCount * sizeof(char16_t), 0) == XML_STATUS_OK) { *aWriteCount = aCount; return NS_OK; @@ -666,15 +666,15 @@ ExternalDTDStreamReaderFunc(nsIUnicharInputStream* aIn, } int -nsExpatDriver::HandleExternalEntityRef(const PRUnichar *openEntityNames, - const PRUnichar *base, - const PRUnichar *systemId, - const PRUnichar *publicId) +nsExpatDriver::HandleExternalEntityRef(const char16_t *openEntityNames, + const char16_t *base, + const char16_t *systemId, + const char16_t *publicId) { if (mInInternalSubset && !mInExternalDTD && openEntityNames) { - mInternalSubset.Append(PRUnichar('%')); + mInternalSubset.Append(char16_t('%')); mInternalSubset.Append(nsDependentString(openEntityNames)); - mInternalSubset.Append(PRUnichar(';')); + mInternalSubset.Append(char16_t(';')); } // Load the external entity into a buffer. @@ -730,9 +730,9 @@ nsExpatDriver::HandleExternalEntityRef(const PRUnichar *openEntityNames, } nsresult -nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr, - const PRUnichar* aURLStr, - const PRUnichar* aBaseURL, +nsExpatDriver::OpenInputStreamFromExternalDTD(const char16_t* aFPIStr, + const char16_t* aURLStr, + const char16_t* aBaseURL, nsIInputStream** aStream, nsAString& aAbsURL) { @@ -801,8 +801,8 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr, } static nsresult -CreateErrorText(const PRUnichar* aDescription, - const PRUnichar* aSourceURL, +CreateErrorText(const char16_t* aDescription, + const char16_t* aSourceURL, const uint32_t aLineNumber, const uint32_t aColNumber, nsString& aErrorString) @@ -816,7 +816,7 @@ CreateErrorText(const PRUnichar* aDescription, NS_ENSURE_SUCCESS(rv, rv); // XML Parsing Error: %1$S\nLocation: %2$S\nLine Number %3$u, Column %4$u: - PRUnichar *message = nsTextFormatter::smprintf(msg.get(), aDescription, + char16_t *message = nsTextFormatter::smprintf(msg.get(), aDescription, aSourceURL, aLineNumber, aColNumber); if (!message) { @@ -831,10 +831,10 @@ CreateErrorText(const PRUnichar* aDescription, static nsresult AppendErrorPointer(const int32_t aColNumber, - const PRUnichar *aSourceLine, + const char16_t *aSourceLine, nsString& aSourceString) { - aSourceString.Append(PRUnichar('\n')); + aSourceString.Append(char16_t('\n')); // Last character will be '^'. int32_t last = aColNumber - 1; @@ -848,11 +848,11 @@ AppendErrorPointer(const int32_t aColNumber, minuses += add; } else { - aSourceString.Append(PRUnichar('-')); + aSourceString.Append(char16_t('-')); ++minuses; } } - aSourceString.Append(PRUnichar('^')); + aSourceString.Append(char16_t('^')); return NS_OK; } @@ -879,10 +879,10 @@ nsExpatDriver::HandleError() * and we use 0xFFFF for the . * */ - const PRUnichar *mismatch = MOZ_XML_GetMismatchedTag(mExpatParser); - const PRUnichar *uriEnd = nullptr; - const PRUnichar *nameEnd = nullptr; - const PRUnichar *pos; + const char16_t *mismatch = MOZ_XML_GetMismatchedTag(mExpatParser); + const char16_t *uriEnd = nullptr; + const char16_t *nameEnd = nullptr; + const char16_t *pos; for (pos = mismatch; *pos; ++pos) { if (*pos == kExpatSeparatorChar) { if (uriEnd) { @@ -898,9 +898,9 @@ nsExpatDriver::HandleError() if (uriEnd && nameEnd) { // We have a prefix. tagName.Append(nameEnd + 1, pos - nameEnd - 1); - tagName.Append(PRUnichar(':')); + tagName.Append(char16_t(':')); } - const PRUnichar *nameStart = uriEnd ? uriEnd + 1 : mismatch; + const char16_t *nameStart = uriEnd ? uriEnd + 1 : mismatch; tagName.Append(nameStart, (nameEnd ? nameEnd : pos) - nameStart); nsAutoString msg; @@ -908,7 +908,7 @@ nsExpatDriver::HandleError() "Expected", msg); // . Expected: . - PRUnichar *message = nsTextFormatter::smprintf(msg.get(), tagName.get()); + char16_t *message = nsTextFormatter::smprintf(msg.get(), tagName.get()); if (!message) { return NS_ERROR_OUT_OF_MEMORY; } @@ -968,7 +968,7 @@ nsExpatDriver::HandleError() } void -nsExpatDriver::ParseBuffer(const PRUnichar *aBuffer, +nsExpatDriver::ParseBuffer(const char16_t *aBuffer, uint32_t aLength, bool aIsFinal, uint32_t *aConsumed) @@ -978,8 +978,8 @@ nsExpatDriver::ParseBuffer(const PRUnichar *aBuffer, "Useless call, we won't call Expat"); NS_PRECONDITION(!BlockedOrInterrupted() || !aBuffer, "Non-null buffer when resuming"); - NS_PRECONDITION(XML_GetCurrentByteIndex(mExpatParser) % sizeof(PRUnichar) == 0, - "Consumed part of a PRUnichar?"); + NS_PRECONDITION(XML_GetCurrentByteIndex(mExpatParser) % sizeof(char16_t) == 0, + "Consumed part of a char16_t?"); if (mExpatParser && (mInternalState == NS_OK || BlockedOrInterrupted())) { int32_t parserBytesBefore = XML_GetCurrentByteIndex(mExpatParser); @@ -993,7 +993,7 @@ nsExpatDriver::ParseBuffer(const PRUnichar *aBuffer, else { status = XML_Parse(mExpatParser, reinterpret_cast(aBuffer), - aLength * sizeof(PRUnichar), aIsFinal); + aLength * sizeof(char16_t), aIsFinal); } int32_t parserBytesConsumed = XML_GetCurrentByteIndex(mExpatParser); @@ -1001,11 +1001,11 @@ nsExpatDriver::ParseBuffer(const PRUnichar *aBuffer, NS_ASSERTION(parserBytesConsumed >= 0, "Unexpected value"); NS_ASSERTION(parserBytesConsumed >= parserBytesBefore, "How'd this happen?"); - NS_ASSERTION(parserBytesConsumed % sizeof(PRUnichar) == 0, - "Consumed part of a PRUnichar?"); + NS_ASSERTION(parserBytesConsumed % sizeof(char16_t) == 0, + "Consumed part of a char16_t?"); // Consumed something. - *aConsumed = (parserBytesConsumed - parserBytesBefore) / sizeof(PRUnichar); + *aConsumed = (parserBytesConsumed - parserBytesBefore) / sizeof(char16_t); NS_ASSERTION(*aConsumed <= aLength + mExpatBuffered, "Too many bytes consumed?"); @@ -1050,7 +1050,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) bool noMoreBuffers = start == end && mIsFinalChunk; bool blocked = BlockedOrInterrupted(); - const PRUnichar *buffer; + const char16_t *buffer; uint32_t length; if (blocked || noMoreBuffers) { // If we're blocked we just resume Expat so we don't need a buffer, if @@ -1145,7 +1145,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) while (lastLine != end) { length = uint32_t(lastLine.size_forward()); uint32_t endOffset = 0; - const PRUnichar *buffer = lastLine.get(); + const char16_t *buffer = lastLine.get(); while (endOffset < length && buffer[endOffset] != '\n' && buffer[endOffset] != '\r') { ++endOffset; @@ -1211,7 +1211,7 @@ nsExpatDriver::WillBuildModel(const CParserContext& aParserContext, PR_Free }; - static const PRUnichar kExpatSeparator[] = { kExpatSeparatorChar, '\0' }; + static const char16_t kExpatSeparator[] = { kExpatSeparatorChar, '\0' }; mExpatParser = XML_ParserCreate_MM(kUTF16, &memsuite, kExpatSeparator); NS_ENSURE_TRUE(mExpatParser, NS_ERROR_FAILURE); diff --git a/parser/htmlparser/src/nsExpatDriver.h b/parser/htmlparser/src/nsExpatDriver.h index af98c006499f..4b047005fe20 100644 --- a/parser/htmlparser/src/nsExpatDriver.h +++ b/parser/htmlparser/src/nsExpatDriver.h @@ -32,45 +32,45 @@ public: nsExpatDriver(); virtual ~nsExpatDriver(); - int HandleExternalEntityRef(const PRUnichar *aOpenEntityNames, - const PRUnichar *aBase, - const PRUnichar *aSystemId, - const PRUnichar *aPublicId); - nsresult HandleStartElement(const PRUnichar *aName, const PRUnichar **aAtts); - nsresult HandleEndElement(const PRUnichar *aName); - nsresult HandleCharacterData(const PRUnichar *aCData, const uint32_t aLength); - nsresult HandleComment(const PRUnichar *aName); - nsresult HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData); - nsresult HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, + int HandleExternalEntityRef(const char16_t *aOpenEntityNames, + const char16_t *aBase, + const char16_t *aSystemId, + const char16_t *aPublicId); + nsresult HandleStartElement(const char16_t *aName, const char16_t **aAtts); + nsresult HandleEndElement(const char16_t *aName); + nsresult HandleCharacterData(const char16_t *aCData, const uint32_t aLength); + nsresult HandleComment(const char16_t *aName); + nsresult HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData); + nsresult HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone); - nsresult HandleDefault(const PRUnichar *aData, const uint32_t aLength); + nsresult HandleDefault(const char16_t *aData, const uint32_t aLength); nsresult HandleStartCdataSection(); nsresult HandleEndCdataSection(); - nsresult HandleStartDoctypeDecl(const PRUnichar* aDoctypeName, - const PRUnichar* aSysid, - const PRUnichar* aPubid, + nsresult HandleStartDoctypeDecl(const char16_t* aDoctypeName, + const char16_t* aSysid, + const char16_t* aPubid, bool aHasInternalSubset); nsresult HandleEndDoctypeDecl(); - nsresult HandleStartNamespaceDecl(const PRUnichar* aPrefix, - const PRUnichar* aUri); - nsresult HandleEndNamespaceDecl(const PRUnichar* aPrefix); - nsresult HandleNotationDecl(const PRUnichar* aNotationName, - const PRUnichar* aBase, - const PRUnichar* aSysid, - const PRUnichar* aPubid); - nsresult HandleUnparsedEntityDecl(const PRUnichar* aEntityName, - const PRUnichar* aBase, - const PRUnichar* aSysid, - const PRUnichar* aPubid, - const PRUnichar* aNotationName); + nsresult HandleStartNamespaceDecl(const char16_t* aPrefix, + const char16_t* aUri); + nsresult HandleEndNamespaceDecl(const char16_t* aPrefix); + nsresult HandleNotationDecl(const char16_t* aNotationName, + const char16_t* aBase, + const char16_t* aSysid, + const char16_t* aPubid); + nsresult HandleUnparsedEntityDecl(const char16_t* aEntityName, + const char16_t* aBase, + const char16_t* aSysid, + const char16_t* aPubid, + const char16_t* aNotationName); private: // Load up an external stream to get external entity information - nsresult OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr, - const PRUnichar* aURLStr, - const PRUnichar* aBaseURL, + nsresult OpenInputStreamFromExternalDTD(const char16_t* aFPIStr, + const char16_t* aURLStr, + const char16_t* aBaseURL, nsIInputStream** aStream, nsAString& aAbsURL); @@ -82,7 +82,7 @@ private: * * @param aBuffer the buffer to pass to Expat. May be null. * @param aLength the length of the buffer to pass to Expat (in number of - * PRUnichar's). Must be 0 if aBuffer is null and > 0 if + * char16_t's). Must be 0 if aBuffer is null and > 0 if * aBuffer is not null. * @param aIsFinal whether there will definitely not be any more new buffers * passed in to ParseBuffer @@ -90,7 +90,7 @@ private: * doesn't include the PRUnichars that Expat stored in * its buffer but didn't parse yet. */ - void ParseBuffer(const PRUnichar *aBuffer, uint32_t aLength, bool aIsFinal, + void ParseBuffer(const char16_t *aBuffer, uint32_t aLength, bool aIsFinal, uint32_t *aConsumed); nsresult HandleError(); diff --git a/parser/htmlparser/src/nsHTMLTags.cpp b/parser/htmlparser/src/nsHTMLTags.cpp index 98ab26e72abb..4d61844ee490 100644 --- a/parser/htmlparser/src/nsHTMLTags.cpp +++ b/parser/htmlparser/src/nsHTMLTags.cpp @@ -17,268 +17,268 @@ using namespace mozilla; // C++ sucks! There's no way to do this with a macro, at least not // that I know, if you know how to do this with a macro then please do // so... -static const PRUnichar sHTMLTagUnicodeName_a[] = +static const char16_t sHTMLTagUnicodeName_a[] = {'a', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_abbr[] = +static const char16_t sHTMLTagUnicodeName_abbr[] = {'a', 'b', 'b', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_acronym[] = +static const char16_t sHTMLTagUnicodeName_acronym[] = {'a', 'c', 'r', 'o', 'n', 'y', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_address[] = +static const char16_t sHTMLTagUnicodeName_address[] = {'a', 'd', 'd', 'r', 'e', 's', 's', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_applet[] = +static const char16_t sHTMLTagUnicodeName_applet[] = {'a', 'p', 'p', 'l', 'e', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_area[] = +static const char16_t sHTMLTagUnicodeName_area[] = {'a', 'r', 'e', 'a', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_article[] = +static const char16_t sHTMLTagUnicodeName_article[] = {'a', 'r', 't', 'i', 'c', 'l', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_aside[] = +static const char16_t sHTMLTagUnicodeName_aside[] = {'a', 's', 'i', 'd', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_audio[] = +static const char16_t sHTMLTagUnicodeName_audio[] = {'a', 'u', 'd', 'i', 'o', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_b[] = +static const char16_t sHTMLTagUnicodeName_b[] = {'b', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_base[] = +static const char16_t sHTMLTagUnicodeName_base[] = {'b', 'a', 's', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_basefont[] = +static const char16_t sHTMLTagUnicodeName_basefont[] = {'b', 'a', 's', 'e', 'f', 'o', 'n', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_bdo[] = +static const char16_t sHTMLTagUnicodeName_bdo[] = {'b', 'd', 'o', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_bgsound[] = +static const char16_t sHTMLTagUnicodeName_bgsound[] = {'b', 'g', 's', 'o', 'u', 'n', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_big[] = +static const char16_t sHTMLTagUnicodeName_big[] = {'b', 'i', 'g', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_blockquote[] = +static const char16_t sHTMLTagUnicodeName_blockquote[] = {'b', 'l', 'o', 'c', 'k', 'q', 'u', 'o', 't', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_body[] = +static const char16_t sHTMLTagUnicodeName_body[] = {'b', 'o', 'd', 'y', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_br[] = +static const char16_t sHTMLTagUnicodeName_br[] = {'b', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_button[] = +static const char16_t sHTMLTagUnicodeName_button[] = {'b', 'u', 't', 't', 'o', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_canvas[] = +static const char16_t sHTMLTagUnicodeName_canvas[] = {'c', 'a', 'n', 'v', 'a', 's', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_caption[] = +static const char16_t sHTMLTagUnicodeName_caption[] = {'c', 'a', 'p', 't', 'i', 'o', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_center[] = +static const char16_t sHTMLTagUnicodeName_center[] = {'c', 'e', 'n', 't', 'e', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_cite[] = +static const char16_t sHTMLTagUnicodeName_cite[] = {'c', 'i', 't', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_code[] = +static const char16_t sHTMLTagUnicodeName_code[] = {'c', 'o', 'd', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_col[] = +static const char16_t sHTMLTagUnicodeName_col[] = {'c', 'o', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_colgroup[] = +static const char16_t sHTMLTagUnicodeName_colgroup[] = {'c', 'o', 'l', 'g', 'r', 'o', 'u', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_content[] = +static const char16_t sHTMLTagUnicodeName_content[] = {'c', 'o', 'n', 't', 'e', 'n', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_data[] = +static const char16_t sHTMLTagUnicodeName_data[] = {'d', 'a', 't', 'a', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_datalist[] = +static const char16_t sHTMLTagUnicodeName_datalist[] = {'d', 'a', 't', 'a', 'l', 'i', 's', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_dd[] = +static const char16_t sHTMLTagUnicodeName_dd[] = {'d', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_del[] = +static const char16_t sHTMLTagUnicodeName_del[] = {'d', 'e', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_dfn[] = +static const char16_t sHTMLTagUnicodeName_dfn[] = {'d', 'f', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_dir[] = +static const char16_t sHTMLTagUnicodeName_dir[] = {'d', 'i', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_div[] = +static const char16_t sHTMLTagUnicodeName_div[] = {'d', 'i', 'v', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_dl[] = +static const char16_t sHTMLTagUnicodeName_dl[] = {'d', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_dt[] = +static const char16_t sHTMLTagUnicodeName_dt[] = {'d', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_em[] = +static const char16_t sHTMLTagUnicodeName_em[] = {'e', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_embed[] = +static const char16_t sHTMLTagUnicodeName_embed[] = {'e', 'm', 'b', 'e', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_fieldset[] = +static const char16_t sHTMLTagUnicodeName_fieldset[] = {'f', 'i', 'e', 'l', 'd', 's', 'e', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_figcaption[] = +static const char16_t sHTMLTagUnicodeName_figcaption[] = {'f', 'i', 'g', 'c', 'a', 'p', 't', 'i', 'o', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_figure[] = +static const char16_t sHTMLTagUnicodeName_figure[] = {'f', 'i', 'g', 'u', 'r', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_font[] = +static const char16_t sHTMLTagUnicodeName_font[] = {'f', 'o', 'n', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_footer[] = +static const char16_t sHTMLTagUnicodeName_footer[] = {'f', 'o', 'o', 't', 'e', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_form[] = +static const char16_t sHTMLTagUnicodeName_form[] = {'f', 'o', 'r', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_frame[] = +static const char16_t sHTMLTagUnicodeName_frame[] = {'f', 'r', 'a', 'm', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_frameset[] = +static const char16_t sHTMLTagUnicodeName_frameset[] = {'f', 'r', 'a', 'm', 'e', 's', 'e', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h1[] = +static const char16_t sHTMLTagUnicodeName_h1[] = {'h', '1', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h2[] = +static const char16_t sHTMLTagUnicodeName_h2[] = {'h', '2', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h3[] = +static const char16_t sHTMLTagUnicodeName_h3[] = {'h', '3', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h4[] = +static const char16_t sHTMLTagUnicodeName_h4[] = {'h', '4', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h5[] = +static const char16_t sHTMLTagUnicodeName_h5[] = {'h', '5', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_h6[] = +static const char16_t sHTMLTagUnicodeName_h6[] = {'h', '6', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_head[] = +static const char16_t sHTMLTagUnicodeName_head[] = {'h', 'e', 'a', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_header[] = +static const char16_t sHTMLTagUnicodeName_header[] = {'h', 'e', 'a', 'd', 'e', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_hgroup[] = +static const char16_t sHTMLTagUnicodeName_hgroup[] = {'h', 'g', 'r', 'o', 'u', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_hr[] = +static const char16_t sHTMLTagUnicodeName_hr[] = {'h', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_html[] = +static const char16_t sHTMLTagUnicodeName_html[] = {'h', 't', 'm', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_i[] = +static const char16_t sHTMLTagUnicodeName_i[] = {'i', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_iframe[] = +static const char16_t sHTMLTagUnicodeName_iframe[] = {'i', 'f', 'r', 'a', 'm', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_image[] = +static const char16_t sHTMLTagUnicodeName_image[] = {'i', 'm', 'a', 'g', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_img[] = +static const char16_t sHTMLTagUnicodeName_img[] = {'i', 'm', 'g', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_input[] = +static const char16_t sHTMLTagUnicodeName_input[] = {'i', 'n', 'p', 'u', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_ins[] = +static const char16_t sHTMLTagUnicodeName_ins[] = {'i', 'n', 's', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_kbd[] = +static const char16_t sHTMLTagUnicodeName_kbd[] = {'k', 'b', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_keygen[] = +static const char16_t sHTMLTagUnicodeName_keygen[] = {'k', 'e', 'y', 'g', 'e', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_label[] = +static const char16_t sHTMLTagUnicodeName_label[] = {'l', 'a', 'b', 'e', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_legend[] = +static const char16_t sHTMLTagUnicodeName_legend[] = {'l', 'e', 'g', 'e', 'n', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_li[] = +static const char16_t sHTMLTagUnicodeName_li[] = {'l', 'i', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_link[] = +static const char16_t sHTMLTagUnicodeName_link[] = {'l', 'i', 'n', 'k', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_listing[] = +static const char16_t sHTMLTagUnicodeName_listing[] = {'l', 'i', 's', 't', 'i', 'n', 'g', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_main[] = +static const char16_t sHTMLTagUnicodeName_main[] = {'m', 'a', 'i', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_map[] = +static const char16_t sHTMLTagUnicodeName_map[] = {'m', 'a', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_mark[] = +static const char16_t sHTMLTagUnicodeName_mark[] = {'m', 'a', 'r', 'k', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_marquee[] = +static const char16_t sHTMLTagUnicodeName_marquee[] = {'m', 'a', 'r', 'q', 'u', 'e', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_menu[] = +static const char16_t sHTMLTagUnicodeName_menu[] = {'m', 'e', 'n', 'u', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_menuitem[] = +static const char16_t sHTMLTagUnicodeName_menuitem[] = {'m', 'e', 'n', 'u', 'i', 't', 'e', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_meta[] = +static const char16_t sHTMLTagUnicodeName_meta[] = {'m', 'e', 't', 'a', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_meter[] = +static const char16_t sHTMLTagUnicodeName_meter[] = {'m', 'e', 't', 'e', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_multicol[] = +static const char16_t sHTMLTagUnicodeName_multicol[] = {'m', 'u', 'l', 't', 'i', 'c', 'o', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_nav[] = +static const char16_t sHTMLTagUnicodeName_nav[] = {'n', 'a', 'v', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_nobr[] = +static const char16_t sHTMLTagUnicodeName_nobr[] = {'n', 'o', 'b', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_noembed[] = +static const char16_t sHTMLTagUnicodeName_noembed[] = {'n', 'o', 'e', 'm', 'b', 'e', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_noframes[] = +static const char16_t sHTMLTagUnicodeName_noframes[] = {'n', 'o', 'f', 'r', 'a', 'm', 'e', 's', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_noscript[] = +static const char16_t sHTMLTagUnicodeName_noscript[] = {'n', 'o', 's', 'c', 'r', 'i', 'p', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_object[] = +static const char16_t sHTMLTagUnicodeName_object[] = {'o', 'b', 'j', 'e', 'c', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_ol[] = +static const char16_t sHTMLTagUnicodeName_ol[] = {'o', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_optgroup[] = +static const char16_t sHTMLTagUnicodeName_optgroup[] = {'o', 'p', 't', 'g', 'r', 'o', 'u', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_option[] = +static const char16_t sHTMLTagUnicodeName_option[] = {'o', 'p', 't', 'i', 'o', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_output[] = +static const char16_t sHTMLTagUnicodeName_output[] = {'o', 'u', 't', 'p', 'u', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_p[] = +static const char16_t sHTMLTagUnicodeName_p[] = {'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_param[] = +static const char16_t sHTMLTagUnicodeName_param[] = {'p', 'a', 'r', 'a', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_plaintext[] = +static const char16_t sHTMLTagUnicodeName_plaintext[] = {'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_pre[] = +static const char16_t sHTMLTagUnicodeName_pre[] = {'p', 'r', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_progress[] = +static const char16_t sHTMLTagUnicodeName_progress[] = {'p', 'r', 'o', 'g', 'r', 'e', 's', 's', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_q[] = +static const char16_t sHTMLTagUnicodeName_q[] = {'q', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_s[] = +static const char16_t sHTMLTagUnicodeName_s[] = {'s', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_samp[] = +static const char16_t sHTMLTagUnicodeName_samp[] = {'s', 'a', 'm', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_script[] = +static const char16_t sHTMLTagUnicodeName_script[] = {'s', 'c', 'r', 'i', 'p', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_section[] = +static const char16_t sHTMLTagUnicodeName_section[] = {'s', 'e', 'c', 't', 'i', 'o', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_select[] = +static const char16_t sHTMLTagUnicodeName_select[] = {'s', 'e', 'l', 'e', 'c', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_shadow[] = +static const char16_t sHTMLTagUnicodeName_shadow[] = {'s', 'h', 'a', 'd', 'o', 'w', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_small[] = +static const char16_t sHTMLTagUnicodeName_small[] = {'s', 'm', 'a', 'l', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_source[] = +static const char16_t sHTMLTagUnicodeName_source[] = {'s', 'o', 'u', 'r', 'c', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_span[] = +static const char16_t sHTMLTagUnicodeName_span[] = {'s', 'p', 'a', 'n', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_strike[] = +static const char16_t sHTMLTagUnicodeName_strike[] = {'s', 't', 'r', 'i', 'k', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_strong[] = +static const char16_t sHTMLTagUnicodeName_strong[] = {'s', 't', 'r', 'o', 'n', 'g', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_style[] = +static const char16_t sHTMLTagUnicodeName_style[] = {'s', 't', 'y', 'l', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_sub[] = +static const char16_t sHTMLTagUnicodeName_sub[] = {'s', 'u', 'b', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_sup[] = +static const char16_t sHTMLTagUnicodeName_sup[] = {'s', 'u', 'p', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_table[] = +static const char16_t sHTMLTagUnicodeName_table[] = {'t', 'a', 'b', 'l', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_tbody[] = +static const char16_t sHTMLTagUnicodeName_tbody[] = {'t', 'b', 'o', 'd', 'y', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_td[] = +static const char16_t sHTMLTagUnicodeName_td[] = {'t', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_textarea[] = +static const char16_t sHTMLTagUnicodeName_textarea[] = {'t', 'e', 'x', 't', 'a', 'r', 'e', 'a', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_tfoot[] = +static const char16_t sHTMLTagUnicodeName_tfoot[] = {'t', 'f', 'o', 'o', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_th[] = +static const char16_t sHTMLTagUnicodeName_th[] = {'t', 'h', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_thead[] = +static const char16_t sHTMLTagUnicodeName_thead[] = {'t', 'h', 'e', 'a', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_template[] = +static const char16_t sHTMLTagUnicodeName_template[] = {'t', 'e', 'm', 'p', 'l', 'a', 't', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_time[] = +static const char16_t sHTMLTagUnicodeName_time[] = {'t', 'i', 'm', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_title[] = +static const char16_t sHTMLTagUnicodeName_title[] = {'t', 'i', 't', 'l', 'e', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_tr[] = +static const char16_t sHTMLTagUnicodeName_tr[] = {'t', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_track[] = +static const char16_t sHTMLTagUnicodeName_track[] = {'t', 'r', 'a', 'c', 'k', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_tt[] = +static const char16_t sHTMLTagUnicodeName_tt[] = {'t', 't', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_u[] = +static const char16_t sHTMLTagUnicodeName_u[] = {'u', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_ul[] = +static const char16_t sHTMLTagUnicodeName_ul[] = {'u', 'l', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_var[] = +static const char16_t sHTMLTagUnicodeName_var[] = {'v', 'a', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_video[] = +static const char16_t sHTMLTagUnicodeName_video[] = {'v', 'i', 'd', 'e', 'o', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_wbr[] = +static const char16_t sHTMLTagUnicodeName_wbr[] = {'w', 'b', 'r', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_xmp[] = +static const char16_t sHTMLTagUnicodeName_xmp[] = {'x', 'm', 'p', '\0'}; // static array of unicode tag names #define HTML_TAG(_tag, _classname) sHTMLTagUnicodeName_##_tag, #define HTML_HTMLELEMENT_TAG(_tag) sHTMLTagUnicodeName_##_tag, #define HTML_OTHER(_tag) -const PRUnichar* const nsHTMLTags::sTagUnicodeTable[] = { +const char16_t* const nsHTMLTags::sTagUnicodeTable[] = { #include "nsHTMLTagList.h" }; #undef HTML_TAG @@ -293,18 +293,18 @@ PLHashTable* nsHTMLTags::gTagTable; PLHashTable* nsHTMLTags::gTagAtomTable; -// PRUnichar* -> id hash +// char16_t* -> id hash static PLHashNumber HTMLTagsHashCodeUCPtr(const void *key) { - return HashString(static_cast(key)); + return HashString(static_cast(key)); } static int HTMLTagsKeyCompareUCPtr(const void *key1, const void *key2) { - const PRUnichar *str1 = (const PRUnichar *)key1; - const PRUnichar *str2 = (const PRUnichar *)key2; + const char16_t *str1 = (const char16_t *)key1; + const char16_t *str2 = (const char16_t *)key2; return nsCRT::strcmp(str1, str2) == 0; } @@ -359,7 +359,7 @@ nsHTMLTags::AddRefTable(void) nullptr, nullptr); NS_ENSURE_TRUE(gTagAtomTable, NS_ERROR_OUT_OF_MEMORY); - // Fill in gTagTable with the above static PRUnichar strings as + // Fill in gTagTable with the above static char16_t strings as // keys and the value of the corresponding enum as the value in // the table. @@ -378,8 +378,8 @@ nsHTMLTags::AddRefTable(void) { // let's verify that all names in the the table are lowercase... for (i = 0; i < NS_HTML_TAG_MAX; ++i) { - nsAutoString temp1((PRUnichar*)sTagAtoms_info[i].mStringBuffer->Data()); - nsAutoString temp2((PRUnichar*)sTagAtoms_info[i].mStringBuffer->Data()); + nsAutoString temp1((char16_t*)sTagAtoms_info[i].mStringBuffer->Data()); + nsAutoString temp2((char16_t*)sTagAtoms_info[i].mStringBuffer->Data()); ToLowerCase(temp1); NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); } @@ -388,7 +388,7 @@ nsHTMLTags::AddRefTable(void) // correct. for (i = 0; i < NS_HTML_TAG_MAX; ++i) { nsAutoString temp1(sTagUnicodeTable[i]); - nsAutoString temp2((PRUnichar*)sTagAtoms_info[i].mStringBuffer->Data()); + nsAutoString temp2((char16_t*)sTagAtoms_info[i].mStringBuffer->Data()); NS_ASSERTION(temp1.Equals(temp2), "Bad unicode tag name!"); } @@ -433,16 +433,16 @@ nsHTMLTags::LookupTag(const nsAString& aTagName) return eHTMLTag_userdefined; } - PRUnichar buf[NS_HTMLTAG_NAME_MAX_LENGTH + 1]; + char16_t buf[NS_HTMLTAG_NAME_MAX_LENGTH + 1]; nsAString::const_iterator iter; uint32_t i = 0; - PRUnichar c; + char16_t c; aTagName.BeginReading(iter); // Fast lowercasing-while-copying of ASCII characters into a - // PRUnichar buffer + // char16_t buffer while (i < length) { c = *iter; @@ -466,7 +466,7 @@ nsHTMLTags::LookupTag(const nsAString& aTagName) void nsHTMLTags::TestTagTable() { - const PRUnichar *tag; + const char16_t *tag; nsHTMLTag id; nsCOMPtr atom; @@ -476,7 +476,7 @@ nsHTMLTags::TestTagTable() tag = sTagUnicodeTable[i]; id = LookupTag(nsDependentString(tag)); NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id"); - const PRUnichar* check = GetStringValue(id); + const char16_t* check = GetStringValue(id); NS_ASSERTION(0 == nsCRT::strcmp(check, tag), "can't map id back to tag"); nsAutoString uname(tag); diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index af6d238ba0e6..159d7a9caff8 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -354,13 +354,13 @@ static int32_t ParsePS(const nsString& aBuffer, int32_t aIndex) { for (;;) { - PRUnichar ch = aBuffer.CharAt(aIndex); - if ((ch == PRUnichar(' ')) || (ch == PRUnichar('\t')) || - (ch == PRUnichar('\n')) || (ch == PRUnichar('\r'))) { + char16_t ch = aBuffer.CharAt(aIndex); + if ((ch == char16_t(' ')) || (ch == char16_t('\t')) || + (ch == char16_t('\n')) || (ch == char16_t('\r'))) { ++aIndex; - } else if (ch == PRUnichar('-')) { + } else if (ch == char16_t('-')) { int32_t tmpIndex; - if (aBuffer.CharAt(aIndex+1) == PRUnichar('-') && + if (aBuffer.CharAt(aIndex+1) == char16_t('-') && kNotFound != (tmpIndex=aBuffer.Find("--",false,aIndex+2,-1))) { aIndex = tmpIndex + 2; } else { @@ -393,8 +393,8 @@ ParseDocTypeDecl(const nsString &aBuffer, do { theIndex = aBuffer.FindChar('<', theIndex); if (theIndex == kNotFound) break; - PRUnichar nextChar = aBuffer.CharAt(theIndex+1); - if (nextChar == PRUnichar('!')) { + char16_t nextChar = aBuffer.CharAt(theIndex+1); + if (nextChar == char16_t('!')) { int32_t tmpIndex = theIndex + 2; if (kNotFound != (theIndex=aBuffer.Find("DOCTYPE", true, tmpIndex, 0))) { @@ -404,7 +404,7 @@ ParseDocTypeDecl(const nsString &aBuffer, } theIndex = ParsePS(aBuffer, tmpIndex); theIndex = aBuffer.FindChar('>', theIndex); - } else if (nextChar == PRUnichar('?')) { + } else if (nextChar == char16_t('?')) { theIndex = aBuffer.FindChar('>', theIndex); } else { break; @@ -431,8 +431,8 @@ ParseDocTypeDecl(const nsString &aBuffer, // Now find the beginning and end of the public identifier // and the system identifier (if present). - PRUnichar lit = aBuffer.CharAt(theIndex); - if ((lit != PRUnichar('\"')) && (lit != PRUnichar('\''))) + char16_t lit = aBuffer.CharAt(theIndex); + if ((lit != char16_t('\"')) && (lit != char16_t('\''))) return false; // Start is the first character, excluding the quote, and End is @@ -443,15 +443,15 @@ ParseDocTypeDecl(const nsString &aBuffer, if (kNotFound == PublicIDEnd) return false; theIndex = ParsePS(aBuffer, PublicIDEnd + 1); - PRUnichar next = aBuffer.CharAt(theIndex); - if (next == PRUnichar('>')) { + char16_t next = aBuffer.CharAt(theIndex); + if (next == char16_t('>')) { // There was a public identifier, but no system // identifier, // so do nothing. // This is needed to avoid the else at the end, and it's // also the most common case. - } else if ((next == PRUnichar('\"')) || - (next == PRUnichar('\''))) { + } else if ((next == char16_t('\"')) || + (next == char16_t('\''))) { // We found a system identifier. *aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID; int32_t SystemIDStart = theIndex + 1; @@ -460,7 +460,7 @@ ParseDocTypeDecl(const nsString &aBuffer, return false; aSystemID = Substring(aBuffer, SystemIDStart, SystemIDEnd - SystemIDStart); - } else if (next == PRUnichar('[')) { + } else if (next == char16_t('[')) { // We found an internal subset. *aResultFlags |= PARSE_DTD_HAVE_INTERNAL_SUBSET; } else { @@ -480,8 +480,8 @@ ParseDocTypeDecl(const nsString &aBuffer, *aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID; theIndex = ParsePS(aBuffer, tmpIndex+6); - PRUnichar next = aBuffer.CharAt(theIndex); - if (next != PRUnichar('\"') && next != PRUnichar('\'')) + char16_t next = aBuffer.CharAt(theIndex); + if (next != char16_t('\"') && next != char16_t('\'')) return false; int32_t SystemIDStart = theIndex + 1; @@ -494,10 +494,10 @@ ParseDocTypeDecl(const nsString &aBuffer, theIndex = ParsePS(aBuffer, SystemIDEnd + 1); } - PRUnichar nextChar = aBuffer.CharAt(theIndex); - if (nextChar == PRUnichar('[')) + char16_t nextChar = aBuffer.CharAt(theIndex); + if (nextChar == char16_t('[')) *aResultFlags |= PARSE_DTD_HAVE_INTERNAL_SUBSET; - else if (nextChar != PRUnichar('>')) + else if (nextChar != char16_t('>')) return false; } return true; @@ -850,7 +850,7 @@ nsParser::WillBuildModel(nsString& aFilename) if (eDTDMode_unknown == mParserContext->mDTDMode || eDTDMode_autodetect == mParserContext->mDTDMode) { - PRUnichar buf[1025]; + char16_t buf[1025]; nsFixedString theBuffer(buf, 1024, 0); // Grab 1024 characters, starting at the first non-whitespace @@ -1385,7 +1385,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer, nsString& thisTag = aTagStack[theIndex]; // was there an xmlns=? - int32_t endOfTag = thisTag.FindChar(PRUnichar(' ')); + int32_t endOfTag = thisTag.FindChar(char16_t(' ')); if (endOfTag == -1) { endContext.Append(thisTag); } else { diff --git a/parser/htmlparser/src/nsParserService.cpp b/parser/htmlparser/src/nsParserService.cpp index 794e1194b2d0..ea714b01491f 100644 --- a/parser/htmlparser/src/nsParserService.cpp +++ b/parser/htmlparser/src/nsParserService.cpp @@ -40,7 +40,7 @@ nsParserService::HTMLStringTagToId(const nsAString& aTag) const return nsHTMLTags::LookupTag(aTag); } -const PRUnichar* +const char16_t* nsParserService::HTMLIdToStringTag(int32_t aId) const { return nsHTMLTags::GetStringValue((nsHTMLTag)aId); diff --git a/parser/htmlparser/src/nsParserService.h b/parser/htmlparser/src/nsParserService.h index 3e83c2920f91..f4ba0b546c3f 100644 --- a/parser/htmlparser/src/nsParserService.h +++ b/parser/htmlparser/src/nsParserService.h @@ -11,7 +11,7 @@ extern "C" int MOZ_XMLIsLetter(const char* ptr); extern "C" int MOZ_XMLIsNCNameChar(const char* ptr); extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end, - const char** next, PRUnichar* result); + const char** next, char16_t* result); class nsParserService : public nsIParserService { public: @@ -26,7 +26,7 @@ public: int32_t HTMLStringTagToId(const nsAString& aTag) const; - const PRUnichar *HTMLIdToStringTag(int32_t aId) const; + const char16_t *HTMLIdToStringTag(int32_t aId) const; nsIAtom *HTMLIdToAtomTag(int32_t aId) const; diff --git a/parser/htmlparser/src/nsScanner.cpp b/parser/htmlparser/src/nsScanner.cpp index 2035b47e41b9..47947d4217c4 100644 --- a/parser/htmlparser/src/nsScanner.cpp +++ b/parser/htmlparser/src/nsScanner.cpp @@ -24,10 +24,10 @@ using mozilla::dom::EncodingUtils; // We replace NUL characters with this character. -static PRUnichar sInvalid = UCS2_REPLACEMENT_CHAR; +static char16_t sInvalid = UCS2_REPLACEMENT_CHAR; -nsReadEndCondition::nsReadEndCondition(const PRUnichar* aTerminateChars) : - mChars(aTerminateChars), mFilter(PRUnichar(~0)) // All bits set +nsReadEndCondition::nsReadEndCondition(const char16_t* aTerminateChars) : + mChars(aTerminateChars), mFilter(char16_t(~0)) // All bits set { // Build filter that will be used to filter out characters with // bits that none of the terminal chars have. This works very well @@ -36,8 +36,8 @@ nsReadEndCondition::nsReadEndCondition(const PRUnichar* aTerminateChars) : // bits set. // Calculate filter - const PRUnichar *current = aTerminateChars; - PRUnichar terminalChar = *current; + const char16_t *current = aTerminateChars; + char16_t terminalChar = *current; while (terminalChar) { mFilter &= ~terminalChar; ++current; @@ -73,7 +73,7 @@ nsScanner::nsScanner(const nsAString& anHTMLString) mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; mHasInvalidCharacter = false; - mReplacementCharacter = PRUnichar(0x0); + mReplacementCharacter = char16_t(0x0); } /** @@ -105,7 +105,7 @@ nsScanner::nsScanner(nsString& aFilename, bool aCreateStream) mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; mHasInvalidCharacter = false; - mReplacementCharacter = PRUnichar(0x0); + mReplacementCharacter = char16_t(0x0); // XML defaults to UTF-8 and about:blank is UTF-8, too. SetDocumentCharset(NS_LITERAL_CSTRING("UTF-8"), kCharsetFromDocTypeDefault); } @@ -244,7 +244,7 @@ nsresult nsScanner::Append(const char* aBuffer, uint32_t aLen, mUnicodeDecoder->GetMaxLength(aBuffer, aLen, &unicharBufLen); nsScannerString::Buffer* buffer = nsScannerString::AllocBuffer(unicharBufLen + 1); NS_ENSURE_TRUE(buffer,NS_ERROR_OUT_OF_MEMORY); - PRUnichar *unichars = buffer->DataStart(); + char16_t *unichars = buffer->DataStart(); int32_t totalChars = 0; int32_t unicharLength = unicharBufLen; @@ -315,7 +315,7 @@ nsresult nsScanner::Append(const char* aBuffer, uint32_t aLen, * @param * @return error code reflecting read status */ -nsresult nsScanner::GetChar(PRUnichar& aChar) { +nsresult nsScanner::GetChar(char16_t& aChar) { if (!mSlidingBuffer || mCurrentPosition == mEndPosition) { aChar = 0; return kEOF; @@ -336,7 +336,7 @@ nsresult nsScanner::GetChar(PRUnichar& aChar) { * @param * @return */ -nsresult nsScanner::Peek(PRUnichar& aChar, uint32_t aOffset) { +nsresult nsScanner::Peek(char16_t& aChar, uint32_t aOffset) { aChar = 0; if (!mSlidingBuffer || mCurrentPosition == mEndPosition) { @@ -403,7 +403,7 @@ nsresult nsScanner::SkipWhitespace(int32_t& aNewlinesSkipped) { return kEOF; } - PRUnichar theChar = 0; + char16_t theChar = 0; nsresult result = Peek(theChar); if (NS_FAILED(result)) { @@ -422,7 +422,7 @@ nsresult nsScanner::SkipWhitespace(int32_t& aNewlinesSkipped) { case '\t': { skipped = true; - PRUnichar thePrevChar = theChar; + char16_t thePrevChar = theChar; theChar = (++current != mEndPosition) ? *current : '\0'; if ((thePrevChar == '\r' && theChar == '\n') || (thePrevChar == '\n' && theChar == '\r')) { @@ -453,13 +453,13 @@ nsresult nsScanner::SkipWhitespace(int32_t& aNewlinesSkipped) { * @param * @return error code */ -nsresult nsScanner::SkipOver(PRUnichar aSkipChar){ +nsresult nsScanner::SkipOver(char16_t aSkipChar){ if (!mSlidingBuffer) { return kEOF; } - PRUnichar ch=0; + char16_t ch=0; nsresult result=NS_OK; while(NS_OK==result) { @@ -506,7 +506,7 @@ nsresult nsScanner::ReadTagIdentifier(nsScannerSharedSubstring& aString) { return kEOF; } - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); nsScannerIterator current, end; bool found=false; @@ -573,7 +573,7 @@ nsresult nsScanner::ReadEntityIdentifier(nsString& aString) { return kEOF; } - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); nsScannerIterator origin, current, end; bool found=false; @@ -634,7 +634,7 @@ nsresult nsScanner::ReadNumber(nsString& aString,int32_t aBase) { NS_ASSERTION(aBase == 10 || aBase == 16,"base value not supported"); - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); nsScannerIterator origin, current, end; @@ -687,7 +687,7 @@ nsresult nsScanner::ReadWhitespace(nsScannerSharedSubstring& aString, return kEOF; } - PRUnichar theChar = 0; + char16_t theChar = 0; nsresult result = Peek(theChar); if (NS_FAILED(result)) { @@ -709,7 +709,7 @@ nsresult nsScanner::ReadWhitespace(nsScannerSharedSubstring& aString, case '\r': { ++aNewlinesSkipped; - PRUnichar thePrevChar = theChar; + char16_t thePrevChar = theChar; theChar = (++current != end) ? *current : '\0'; if ((thePrevChar == '\r' && theChar == '\n') || (thePrevChar == '\n' && theChar == '\r')) { @@ -718,7 +718,7 @@ nsresult nsScanner::ReadWhitespace(nsScannerSharedSubstring& aString, } else if (thePrevChar == '\r') { // Lone CR becomes CRLF; callers should know to remove extra CRs AppendUnicodeTo(origin, current, aString); - aString.writable().Append(PRUnichar('\n')); + aString.writable().Append(char16_t('\n')); origin = current; haveCR = true; } @@ -755,7 +755,7 @@ nsresult nsScanner::ReadWhitespace(nsScannerIterator& aStart, return kEOF; } - PRUnichar theChar = 0; + char16_t theChar = 0; nsresult result = Peek(theChar); if (NS_FAILED(result)) { @@ -776,7 +776,7 @@ nsresult nsScanner::ReadWhitespace(nsScannerIterator& aStart, case ' ' : case '\t': { - PRUnichar thePrevChar = theChar; + char16_t thePrevChar = theChar; theChar = (++current != end) ? *current : '\0'; if ((thePrevChar == '\r' && theChar == '\n') || (thePrevChar == '\n' && theChar == '\r')) { @@ -821,13 +821,13 @@ nsresult nsScanner::ReadUntil(nsAString& aString, } nsScannerIterator origin, current; - const PRUnichar* setstart = aEndCondition.mChars; - const PRUnichar* setcurrent; + const char16_t* setstart = aEndCondition.mChars; + const char16_t* setcurrent; origin = mCurrentPosition; current = origin; - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); if (NS_FAILED(result)) { @@ -881,13 +881,13 @@ nsresult nsScanner::ReadUntil(nsScannerSharedSubstring& aString, } nsScannerIterator origin, current; - const PRUnichar* setstart = aEndCondition.mChars; - const PRUnichar* setcurrent; + const char16_t* setstart = aEndCondition.mChars; + const char16_t* setcurrent; origin = mCurrentPosition; current = origin; - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); if (NS_FAILED(result)) { @@ -942,13 +942,13 @@ nsresult nsScanner::ReadUntil(nsScannerIterator& aStart, } nsScannerIterator origin, current; - const PRUnichar* setstart = aEndCondition.mChars; - const PRUnichar* setcurrent; + const char16_t* setstart = aEndCondition.mChars; + const char16_t* setcurrent; origin = mCurrentPosition; current = origin; - PRUnichar theChar=0; + char16_t theChar=0; nsresult result=Peek(theChar); if (NS_FAILED(result)) { @@ -1001,7 +1001,7 @@ nsresult nsScanner::ReadUntil(nsScannerIterator& aStart, * @return error code */ nsresult nsScanner::ReadUntil(nsAString& aString, - PRUnichar aTerminalChar, + char16_t aTerminalChar, bool addTerminal) { if (!mSlidingBuffer) { @@ -1013,7 +1013,7 @@ nsresult nsScanner::ReadUntil(nsAString& aString, origin = mCurrentPosition; current = origin; - PRUnichar theChar; + char16_t theChar; nsresult result = Peek(theChar); if (NS_FAILED(result)) { @@ -1088,7 +1088,7 @@ void nsScanner::SetPosition(nsScannerIterator& aPosition, bool aTerminate, bool } void nsScanner::ReplaceCharacter(nsScannerIterator& aPosition, - PRUnichar aChar) + char16_t aChar) { if (mSlidingBuffer) { mSlidingBuffer->ReplaceCharacter(aPosition, aChar); @@ -1188,7 +1188,7 @@ void nsScanner::SelfTest(void) { #endif } -void nsScanner::OverrideReplacementCharacter(PRUnichar aReplacementCharacter) +void nsScanner::OverrideReplacementCharacter(char16_t aReplacementCharacter) { mReplacementCharacter = aReplacementCharacter; diff --git a/parser/htmlparser/src/nsScanner.h b/parser/htmlparser/src/nsScanner.h index 70eb287dfc94..904bf511f0f7 100644 --- a/parser/htmlparser/src/nsScanner.h +++ b/parser/htmlparser/src/nsScanner.h @@ -29,9 +29,9 @@ class nsParser; class nsReadEndCondition { public: - const PRUnichar *mChars; - PRUnichar mFilter; - explicit nsReadEndCondition(const PRUnichar* aTerminateChars); + const char16_t *mChars; + char16_t mFilter; + explicit nsReadEndCondition(const char16_t* aTerminateChars); private: nsReadEndCondition(const nsReadEndCondition& aOther); // No copying void operator=(const nsReadEndCondition& aOther); // No assigning @@ -60,7 +60,7 @@ class nsScanner { * @param ch is the char to accept new value * @return error code reflecting read status */ - nsresult GetChar(PRUnichar& ch); + nsresult GetChar(char16_t& ch); /** * peek ahead to consume next char from scanner's internal @@ -70,7 +70,7 @@ class nsScanner { * @param ch is the char to accept new value * @return error code reflecting read status */ - nsresult Peek(PRUnichar& ch, uint32_t aOffset=0); + nsresult Peek(char16_t& ch, uint32_t aOffset=0); nsresult Peek(nsAString& aStr, int32_t aNumChars, int32_t aOffset = 0); @@ -81,7 +81,7 @@ class nsScanner { * @param char to be skipped * @return error code */ - nsresult SkipOver(PRUnichar aSkipChar); + nsresult SkipOver(char16_t aSkipChar); /** * Skip whitespace on scanner input stream @@ -125,7 +125,7 @@ class nsScanner { * @return error code */ nsresult ReadUntil(nsAString& aString, - PRUnichar aTerminal, + char16_t aTerminal, bool addTerminal); /** @@ -242,7 +242,7 @@ class nsScanner { bool aTruncate = false, bool aReverse = false); void ReplaceCharacter(nsScannerIterator& aPosition, - PRUnichar aChar); + char16_t aChar); /** * Internal method used to cause the internal buffer to @@ -270,7 +270,7 @@ class nsScanner { * @param aReplacementCharacter the replacement character * XML (expat) parser uses 0xffff */ - void OverrideReplacementCharacter(PRUnichar aReplacementCharacter); + void OverrideReplacementCharacter(char16_t aReplacementCharacter); protected: @@ -294,7 +294,7 @@ class nsScanner { // from the scanner buffer bool mIncremental; bool mHasInvalidCharacter; - PRUnichar mReplacementCharacter; + char16_t mReplacementCharacter; int32_t mFirstNonWhitespacePosition; int32_t mCharsetSource; nsCString mCharset; diff --git a/parser/htmlparser/src/nsScannerString.cpp b/parser/htmlparser/src/nsScannerString.cpp index 23ab9170f3da..a596498e9bfc 100644 --- a/parser/htmlparser/src/nsScannerString.cpp +++ b/parser/htmlparser/src/nsScannerString.cpp @@ -12,8 +12,8 @@ * nsScannerBufferList */ -#define MAX_CAPACITY ((UINT32_MAX / sizeof(PRUnichar)) - \ - (sizeof(Buffer) + sizeof(PRUnichar))) +#define MAX_CAPACITY ((UINT32_MAX / sizeof(char16_t)) - \ + (sizeof(Buffer) + sizeof(char16_t))) nsScannerBufferList::Buffer* nsScannerBufferList::AllocBufferFromString( const nsAString& aString ) @@ -25,7 +25,7 @@ nsScannerBufferList::AllocBufferFromString( const nsAString& aString ) { nsAString::const_iterator source; aString.BeginReading(source); - nsCharTraits::copy(buf->DataStart(), source.get(), len); + nsCharTraits::copy(buf->DataStart(), source.get(), len); } return buf; } @@ -36,7 +36,7 @@ nsScannerBufferList::AllocBuffer( uint32_t capacity ) if (capacity > MAX_CAPACITY) return nullptr; - void* ptr = malloc(sizeof(Buffer) + (capacity + 1) * sizeof(PRUnichar)); + void* ptr = malloc(sizeof(Buffer) + (capacity + 1) * sizeof(char16_t)); if (!ptr) return nullptr; @@ -47,7 +47,7 @@ nsScannerBufferList::AllocBuffer( uint32_t capacity ) // XXX null terminate. this shouldn't be required, but we do it because // nsScanner erroneously thinks it can dereference DataEnd :-( - *buf->mDataEnd = PRUnichar(0); + *buf->mDataEnd = char16_t(0); return buf; } @@ -80,7 +80,7 @@ nsScannerBufferList::SplitBuffer( const Position& pos ) Buffer* new_buffer = AllocBuffer(len); if (new_buffer) { - nsCharTraits::copy(new_buffer->DataStart(), + nsCharTraits::copy(new_buffer->DataStart(), bufferToSplit->DataStart() + splitOffset, len); InsertAfter(new_buffer, bufferToSplit); @@ -147,7 +147,7 @@ nsScannerSubstring::~nsScannerSubstring() } int32_t -nsScannerSubstring::CountChar( PRUnichar c ) const +nsScannerSubstring::CountChar( char16_t c ) const { /* re-write this to use a counting sink @@ -160,7 +160,7 @@ nsScannerSubstring::CountChar( PRUnichar c ) const for ( BeginReading(iter); ; ) { int32_t lengthToExamineInThisFragment = iter.size_forward(); - const PRUnichar* fromBegin = iter.get(); + const char16_t* fromBegin = iter.get(); result += size_type(NS_COUNT(fromBegin, fromBegin+lengthToExamineInThisFragment, c)); if ( !(lengthToExamine -= lengthToExamineInThisFragment) ) return result; @@ -373,12 +373,12 @@ nsScannerString::UngetReadable( const nsAString& aReadable, const nsScannerItera } void -nsScannerString::ReplaceCharacter(nsScannerIterator& aPosition, PRUnichar aChar) +nsScannerString::ReplaceCharacter(nsScannerIterator& aPosition, char16_t aChar) { // XXX Casting a const to non-const. Unless the base class // provides support for writing iterators, this is the best // that can be done. - PRUnichar* pos = const_cast(aPosition.get()); + char16_t* pos = const_cast(aPosition.get()); *pos = aChar; mIsDirty = true; @@ -514,7 +514,7 @@ AppendUnicodeTo( const nsScannerIterator& aSrcStart, } bool -FindCharInReadable( PRUnichar aChar, +FindCharInReadable( char16_t aChar, nsScannerIterator& aSearchStart, const nsScannerIterator& aSearchEnd ) { @@ -526,7 +526,7 @@ FindCharInReadable( PRUnichar aChar, else fragmentLength = aSearchStart.size_forward(); - const PRUnichar* charFoundAt = nsCharTraits::find(aSearchStart.get(), fragmentLength, aChar); + const char16_t* charFoundAt = nsCharTraits::find(aSearchStart.get(), fragmentLength, aChar); if ( charFoundAt ) { aSearchStart.advance( charFoundAt - aSearchStart.get() ); return true; diff --git a/parser/xml/src/nsSAXXMLReader.cpp b/parser/xml/src/nsSAXXMLReader.cpp index 8c758c66ba55..d4374716eaf6 100644 --- a/parser/xml/src/nsSAXXMLReader.cpp +++ b/parser/xml/src/nsSAXXMLReader.cpp @@ -78,8 +78,8 @@ nsSAXXMLReader::SetParser(nsParserBase *aParser) // nsIExtendedExpatSink NS_IMETHODIMP -nsSAXXMLReader::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +nsSAXXMLReader::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -109,7 +109,7 @@ nsSAXXMLReader::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -nsSAXXMLReader::HandleEndElement(const PRUnichar *aName) +nsSAXXMLReader::HandleEndElement(const char16_t *aName) { if (mContentHandler) { nsAutoString uri, localName, qName; @@ -120,7 +120,7 @@ nsSAXXMLReader::HandleEndElement(const PRUnichar *aName) } NS_IMETHODIMP -nsSAXXMLReader::HandleComment(const PRUnichar *aName) +nsSAXXMLReader::HandleComment(const char16_t *aName) { NS_ASSERTION(aName, "null passed to handler"); if (mLexicalHandler) @@ -130,7 +130,7 @@ nsSAXXMLReader::HandleComment(const PRUnichar *aName) } NS_IMETHODIMP -nsSAXXMLReader::HandleCDataSection(const PRUnichar *aData, +nsSAXXMLReader::HandleCDataSection(const char16_t *aData, uint32_t aLength) { nsresult rv; @@ -153,11 +153,11 @@ nsSAXXMLReader::HandleCDataSection(const PRUnichar *aData, } NS_IMETHODIMP -nsSAXXMLReader::HandleStartDTD(const PRUnichar *aName, - const PRUnichar *aSystemId, - const PRUnichar *aPublicId) +nsSAXXMLReader::HandleStartDTD(const char16_t *aName, + const char16_t *aSystemId, + const char16_t *aPublicId) { - PRUnichar nullChar = PRUnichar(0); + char16_t nullChar = char16_t(0); if (!aName) aName = &nullChar; if (!aSystemId) @@ -190,7 +190,7 @@ nsSAXXMLReader::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -nsSAXXMLReader::HandleCharacterData(const PRUnichar *aData, +nsSAXXMLReader::HandleCharacterData(const char16_t *aData, uint32_t aLength) { if (mContentHandler) @@ -200,13 +200,13 @@ nsSAXXMLReader::HandleCharacterData(const PRUnichar *aData, } NS_IMETHODIMP -nsSAXXMLReader::HandleStartNamespaceDecl(const PRUnichar *aPrefix, - const PRUnichar *aUri) +nsSAXXMLReader::HandleStartNamespaceDecl(const char16_t *aPrefix, + const char16_t *aUri) { if (!mContentHandler) return NS_OK; - PRUnichar nullChar = PRUnichar(0); + char16_t nullChar = char16_t(0); if (!aPrefix) aPrefix = &nullChar; if (!aUri) @@ -217,7 +217,7 @@ nsSAXXMLReader::HandleStartNamespaceDecl(const PRUnichar *aPrefix, } NS_IMETHODIMP -nsSAXXMLReader::HandleEndNamespaceDecl(const PRUnichar *aPrefix) +nsSAXXMLReader::HandleEndNamespaceDecl(const char16_t *aPrefix) { if (!mContentHandler) return NS_OK; @@ -229,8 +229,8 @@ nsSAXXMLReader::HandleEndNamespaceDecl(const PRUnichar *aPrefix) } NS_IMETHODIMP -nsSAXXMLReader::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +nsSAXXMLReader::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { NS_ASSERTION(aTarget && aData, "null passed to handler"); if (mContentHandler) { @@ -242,13 +242,13 @@ nsSAXXMLReader::HandleProcessingInstruction(const PRUnichar *aTarget, } NS_IMETHODIMP -nsSAXXMLReader::HandleNotationDecl(const PRUnichar *aNotationName, - const PRUnichar *aSystemId, - const PRUnichar *aPublicId) +nsSAXXMLReader::HandleNotationDecl(const char16_t *aNotationName, + const char16_t *aSystemId, + const char16_t *aPublicId) { NS_ASSERTION(aNotationName, "null passed to handler"); if (mDTDHandler) { - PRUnichar nullChar = PRUnichar(0); + char16_t nullChar = char16_t(0); if (!aSystemId) aSystemId = &nullChar; if (!aPublicId) @@ -263,14 +263,14 @@ nsSAXXMLReader::HandleNotationDecl(const PRUnichar *aNotationName, } NS_IMETHODIMP -nsSAXXMLReader::HandleUnparsedEntityDecl(const PRUnichar *aEntityName, - const PRUnichar *aSystemId, - const PRUnichar *aPublicId, - const PRUnichar *aNotationName) +nsSAXXMLReader::HandleUnparsedEntityDecl(const char16_t *aEntityName, + const char16_t *aSystemId, + const char16_t *aPublicId, + const char16_t *aNotationName) { NS_ASSERTION(aEntityName && aNotationName, "null passed to handler"); if (mDTDHandler) { - PRUnichar nullChar = PRUnichar(0); + char16_t nullChar = char16_t(0); if (!aSystemId) aSystemId = &nullChar; if (!aPublicId) @@ -286,13 +286,13 @@ nsSAXXMLReader::HandleUnparsedEntityDecl(const PRUnichar *aEntityName, } NS_IMETHODIMP -nsSAXXMLReader::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +nsSAXXMLReader::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { NS_ASSERTION(aVersion, "null passed to handler"); if (mDeclarationHandler) { - PRUnichar nullChar = PRUnichar(0); + char16_t nullChar = char16_t(0); if (!aEncoding) aEncoding = &nullChar; mDeclarationHandler->HandleXMLDeclaration(nsDependentString(aVersion), @@ -303,8 +303,8 @@ nsSAXXMLReader::HandleXMLDeclaration(const PRUnichar *aVersion, } NS_IMETHODIMP -nsSAXXMLReader::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +nsSAXXMLReader::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { @@ -667,7 +667,7 @@ nsSAXXMLReader::EnsureBaseURI() } nsresult -nsSAXXMLReader::SplitExpatName(const PRUnichar *aExpatName, +nsSAXXMLReader::SplitExpatName(const char16_t *aExpatName, nsString &aURI, nsString &aLocalName, nsString &aQName) @@ -687,7 +687,7 @@ nsSAXXMLReader::SplitExpatName(const PRUnichar *aExpatName, NS_ASSERTION(aExpatName, "null passed to handler"); nsDependentString expatStr(aExpatName); int32_t break1, break2 = kNotFound; - break1 = expatStr.FindChar(PRUnichar(0xFFFF)); + break1 = expatStr.FindChar(char16_t(0xFFFF)); if (break1 == kNotFound) { aLocalName = expatStr; // no namespace @@ -695,7 +695,7 @@ nsSAXXMLReader::SplitExpatName(const PRUnichar *aExpatName, aQName = expatStr; } else { aURI = StringHead(expatStr, break1); - break2 = expatStr.FindChar(PRUnichar(0xFFFF), break1 + 1); + break2 = expatStr.FindChar(char16_t(0xFFFF), break1 + 1); if (break2 == kNotFound) { // namespace, but no prefix aLocalName = Substring(expatStr, break1 + 1); aQName = aLocalName; diff --git a/parser/xml/src/nsSAXXMLReader.h b/parser/xml/src/nsSAXXMLReader.h index 44ade151997c..aac44e623a01 100644 --- a/parser/xml/src/nsSAXXMLReader.h +++ b/parser/xml/src/nsSAXXMLReader.h @@ -89,7 +89,7 @@ private: nsACString& aCharset); nsresult EnsureBaseURI(); nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel); - nsresult SplitExpatName(const PRUnichar *aExpatName, + nsresult SplitExpatName(const char16_t *aExpatName, nsString &aURI, nsString &aLocalName, nsString &aQName); diff --git a/rdf/base/idl/nsIRDFLiteral.idl b/rdf/base/idl/nsIRDFLiteral.idl index 33f618afb8e8..3d289c4fee69 100644 --- a/rdf/base/idl/nsIRDFLiteral.idl +++ b/rdf/base/idl/nsIRDFLiteral.idl @@ -6,7 +6,7 @@ #include "nsIRDFNode.idl" %{C++ -#include "nscore.h" // for PRUnichar +#include "nscore.h" // for char16_t %} [ptr] native const_octet_ptr(const uint8_t); diff --git a/rdf/base/src/nsContainerEnumerator.cpp b/rdf/base/src/nsContainerEnumerator.cpp index f8e8d5d2e1dc..cfe3ae493b60 100644 --- a/rdf/base/src/nsContainerEnumerator.cpp +++ b/rdf/base/src/nsContainerEnumerator.cpp @@ -154,7 +154,7 @@ ContainerEnumeratorImpl::HasMoreElements(bool* aResult) if (! nextValLiteral) continue; - const PRUnichar *nextValStr; + const char16_t *nextValStr; nextValLiteral->GetValueConst(&nextValStr); nsresult err; diff --git a/rdf/base/src/nsRDFContainer.cpp b/rdf/base/src/nsRDFContainer.cpp index f3c32c79cfb6..76b6acb7046f 100644 --- a/rdf/base/src/nsRDFContainer.cpp +++ b/rdf/base/src/nsRDFContainer.cpp @@ -173,7 +173,7 @@ RDFContainerImpl::GetCount(int32_t *aCount) rv = nextValNode->QueryInterface(NS_GET_IID(nsIRDFLiteral), getter_AddRefs(nextValLiteral)); if (NS_FAILED(rv)) return rv; - const PRUnichar *s; + const char16_t *s; rv = nextValLiteral->GetValueConst( &s ); if (NS_FAILED(rv)) return rv; @@ -670,13 +670,13 @@ RDFContainerImpl::GetNextValue(nsIRDFResource** aResult) rv = nextValNode->QueryInterface(NS_GET_IID(nsIRDFLiteral), getter_AddRefs(nextValLiteral)); if (NS_FAILED(rv)) return rv; - const PRUnichar* s; + const char16_t* s; rv = nextValLiteral->GetValueConst(&s); if (NS_FAILED(rv)) return rv; int32_t nextVal = 0; { - for (const PRUnichar* p = s; *p != 0; ++p) { + for (const char16_t* p = s; *p != 0; ++p) { NS_ASSERTION(*p >= '0' && *p <= '9', "not a digit"); if (*p < '0' || *p > '9') break; diff --git a/rdf/base/src/nsRDFContentSink.cpp b/rdf/base/src/nsRDFContentSink.cpp index d92486424dbf..b5b7046586a5 100644 --- a/rdf/base/src/nsRDFContentSink.cpp +++ b/rdf/base/src/nsRDFContentSink.cpp @@ -150,21 +150,21 @@ protected: void ParseText(nsIRDFNode **aResult); nsresult FlushText(); - nsresult AddText(const PRUnichar* aText, int32_t aLength); + nsresult AddText(const char16_t* aText, int32_t aLength); // RDF-specific parsing - nsresult OpenRDF(const PRUnichar* aName); - nsresult OpenObject(const PRUnichar* aName ,const PRUnichar** aAttributes); - nsresult OpenProperty(const PRUnichar* aName, const PRUnichar** aAttributes); - nsresult OpenMember(const PRUnichar* aName, const PRUnichar** aAttributes); - nsresult OpenValue(const PRUnichar* aName, const PRUnichar** aAttributes); + nsresult OpenRDF(const char16_t* aName); + nsresult OpenObject(const char16_t* aName ,const char16_t** aAttributes); + nsresult OpenProperty(const char16_t* aName, const char16_t** aAttributes); + nsresult OpenMember(const char16_t* aName, const char16_t** aAttributes); + nsresult OpenValue(const char16_t* aName, const char16_t** aAttributes); - nsresult GetIdAboutAttribute(const PRUnichar** aAttributes, nsIRDFResource** aResource, bool* aIsAnonymous = nullptr); - nsresult GetResourceAttribute(const PRUnichar** aAttributes, nsIRDFResource** aResource); - nsresult AddProperties(const PRUnichar** aAttributes, nsIRDFResource* aSubject, int32_t* aCount = nullptr); - void SetParseMode(const PRUnichar **aAttributes); + nsresult GetIdAboutAttribute(const char16_t** aAttributes, nsIRDFResource** aResource, bool* aIsAnonymous = nullptr); + nsresult GetResourceAttribute(const char16_t** aAttributes, nsIRDFResource** aResource); + nsresult AddProperties(const char16_t** aAttributes, nsIRDFResource* aSubject, int32_t* aCount = nullptr); + void SetParseMode(const char16_t **aAttributes); - PRUnichar* mText; + char16_t* mText; int32_t mTextLength; int32_t mTextSize; @@ -175,7 +175,7 @@ protected: * Hopefully, this will keep namespace definitions intact in a * parse - serialize cycle. */ - void RegisterNamespaces(const PRUnichar **aAttributes); + void RegisterNamespaces(const char16_t **aAttributes); /** * Extracts the localname from aExpatName, the name that the Expat parser @@ -183,7 +183,7 @@ protected: * aLocalName will contain the localname in aExpatName. * The return value is a dependent string containing just the namespace. */ - const nsDependentSubstring SplitExpatName(const PRUnichar *aExpatName, + const nsDependentSubstring SplitExpatName(const char16_t *aExpatName, nsIAtom **aLocalName); enum eContainerType { eBag, eSeq, eAlt }; @@ -394,8 +394,8 @@ RDFContentSinkImpl::QueryInterface(REFNSIID iid, void** result) } NS_IMETHODIMP -RDFContentSinkImpl::HandleStartElement(const PRUnichar *aName, - const PRUnichar **aAtts, +RDFContentSinkImpl::HandleStartElement(const char16_t *aName, + const char16_t **aAtts, uint32_t aAttsCount, int32_t aIndex, uint32_t aLineNumber) @@ -439,7 +439,7 @@ RDFContentSinkImpl::HandleStartElement(const PRUnichar *aName, } NS_IMETHODIMP -RDFContentSinkImpl::HandleEndElement(const PRUnichar *aName) +RDFContentSinkImpl::HandleEndElement(const char16_t *aName) { FlushText(); @@ -490,13 +490,13 @@ RDFContentSinkImpl::HandleEndElement(const PRUnichar *aName) } NS_IMETHODIMP -RDFContentSinkImpl::HandleComment(const PRUnichar *aName) +RDFContentSinkImpl::HandleComment(const char16_t *aName) { return NS_OK; } NS_IMETHODIMP -RDFContentSinkImpl::HandleCDataSection(const PRUnichar *aData, +RDFContentSinkImpl::HandleCDataSection(const char16_t *aData, uint32_t aLength) { return aData ? AddText(aData, aLength) : NS_OK; @@ -513,30 +513,30 @@ RDFContentSinkImpl::HandleDoctypeDecl(const nsAString & aSubset, } NS_IMETHODIMP -RDFContentSinkImpl::HandleCharacterData(const PRUnichar *aData, +RDFContentSinkImpl::HandleCharacterData(const char16_t *aData, uint32_t aLength) { return aData ? AddText(aData, aLength) : NS_OK; } NS_IMETHODIMP -RDFContentSinkImpl::HandleProcessingInstruction(const PRUnichar *aTarget, - const PRUnichar *aData) +RDFContentSinkImpl::HandleProcessingInstruction(const char16_t *aTarget, + const char16_t *aData) { return NS_OK; } NS_IMETHODIMP -RDFContentSinkImpl::HandleXMLDeclaration(const PRUnichar *aVersion, - const PRUnichar *aEncoding, +RDFContentSinkImpl::HandleXMLDeclaration(const char16_t *aVersion, + const char16_t *aEncoding, int32_t aStandalone) { return NS_OK; } NS_IMETHODIMP -RDFContentSinkImpl::ReportError(const PRUnichar* aErrorText, - const PRUnichar* aSourceText, +RDFContentSinkImpl::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError *aError, bool *_retval) { @@ -646,7 +646,7 @@ RDFContentSinkImpl::GetDataSource(nsIRDFDataSource*& aDataSource) // Text buffering static bool -rdf_IsDataInBuffer(PRUnichar* buffer, int32_t length) +rdf_IsDataInBuffer(char16_t* buffer, int32_t length) { for (int32_t i = 0; i < length; ++i) { if (buffer[i] == ' ' || @@ -751,11 +751,11 @@ RDFContentSinkImpl::FlushText() nsresult -RDFContentSinkImpl::AddText(const PRUnichar* aText, int32_t aLength) +RDFContentSinkImpl::AddText(const char16_t* aText, int32_t aLength) { // Create buffer when we first need it if (0 == mTextSize) { - mText = (PRUnichar *) moz_malloc(sizeof(PRUnichar) * 4096); + mText = (char16_t *) moz_malloc(sizeof(char16_t) * 4096); if (!mText) { return NS_ERROR_OUT_OF_MEMORY; } @@ -772,14 +772,14 @@ RDFContentSinkImpl::AddText(const PRUnichar* aText, int32_t aLength) // don't clobber mText or mTextSize until the new mem is allocated. int32_t newSize = (2 * mTextSize > (mTextSize + aLength)) ? (2 * mTextSize) : (mTextSize + aLength); - PRUnichar* newText = - (PRUnichar *) moz_realloc(mText, sizeof(PRUnichar) * newSize); + char16_t* newText = + (char16_t *) moz_realloc(mText, sizeof(char16_t) * newSize); if (!newText) return NS_ERROR_OUT_OF_MEMORY; mTextSize = newSize; mText = newText; } - memcpy(&mText[mTextLength], aText, sizeof(PRUnichar) * aLength); + memcpy(&mText[mTextLength], aText, sizeof(char16_t) * aLength); mTextLength += aLength; return NS_OK; @@ -794,7 +794,7 @@ rdf_RequiresAbsoluteURI(const nsString& uri) } nsresult -RDFContentSinkImpl::GetIdAboutAttribute(const PRUnichar** aAttributes, +RDFContentSinkImpl::GetIdAboutAttribute(const char16_t** aAttributes, nsIRDFResource** aResource, bool* aIsAnonymous) { @@ -888,7 +888,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const PRUnichar** aAttributes, } nsresult -RDFContentSinkImpl::GetResourceAttribute(const PRUnichar** aAttributes, +RDFContentSinkImpl::GetResourceAttribute(const char16_t** aAttributes, nsIRDFResource** aResource) { nsCOMPtr localName; @@ -952,7 +952,7 @@ RDFContentSinkImpl::GetResourceAttribute(const PRUnichar** aAttributes, } nsresult -RDFContentSinkImpl::AddProperties(const PRUnichar** aAttributes, +RDFContentSinkImpl::AddProperties(const char16_t** aAttributes, nsIRDFResource* aSubject, int32_t* aCount) { @@ -1006,7 +1006,7 @@ RDFContentSinkImpl::AddProperties(const PRUnichar** aAttributes, } void -RDFContentSinkImpl::SetParseMode(const PRUnichar **aAttributes) +RDFContentSinkImpl::SetParseMode(const char16_t **aAttributes) { nsCOMPtr localName; for (; *aAttributes; aAttributes += 2) { @@ -1039,7 +1039,7 @@ RDFContentSinkImpl::SetParseMode(const PRUnichar **aAttributes) // RDF-specific routines used to build the model nsresult -RDFContentSinkImpl::OpenRDF(const PRUnichar* aName) +RDFContentSinkImpl::OpenRDF(const char16_t* aName) { // ensure that we're actually reading RDF by making sure that the // opening tag is , where "rdf:" corresponds to whatever @@ -1062,8 +1062,8 @@ RDFContentSinkImpl::OpenRDF(const PRUnichar* aName) } nsresult -RDFContentSinkImpl::OpenObject(const PRUnichar* aName, - const PRUnichar** aAttributes) +RDFContentSinkImpl::OpenObject(const char16_t* aName, + const char16_t** aAttributes) { // an "object" non-terminal is either a "description", a "typed // node", or a "container", so this change the content sink's @@ -1136,7 +1136,7 @@ RDFContentSinkImpl::OpenObject(const PRUnichar* aName, } nsresult -RDFContentSinkImpl::OpenProperty(const PRUnichar* aName, const PRUnichar** aAttributes) +RDFContentSinkImpl::OpenProperty(const char16_t* aName, const char16_t** aAttributes) { nsresult rv; @@ -1209,8 +1209,8 @@ RDFContentSinkImpl::OpenProperty(const PRUnichar* aName, const PRUnichar** aAttr } nsresult -RDFContentSinkImpl::OpenMember(const PRUnichar* aName, - const PRUnichar** aAttributes) +RDFContentSinkImpl::OpenMember(const char16_t* aName, + const char16_t** aAttributes) { // ensure that we're actually reading a member element by making // sure that the opening tag is , where "rdf:" corresponds @@ -1265,7 +1265,7 @@ RDFContentSinkImpl::OpenMember(const PRUnichar* aName, nsresult -RDFContentSinkImpl::OpenValue(const PRUnichar* aName, const PRUnichar** aAttributes) +RDFContentSinkImpl::OpenValue(const char16_t* aName, const char16_t** aAttributes) { // a "value" can either be an object or a string: we'll only get // *here* if it's an object, as raw text is added as a leaf. @@ -1275,7 +1275,7 @@ RDFContentSinkImpl::OpenValue(const PRUnichar* aName, const PRUnichar** aAttribu //////////////////////////////////////////////////////////////////////// // namespace resolution void -RDFContentSinkImpl::RegisterNamespaces(const PRUnichar **aAttributes) +RDFContentSinkImpl::RegisterNamespaces(const char16_t **aAttributes) { nsCOMPtr sink = do_QueryInterface(mDataSource); if (!sink) { @@ -1284,8 +1284,8 @@ RDFContentSinkImpl::RegisterNamespaces(const PRUnichar **aAttributes) NS_NAMED_LITERAL_STRING(xmlns, "http://www.w3.org/2000/xmlns/"); for (; *aAttributes; aAttributes += 2) { // check the namespace - const PRUnichar* attr = aAttributes[0]; - const PRUnichar* xmlnsP = xmlns.BeginReading(); + const char16_t* attr = aAttributes[0]; + const char16_t* xmlnsP = xmlns.BeginReading(); while (*attr == *xmlnsP) { ++attr; ++xmlnsP; @@ -1295,7 +1295,7 @@ RDFContentSinkImpl::RegisterNamespaces(const PRUnichar **aAttributes) continue; } // get the localname (or "xmlns" for the default namespace) - const PRUnichar* endLocal = ++attr; + const char16_t* endLocal = ++attr; while (*endLocal && *endLocal != 0xFFFF) { ++endLocal; } @@ -1312,7 +1312,7 @@ RDFContentSinkImpl::RegisterNamespaces(const PRUnichar **aAttributes) // Qualified name resolution const nsDependentSubstring -RDFContentSinkImpl::SplitExpatName(const PRUnichar *aExpatName, +RDFContentSinkImpl::SplitExpatName(const char16_t *aExpatName, nsIAtom **aLocalName) { /** @@ -1325,9 +1325,9 @@ RDFContentSinkImpl::SplitExpatName(const PRUnichar *aExpatName, * */ - const PRUnichar *uriEnd = aExpatName; - const PRUnichar *nameStart = aExpatName; - const PRUnichar *pos; + const char16_t *uriEnd = aExpatName; + const char16_t *nameStart = aExpatName; + const char16_t *pos; for (pos = aExpatName; *pos; ++pos) { if (*pos == 0xFFFF) { if (uriEnd != aExpatName) { diff --git a/rdf/base/src/nsRDFService.cpp b/rdf/base/src/nsRDFService.cpp index f8d06892e4a9..73b7752231b4 100644 --- a/rdf/base/src/nsRDFService.cpp +++ b/rdf/base/src/nsRDFService.cpp @@ -157,12 +157,12 @@ static const PLDHashTableOps gResourceTableOps = { struct LiteralHashEntry : public PLDHashEntryHdr { nsIRDFLiteral *mLiteral; - const PRUnichar *mKey; + const char16_t *mKey; static PLDHashNumber HashKey(PLDHashTable *table, const void *key) { - return HashString(static_cast(key)); + return HashString(static_cast(key)); } static bool @@ -172,7 +172,7 @@ struct LiteralHashEntry : public PLDHashEntryHdr { const LiteralHashEntry *entry = static_cast(hdr); - return 0 == nsCRT::strcmp(static_cast(key), + return 0 == nsCRT::strcmp(static_cast(key), entry->mKey); } }; @@ -394,7 +394,7 @@ static const PLDHashTableOps gBlobTableOps = { class LiteralImpl : public nsIRDFLiteral { public: static nsresult - Create(const PRUnichar* aValue, nsIRDFLiteral** aResult); + Create(const char16_t* aValue, nsIRDFLiteral** aResult); // nsISupports NS_DECL_THREADSAFE_ISUPPORTS @@ -406,37 +406,37 @@ public: NS_DECL_NSIRDFLITERAL protected: - LiteralImpl(const PRUnichar* s); + LiteralImpl(const char16_t* s); virtual ~LiteralImpl(); - const PRUnichar* GetValue() const { - size_t objectSize = ((sizeof(LiteralImpl) + sizeof(PRUnichar) - 1) / sizeof(PRUnichar)) * sizeof(PRUnichar); - return reinterpret_cast(reinterpret_cast(this) + objectSize); + const char16_t* GetValue() const { + size_t objectSize = ((sizeof(LiteralImpl) + sizeof(char16_t) - 1) / sizeof(char16_t)) * sizeof(char16_t); + return reinterpret_cast(reinterpret_cast(this) + objectSize); } }; nsresult -LiteralImpl::Create(const PRUnichar* aValue, nsIRDFLiteral** aResult) +LiteralImpl::Create(const char16_t* aValue, nsIRDFLiteral** aResult) { // Goofy math to get alignment right. Copied from nsSharedString.h. - size_t objectSize = ((sizeof(LiteralImpl) + sizeof(PRUnichar) - 1) / sizeof(PRUnichar)) * sizeof(PRUnichar); - size_t stringLen = nsCharTraits::length(aValue); - size_t stringSize = (stringLen + 1) * sizeof(PRUnichar); + size_t objectSize = ((sizeof(LiteralImpl) + sizeof(char16_t) - 1) / sizeof(char16_t)) * sizeof(char16_t); + size_t stringLen = nsCharTraits::length(aValue); + size_t stringSize = (stringLen + 1) * sizeof(char16_t); void* objectPtr = operator new(objectSize + stringSize); if (! objectPtr) return NS_ERROR_NULL_POINTER; - PRUnichar* buf = reinterpret_cast(static_cast(objectPtr) + objectSize); - nsCharTraits::copy(buf, aValue, stringLen + 1); + char16_t* buf = reinterpret_cast(static_cast(objectPtr) + objectSize); + nsCharTraits::copy(buf, aValue, stringLen + 1); NS_ADDREF(*aResult = new (objectPtr) LiteralImpl(buf)); return NS_OK; } -LiteralImpl::LiteralImpl(const PRUnichar* s) +LiteralImpl::LiteralImpl(const char16_t* s) { RDFServiceImpl::gRDFService->RegisterLiteral(this); NS_ADDREF(RDFServiceImpl::gRDFService); @@ -494,20 +494,20 @@ LiteralImpl::EqualsNode(nsIRDFNode* aNode, bool* aResult) } NS_IMETHODIMP -LiteralImpl::GetValue(PRUnichar* *value) +LiteralImpl::GetValue(char16_t* *value) { NS_ASSERTION(value, "null ptr"); if (! value) return NS_ERROR_NULL_POINTER; - const PRUnichar *temp = GetValue(); + const char16_t *temp = GetValue(); *value = temp? NS_strdup(temp) : 0; return NS_OK; } NS_IMETHODIMP -LiteralImpl::GetValueConst(const PRUnichar** aValue) +LiteralImpl::GetValueConst(const char16_t** aValue) { *aValue = GetValue(); return NS_OK; @@ -1050,7 +1050,7 @@ static int32_t kShift = 6; NS_IMETHODIMP -RDFServiceImpl::GetLiteral(const PRUnichar* aValue, nsIRDFLiteral** aLiteral) +RDFServiceImpl::GetLiteral(const char16_t* aValue, nsIRDFLiteral** aLiteral) { NS_PRECONDITION(aValue != nullptr, "null ptr"); if (! aValue) @@ -1396,7 +1396,7 @@ RDFServiceImpl::GetDataSource(const char* aURI, bool aBlock, nsIRDFDataSource** Substring(spec, 4, spec.Length() - 4)); // Strip params to get ``base'' contractID for data source. - int32_t p = contractID.FindChar(PRUnichar('&')); + int32_t p = contractID.FindChar(char16_t('&')); if (p >= 0) contractID.Truncate(p); @@ -1435,7 +1435,7 @@ RDFServiceImpl::GetDataSource(const char* aURI, bool aBlock, nsIRDFDataSource** nsresult RDFServiceImpl::RegisterLiteral(nsIRDFLiteral* aLiteral) { - const PRUnichar* value; + const char16_t* value; aLiteral->GetValueConst(&value); NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mLiterals, @@ -1460,7 +1460,7 @@ RDFServiceImpl::RegisterLiteral(nsIRDFLiteral* aLiteral) PR_LOG(gLog, PR_LOG_DEBUG, ("rdfserv register-literal [%p] %s", - aLiteral, (const PRUnichar*) value)); + aLiteral, (const char16_t*) value)); return NS_OK; } @@ -1469,7 +1469,7 @@ RDFServiceImpl::RegisterLiteral(nsIRDFLiteral* aLiteral) nsresult RDFServiceImpl::UnregisterLiteral(nsIRDFLiteral* aLiteral) { - const PRUnichar* value; + const char16_t* value; aLiteral->GetValueConst(&value); NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mLiterals, @@ -1483,7 +1483,7 @@ RDFServiceImpl::UnregisterLiteral(nsIRDFLiteral* aLiteral) // reference to it in the hashtable. PR_LOG(gLog, PR_LOG_DEBUG, ("rdfserv unregister-literal [%p] %s", - aLiteral, (const PRUnichar*) value)); + aLiteral, (const char16_t*) value)); return NS_OK; } diff --git a/rdf/base/src/nsRDFXMLSerializer.cpp b/rdf/base/src/nsRDFXMLSerializer.cpp index 6cfd4d144033..4b3c392a2c45 100644 --- a/rdf/base/src/nsRDFXMLSerializer.cpp +++ b/rdf/base/src/nsRDFXMLSerializer.cpp @@ -371,7 +371,7 @@ nsRDFXMLSerializer::SerializeInlineAssertion(nsIOutputStream* aStream, NS_LITERAL_CSTRING("\n ")); if (NS_FAILED(rv)) return rv; - const PRUnichar* value; + const char16_t* value; aValue->GetValueConst(&value); NS_ConvertUTF16toUTF8 s(value); @@ -424,7 +424,7 @@ nsRDFXMLSerializer::SerializeChildAssertion(nsIOutputStream* aStream, goto no_close_tag; } else if ((literal = do_QueryInterface(aValue)) != nullptr) { - const PRUnichar *value; + const char16_t *value; literal->GetValueConst(&value); NS_ConvertUTF16toUTF8 s(value); @@ -515,12 +515,12 @@ nsRDFXMLSerializer::SerializeProperty(nsIOutputStream* aStream, if (!needsChild) { assertions->HasMoreElements(&needsChild); if (!needsChild) { - const PRUnichar* literalVal = nullptr; + const char16_t* literalVal = nullptr; literal->GetValueConst(&literalVal); if (literalVal) { for (; *literalVal; literalVal++) { - if (*literalVal == PRUnichar('\n') || - *literalVal == PRUnichar('\r')) { + if (*literalVal == char16_t('\n') || + *literalVal == char16_t('\r')) { needsChild = true; break; } @@ -592,7 +592,7 @@ nsRDFXMLSerializer::SerializeDescription(nsIOutputStream* aStream, sizeof(kRDFDescriptionOpen) - 1); if (NS_FAILED(rv)) return rv; } - if (uri[0] == PRUnichar('#')) { + if (uri[0] == char16_t('#')) { uri.Cut(0, 1); rv = rdf_BlockingWrite(aStream, kIDAttr, sizeof(kIDAttr) - 1); } @@ -758,7 +758,7 @@ static const char kRDFLIOpen[] = " GetValueConst(&value); static const char kRDFLIOpenGT[] = ">"; // close the 'GetValueConst(&value); nsAutoCString object; object.AppendLiteral("\""); diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index 1fb833d5f736..44fe947e185b 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -153,8 +153,8 @@ FileSystemDataSource::Init() tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"), getter_AddRefs(mRDF_type)); - static const PRUnichar kTrue[] = {'t','r','u','e','\0'}; - static const PRUnichar kFalse[] = {'f','a','l','s','e','\0'}; + static const char16_t kTrue[] = {'t','r','u','e','\0'}; + static const char16_t kFalse[] = {'f','a','l','s','e','\0'}; tmp = mRDFService->GetLiteral(kTrue, getter_AddRefs(mLiteralTrue)); if (NS_FAILED(tmp)) { @@ -332,7 +332,7 @@ FileSystemDataSource::GetTarget(nsIRDFResource *source, if (isFavorite || !url) rv = NS_RDF_NO_VALUE; if (rv == NS_RDF_NO_VALUE) return(rv); - const PRUnichar *uni = nullptr; + const char16_t *uni = nullptr; url->GetValueConst(&uni); if (!uni) return(NS_RDF_NO_VALUE); nsAutoString urlStr; @@ -854,7 +854,7 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult) for (volNum = 0; volNum < 26; volNum++) { - swprintf( drive, L"%c:\\", volNum + (PRUnichar)'A'); + swprintf( drive, L"%c:\\", volNum + (char16_t)'A'); driveType = GetDriveTypeW(drive); if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR) @@ -939,7 +939,7 @@ FileSystemDataSource::isValidFolder(nsIRDFResource *source) if (NS_FAILED(rv = GetName(res, getter_AddRefs(nameLiteral)))) break; - const PRUnichar *uniName; + const char16_t *uniName; if (NS_FAILED(rv = nameLiteral->GetValueConst(&uniName))) break; nsAutoString name(uniName); @@ -1233,7 +1233,7 @@ FileSystemDataSource::GetExtension(nsIRDFResource *source, nsIRDFLiteral **aResu if (NS_FAILED(rv)) return rv; - const PRUnichar* unicodeLeafName; + const char16_t* unicodeLeafName; rv = name->GetValueConst(&unicodeLeafName); if (NS_FAILED(rv)) return rv; diff --git a/rdf/datasource/src/nsLocalStore.cpp b/rdf/datasource/src/nsLocalStore.cpp index d6cddc4c6f8e..c0704facbde6 100644 --- a/rdf/datasource/src/nsLocalStore.cpp +++ b/rdf/datasource/src/nsLocalStore.cpp @@ -459,7 +459,7 @@ LocalStoreImpl::DoCommand(nsISupportsArray* aSources, } NS_IMETHODIMP -LocalStoreImpl::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +LocalStoreImpl::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { nsresult rv = NS_OK; diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 419b34f53b66..d133b33bf483 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -326,7 +326,7 @@ nsSecureBrowserUIImpl::SetDocShell(nsIDocShell *aDocShell) NS_IMETHODIMP nsSecureBrowserUIImpl::Observe(nsISupports*, const char*, - const PRUnichar*) + const char16_t*) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1495,7 +1495,7 @@ NS_IMETHODIMP nsSecureBrowserUIImpl::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; diff --git a/security/manager/boot/src/nsSecurityWarningDialogs.cpp b/security/manager/boot/src/nsSecurityWarningDialogs.cpp index c6e4010d2a32..29ca482d1589 100644 --- a/security/manager/boot/src/nsSecurityWarningDialogs.cpp +++ b/security/manager/boot/src/nsSecurityWarningDialogs.cpp @@ -65,8 +65,8 @@ nsSecurityWarningDialogs::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor nsresult nsSecurityWarningDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char *prefName, - const PRUnichar *messageName, - const PRUnichar *showAgainName, + const char16_t *messageName, + const char16_t *showAgainName, const uint32_t aBucket, bool* _result) { @@ -120,7 +120,7 @@ nsSecurityWarningDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char * if (!windowTitle || !message || !cont) return NS_ERROR_FAILURE; // Replace # characters with newlines to lay out the dialog. - PRUnichar* msgchars = message.BeginWriting(); + char16_t* msgchars = message.BeginWriting(); uint32_t i = 0; for (i = 0; msgchars[i] != '\0'; i++) { diff --git a/security/manager/boot/src/nsSecurityWarningDialogs.h b/security/manager/boot/src/nsSecurityWarningDialogs.h index c7b96bd39ffd..6fae315cec82 100644 --- a/security/manager/boot/src/nsSecurityWarningDialogs.h +++ b/security/manager/boot/src/nsSecurityWarningDialogs.h @@ -25,12 +25,12 @@ public: protected: nsresult AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName, - const PRUnichar *messageName, - const PRUnichar *showAgainName, + const char16_t *messageName, + const char16_t *showAgainName, bool aAsync, const uint32_t aBucket); nsresult ConfirmDialog(nsIInterfaceRequestor *ctx, const char *prefName, - const PRUnichar *messageName, - const PRUnichar *showAgainName, const uint32_t aBucket, + const char16_t *messageName, + const char16_t *showAgainName, const uint32_t aBucket, bool* _result); nsCOMPtr mStringBundle; nsCOMPtr mPrefBranch; diff --git a/security/manager/boot/src/nsSiteSecurityService.cpp b/security/manager/boot/src/nsSiteSecurityService.cpp index 742187550a1e..e5734b4e7e01 100644 --- a/security/manager/boot/src/nsSiteSecurityService.cpp +++ b/security/manager/boot/src/nsSiteSecurityService.cpp @@ -625,7 +625,7 @@ nsSiteSecurityService::ShouldIgnoreHeaders(nsISupports* aSecurityInfo, NS_IMETHODIMP nsSiteSecurityService::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { if (strcmp(topic, "last-pb-context-exited") == 0) { mPrivateModeHostTable.Clear(); diff --git a/security/manager/pki/src/nsASN1Tree.cpp b/security/manager/pki/src/nsASN1Tree.cpp index 30719fa3a508..54a543bd95c6 100644 --- a/security/manager/pki/src/nsASN1Tree.cpp +++ b/security/manager/pki/src/nsASN1Tree.cpp @@ -390,21 +390,21 @@ nsNSSASN1Tree::SetCellText(int32_t row, nsITreeColumn* col, /* void performAction (in wstring action); */ NS_IMETHODIMP -nsNSSASN1Tree::PerformAction(const PRUnichar *action) +nsNSSASN1Tree::PerformAction(const char16_t *action) { return NS_OK; } /* void performActionOnRow (in wstring action, in long row); */ NS_IMETHODIMP -nsNSSASN1Tree::PerformActionOnRow(const PRUnichar *action, int32_t row) +nsNSSASN1Tree::PerformActionOnRow(const char16_t *action, int32_t row) { return NS_OK; } /* void performActionOnCell (in wstring action, in long row, in nsITreeColumn col); */ NS_IMETHODIMP -nsNSSASN1Tree::PerformActionOnCell(const PRUnichar *action, int32_t row, +nsNSSASN1Tree::PerformActionOnCell(const char16_t *action, int32_t row, nsITreeColumn* col) { return NS_OK; diff --git a/security/manager/pki/src/nsFormSigningDialog.cpp b/security/manager/pki/src/nsFormSigningDialog.cpp index 88298d8deb5d..ac0e7e791818 100644 --- a/security/manager/pki/src/nsFormSigningDialog.cpp +++ b/security/manager/pki/src/nsFormSigningDialog.cpp @@ -27,8 +27,8 @@ NS_IMETHODIMP nsFormSigningDialog::ConfirmSignText(nsIInterfaceRequestor *aContext, const nsAString &aHost, const nsAString &aSignText, - const PRUnichar **aCertNickList, - const PRUnichar **aCertDetailsList, + const char16_t **aCertNickList, + const char16_t **aCertDetailsList, uint32_t aCount, int32_t *aSelectedIndex, nsAString &aPassword, bool *aCanceled) { diff --git a/security/manager/pki/src/nsNSSDialogs.cpp b/security/manager/pki/src/nsNSSDialogs.cpp index d4ca0759d5f0..02fe41b2e718 100644 --- a/security/manager/pki/src/nsNSSDialogs.cpp +++ b/security/manager/pki/src/nsNSSDialogs.cpp @@ -72,7 +72,7 @@ nsNSSDialogs::Init() nsresult nsNSSDialogs::SetPassword(nsIInterfaceRequestor *ctx, - const PRUnichar *tokenName, bool* _canceled) + const char16_t *tokenName, bool* _canceled) { nsresult rv; @@ -107,8 +107,8 @@ nsNSSDialogs::SetPassword(nsIInterfaceRequestor *ctx, nsresult nsNSSDialogs::GetPassword(nsIInterfaceRequestor *ctx, - const PRUnichar *tokenName, - PRUnichar **_password, + const char16_t *tokenName, + char16_t **_password, bool* _canceled) { nsresult rv; @@ -219,7 +219,7 @@ nsNSSDialogs::NotifyCACertExists(nsIInterfaceRequestor *ctx) NS_IMETHODIMP -nsNSSDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const PRUnichar *cn, const PRUnichar *organization, const PRUnichar *issuer, const PRUnichar **certNickList, const PRUnichar **certDetailsList, uint32_t count, int32_t *selectedIndex, bool *canceled) +nsNSSDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const char16_t *cn, const char16_t *organization, const char16_t *issuer, const char16_t **certNickList, const char16_t **certDetailsList, uint32_t count, int32_t *selectedIndex, bool *canceled) { nsresult rv; uint32_t i; @@ -286,8 +286,8 @@ nsNSSDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const PRUnichar *cn, NS_IMETHODIMP nsNSSDialogs::PickCertificate(nsIInterfaceRequestor *ctx, - const PRUnichar **certNickList, - const PRUnichar **certDetailsList, + const char16_t **certNickList, + const char16_t **certDetailsList, uint32_t count, int32_t *selectedIndex, bool *canceled) @@ -364,7 +364,7 @@ nsNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, *_retval = (status == 0) ? false : true; if (*_retval) { // retrieve the password - PRUnichar *pw; + char16_t *pw; rv = block->GetString(2, &pw); if (NS_SUCCEEDED(rv)) { _password = pw; @@ -398,7 +398,7 @@ nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, *_retval = (status == 0) ? false : true; if (*_retval) { // retrieve the password - PRUnichar *pw; + char16_t *pw; rv = block->GetString(2, &pw); if (NS_SUCCEEDED(rv)) { _password = pw; @@ -449,7 +449,7 @@ nsNSSDialogs::DisplayGeneratingKeypairInfo(nsIInterfaceRequestor *aCtx, nsIKeyge } NS_IMETHODIMP -nsNSSDialogs::ChooseToken(nsIInterfaceRequestor *aCtx, const PRUnichar **aTokenList, uint32_t aCount, PRUnichar **aTokenChosen, bool *aCanceled) { +nsNSSDialogs::ChooseToken(nsIInterfaceRequestor *aCtx, const char16_t **aTokenList, uint32_t aCount, char16_t **aTokenChosen, bool *aCanceled) { nsresult rv; uint32_t i; diff --git a/security/manager/pki/src/nsPKIParamBlock.cpp b/security/manager/pki/src/nsPKIParamBlock.cpp index 825d73057bcb..35b876045341 100644 --- a/security/manager/pki/src/nsPKIParamBlock.cpp +++ b/security/manager/pki/src/nsPKIParamBlock.cpp @@ -47,13 +47,13 @@ nsPKIParamBlock::GetInt(int32_t inIndex, int32_t *outInt) NS_IMETHODIMP -nsPKIParamBlock::GetString(int32_t inIndex, PRUnichar **_retval) +nsPKIParamBlock::GetString(int32_t inIndex, char16_t **_retval) { return mDialogParamBlock->GetString(inIndex, _retval); } NS_IMETHODIMP -nsPKIParamBlock::SetString(int32_t inIndex, const PRUnichar *inString) +nsPKIParamBlock::SetString(int32_t inIndex, const char16_t *inString) { return mDialogParamBlock->SetString(inIndex, inString); } diff --git a/security/manager/ssl/src/PSMContentDownloader.h b/security/manager/ssl/src/PSMContentDownloader.h index ef4507633849..d98fed93c1f9 100644 --- a/security/manager/ssl/src/PSMContentDownloader.h +++ b/security/manager/ssl/src/PSMContentDownloader.h @@ -107,14 +107,14 @@ class NS_NO_VTABLE nsINSSComponent : public nsISupports { NS_IMETHOD GetPIPNSSBundleString(const char *name, nsAString &outString) = 0; NS_IMETHOD PIPBundleFormatStringFromName(const char *name, - const PRUnichar **params, + const char16_t **params, uint32_t numParams, nsAString &outString) = 0; NS_IMETHOD GetNSSBundleString(const char *name, nsAString &outString) = 0; NS_IMETHOD NSSBundleFormatStringFromName(const char *name, - const PRUnichar **params, + const char16_t **params, uint32_t numParams, nsAString &outString) = 0; @@ -182,13 +182,13 @@ public: NS_IMETHOD GetPIPNSSBundleString(const char *name, nsAString &outString); NS_IMETHOD PIPBundleFormatStringFromName(const char *name, - const PRUnichar **params, + const char16_t **params, uint32_t numParams, nsAString &outString); NS_IMETHOD GetNSSBundleString(const char *name, nsAString &outString); NS_IMETHOD NSSBundleFormatStringFromName(const char *name, - const PRUnichar **params, + const char16_t **params, uint32_t numParams, nsAString &outString); NS_IMETHOD SkipOcsp(); diff --git a/security/manager/ssl/src/SharedSSLState.cpp b/security/manager/ssl/src/SharedSSLState.cpp index 89af353c2ffc..698efe914ce6 100644 --- a/security/manager/ssl/src/SharedSSLState.cpp +++ b/security/manager/ssl/src/SharedSSLState.cpp @@ -123,7 +123,7 @@ NS_IMPL_ISUPPORTS1(PrivateBrowsingObserver, nsIObserver) NS_IMETHODIMP PrivateBrowsingObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "last-pb-context-exited")) { mOwner->ResetStoredData(); diff --git a/security/manager/ssl/src/TransportSecurityInfo.cpp b/security/manager/ssl/src/TransportSecurityInfo.cpp index 4b95fa5191d6..b2beca462ea9 100644 --- a/security/manager/ssl/src/TransportSecurityInfo.cpp +++ b/security/manager/ssl/src/TransportSecurityInfo.cpp @@ -172,7 +172,7 @@ TransportSecurityInfo::Flush() } NS_IMETHODIMP -TransportSecurityInfo::GetErrorMessage(PRUnichar** aText) +TransportSecurityInfo::GetErrorMessage(char16_t** aText) { NS_ENSURE_ARG_POINTER(aText); *aText = nullptr; @@ -559,7 +559,7 @@ formatPlainErrorMessage(const nsXPIDLCString &host, int32_t port, { static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID); - const PRUnichar *params[1]; + const char16_t *params[1]; nsresult rv; nsCOMPtr component = do_GetService(kNSSComponentCID, &rv); @@ -755,7 +755,7 @@ AppendErrorTextMismatch(const nsString &host, bool wantsHtml, nsString &returnedMessage) { - const PRUnichar *params[1]; + const char16_t *params[1]; nsresult rv; ScopedCERTCertificate nssCert; @@ -812,7 +812,7 @@ AppendErrorTextMismatch(const nsString &host, } } else if (nameCount == 1) { - const PRUnichar *params[1]; + const char16_t *params[1]; params[0] = allNames.get(); const char *stringID; @@ -895,7 +895,7 @@ AppendErrorTextTime(nsIX509Cert* ix509, bool trueExpired_falseNotYetValid; GetDateBoundary(ix509, formattedDate, nowDate, trueExpired_falseNotYetValid); - const PRUnichar *params[2]; + const char16_t *params[2]; params[0] = formattedDate.get(); // might be empty, if helper function had a problem params[1] = nowDate.get(); @@ -927,7 +927,7 @@ AppendErrorTextCode(PRErrorCode errorCodeToReport, ToLowerCase(error_id); NS_ConvertASCIItoUTF16 idU(error_id); - const PRUnichar *params[1]; + const char16_t *params[1]; params[0] = idU.get(); nsString formattedString; @@ -962,7 +962,7 @@ formatOverridableCertErrorMessage(nsISSLStatus & sslStatus, { static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID); - const PRUnichar *params[1]; + const char16_t *params[1]; nsresult rv; nsAutoString hostWithPort; nsAutoString hostWithoutPort; diff --git a/security/manager/ssl/src/TransportSecurityInfo.h b/security/manager/ssl/src/TransportSecurityInfo.h index 285618b0924a..47aafccf9d05 100644 --- a/security/manager/ssl/src/TransportSecurityInfo.h +++ b/security/manager/ssl/src/TransportSecurityInfo.h @@ -47,7 +47,7 @@ public: NS_DECL_NSICLASSINFO nsresult SetSecurityState(uint32_t aState); - nsresult SetShortSecurityDescription(const PRUnichar *aText); + nsresult SetShortSecurityDescription(const char16_t *aText); const nsACString & GetHostName() const { return mHostName; } const char * GetHostNameRaw() const { return mHostName.get(); } diff --git a/security/manager/ssl/src/nsCertOverrideService.cpp b/security/manager/ssl/src/nsCertOverrideService.cpp index 3c849d96b562..04cad13639d1 100644 --- a/security/manager/ssl/src/nsCertOverrideService.cpp +++ b/security/manager/ssl/src/nsCertOverrideService.cpp @@ -136,7 +136,7 @@ nsCertOverrideService::Init() NS_IMETHODIMP nsCertOverrideService::Observe(nsISupports *, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // check the topic if (!nsCRT::strcmp(aTopic, "profile-before-change")) { @@ -659,7 +659,7 @@ nsCertOverrideService::ClearValidityOverride(const nsACString & aHostName, int32 NS_IMETHODIMP nsCertOverrideService::GetAllOverrideHostsWithPorts(uint32_t *aCount, - PRUnichar ***aHostsWithPortsArray) + char16_t ***aHostsWithPortsArray) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/security/manager/ssl/src/nsCertPicker.cpp b/security/manager/ssl/src/nsCertPicker.cpp index bffdae902534..b7118cdab7db 100644 --- a/security/manager/ssl/src/nsCertPicker.cpp +++ b/security/manager/ssl/src/nsCertPicker.cpp @@ -31,7 +31,7 @@ nsCertPicker::~nsCertPicker() } NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, - const PRUnichar *selectedNickname, + const char16_t *selectedNickname, int32_t certUsage, bool allowInvalid, bool allowDuplicateNicknames, @@ -41,8 +41,8 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, nsNSSShutDownPreventionLock locker; int32_t selectedIndex = -1; bool selectionFound = false; - PRUnichar **certNicknameList = nullptr; - PRUnichar **certDetailsList = nullptr; + char16_t **certNicknameList = nullptr; + char16_t **certDetailsList = nullptr; CERTCertListNode* node = nullptr; nsresult rv = NS_OK; @@ -70,8 +70,8 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, return NS_ERROR_NOT_AVAILABLE; } - certNicknameList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames); - certDetailsList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames); + certNicknameList = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * nicknames->numnicknames); + certDetailsList = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * nicknames->numnicknames); if (!certNicknameList || !certDetailsList) { nsMemory::Free(certNicknameList); @@ -135,7 +135,7 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, else { /* Throw up the cert picker dialog and get back the index of the selected cert */ rv = dialogs->PickCertificate(ctx, - (const PRUnichar**)certNicknameList, (const PRUnichar**)certDetailsList, + (const char16_t**)certNicknameList, (const char16_t**)certDetailsList, CertsToUse, &selectedIndex, canceled); } diff --git a/security/manager/ssl/src/nsCertTree.cpp b/security/manager/ssl/src/nsCertTree.cpp index 8a93709f2d8c..f0ba2439ba3b 100644 --- a/security/manager/ssl/src/nsCertTree.cpp +++ b/security/manager/ssl/src/nsCertTree.cpp @@ -1084,7 +1084,7 @@ nsCertTree::GetCellText(int32_t row, nsITreeColumn* col, nsresult rv; _retval.Truncate(); - const PRUnichar* colID; + const char16_t* colID; col->GetIdConst(&colID); treeArrayEl *el = GetThreadDescAtIndex(row); @@ -1349,14 +1349,14 @@ nsCertTree::SetCellText(int32_t row, nsITreeColumn* col, /* void performAction (in wstring action); */ NS_IMETHODIMP -nsCertTree::PerformAction(const PRUnichar *action) +nsCertTree::PerformAction(const char16_t *action) { return NS_OK; } /* void performActionOnRow (in wstring action, in long row); */ NS_IMETHODIMP -nsCertTree::PerformActionOnRow(const PRUnichar *action, int32_t row) +nsCertTree::PerformActionOnRow(const char16_t *action, int32_t row) { return NS_OK; } @@ -1365,7 +1365,7 @@ nsCertTree::PerformActionOnRow(const PRUnichar *action, int32_t row) * in wstring colID); */ NS_IMETHODIMP -nsCertTree::PerformActionOnCell(const PRUnichar *action, int32_t row, +nsCertTree::PerformActionOnCell(const char16_t *action, int32_t row, nsITreeColumn* col) { return NS_OK; @@ -1390,7 +1390,7 @@ nsCertTree::dumpMap() } nsCOMPtr ct = GetCertAtIndex(i); if (ct) { - PRUnichar *goo; + char16_t *goo; ct->GetCommonName(&goo); nsAutoString doo(goo); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("cert [%d]: %s", i, NS_LossyConvertUTF16toASCII(doo).get())); diff --git a/security/manager/ssl/src/nsCertVerificationThread.cpp b/security/manager/ssl/src/nsCertVerificationThread.cpp index 7447d710ae2c..b2bbf99ef3ee 100644 --- a/security/manager/ssl/src/nsCertVerificationThread.cpp +++ b/security/manager/ssl/src/nsCertVerificationThread.cpp @@ -43,7 +43,7 @@ void nsCertVerificationJob::Run() uint32_t verified; uint32_t count; - PRUnichar **usages; + char16_t **usages; nsCOMPtr ires; RefPtr vres(new nsCertVerificationResult); @@ -176,7 +176,7 @@ nsCertVerificationResult::~nsCertVerificationResult() NS_IMETHODIMP nsCertVerificationResult::GetUsagesArrayResult(uint32_t *aVerified, uint32_t *aCount, - PRUnichar ***aUsages) + char16_t ***aUsages) { if (NS_FAILED(mRV)) return mRV; diff --git a/security/manager/ssl/src/nsClientAuthRemember.cpp b/security/manager/ssl/src/nsClientAuthRemember.cpp index 2b1c5449077c..cb8e3b3db860 100644 --- a/security/manager/ssl/src/nsClientAuthRemember.cpp +++ b/security/manager/ssl/src/nsClientAuthRemember.cpp @@ -61,7 +61,7 @@ nsClientAuthRememberService::Init() NS_IMETHODIMP nsClientAuthRememberService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // check the topic if (!nsCRT::strcmp(aTopic, "profile-before-change")) { diff --git a/security/manager/ssl/src/nsCrypto.cpp b/security/manager/ssl/src/nsCrypto.cpp index 6f8ae26e361a..a0af934f8034 100644 --- a/security/manager/ssl/src/nsCrypto.cpp +++ b/security/manager/ssl/src/nsCrypto.cpp @@ -2624,14 +2624,14 @@ nsCrypto::SignText(JSContext* aContext, NS_ASSERTION(nicknames->numnicknames == numberOfCerts, "nicknames->numnicknames != numberOfCerts"); - nsAutoArrayPtr certNicknameList(new PRUnichar*[nicknames->numnicknames * 2]); + nsAutoArrayPtr certNicknameList(new char16_t*[nicknames->numnicknames * 2]); if (!certNicknameList) { aReturn.Append(internalError); return; } - PRUnichar** certDetailsList = certNicknameList.get() + nicknames->numnicknames; + char16_t** certDetailsList = certNicknameList.get() + nicknames->numnicknames; int32_t certsToUse; for (node = CERT_LIST_HEAD(certList), certsToUse = 0; @@ -2672,8 +2672,8 @@ nsCrypto::SignText(JSContext* aContext, // of the selected cert. int32_t selectedIndex = -1; rv = fsd->ConfirmSignText(uiContext, utf16Host, aStringToSign, - const_cast(certNicknameList.get()), - const_cast(certDetailsList), + const_cast(certNicknameList.get()), + const_cast(certDetailsList), certsToUse, &selectedIndex, password, &canceled); if (NS_FAILED(rv) || canceled) { diff --git a/security/manager/ssl/src/nsKeygenHandler.cpp b/security/manager/ssl/src/nsKeygenHandler.cpp index 874836722d11..0946347ef1f0 100644 --- a/security/manager/ssl/src/nsKeygenHandler.cpp +++ b/security/manager/ssl/src/nsKeygenHandler.cpp @@ -356,9 +356,9 @@ GetSlotWithMechanism(uint32_t aMechanism, { nsNSSShutDownPreventionLock locker; PK11SlotList * slotList = nullptr; - PRUnichar** tokenNameList = nullptr; + char16_t** tokenNameList = nullptr; nsITokenDialogs * dialogs; - PRUnichar *unicodeTokenChosen; + char16_t *unicodeTokenChosen; PK11SlotListElement *slotElement, *tmpSlot; uint32_t numSlots = 0, i = 0; bool canceled; @@ -386,7 +386,7 @@ GetSlotWithMechanism(uint32_t aMechanism, } // Allocate the slot name buffer // - tokenNameList = static_cast(nsMemory::Alloc(sizeof(PRUnichar *) * numSlots)); + tokenNameList = static_cast(nsMemory::Alloc(sizeof(char16_t *) * numSlots)); if (!tokenNameList) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; @@ -424,7 +424,7 @@ GetSlotWithMechanism(uint32_t aMechanism, rv = NS_ERROR_NOT_AVAILABLE; } else { - rv = dialogs->ChooseToken(m_ctx, (const PRUnichar**)tokenNameList, numSlots, &unicodeTokenChosen, &canceled); + rv = dialogs->ChooseToken(m_ctx, (const char16_t**)tokenNameList, numSlots, &unicodeTokenChosen, &canceled); } } NS_RELEASE(dialogs); diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp index 3d4b3d70c2a8..360f6972ace4 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp @@ -793,7 +793,7 @@ void PK11PasswordPromptRunnable::RunOnTargetThread() nsNSSShutDownPreventionLock locker; nsresult rv = NS_OK; - PRUnichar *password = nullptr; + char16_t *password = nullptr; bool value = false; nsCOMPtr prompt; @@ -827,13 +827,13 @@ void PK11PasswordPromptRunnable::RunOnTargetThread() if (NS_FAILED(rv)) return; - const PRUnichar* formatStrings[1] = { + const char16_t* formatStrings[1] = { ToNewUnicode(NS_ConvertUTF8toUTF16(PK11_GetTokenName(mSlot))) }; rv = nssComponent->PIPBundleFormatStringFromName("CertPassPrompt", formatStrings, 1, promptString); - nsMemory::Free(const_cast(formatStrings[0])); + nsMemory::Free(const_cast(formatStrings[0])); if (NS_FAILED(rv)) return; diff --git a/security/manager/ssl/src/nsNSSCertHelper.cpp b/security/manager/ssl/src/nsNSSCertHelper.cpp index b6871cc8523f..c44104efc72d 100644 --- a/security/manager/ssl/src/nsNSSCertHelper.cpp +++ b/security/manager/ssl/src/nsNSSCertHelper.cpp @@ -613,7 +613,7 @@ GetOIDText(SECItem *oid, nsINSSComponent *nssComponent, nsAString &text) if (NS_FAILED(rv)) return rv; - const PRUnichar *params[1] = {text2.get()}; + const char16_t *params[1] = {text2.get()}; rv = nssComponent->PIPBundleFormatStringFromName("CertDumpDefOID", params, 1, text); } @@ -646,7 +646,7 @@ ProcessRawBytes(nsINSSComponent *nssComponent, SECItem *data, bytelen.AppendInt(data->len); bitlen.AppendInt(data->len*8); - const PRUnichar *params[2] = {bytelen.get(), bitlen.get()}; + const char16_t *params[2] = {bytelen.get(), bitlen.get()}; nsresult rv = nssComponent->PIPBundleFormatStringFromName("CertDumpRawBytesHeader", params, 2, text); if (NS_FAILED(rv)) @@ -811,7 +811,7 @@ ProcessBasicConstraints(SECItem *extData, nssComponent->GetPIPNSSBundleString("CertDumpPathLenUnlimited", depth); else depth.AppendInt(value.pathLenConstraint); - const PRUnichar *params[1] = {depth.get()}; + const char16_t *params[1] = {depth.get()}; rv2 = nssComponent->PIPBundleFormatStringFromName("CertDumpPathLen", params, 1, local); if (NS_FAILED(rv2)) @@ -881,7 +881,7 @@ ProcessRDN(CERTRDN* rdn, nsAString &finalString, nsINSSComponent *nssComponent) nsString avavalue; nsString type; nsAutoString temp; - const PRUnichar *params[2]; + const char16_t *params[2]; avas = rdn->avas; while ((ava = *avas++) != 0) { @@ -923,7 +923,7 @@ ProcessRDN(CERTRDN* rdn, nsAString &finalString, nsINSSComponent *nssComponent) } static nsresult -ProcessName(CERTName *name, nsINSSComponent *nssComponent, PRUnichar **value) +ProcessName(CERTName *name, nsINSSComponent *nssComponent, char16_t **value) { CERTRDN** rdns; CERTRDN** rdn; @@ -1752,7 +1752,7 @@ ProcessSECAlgorithmID(SECAlgorithmID *algID, } static nsresult -ProcessTime(PRTime dispTime, const PRUnichar *displayName, +ProcessTime(PRTime dispTime, const char16_t *displayName, nsIASN1Sequence *parentSequence) { nsresult rv; @@ -1831,7 +1831,7 @@ ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki, false); ProcessRawBytes(nssComponent, &key->u.rsa.publicExponent, data2, false); - const PRUnichar *params[4] = {length1.get(), data1.get(), + const char16_t *params[4] = {length1.get(), data1.get(), length2.get(), data2.get()}; nssComponent->PIPBundleFormatStringFromName("CertDumpRSATemplate", params, 4, text); @@ -1854,7 +1854,7 @@ ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki, int i_pv = DER_GetInteger(&ecpk.publicValue); s_pv.AppendInt(i_pv); } - const PRUnichar *params[] = {s_fsl.get(), s_bpol.get(), s_pv.get()}; + const char16_t *params[] = {s_fsl.get(), s_bpol.get(), s_pv.get()}; nssComponent->PIPBundleFormatStringFromName("CertDumpECTemplate", params, 3, text); break; diff --git a/security/manager/ssl/src/nsNSSCertificate.cpp b/security/manager/ssl/src/nsNSSCertificate.cpp index c592801573c6..11e279fd89b5 100644 --- a/security/manager/ssl/src/nsNSSCertificate.cpp +++ b/security/manager/ssl/src/nsNSSCertificate.cpp @@ -362,11 +362,11 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoIssuedFor", info))) { details.Append(info); - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); if (NS_SUCCEEDED(GetSubjectName(temp1)) && !temp1.IsEmpty()) { details.Append(temp1); } - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } if (NS_SUCCEEDED(GetSerialNumber(temp1)) && !temp1.IsEmpty()) { @@ -379,9 +379,9 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni nickWithSerial.AppendLiteral(" ["); nickWithSerial.Append(temp1); - nickWithSerial.Append(PRUnichar(']')); + nickWithSerial.Append(char16_t(']')); - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } nsCOMPtr validity; @@ -393,24 +393,24 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni } if (NS_SUCCEEDED(validity->GetNotBeforeLocalTime(temp1)) && !temp1.IsEmpty()) { - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoFrom", info))) { details.Append(info); - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); } details.Append(temp1); } if (NS_SUCCEEDED(validity->GetNotAfterLocalTime(temp1)) && !temp1.IsEmpty()) { - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoTo", info))) { details.Append(info); - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); } details.Append(temp1); } - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } if (NS_SUCCEEDED(GetKeyUsagesString(mCert, nssComponent, temp1)) && !temp1.IsEmpty()) { @@ -420,7 +420,7 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni details.AppendLiteral(": "); } details.Append(temp1); - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } nsAutoString firstEmail; @@ -462,23 +462,23 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni if (!firstEmail.IsEmpty()) { // We got at least one email address, so we want a newline - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoIssuedBy", info))) { details.Append(info); - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); if (NS_SUCCEEDED(GetIssuerName(temp1)) && !temp1.IsEmpty()) { details.Append(temp1); } - details.Append(PRUnichar('\n')); + details.Append(char16_t('\n')); } if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoStoredIn", info))) { details.Append(info); - details.Append(PRUnichar(' ')); + details.Append(char16_t(' ')); if (NS_SUCCEEDED(GetTokenName(temp1)) && !temp1.IsEmpty()) { details.Append(temp1); @@ -607,7 +607,7 @@ nsNSSCertificate::GetEmailAddress(nsAString &aEmailAddress) } NS_IMETHODIMP -nsNSSCertificate::GetEmailAddresses(uint32_t *aLength, PRUnichar*** aAddresses) +nsNSSCertificate::GetEmailAddresses(uint32_t *aLength, char16_t*** aAddresses) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -628,7 +628,7 @@ nsNSSCertificate::GetEmailAddresses(uint32_t *aLength, PRUnichar*** aAddresses) ++(*aLength); } - *aAddresses = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * (*aLength)); + *aAddresses = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * (*aLength)); if (!*aAddresses) return NS_ERROR_OUT_OF_MEMORY; @@ -912,7 +912,7 @@ done: } NS_IMETHODIMP -nsNSSCertificate::GetAllTokenNames(uint32_t *aLength, PRUnichar*** aTokenNames) +nsNSSCertificate::GetAllTokenNames(uint32_t *aLength, char16_t*** aTokenNames) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -941,7 +941,7 @@ nsNSSCertificate::GetAllTokenNames(uint32_t *aLength, PRUnichar*** aTokenNames) ++(*aLength); } - *aTokenNames = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * (*aLength)); + *aTokenNames = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * (*aLength)); if (!*aTokenNames) { *aLength = 0; return NS_ERROR_OUT_OF_MEMORY; @@ -1272,7 +1272,7 @@ NS_IMETHODIMP nsNSSCertificate::GetUsagesArray(bool localOnly, uint32_t *_verified, uint32_t *_count, - PRUnichar ***_usages) + char16_t ***_usages) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -1280,14 +1280,14 @@ nsNSSCertificate::GetUsagesArray(bool localOnly, nsresult rv; const int max_usages = 13; - PRUnichar *tmpUsages[max_usages]; + char16_t *tmpUsages[max_usages]; const char *suffix = ""; uint32_t tmpCount; nsUsageArrayHelper uah(mCert); rv = uah.GetUsagesArray(suffix, localOnly, max_usages, _verified, &tmpCount, tmpUsages); NS_ENSURE_SUCCESS(rv,rv); if (tmpCount > 0) { - *_usages = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * tmpCount); + *_usages = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * tmpCount); if (!*_usages) return NS_ERROR_OUT_OF_MEMORY; for (uint32_t i=0; inumnicknames); + certNicknameList = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * nicknames->numnicknames); if (!certNicknameList) goto loser; - certDetailsList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames); + certDetailsList = (char16_t **)nsMemory::Alloc(sizeof(char16_t *) * nicknames->numnicknames); if (!certDetailsList) { nsMemory::Free(certNicknameList); goto loser; @@ -2475,8 +2475,8 @@ if (!hasRemembered) else { rv = dialogs->ChooseCertificate(mSocketInfo, cn_host_port.get(), org.get(), issuer.get(), - (const PRUnichar**)certNicknameList, - (const PRUnichar**)certDetailsList, + (const char16_t**)certNicknameList, + (const char16_t**)certDetailsList, CertsToUse, &selectedIndex, &canceled); } } diff --git a/security/manager/ssl/src/nsNTLMAuthModule.cpp b/security/manager/ssl/src/nsNTLMAuthModule.cpp index 5988b680fb54..9db788b5e782 100644 --- a/security/manager/ssl/src/nsNTLMAuthModule.cpp +++ b/security/manager/ssl/src/nsNTLMAuthModule.cpp @@ -281,7 +281,7 @@ WriteSecBuf(void *buf, uint16_t length, uint32_t offset) * convert the unicode buffer to little-endian on big-endian platforms. */ static void * -WriteUnicodeLE(void *buf, const PRUnichar *str, uint32_t strLen) +WriteUnicodeLE(void *buf, const char16_t *str, uint32_t strLen) { // convert input string from BE to LE uint8_t *cursor = (uint8_t *) buf, @@ -590,7 +590,7 @@ GenerateType3Msg(const nsString &domain, ucsDomainBuf = domain; domainPtr = ucsDomainBuf.get(); domainLen = ucsDomainBuf.Length() * 2; - WriteUnicodeLE((void *) domainPtr, (const PRUnichar *) domainPtr, + WriteUnicodeLE((void *) domainPtr, (const char16_t *) domainPtr, ucsDomainBuf.Length()); #else domainPtr = domain.get(); @@ -613,7 +613,7 @@ GenerateType3Msg(const nsString &domain, ucsUserBuf = username; userPtr = ucsUserBuf.get(); userLen = ucsUserBuf.Length() * 2; - WriteUnicodeLE((void *) userPtr, (const PRUnichar *) userPtr, + WriteUnicodeLE((void *) userPtr, (const char16_t *) userPtr, ucsUserBuf.Length()); #else userPtr = username.get(); @@ -641,7 +641,7 @@ GenerateType3Msg(const nsString &domain, hostPtr = ucsHostBuf.get(); hostLen = ucsHostBuf.Length() * 2; #ifdef IS_BIG_ENDIAN - WriteUnicodeLE((void *) hostPtr, (const PRUnichar *) hostPtr, + WriteUnicodeLE((void *) hostPtr, (const char16_t *) hostPtr, ucsHostBuf.Length()); #endif } @@ -764,9 +764,9 @@ nsNTLMAuthModule::InitTest() NS_IMETHODIMP nsNTLMAuthModule::Init(const char *serviceName, uint32_t serviceFlags, - const PRUnichar *domain, - const PRUnichar *username, - const PRUnichar *password) + const char16_t *domain, + const char16_t *username, + const char16_t *password) { NS_ASSERTION((serviceFlags & ~nsIAuthModule::REQ_PROXY_AUTH) == nsIAuthModule::REQ_DEFAULT, "unexpected service flags"); diff --git a/security/manager/ssl/src/nsPK11TokenDB.cpp b/security/manager/ssl/src/nsPK11TokenDB.cpp index 50a58fdd313d..bdf2f382cdc4 100644 --- a/security/manager/ssl/src/nsPK11TokenDB.cpp +++ b/security/manager/ssl/src/nsPK11TokenDB.cpp @@ -107,7 +107,7 @@ void nsPK11Token::destructorSafeDestroyNSSReference() } /* readonly attribute wstring tokenName; */ -NS_IMETHODIMP nsPK11Token::GetTokenName(PRUnichar * *aTokenName) +NS_IMETHODIMP nsPK11Token::GetTokenName(char16_t * *aTokenName) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -120,7 +120,7 @@ NS_IMETHODIMP nsPK11Token::GetTokenName(PRUnichar * *aTokenName) } /* readonly attribute wstring tokenDesc; */ -NS_IMETHODIMP nsPK11Token::GetTokenLabel(PRUnichar **aTokLabel) +NS_IMETHODIMP nsPK11Token::GetTokenLabel(char16_t **aTokLabel) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -132,7 +132,7 @@ NS_IMETHODIMP nsPK11Token::GetTokenLabel(PRUnichar **aTokLabel) } /* readonly attribute wstring tokenManID; */ -NS_IMETHODIMP nsPK11Token::GetTokenManID(PRUnichar **aTokManID) +NS_IMETHODIMP nsPK11Token::GetTokenManID(char16_t **aTokManID) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -144,7 +144,7 @@ NS_IMETHODIMP nsPK11Token::GetTokenManID(PRUnichar **aTokManID) } /* readonly attribute wstring tokenHWVersion; */ -NS_IMETHODIMP nsPK11Token::GetTokenHWVersion(PRUnichar **aTokHWVersion) +NS_IMETHODIMP nsPK11Token::GetTokenHWVersion(char16_t **aTokHWVersion) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -156,7 +156,7 @@ NS_IMETHODIMP nsPK11Token::GetTokenHWVersion(PRUnichar **aTokHWVersion) } /* readonly attribute wstring tokenFWVersion; */ -NS_IMETHODIMP nsPK11Token::GetTokenFWVersion(PRUnichar **aTokFWVersion) +NS_IMETHODIMP nsPK11Token::GetTokenFWVersion(char16_t **aTokFWVersion) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -168,7 +168,7 @@ NS_IMETHODIMP nsPK11Token::GetTokenFWVersion(PRUnichar **aTokFWVersion) } /* readonly attribute wstring tokenSerialNumber; */ -NS_IMETHODIMP nsPK11Token::GetTokenSerialNumber(PRUnichar **aTokSerialNum) +NS_IMETHODIMP nsPK11Token::GetTokenSerialNumber(char16_t **aTokSerialNum) { // handle removals/insertions if (mSeries != PK11_GetSlotSeries(mSlot)) { @@ -279,7 +279,7 @@ NS_IMETHODIMP nsPK11Token::GetNeedsUserInit(bool *aNeedsUserInit) } /* boolean checkPassword (in wstring password); */ -NS_IMETHODIMP nsPK11Token::CheckPassword(const PRUnichar *password, bool *_retval) +NS_IMETHODIMP nsPK11Token::CheckPassword(const char16_t *password, bool *_retval) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -304,7 +304,7 @@ NS_IMETHODIMP nsPK11Token::CheckPassword(const PRUnichar *password, bool *_retva } /* void initPassword (in wstring initialPassword); */ -NS_IMETHODIMP nsPK11Token::InitPassword(const PRUnichar *initialPassword) +NS_IMETHODIMP nsPK11Token::InitPassword(const char16_t *initialPassword) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -365,7 +365,7 @@ nsPK11Token::SetAskPasswordDefaults(const int32_t askTimes, } /* void changePassword (in wstring oldPassword, in wstring newPassword); */ -NS_IMETHODIMP nsPK11Token::ChangePassword(const PRUnichar *oldPassword, const PRUnichar *newPassword) +NS_IMETHODIMP nsPK11Token::ChangePassword(const char16_t *oldPassword, const char16_t *newPassword) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -459,7 +459,7 @@ done: /* nsIPK11Token findTokenByName (in wchar tokenName); */ NS_IMETHODIMP nsPK11TokenDB:: -FindTokenByName(const PRUnichar* tokenName, nsIPK11Token **_retval) +FindTokenByName(const char16_t* tokenName, nsIPK11Token **_retval) { nsNSSShutDownPreventionLock locker; nsresult rv = NS_OK; diff --git a/security/manager/ssl/src/nsPKCS11Slot.cpp b/security/manager/ssl/src/nsPKCS11Slot.cpp index ef99de44cf7d..6df0ae8ea4ea 100644 --- a/security/manager/ssl/src/nsPKCS11Slot.cpp +++ b/security/manager/ssl/src/nsPKCS11Slot.cpp @@ -92,7 +92,7 @@ void nsPKCS11Slot::destructorSafeDestroyNSSReference() /* readonly attribute wstring name; */ NS_IMETHODIMP -nsPKCS11Slot::GetName(PRUnichar **aName) +nsPKCS11Slot::GetName(char16_t **aName) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -116,7 +116,7 @@ nsPKCS11Slot::GetName(PRUnichar **aName) /* readonly attribute wstring desc; */ NS_IMETHODIMP -nsPKCS11Slot::GetDesc(PRUnichar **aDesc) +nsPKCS11Slot::GetDesc(char16_t **aDesc) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -133,7 +133,7 @@ nsPKCS11Slot::GetDesc(PRUnichar **aDesc) /* readonly attribute wstring manID; */ NS_IMETHODIMP -nsPKCS11Slot::GetManID(PRUnichar **aManID) +nsPKCS11Slot::GetManID(char16_t **aManID) { if (mSeries != PK11_GetSlotSeries(mSlot)) { refreshSlotInfo(); @@ -145,7 +145,7 @@ nsPKCS11Slot::GetManID(PRUnichar **aManID) /* readonly attribute wstring HWVersion; */ NS_IMETHODIMP -nsPKCS11Slot::GetHWVersion(PRUnichar **aHWVersion) +nsPKCS11Slot::GetHWVersion(char16_t **aHWVersion) { if (mSeries != PK11_GetSlotSeries(mSlot)) { refreshSlotInfo(); @@ -157,7 +157,7 @@ nsPKCS11Slot::GetHWVersion(PRUnichar **aHWVersion) /* readonly attribute wstring FWVersion; */ NS_IMETHODIMP -nsPKCS11Slot::GetFWVersion(PRUnichar **aFWVersion) +nsPKCS11Slot::GetFWVersion(char16_t **aFWVersion) { if (mSeries != PK11_GetSlotSeries(mSlot)) { refreshSlotInfo(); @@ -183,7 +183,7 @@ nsPKCS11Slot::GetToken(nsIPK11Token **_retval) /* readonly attribute wstring tokenName; */ NS_IMETHODIMP -nsPKCS11Slot::GetTokenName(PRUnichar **aName) +nsPKCS11Slot::GetTokenName(char16_t **aName) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -266,7 +266,7 @@ void nsPKCS11Module::destructorSafeDestroyNSSReference() /* readonly attribute wstring name; */ NS_IMETHODIMP -nsPKCS11Module::GetName(PRUnichar **aName) +nsPKCS11Module::GetName(char16_t **aName) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -278,7 +278,7 @@ nsPKCS11Module::GetName(PRUnichar **aName) /* readonly attribute wstring libName; */ NS_IMETHODIMP -nsPKCS11Module::GetLibName(PRUnichar **aName) +nsPKCS11Module::GetLibName(char16_t **aName) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) @@ -294,7 +294,7 @@ nsPKCS11Module::GetLibName(PRUnichar **aName) /* nsIPKCS11Slot findSlotByName(in wstring name); */ NS_IMETHODIMP -nsPKCS11Module::FindSlotByName(const PRUnichar *aName, +nsPKCS11Module::FindSlotByName(const char16_t *aName, nsIPKCS11Slot **_retval) { nsNSSShutDownPreventionLock locker; @@ -409,7 +409,7 @@ nsPKCS11ModuleDB::GetInternalFIPS(nsIPKCS11Module **_retval) /* nsIPKCS11Module findModuleByName(in wstring name); */ NS_IMETHODIMP -nsPKCS11ModuleDB::FindModuleByName(const PRUnichar *aName, +nsPKCS11ModuleDB::FindModuleByName(const char16_t *aName, nsIPKCS11Module **_retval) { nsNSSShutDownPreventionLock locker; @@ -430,7 +430,7 @@ nsPKCS11ModuleDB::FindModuleByName(const PRUnichar *aName, */ /* nsIPKCS11Module findSlotByName(in wstring name); */ NS_IMETHODIMP -nsPKCS11ModuleDB::FindSlotByName(const PRUnichar *aName, +nsPKCS11ModuleDB::FindSlotByName(const char16_t *aName, nsIPKCS11Slot **_retval) { nsNSSShutDownPreventionLock locker; diff --git a/security/manager/ssl/src/nsPKCS12Blob.cpp b/security/manager/ssl/src/nsPKCS12Blob.cpp index 27c46ba891fc..63039cf4a62c 100644 --- a/security/manager/ssl/src/nsPKCS12Blob.cpp +++ b/security/manager/ssl/src/nsPKCS12Blob.cpp @@ -207,7 +207,7 @@ finish: // for every error possible. if (srv != SECSuccess) { if (SEC_ERROR_BAD_PASSWORD == PORT_GetError()) { - if (unicodePw.len == sizeof(PRUnichar)) + if (unicodePw.len == sizeof(char16_t)) { // no password chars available, // unicodeToItem allocated space for the trailing zero character only. @@ -241,7 +241,7 @@ finish: // Given an array of certificate nicknames, load the corresponding // certificates into a local array. nsresult -nsPKCS12Blob::LoadCerts(const PRUnichar **certNames, int numCerts) +nsPKCS12Blob::LoadCerts(const char16_t **certNames, int numCerts) { nsresult rv; char namecpy[256]; @@ -461,11 +461,11 @@ finish: // a buffer of octets. Must handle byte order correctly. // TODO: Is there a mozilla way to do this? In the string lib? void -nsPKCS12Blob::unicodeToItem(const PRUnichar *uni, SECItem *item) +nsPKCS12Blob::unicodeToItem(const char16_t *uni, SECItem *item) { int len = 0; while (uni[len++] != 0); - SECITEM_AllocItem(nullptr, item, sizeof(PRUnichar) * len); + SECITEM_AllocItem(nullptr, item, sizeof(char16_t) * len); #ifdef IS_LITTLE_ENDIAN int i = 0; for (i=0; i rv = GetSharedString(idx, len, &str); NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), diff --git a/storage/public/mozIStorageValueArray.idl b/storage/public/mozIStorageValueArray.idl index 48a0557ea339..ce702ae2c114 100644 --- a/storage/public/mozIStorageValueArray.idl +++ b/storage/public/mozIStorageValueArray.idl @@ -112,8 +112,8 @@ interface mozIStorageValueArray : nsISupports { return str; } - inline const PRUnichar* AsSharedWString(uint32_t idx, uint32_t *len) { - const PRUnichar *str = nullptr; + inline const char16_t* AsSharedWString(uint32_t idx, uint32_t *len) { + const char16_t *str = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedString(idx, len, &str); NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), diff --git a/storage/src/FileSystemModule.cpp b/storage/src/FileSystemModule.cpp index 7ea768b473d5..a12178be2864 100644 --- a/storage/src/FileSystemModule.cpp +++ b/storage/src/FileSystemModule.cpp @@ -204,7 +204,7 @@ int Filter(sqlite3_vtab_cursor* aCursor, int aIdxNum, const char* aIdxStr, } nsDependentString path( - reinterpret_cast(::sqlite3_value_text16(aArgv[0]))); + reinterpret_cast(::sqlite3_value_text16(aArgv[0]))); nsresult rv = cursor->Init(path); NS_ENSURE_SUCCESS(rv, SQLITE_ERROR); @@ -238,7 +238,7 @@ int Column(sqlite3_vtab_cursor* aCursor, sqlite3_context* aContext, case 0: { const nsString& name = cursor->CurrentFileName(); sqlite3_result_text16(aContext, name.get(), - name.Length() * sizeof(PRUnichar), + name.Length() * sizeof(char16_t), SQLITE_TRANSIENT); break; } @@ -247,7 +247,7 @@ int Column(sqlite3_vtab_cursor* aCursor, sqlite3_context* aContext, case 1: { const nsString& path = cursor->DirectoryPath(); sqlite3_result_text16(aContext, path.get(), - path.Length() * sizeof(PRUnichar), + path.Length() * sizeof(char16_t), SQLITE_TRANSIENT); break; } diff --git a/storage/src/SQLCollations.cpp b/storage/src/SQLCollations.cpp index 219387b9229d..ff2bf4a14b68 100644 --- a/storage/src/SQLCollations.cpp +++ b/storage/src/SQLCollations.cpp @@ -60,12 +60,12 @@ localeCollationHelper8(void *aService, * The number of bytes (not characters) in aStr1. * @param aStr1 * The string to be compared against aStr2 as provided by SQLite. It - * must be a non-null-terminated PRUnichar* buffer. + * must be a non-null-terminated char16_t* buffer. * @param aLen2 * The number of bytes (not characters) in aStr2. * @param aStr2 * The string to be compared against aStr1 as provided by SQLite. It - * must be a non-null-terminated PRUnichar* buffer. + * must be a non-null-terminated char16_t* buffer. * @param aComparisonStrength * The sorting strength, one of the nsICollation constants. * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number. @@ -80,15 +80,15 @@ localeCollationHelper16(void *aService, const void *aStr2, int32_t aComparisonStrength) { - const PRUnichar *buf1 = static_cast(aStr1); - const PRUnichar *buf2 = static_cast(aStr2); + const char16_t *buf1 = static_cast(aStr1); + const char16_t *buf2 = static_cast(aStr2); // The second argument to the nsDependentSubstring constructor is exclusive: - // It points to the PRUnichar immediately following the last one in the target - // substring. Since aLen1 and aLen2 are in bytes, divide by sizeof(PRUnichar) + // It points to the char16_t immediately following the last one in the target + // substring. Since aLen1 and aLen2 are in bytes, divide by sizeof(char16_t) // so that the pointer arithmetic is correct. - nsDependentSubstring str1(buf1, buf1 + (aLen1 / sizeof(PRUnichar))); - nsDependentSubstring str2(buf2, buf2 + (aLen2 / sizeof(PRUnichar))); + nsDependentSubstring str1(buf1, buf1 + (aLen1 / sizeof(char16_t))); + nsDependentSubstring str2(buf2, buf2 + (aLen2 / sizeof(char16_t))); Service *serv = static_cast(aService); return serv->localeCompareStrings(str1, str2, aComparisonStrength); } diff --git a/storage/src/SQLCollations.h b/storage/src/SQLCollations.h index 13554b669ad0..fb4ef7fbdee9 100644 --- a/storage/src/SQLCollations.h +++ b/storage/src/SQLCollations.h @@ -147,12 +147,12 @@ NS_HIDDEN_(int) localeCollationCaseAccentSensitive8(void *aService, * The number of bytes (not characters) in aStr1. * @param aStr1 * The string to be compared against aStr2. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @param aLen2 * The number of bytes (not characters) in aStr2. * @param aStr2 * The string to be compared against aStr1. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number. * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2, * returns 0. @@ -174,12 +174,12 @@ NS_HIDDEN_(int) localeCollation16(void *aService, * The number of bytes (not characters) in aStr1. * @param aStr1 * The string to be compared against aStr2. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @param aLen2 * The number of bytes (not characters) in aStr2. * @param aStr2 * The string to be compared against aStr1. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number. * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2, * returns 0. @@ -201,12 +201,12 @@ NS_HIDDEN_(int) localeCollationCaseSensitive16(void *aService, * The number of bytes (not characters) in aStr1. * @param aStr1 * The string to be compared against aStr2. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @param aLen2 * The number of bytes (not characters) in aStr2. * @param aStr2 * The string to be compared against aStr1. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number. * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2, * returns 0. @@ -227,12 +227,12 @@ NS_HIDDEN_(int) localeCollationAccentSensitive16(void *aService, * The number of bytes (not characters) in aStr1. * @param aStr1 * The string to be compared against aStr2. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @param aLen2 * The number of bytes (not characters) in aStr2. * @param aStr2 * The string to be compared against aStr1. It will be passed in by - * SQLite as a non-null-terminated PRUnichar* buffer. + * SQLite as a non-null-terminated char16_t* buffer. * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number. * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2, * returns 0. diff --git a/storage/src/StorageBaseStatementInternal.cpp b/storage/src/StorageBaseStatementInternal.cpp index d2f93292c7b6..7f5343acec04 100644 --- a/storage/src/StorageBaseStatementInternal.cpp +++ b/storage/src/StorageBaseStatementInternal.cpp @@ -201,12 +201,12 @@ StorageBaseStatementInternal::ExecuteAsync( NS_IMETHODIMP StorageBaseStatementInternal::EscapeStringForLIKE( const nsAString &aValue, - const PRUnichar aEscapeChar, + const char16_t aEscapeChar, nsAString &_escapedString ) { - const PRUnichar MATCH_ALL('%'); - const PRUnichar MATCH_ONE('_'); + const char16_t MATCH_ALL('%'); + const char16_t MATCH_ONE('_'); _escapedString.Truncate(0); diff --git a/storage/src/StorageBaseStatementInternal.h b/storage/src/StorageBaseStatementInternal.h index 2db13faefa03..2f06de030d5f 100644 --- a/storage/src/StorageBaseStatementInternal.h +++ b/storage/src/StorageBaseStatementInternal.h @@ -139,7 +139,7 @@ protected: // mix-in bits are protected NS_IMETHOD ExecuteAsync(mozIStorageStatementCallback *aCallback, mozIStoragePendingStatement **_stmt); NS_IMETHOD EscapeStringForLIKE(const nsAString &aValue, - const PRUnichar aEscapeChar, + const char16_t aEscapeChar, nsAString &_escapedString); // Needs access to internalAsyncFinalize @@ -187,7 +187,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(StorageBaseStatementInternal, (aCallback, _stmt)) \ MIX_IMPL(_class, _optionalGuard, \ EscapeStringForLIKE, \ - (const nsAString &aValue, const PRUnichar aEscapeChar, \ + (const nsAString &aValue, const char16_t aEscapeChar, \ nsAString &_escapedString), \ (aValue, aEscapeChar, _escapedString)) diff --git a/storage/src/VacuumManager.cpp b/storage/src/VacuumManager.cpp index c016763522d5..e8daa802f6ac 100644 --- a/storage/src/VacuumManager.cpp +++ b/storage/src/VacuumManager.cpp @@ -359,7 +359,7 @@ VacuumManager::~VacuumManager() NS_IMETHODIMP VacuumManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, OBSERVER_TOPIC_IDLE_DAILY) == 0) { // Try to run vacuum on all registered entries. Will stop at the first diff --git a/storage/src/Variant_inl.h b/storage/src/Variant_inl.h index 57a5af55dd52..0fe936781205 100644 --- a/storage/src/Variant_inl.h +++ b/storage/src/Variant_inl.h @@ -147,7 +147,7 @@ Variant_base::GetAsChar(char *) inline NS_IMETHODIMP -Variant_base::GetAsWChar(PRUnichar *) +Variant_base::GetAsWChar(char16_t *) { return NS_ERROR_CANNOT_CONVERT_DATA; } @@ -175,7 +175,7 @@ Variant_base::GetAsString(char **) inline NS_IMETHODIMP -Variant_base::GetAsWString(PRUnichar **) +Variant_base::GetAsWString(char16_t **) { return NS_ERROR_CANNOT_CONVERT_DATA; } @@ -213,7 +213,7 @@ Variant_base::GetAsStringWithSize(uint32_t *, inline NS_IMETHODIMP Variant_base::GetAsWStringWithSize(uint32_t *, - PRUnichar **) + char16_t **) { return NS_ERROR_CANNOT_CONVERT_DATA; } diff --git a/storage/src/mozStorageArgValueArray.cpp b/storage/src/mozStorageArgValueArray.cpp index f9c4cf87fade..02dd7242855d 100644 --- a/storage/src/mozStorageArgValueArray.cpp +++ b/storage/src/mozStorageArgValueArray.cpp @@ -130,7 +130,7 @@ ArgValueArray::GetString(uint32_t aIndex, _value.Truncate(0); _value.SetIsVoid(true); } else { - _value.Assign(static_cast(::sqlite3_value_text16(mArgv[aIndex])), + _value.Assign(static_cast(::sqlite3_value_text16(mArgv[aIndex])), ::sqlite3_value_bytes16(mArgv[aIndex]) / 2); } return NS_OK; @@ -180,12 +180,12 @@ ArgValueArray::GetSharedUTF8String(uint32_t aIndex, NS_IMETHODIMP ArgValueArray::GetSharedString(uint32_t aIndex, uint32_t *_length, - const PRUnichar **_string) + const char16_t **_string) { if (_length) *_length = ::sqlite3_value_bytes(mArgv[aIndex]); - *_string = static_cast(::sqlite3_value_text16(mArgv[aIndex])); + *_string = static_cast(::sqlite3_value_text16(mArgv[aIndex])); return NS_OK; } diff --git a/storage/src/mozStorageRow.cpp b/storage/src/mozStorageRow.cpp index e71d09100d54..c42bceef1646 100644 --- a/storage/src/mozStorageRow.cpp +++ b/storage/src/mozStorageRow.cpp @@ -38,7 +38,7 @@ Row::initialize(sqlite3_stmt *aStatement) case SQLITE_TEXT: { nsDependentString str( - static_cast(::sqlite3_column_text16(aStatement, i)) + static_cast(::sqlite3_column_text16(aStatement, i)) ); variant = new TextVariant(str); break; @@ -218,7 +218,7 @@ Row::GetSharedUTF8String(uint32_t, NS_IMETHODIMP Row::GetSharedString(uint32_t, uint32_t *, - const PRUnichar **) + const char16_t **) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/storage/src/mozStorageSQLFunctions.cpp b/storage/src/mozStorageSQLFunctions.cpp index 163c1b13bc29..3442448abcd3 100644 --- a/storage/src/mozStorageSQLFunctions.cpp +++ b/storage/src/mozStorageSQLFunctions.cpp @@ -39,10 +39,10 @@ likeCompare(nsAString::const_iterator aPatternItr, nsAString::const_iterator aPatternEnd, nsAString::const_iterator aStringItr, nsAString::const_iterator aStringEnd, - PRUnichar aEscapeChar) + char16_t aEscapeChar) { - const PRUnichar MATCH_ALL('%'); - const PRUnichar MATCH_ONE('_'); + const char16_t MATCH_ALL('%'); + const char16_t MATCH_ONE('_'); bool lastWasEscape = false; while (aPatternItr != aPatternEnd) { @@ -222,8 +222,8 @@ levenshteinDistance(const nsAString &aStringS, for (uint32_t i = 0; i <= sLen; i++) prevRow[i] = i; - const PRUnichar *s = aStringS.BeginReading(); - const PRUnichar *t = aStringT.BeginReading(); + const char16_t *s = aStringS.BeginReading(); + const char16_t *t = aStringT.BeginReading(); // Compute the empty cells in the "matrix" row-by-row, starting with // the second row. @@ -233,7 +233,7 @@ levenshteinDistance(const nsAString &aStringS, currRow[0] = ti; // Get the character from "t" that corresponds to this row. - const PRUnichar tch = t[ti - 1]; + const char16_t tch = t[ti - 1]; // Compute the remaining cells in this row, left-to-right, // starting at the second column (and first character of "s"). @@ -241,7 +241,7 @@ levenshteinDistance(const nsAString &aStringS, // Get the character from "s" that corresponds to this column, // compare it to the t-character, and compute the "cost". - const PRUnichar sch = s[si - 1]; + const char16_t sch = s[si - 1]; int cost = (sch == tch) ? 0 : 1; // ............ We want to calculate the value of cell "d" from @@ -362,7 +362,7 @@ caseFunction(sqlite3_context *aCtx, { NS_ASSERTION(1 == aArgc, "Invalid number of arguments!"); - nsAutoString data(static_cast(::sqlite3_value_text16(aArgv[0]))); + nsAutoString data(static_cast(::sqlite3_value_text16(aArgv[0]))); bool toUpper = ::sqlite3_user_data(aCtx) ? true : false; if (toUpper) @@ -395,13 +395,13 @@ likeFunction(sqlite3_context *aCtx, if (!::sqlite3_value_text16(aArgv[0]) || !::sqlite3_value_text16(aArgv[1])) return; - nsDependentString A(static_cast(::sqlite3_value_text16(aArgv[1]))); - nsDependentString B(static_cast(::sqlite3_value_text16(aArgv[0]))); + nsDependentString A(static_cast(::sqlite3_value_text16(aArgv[1]))); + nsDependentString B(static_cast(::sqlite3_value_text16(aArgv[0]))); NS_ASSERTION(!B.IsEmpty(), "LIKE string must not be null!"); - PRUnichar E = 0; + char16_t E = 0; if (3 == aArgc) - E = static_cast(::sqlite3_value_text16(aArgv[2]))[0]; + E = static_cast(::sqlite3_value_text16(aArgv[2]))[0]; nsAString::const_iterator itrString, endString; A.BeginReading(itrString); @@ -426,11 +426,11 @@ void levenshteinDistanceFunction(sqlite3_context *aCtx, return; } - int aLen = ::sqlite3_value_bytes16(aArgv[0]) / sizeof(PRUnichar); - const PRUnichar *a = static_cast(::sqlite3_value_text16(aArgv[0])); + int aLen = ::sqlite3_value_bytes16(aArgv[0]) / sizeof(char16_t); + const char16_t *a = static_cast(::sqlite3_value_text16(aArgv[0])); - int bLen = ::sqlite3_value_bytes16(aArgv[1]) / sizeof(PRUnichar); - const PRUnichar *b = static_cast(::sqlite3_value_text16(aArgv[1])); + int bLen = ::sqlite3_value_bytes16(aArgv[1]) / sizeof(char16_t); + const char16_t *b = static_cast(::sqlite3_value_text16(aArgv[1])); // Compute the Levenshtein Distance, and return the result (or error). int distance = -1; diff --git a/storage/src/mozStorageService.cpp b/storage/src/mozStorageService.cpp index 2c8b9244cb93..079c5eb1d5e7 100644 --- a/storage/src/mozStorageService.cpp +++ b/storage/src/mozStorageService.cpp @@ -859,7 +859,7 @@ Service::BackupDatabaseFile(nsIFile *aDBFile, //// nsIObserver NS_IMETHODIMP -Service::Observe(nsISupports *, const char *aTopic, const PRUnichar *) +Service::Observe(nsISupports *, const char *aTopic, const char16_t *) { if (strcmp(aTopic, "xpcom-shutdown") == 0) shutdown(); diff --git a/storage/src/mozStorageStatement.cpp b/storage/src/mozStorageStatement.cpp index 56876c1d7887..bdfa168f686c 100644 --- a/storage/src/mozStorageStatement.cpp +++ b/storage/src/mozStorageStatement.cpp @@ -827,8 +827,8 @@ Statement::GetString(uint32_t aIndex, _value.Truncate(0); _value.SetIsVoid(true); } else { - const PRUnichar *value = - static_cast(::sqlite3_column_text16(mDBStatement, + const char16_t *value = + static_cast(::sqlite3_column_text16(mDBStatement, aIndex)); _value.Assign(value, ::sqlite3_column_bytes16(mDBStatement, aIndex) / 2); } @@ -876,12 +876,12 @@ Statement::GetSharedUTF8String(uint32_t aIndex, NS_IMETHODIMP Statement::GetSharedString(uint32_t aIndex, uint32_t *_length, - const PRUnichar **_value) + const char16_t **_value) { if (_length) *_length = ::sqlite3_column_bytes16(mDBStatement, aIndex); - *_value = static_cast(::sqlite3_column_text16(mDBStatement, + *_value = static_cast(::sqlite3_column_text16(mDBStatement, aIndex)); return NS_OK; } diff --git a/storage/test/test_AsXXX_helpers.cpp b/storage/test/test_AsXXX_helpers.cpp index f778911a5ff8..22c06f899cc1 100644 --- a/storage/test/test_AsXXX_helpers.cpp +++ b/storage/test/test_AsXXX_helpers.cpp @@ -39,7 +39,7 @@ Spinner::HandleResult(mozIStorageResultSet *aResultSet) do_check_eq(row->AsSharedUTF8String(0, &len), (const char*)nullptr); do_check_eq(len, 0); len = 100; - do_check_eq(row->AsSharedWString(0, &len), (const PRUnichar*)nullptr); + do_check_eq(row->AsSharedWString(0, &len), (const char16_t*)nullptr); do_check_eq(len, 0); len = 100; do_check_eq(row->AsSharedBlob(0, &len), (const uint8_t*)nullptr); @@ -72,7 +72,7 @@ test_NULLFallback() do_check_eq(stmt->AsSharedUTF8String(0, &len), (const char*)nullptr); do_check_eq(len, 0); len = 100; - do_check_eq(stmt->AsSharedWString(0, &len), (const PRUnichar*)nullptr); + do_check_eq(stmt->AsSharedWString(0, &len), (const char16_t*)nullptr); do_check_eq(len, 0); len = 100; do_check_eq(stmt->AsSharedBlob(0, &len), (const uint8_t*)nullptr); @@ -86,7 +86,7 @@ test_NULLFallback() do_check_eq(valueArray->AsSharedUTF8String(0, &len), (const char*)nullptr); do_check_eq(len, 0); len = 100; - do_check_eq(valueArray->AsSharedWString(0, &len), (const PRUnichar*)nullptr); + do_check_eq(valueArray->AsSharedWString(0, &len), (const char16_t*)nullptr); do_check_eq(len, 0); len = 100; do_check_eq(valueArray->AsSharedBlob(0, &len), (const uint8_t*)nullptr); diff --git a/toolkit/components/alerts/nsXULAlerts.cpp b/toolkit/components/alerts/nsXULAlerts.cpp index 29b9f2b6cbb9..c48bb5dc09b5 100644 --- a/toolkit/components/alerts/nsXULAlerts.cpp +++ b/toolkit/components/alerts/nsXULAlerts.cpp @@ -21,7 +21,7 @@ NS_IMPL_ISUPPORTS1(nsXULAlertObserver, nsIObserver) NS_IMETHODIMP nsXULAlertObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp("alertfinished", aTopic)) { nsIDOMWindow* currentAlert = mXULAlerts->mNamedWindows.GetWeak(mAlertName); diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp index 7df4497a4749..58a23f90c183 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp @@ -756,7 +756,7 @@ nsAutoCompleteController::GetColumnProperties(nsITreeColumn* col, nsAString& aPr NS_IMETHODIMP nsAutoCompleteController::GetImageSrc(int32_t row, nsITreeColumn* col, nsAString& _retval) { - const PRUnichar* colID; + const char16_t* colID; col->GetIdConst(&colID); if (NS_LITERAL_STRING("treecolAutoCompleteValue").Equals(colID)) @@ -782,7 +782,7 @@ nsAutoCompleteController::GetCellValue(int32_t row, nsITreeColumn* col, nsAStrin NS_IMETHODIMP nsAutoCompleteController::GetCellText(int32_t row, nsITreeColumn* col, nsAString& _retval) { - const PRUnichar* colID; + const char16_t* colID; col->GetIdConst(&colID); if (NS_LITERAL_STRING("treecolAutoCompleteValue").Equals(colID)) @@ -934,19 +934,19 @@ nsAutoCompleteController::Drop(int32_t row, int32_t orientation, nsIDOMDataTrans } NS_IMETHODIMP -nsAutoCompleteController::PerformAction(const PRUnichar *action) +nsAutoCompleteController::PerformAction(const char16_t *action) { return NS_OK; } NS_IMETHODIMP -nsAutoCompleteController::PerformActionOnRow(const PRUnichar *action, int32_t row) +nsAutoCompleteController::PerformActionOnRow(const char16_t *action, int32_t row) { return NS_OK; } NS_IMETHODIMP -nsAutoCompleteController::PerformActionOnCell(const PRUnichar* action, int32_t row, nsITreeColumn* col) +nsAutoCompleteController::PerformActionOnCell(const char16_t* action, int32_t row, nsITreeColumn* col) { return NS_OK; } diff --git a/toolkit/components/commandlines/nsCommandLine.cpp b/toolkit/components/commandlines/nsCommandLine.cpp index 47ac40f15fd8..80a0095c41c3 100644 --- a/toolkit/components/commandlines/nsCommandLine.cpp +++ b/toolkit/components/commandlines/nsCommandLine.cpp @@ -120,7 +120,7 @@ nsCommandLine::FindFlag(const nsAString& aFlag, bool aCaseSensitive, int32_t *aR for (uint32_t f = 0; f < mArgs.Length(); f++) { const nsString &arg = mArgs[f]; - if (arg.Length() >= 2 && arg.First() == PRUnichar('-')) { + if (arg.Length() >= 2 && arg.First() == char16_t('-')) { if (aFlag.Equals(Substring(arg, 1), c)) { *aResult = f; return NS_OK; @@ -506,11 +506,11 @@ nsCommandLine::Init(int32_t argc, const char* const* argv, nsIFile* aWorkingDir, } static void -LogConsoleMessage(const PRUnichar* fmt, ...) +LogConsoleMessage(const char16_t* fmt, ...) { va_list args; va_start(args, fmt); - PRUnichar* msg = nsTextFormatter::vsmprintf(fmt, args); + char16_t* msg = nsTextFormatter::vsmprintf(fmt, args); va_end(args); nsCOMPtr cs = do_GetService("@mozilla.org/consoleservice;1"); diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index b4c7e6a36ba5..7fc181e75f51 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -27,7 +27,7 @@ static char* UnicodeToNative(JSContext *cx, const jschar *source, size_t slen) { nsAutoCString native; - nsDependentString unicode(reinterpret_cast(source), slen); + nsDependentString unicode(reinterpret_cast(source), slen); nsresult rv = NS_CopyUnicodeToNative(unicode, native); if (NS_FAILED(rv)) { JS_ReportError(cx, "could not convert string to native charset"); diff --git a/toolkit/components/ctypes/tests/jsctypes-test.cpp b/toolkit/components/ctypes/tests/jsctypes-test.cpp index 72d8f37c81b8..13bb3df457b2 100644 --- a/toolkit/components/ctypes/tests/jsctypes-test.cpp +++ b/toolkit/components/ctypes/tests/jsctypes-test.cpp @@ -145,7 +145,7 @@ test_ansi_len(const char* string) } int32_t -test_wide_len(const PRUnichar* string) +test_wide_len(const char16_t* string) { return StrLen(string); } @@ -156,10 +156,10 @@ test_ansi_ret() return "success"; } -const PRUnichar * +const char16_t * test_wide_ret() { - static const PRUnichar kSuccess[] = {'s', 'u', 'c', 'c', 'e', 's', 's', '\0'}; + static const char16_t kSuccess[] = {'s', 'u', 'c', 'c', 'e', 's', 's', '\0'}; return kSuccess; } diff --git a/toolkit/components/ctypes/tests/jsctypes-test.h b/toolkit/components/ctypes/tests/jsctypes-test.h index 5cc618f09419..9110e33f5c04 100644 --- a/toolkit/components/ctypes/tests/jsctypes-test.h +++ b/toolkit/components/ctypes/tests/jsctypes-test.h @@ -59,9 +59,9 @@ NS_EXTERN_C #endif /* defined(_WIN32) */ NS_EXPORT int32_t test_ansi_len(const char*); - NS_EXPORT int32_t test_wide_len(const PRUnichar*); + NS_EXPORT int32_t test_wide_len(const char16_t*); NS_EXPORT const char* test_ansi_ret(); - NS_EXPORT const PRUnichar* test_wide_ret(); + NS_EXPORT const char16_t* test_wide_ret(); NS_EXPORT char* test_ansi_echo(const char*); struct ONE_BYTE { diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp index 23f34a15356b..0ad3ef9b03eb 100644 --- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp +++ b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp @@ -58,7 +58,7 @@ DiskSpaceWatcher::FactoryCreate() NS_IMETHODIMP DiskSpaceWatcher::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(NS_IsMainThread()); @@ -119,8 +119,8 @@ void DiskSpaceWatcher::UpdateState(bool aIsDiskFull, uint64_t aFreeSpace) return; } - const PRUnichar stateFull[] = { 'f', 'u', 'l', 'l', 0 }; - const PRUnichar stateFree[] = { 'f', 'r', 'e', 'e', 0 }; + const char16_t stateFull[] = { 'f', 'u', 'l', 'l', 0 }; + const char16_t stateFree[] = { 'f', 'r', 'e', 'e', 0 }; nsCOMPtr subject; CallQueryInterface(gDiskSpaceWatcher.get(), getter_AddRefs(subject)); diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 65bef4f143c8..34be39b7e1dd 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -2383,7 +2383,7 @@ nsDownloadManager::OnDeleteVisits(nsIURI *aURI, PRTime aVisitTime, NS_IMETHODIMP nsDownloadManager::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // This method in not normally invoked when mUseJSTransfer is enabled, however // we provide an extra check in case it is called manually by add-ons. @@ -2520,10 +2520,10 @@ nsDownloadManager::Observe(nsISupports *aSubject, void nsDownloadManager::ConfirmCancelDownloads(int32_t aCount, nsISupportsPRBool *aCancelDownloads, - const PRUnichar *aTitle, - const PRUnichar *aCancelMessageMultiple, - const PRUnichar *aCancelMessageSingle, - const PRUnichar *aDontCancelButton) + const char16_t *aTitle, + const char16_t *aCancelMessageMultiple, + const char16_t *aCancelMessageSingle, + const char16_t *aDontCancelButton) { // If user has already dismissed quit request, then do nothing bool quitRequestCancelled = false; @@ -2537,7 +2537,7 @@ nsDownloadManager::ConfirmCancelDownloads(int32_t aCount, nsAutoString countString; countString.AppendInt(aCount); - const PRUnichar *strings[1] = { countString.get() }; + const char16_t *strings[1] = { countString.get() }; if (aCount > 1) { mBundle->FormatStringFromName(aCancelMessageMultiple, strings, 1, getter_Copies(message)); @@ -3001,7 +3001,7 @@ nsDownload::OnLocationChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP nsDownload::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { if (NS_FAILED(aStatus)) return FailDownload(aStatus, aMessage); @@ -3669,7 +3669,7 @@ nsDownload::UpdateDB() } nsresult -nsDownload::FailDownload(nsresult aStatus, const PRUnichar *aMessage) +nsDownload::FailDownload(nsresult aStatus, const char16_t *aMessage) { // Grab the bundle before potentially losing our member variables nsCOMPtr bundle = mDownloadManager->mBundle; diff --git a/toolkit/components/downloads/nsDownloadManager.h b/toolkit/components/downloads/nsDownloadManager.h index 6377ae1bfe58..d5d0b8df5a29 100644 --- a/toolkit/components/downloads/nsDownloadManager.h +++ b/toolkit/components/downloads/nsDownloadManager.h @@ -188,10 +188,10 @@ protected: void ConfirmCancelDownloads(int32_t aCount, nsISupportsPRBool *aCancelDownloads, - const PRUnichar *aTitle, - const PRUnichar *aCancelMessageMultiple, - const PRUnichar *aCancelMessageSingle, - const PRUnichar *aDontCancelButton); + const char16_t *aTitle, + const char16_t *aCancelMessageMultiple, + const char16_t *aCancelMessageSingle, + const char16_t *aDontCancelButton); int32_t GetRetentionBehavior(); @@ -362,7 +362,7 @@ protected: * Fail a download because of a failure status and prompt the provided * message or use a generic download failure message if nullptr. */ - nsresult FailDownload(nsresult aStatus, const PRUnichar *aMessage); + nsresult FailDownload(nsresult aStatus, const char16_t *aMessage); /** * Opens the downloaded file with the appropriate application, which is diff --git a/toolkit/components/downloads/nsDownloadProxy.h b/toolkit/components/downloads/nsDownloadProxy.h index cea82d514ff1..c9bb9e89284c 100644 --- a/toolkit/components/downloads/nsDownloadProxy.h +++ b/toolkit/components/downloads/nsDownloadProxy.h @@ -87,7 +87,7 @@ public: NS_IMETHODIMP OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { NS_ENSURE_TRUE(mInner, NS_ERROR_NOT_INITIALIZED); return mInner->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); diff --git a/toolkit/components/filepicker/nsFileView.cpp b/toolkit/components/filepicker/nsFileView.cpp index 7aa6ae3106b7..969ec2be9cfc 100644 --- a/toolkit/components/filepicker/nsFileView.cpp +++ b/toolkit/components/filepicker/nsFileView.cpp @@ -239,7 +239,7 @@ protected: int16_t mSortType; int32_t mTotalRows; - nsTArray mCurrentFilters; + nsTArray mCurrentFilters; bool mShowHiddenFiles; bool mDirectoryFilter; @@ -485,7 +485,7 @@ nsFileView::SetFilter(const nsAString& aFilterString) while (iter != end && (*iter != ';' && *iter != ' ')) ++iter; - PRUnichar* filter = ToNewUnicode(Substring(start, iter)); + char16_t* filter = ToNewUnicode(Substring(start, iter)); if (!filter) return NS_ERROR_OUT_OF_MEMORY; @@ -721,7 +721,7 @@ nsFileView::GetCellText(int32_t aRow, nsITreeColumn* aCol, return NS_OK; } - const PRUnichar* colID; + const char16_t* colID; aCol->GetIdConst(&colID); if (NS_LITERAL_STRING("FilenameColumn").Equals(colID)) { curFile->GetLeafName(aCellText); @@ -809,19 +809,19 @@ nsFileView::SetCellText(int32_t aRow, nsITreeColumn* aCol, } NS_IMETHODIMP -nsFileView::PerformAction(const PRUnichar* aAction) +nsFileView::PerformAction(const char16_t* aAction) { return NS_OK; } NS_IMETHODIMP -nsFileView::PerformActionOnRow(const PRUnichar* aAction, int32_t aRow) +nsFileView::PerformActionOnRow(const char16_t* aAction, int32_t aRow) { return NS_OK; } NS_IMETHODIMP -nsFileView::PerformActionOnCell(const PRUnichar* aAction, int32_t aRow, +nsFileView::PerformActionOnCell(const char16_t* aAction, int32_t aRow, nsITreeColumn* aCol) { return NS_OK; diff --git a/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp b/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp index 7c536bf4e614..537fcc475532 100644 --- a/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp +++ b/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp @@ -187,7 +187,7 @@ NS_IMPL_ISUPPORTS1(FinalizationWitnessService, nsIFinalizationWitnessService) */ NS_IMETHODIMP FinalizationWitnessService::Make(const char* aTopic, - const PRUnichar* aValue, + const char16_t* aValue, JSContext* aCx, JS::Value *aRetval) { MOZ_ASSERT(aRetval); diff --git a/toolkit/components/intl/nsCharsetMenu.cpp b/toolkit/components/intl/nsCharsetMenu.cpp index ceb0dd4e534a..6c99393e331e 100644 --- a/toolkit/components/intl/nsCharsetMenu.cpp +++ b/toolkit/components/intl/nsCharsetMenu.cpp @@ -221,7 +221,7 @@ private: nsresult WriteCacheToPrefs(nsTArray * aArray, int32_t aCacheStart, const char * aKey); nsresult UpdateCachePrefs(const char * aCacheKey, const char * aCacheSizeKey, - const char * aStaticKey, const PRUnichar * aCharset); + const char * aStaticKey, const char16_t * aCharset); nsresult ClearMenu(nsIRDFContainer * aContainer, nsTArray * aArray); nsresult RemoveLastMenuItem(nsIRDFContainer * aContainer, @@ -255,9 +255,9 @@ public: //-------------------------------------------------------------------------- // Interface nsICurrentCharsetListener [declaration] - NS_IMETHOD SetCurrentCharset(const PRUnichar * aCharset); - NS_IMETHOD SetCurrentMailCharset(const PRUnichar * aCharset); - NS_IMETHOD SetCurrentComposerCharset(const PRUnichar * aCharset); + NS_IMETHOD SetCurrentCharset(const char16_t * aCharset); + NS_IMETHOD SetCurrentMailCharset(const char16_t * aCharset); + NS_IMETHOD SetCurrentComposerCharset(const char16_t * aCharset); //-------------------------------------------------------------------------- // Interface nsIRDFDataSource [declaration] @@ -369,7 +369,7 @@ private: NS_IMPL_ISUPPORTS1(nsCharsetMenuObserver, nsIObserver) -NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) { nsresult rv = NS_OK; @@ -1134,7 +1134,7 @@ nsresult nsCharsetMenu::AddMenuItemToContainer( res = mRDFService->GetResource(id, getter_AddRefs(node)); if (NS_FAILED(res)) return res; - const PRUnichar * title = aItem->mTitle.get(); + const char16_t * title = aItem->mTitle.get(); // set node's title nsCOMPtr titleLiteral; @@ -1380,7 +1380,7 @@ nsresult nsCharsetMenu::WriteCacheToPrefs(nsTArray * aArray, nsresult nsCharsetMenu::UpdateCachePrefs(const char * aCacheKey, const char * aCacheSizeKey, const char * aStaticKey, - const PRUnichar * aCharset) + const char16_t * aCharset) { nsresult rv = NS_OK; nsXPIDLCString cachePrefValue; @@ -1585,12 +1585,12 @@ nsresult nsCharsetMenu::GetCollation(nsICollation ** aCollation) //---------------------------------------------------------------------------- // Interface nsICurrentCharsetListener [implementation] -NS_IMETHODIMP nsCharsetMenu::SetCurrentCharset(const PRUnichar * aCharset) +NS_IMETHODIMP nsCharsetMenu::SetCurrentCharset(const char16_t * aCharset) { return NS_OK; } -NS_IMETHODIMP nsCharsetMenu::SetCurrentMailCharset(const PRUnichar * aCharset) +NS_IMETHODIMP nsCharsetMenu::SetCurrentMailCharset(const char16_t * aCharset) { nsresult res = NS_OK; @@ -1610,7 +1610,7 @@ NS_IMETHODIMP nsCharsetMenu::SetCurrentMailCharset(const PRUnichar * aCharset) return res; } -NS_IMETHODIMP nsCharsetMenu::SetCurrentComposerCharset(const PRUnichar * aCharset) +NS_IMETHODIMP nsCharsetMenu::SetCurrentComposerCharset(const char16_t * aCharset) { nsresult res = NS_OK; diff --git a/toolkit/components/maintenanceservice/workmonitor.cpp b/toolkit/components/maintenanceservice/workmonitor.cpp index 3741065aa444..50e4beddb110 100644 --- a/toolkit/components/maintenanceservice/workmonitor.cpp +++ b/toolkit/components/maintenanceservice/workmonitor.cpp @@ -28,7 +28,7 @@ // Updates usually take less than a minute so this seems like a // significantly large and safe amount of time to wait. static const int TIME_TO_WAIT_ON_UPDATER = 15 * 60 * 1000; -PRUnichar* MakeCommandLine(int argc, PRUnichar **argv); +char16_t* MakeCommandLine(int argc, char16_t **argv); BOOL WriteStatusFailure(LPCWSTR updateDirPath, int errorCode); BOOL PathGetSiblingFilePath(LPWSTR destinationBuffer, LPCWSTR siblingFilePath, LPCWSTR newFileName); diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index f1519e4bcb80..b272bcdf315b 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -1951,7 +1951,7 @@ Database::Shutdown() NS_IMETHODIMP Database::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { MOZ_ASSERT(NS_IsMainThread()); diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index 801472b130f9..9a16b0c6a02c 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -192,7 +192,7 @@ void GetReversedHostname(const nsString& aForward, nsString& aRevHost) { ReverseString(aForward, aRevHost); - aRevHost.Append(PRUnichar('.')); + aRevHost.Append(char16_t('.')); } void diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index a66ad5f7c4e9..1131339ffa95 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -333,7 +333,7 @@ GetJSValueAsString(JSContext* aCtx, _string.SetIsVoid(true); return; } - _string.Assign(static_cast(chars), length); + _string.Assign(static_cast(chars), length); } /** @@ -2900,7 +2900,7 @@ History::IsURIVisited(nsIURI* aURI, NS_IMETHODIMP History::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, TOPIC_PLACES_SHUTDOWN) == 0) { Shutdown(); diff --git a/toolkit/components/places/nsAnnotationService.cpp b/toolkit/components/places/nsAnnotationService.cpp index dfcd5cef86e4..de6d9006fd8e 100644 --- a/toolkit/components/places/nsAnnotationService.cpp +++ b/toolkit/components/places/nsAnnotationService.cpp @@ -1942,7 +1942,7 @@ nsAnnotationService::StartSetAnnotation(nsIURI* aURI, NS_IMETHODIMP nsAnnotationService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index 64460a511049..7019e3e3ffa9 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -2727,7 +2727,7 @@ nsNavBookmarks::NotifyItemChanged(const ItemChangeData& aData) NS_IMETHODIMP nsNavBookmarks::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 62ed076bed00..c48da35912d1 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -3007,7 +3007,7 @@ nsNavHistory::NotifyOnPageExpired(nsIURI *aURI, PRTime aVisitTime, NS_IMETHODIMP nsNavHistory::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); @@ -3436,7 +3436,7 @@ nsNavHistory::BindQueryClauseParameters(mozIStorageBaseStatement* statement, ); NS_ENSURE_SUCCESS(rv, rv); revDomain.Truncate(revDomain.Length() - 1); - revDomain.Append(PRUnichar('/')); + revDomain.Append(char16_t('/')); rv = statement->BindStringByName( NS_LITERAL_CSTRING("domain_upper") + qIndex, revDomain ); @@ -4121,14 +4121,14 @@ nsNavHistory::TitleForDomain(const nsCString& domain, nsACString& aTitle) } void -nsNavHistory::GetAgeInDaysString(int32_t aInt, const PRUnichar *aName, +nsNavHistory::GetAgeInDaysString(int32_t aInt, const char16_t *aName, nsACString& aResult) { nsIStringBundle *bundle = GetBundle(); if (bundle) { nsAutoString intString; intString.AppendInt(aInt); - const PRUnichar* strings[1] = { intString.get() }; + const char16_t* strings[1] = { intString.get() }; nsXPIDLString value; nsresult rv = bundle->FormatStringFromName(aName, strings, 1, getter_Copies(value)); @@ -4141,7 +4141,7 @@ nsNavHistory::GetAgeInDaysString(int32_t aInt, const PRUnichar *aName, } void -nsNavHistory::GetStringFromName(const PRUnichar *aName, nsACString& aResult) +nsNavHistory::GetStringFromName(const char16_t *aName, nsACString& aResult) { nsIStringBundle *bundle = GetBundle(); if (bundle) { @@ -4181,7 +4181,7 @@ nsNavHistory::GetMonthYear(int32_t aMonth, int32_t aYear, nsACString& aResult) GetMonthName(aMonth, monthName); nsAutoString yearString; yearString.AppendInt(aYear); - const PRUnichar* strings[2] = { + const char16_t* strings[2] = { NS_ConvertUTF8toUTF16(monthName).get() , yearString.get() }; @@ -4265,7 +4265,7 @@ GetSimpleBookmarksQueryFolder(const nsCOMArray& aQueries, // try to input quotes expecting them to do something and get no results // back. -inline bool isQueryWhitespace(PRUnichar ch) +inline bool isQueryWhitespace(char16_t ch) { return ch == ' '; } diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index e8387f17e5f0..149ce1cc282d 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -190,8 +190,8 @@ public: nsIStringBundle* GetBundle(); nsIStringBundle* GetDateFormatBundle(); nsICollation* GetCollation(); - void GetStringFromName(const PRUnichar* aName, nsACString& aResult); - void GetAgeInDaysString(int32_t aInt, const PRUnichar *aName, + void GetStringFromName(const char16_t* aName, nsACString& aResult); + void GetAgeInDaysString(int32_t aInt, const char16_t *aName, nsACString& aResult); void GetMonthName(int32_t aIndex, nsACString& aResult); void GetMonthYear(int32_t aMonth, int32_t aYear, nsACString& aResult); diff --git a/toolkit/components/places/nsNavHistoryQuery.cpp b/toolkit/components/places/nsNavHistoryQuery.cpp index 81f1bd53d859..c0d332558d33 100644 --- a/toolkit/components/places/nsNavHistoryQuery.cpp +++ b/toolkit/components/places/nsNavHistoryQuery.cpp @@ -1146,8 +1146,8 @@ NS_IMETHODIMP nsNavHistoryQuery::GetTags(nsIVariant **aTags) rv = out->SetAsEmptyArray(); else { // Note: The resulting nsIVariant dupes both the array and its elements. - const PRUnichar **array = reinterpret_cast - (NS_Alloc(arrayLen * sizeof(PRUnichar *))); + const char16_t **array = reinterpret_cast + (NS_Alloc(arrayLen * sizeof(char16_t *))); NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY); for (uint32_t i = 0; i < arrayLen; ++i) { @@ -1220,7 +1220,7 @@ NS_IMETHODIMP nsNavHistoryQuery::SetTags(nsIVariant *aTags) return NS_ERROR_ILLEGAL_VALUE; } - PRUnichar **tags = reinterpret_cast(array); + char16_t **tags = reinterpret_cast(array); mTags.Clear(); // Finally, add each passed-in tag to our mTags array and then sort it. diff --git a/toolkit/components/places/tests/cpp/places_test_harness.h b/toolkit/components/places/tests/cpp/places_test_harness.h index 6b3ef744cc2b..1d8ccf69608e 100644 --- a/toolkit/components/places/tests/cpp/places_test_harness.h +++ b/toolkit/components/places/tests/cpp/places_test_harness.h @@ -125,7 +125,7 @@ public: NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { mTopicReceived = true; nsCOMPtr observerService = @@ -387,7 +387,7 @@ public: NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); diff --git a/toolkit/components/places/tests/cpp/test_IHistory.cpp b/toolkit/components/places/tests/cpp/test_IHistory.cpp index 63c8965a0104..9413e5213964 100644 --- a/toolkit/components/places/tests/cpp/test_IHistory.cpp +++ b/toolkit/components/places/tests/cpp/test_IHistory.cpp @@ -73,7 +73,7 @@ public: NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { mVisits++; @@ -325,7 +325,7 @@ namespace test_observer_topic_dispatched_helpers { NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { // Make sure we got notified of the right topic. do_check_false(strcmp(aTopic, URI_VISITED_RESOLUTION_TOPIC)); diff --git a/toolkit/components/remote/nsXRemoteService.cpp b/toolkit/components/remote/nsXRemoteService.cpp index bb5aab392604..d932cc04b430 100644 --- a/toolkit/components/remote/nsXRemoteService.cpp +++ b/toolkit/components/remote/nsXRemoteService.cpp @@ -165,7 +165,7 @@ nsXRemoteService::HandleCommandsFor(Window aWindowId) NS_IMETHODIMP nsXRemoteService::Observe(nsISupports* aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // This can be xpcom-shutdown or quit-application, but it's the same either // way. diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index dd0786e7600e..70730df8a47e 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -669,7 +669,7 @@ nsAppStartup::CreateChromeWindow2(nsIWebBrowserChrome *aParent, NS_IMETHODIMP nsAppStartup::Observe(nsISupports *aSubject, - const char *aTopic, const PRUnichar *aData) + const char *aTopic, const char16_t *aData) { NS_ASSERTION(mAppShell, "appshell service notified before appshell built"); if (!strcmp(aTopic, "quit-application-forced")) { diff --git a/toolkit/components/startup/nsUserInfoMac.mm b/toolkit/components/startup/nsUserInfoMac.mm index 21f1582b2549..ed3e3a7981a5 100644 --- a/toolkit/components/startup/nsUserInfoMac.mm +++ b/toolkit/components/startup/nsUserInfoMac.mm @@ -16,7 +16,7 @@ NS_IMPL_ISUPPORTS1(nsUserInfo, nsIUserInfo) nsUserInfo::nsUserInfo() {} NS_IMETHODIMP -nsUserInfo::GetFullname(PRUnichar **aFullname) +nsUserInfo::GetFullname(char16_t **aFullname) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT diff --git a/toolkit/components/startup/nsUserInfoOS2.cpp b/toolkit/components/startup/nsUserInfoOS2.cpp index f2b300e85ace..abf6e529be3b 100644 --- a/toolkit/components/startup/nsUserInfoOS2.cpp +++ b/toolkit/components/startup/nsUserInfoOS2.cpp @@ -34,7 +34,7 @@ nsUserInfo::GetUsername(char **aUsername) } NS_IMETHODIMP -nsUserInfo::GetFullname(PRUnichar **aFullname) +nsUserInfo::GetFullname(char16_t **aFullname) { *aFullname = nullptr; return NS_ERROR_NOT_IMPLEMENTED; diff --git a/toolkit/components/startup/nsUserInfoUnix.cpp b/toolkit/components/startup/nsUserInfoUnix.cpp index 442675f0e51c..ab3ee1ea6a45 100644 --- a/toolkit/components/startup/nsUserInfoUnix.cpp +++ b/toolkit/components/startup/nsUserInfoUnix.cpp @@ -34,7 +34,7 @@ nsUserInfo::~nsUserInfo() NS_IMPL_ISUPPORTS1(nsUserInfo,nsIUserInfo) NS_IMETHODIMP -nsUserInfo::GetFullname(PRUnichar **aFullname) +nsUserInfo::GetFullname(char16_t **aFullname) { struct passwd *pw = nullptr; diff --git a/toolkit/components/startup/nsUserInfoWin.cpp b/toolkit/components/startup/nsUserInfoWin.cpp index de5b30527ece..e6429f793d48 100644 --- a/toolkit/components/startup/nsUserInfoWin.cpp +++ b/toolkit/components/startup/nsUserInfoWin.cpp @@ -42,7 +42,7 @@ nsUserInfo::GetUsername(char **aUsername) } NS_IMETHODIMP -nsUserInfo::GetFullname(PRUnichar **aFullname) +nsUserInfo::GetFullname(char16_t **aFullname) { NS_ENSURE_ARG_POINTER(aFullname); *aFullname = nullptr; diff --git a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp index d5a7d50c94f7..ce6c1605614a 100644 --- a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp +++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp @@ -227,7 +227,7 @@ NS_IMETHODIMP nsBrowserStatusFilter::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { if (!mListener) return NS_OK; diff --git a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp index 985d7e62897d..a1b01cb00830 100644 --- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp +++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp @@ -220,7 +220,7 @@ nsTypeAheadFind::CollapseSelection() NS_IMETHODIMP nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) return PrefsReset(); diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index e970a9b62849..dc9276ed91c8 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -1434,7 +1434,7 @@ nsUrlClassifierDBService::GetCompleter(const nsACString &tableName, NS_IMETHODIMP nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsresult rv; diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index 7e98e7d656db..34ba4dc275e9 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -524,7 +524,7 @@ nsUrlClassifierStreamUpdater::OnStopRequest(nsIRequest *request, nsISupports* co NS_IMETHODIMP nsUrlClassifierStreamUpdater::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (nsCRT::strcmp(aTopic, gQuitApplicationMessage) == 0) { if (mIsUpdating && mChannel) { diff --git a/toolkit/crashreporter/mac_utils.mm b/toolkit/crashreporter/mac_utils.mm index 5d21d919bb53..9615c25d4a00 100644 --- a/toolkit/crashreporter/mac_utils.mm +++ b/toolkit/crashreporter/mac_utils.mm @@ -32,9 +32,9 @@ void GetObjCExceptionInfo(void* inException, nsACString& outString) reasonBuffer[reasonLength] = '\0'; outString.AssignLiteral("\nObj-C Exception data:\n"); - AppendUTF16toUTF8(reinterpret_cast(nameBuffer), outString); + AppendUTF16toUTF8(reinterpret_cast(nameBuffer), outString); outString.AppendLiteral(": "); - AppendUTF16toUTF8(reinterpret_cast(reasonBuffer), outString); + AppendUTF16toUTF8(reinterpret_cast(reasonBuffer), outString); NS_Free(nameBuffer); NS_Free(reasonBuffer); diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index f91bf9abf62a..2e6a2b5184ca 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -2460,7 +2460,7 @@ CheckForLastRunCrash() #ifdef XP_WIN // Ugly but effective. nsDependentString lastMinidump( - reinterpret_cast(lastMinidump_contents.get())); + reinterpret_cast(lastMinidump_contents.get())); #else nsAutoCString lastMinidump = lastMinidump_contents; #endif diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp index 495269633ee6..deea29518273 100644 --- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -2630,7 +2630,7 @@ int NS_main(int argc, NS_tchar **argv) return 1; } - PRUnichar *cmdLine = MakeCommandLine(argc - 1, argv + 1); + char16_t *cmdLine = MakeCommandLine(argc - 1, argv + 1); if (!cmdLine) { CloseHandle(elevatedFileHandle); return 1; diff --git a/toolkit/system/dbus/nsNetworkManagerListener.cpp b/toolkit/system/dbus/nsNetworkManagerListener.cpp index 15217383713c..7930e5af0539 100644 --- a/toolkit/system/dbus/nsNetworkManagerListener.cpp +++ b/toolkit/system/dbus/nsNetworkManagerListener.cpp @@ -136,7 +136,7 @@ nsNetworkManagerListener::NotifyNetworkStatusObservers() { if (!observerService) { return; } - const PRUnichar* status; + const char16_t* status; if (mNetworkManagerActive) { status = mLinkUp ? NS_LITERAL_STRING(NS_NETWORK_LINK_DATA_UP).get() : NS_LITERAL_STRING(NS_NETWORK_LINK_DATA_DOWN).get(); diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp index d4068c70972e..addc3ca64678 100644 --- a/toolkit/system/gnome/nsAlertsIconListener.cpp +++ b/toolkit/system/gnome/nsAlertsIconListener.cpp @@ -226,7 +226,7 @@ nsAlertsIconListener::SendClosed() NS_IMETHODIMP nsAlertsIconListener::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) { + const char16_t *aData) { // We need to close any open notifications upon application exit, otherwise // we will leak since libnotify holds a ref for us. if (!nsCRT::strcmp(aTopic, "quit-application") && mNotification) { diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp index 4beb4295101b..ff736efda5df 100644 --- a/toolkit/xre/ProfileReset.cpp +++ b/toolkit/xre/ProfileReset.cpp @@ -76,11 +76,11 @@ ProfileResetCleanup(nsIToolkitProfile* aOldProfile) if (!sb) return NS_ERROR_FAILURE; NS_ConvertUTF8toUTF16 appName(gAppData->name); - const PRUnichar* params[] = {appName.get(), appName.get()}; + const char16_t* params[] = {appName.get(), appName.get()}; nsXPIDLString resetBackupDirectoryName; - static const PRUnichar* kResetBackupDirectory = MOZ_UTF16("resetBackupDirectory"); + static const char16_t* kResetBackupDirectory = MOZ_UTF16("resetBackupDirectory"); rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2, getter_Copies(resetBackupDirectoryName)); diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 233a07bf6c31..c72a6947ab3b 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1764,15 +1764,15 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE); NS_ConvertUTF8toUTF16 appName(gAppData->name); - const PRUnichar* params[] = {appName.get(), appName.get()}; + const char16_t* params[] = {appName.get(), appName.get()}; nsXPIDLString killMessage; #ifndef XP_MACOSX - static const PRUnichar kRestartNoUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','N','o','U','n','l','o','c','k','e','r','\0'}; // "restartMessageNoUnlocker" - static const PRUnichar kRestartUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','U','n','l','o','c','k','e','r','\0'}; // "restartMessageUnlocker" + static const char16_t kRestartNoUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','N','o','U','n','l','o','c','k','e','r','\0'}; // "restartMessageNoUnlocker" + static const char16_t kRestartUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','U','n','l','o','c','k','e','r','\0'}; // "restartMessageUnlocker" #else - static const PRUnichar kRestartNoUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','N','o','U','n','l','o','c','k','e','r','M','a','c','\0'}; // "restartMessageNoUnlockerMac" - static const PRUnichar kRestartUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','U','n','l','o','c','k','e','r','M','a','c','\0'}; // "restartMessageUnlockerMac" + static const char16_t kRestartNoUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','N','o','U','n','l','o','c','k','e','r','M','a','c','\0'}; // "restartMessageNoUnlockerMac" + static const char16_t kRestartUnlocker[] = {'r','e','s','t','a','r','t','M','e','s','s','a','g','e','U','n','l','o','c','k','e','r','M','a','c','\0'}; // "restartMessageUnlockerMac" #endif sb->FormatStringFromName(aUnlocker ? kRestartUnlocker : kRestartNoUnlocker, @@ -1856,12 +1856,12 @@ ProfileMissingDialog(nsINativeAppSupport* aNative) NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE); NS_ConvertUTF8toUTF16 appName(gAppData->name); - const PRUnichar* params[] = {appName.get(), appName.get()}; + const char16_t* params[] = {appName.get(), appName.get()}; nsXPIDLString missingMessage; // profileMissing - static const PRUnichar kMissing[] = {'p','r','o','f','i','l','e','M','i','s','s','i','n','g','\0'}; + static const char16_t kMissing[] = {'p','r','o','f','i','l','e','M','i','s','s','i','n','g','\0'}; sb->FormatStringFromName(kMissing, params, 2, getter_Copies(missingMessage)); nsXPIDLString missingTitle; @@ -1916,7 +1916,7 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc, nsresult rv; nsCOMPtr profD, profLD; - PRUnichar* profileNamePtr; + char16_t* profileNamePtr; nsAutoCString profileName; { diff --git a/toolkit/xre/nsNativeAppSupportOS2.cpp b/toolkit/xre/nsNativeAppSupportOS2.cpp index e42e9e8eba8a..1a72b1e7b44f 100644 --- a/toolkit/xre/nsNativeAppSupportOS2.cpp +++ b/toolkit/xre/nsNativeAppSupportOS2.cpp @@ -73,7 +73,7 @@ static HWND hwndForDOMWindow( nsISupports * ); static nsresult -GetMostRecentWindow(const PRUnichar* aType, nsIDOMWindow** aWindow) { +GetMostRecentWindow(const char16_t* aType, nsIDOMWindow** aWindow) { nsresult rv; nsCOMPtr med( do_GetService( NS_WINDOWMEDIATOR_CONTRACTID, &rv ) ); if ( NS_FAILED( rv ) ) @@ -922,7 +922,7 @@ nsNativeAppSupportOS2::Stop( bool *aResult ) { NS_IMETHODIMP nsNativeAppSupportOS2::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, "quit-application") == 0) { Quit(); @@ -1040,7 +1040,7 @@ static void escapeQuotes( nsAString &aString ) { break; } else { // Insert back-slash ahead of the '"'. - aString.Insert( PRUnichar('\\'), offset ); + aString.Insert( char16_t('\\'), offset ); // Increment offset because we just inserted a slash offset++; } diff --git a/toolkit/xre/nsNativeAppSupportWin.cpp b/toolkit/xre/nsNativeAppSupportWin.cpp index 78496a0d1cf5..7111fbaf8ba3 100644 --- a/toolkit/xre/nsNativeAppSupportWin.cpp +++ b/toolkit/xre/nsNativeAppSupportWin.cpp @@ -53,7 +53,7 @@ static HWND hwndForDOMWindow( nsISupports * ); static nsresult -GetMostRecentWindow(const PRUnichar* aType, nsIDOMWindow** aWindow) { +GetMostRecentWindow(const char16_t* aType, nsIDOMWindow** aWindow) { nsresult rv; nsCOMPtr med( do_GetService( NS_WINDOWMEDIATOR_CONTRACTID, &rv ) ); if ( NS_FAILED( rv ) ) @@ -91,7 +91,7 @@ activateWindow( nsIDOMWindow *win ) { // Simple Win32 mutex wrapper. struct Mutex { - Mutex( const PRUnichar *name ) + Mutex( const char16_t *name ) : mName( name ), mHandle( 0 ), mState( -1 ) { @@ -319,7 +319,7 @@ private: static HSZ mApplication, mTopics[ topicCount ]; static DWORD mInstance; static bool mCanHandleRequests; - static PRUnichar mMutexName[]; + static char16_t mMutexName[]; friend struct MessageWindow; }; // nsNativeAppSupportWin @@ -459,7 +459,7 @@ HSZ nsNativeAppSupportWin::mTopics[nsNativeAppSupportWin::topicCount] = { 0 }; DWORD nsNativeAppSupportWin::mInstance = 0; bool nsNativeAppSupportWin::mCanHandleRequests = false; -PRUnichar nsNativeAppSupportWin::mMutexName[ 128 ] = { 0 }; +char16_t nsNativeAppSupportWin::mMutexName[ 128 ] = { 0 }; // Message window encapsulation. @@ -644,7 +644,7 @@ nsNativeAppSupportWin::Start( bool *aResult ) { // Build mutex name from app name. ::_snwprintf(reinterpret_cast(mMutexName), - sizeof mMutexName / sizeof(PRUnichar), L"%s%s%s", + sizeof mMutexName / sizeof(char16_t), L"%s%s%s", MOZ_MUTEX_NAMESPACE, NS_ConvertUTF8toUTF16(gAppData->name).get(), MOZ_STARTUP_MUTEX_NAME ); @@ -760,7 +760,7 @@ nsNativeAppSupportWin::Stop( bool *aResult ) { NS_IMETHODIMP nsNativeAppSupportWin::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, "quit-application") == 0) { Quit(); @@ -891,7 +891,7 @@ static void escapeQuotes( nsAString &aString ) { break; } else { // Insert back-slash ahead of the '"'. - aString.Insert( PRUnichar('\\'), offset ); + aString.Insert( char16_t('\\'), offset ); // Increment offset because we just inserted a slash offset++; } diff --git a/toolkit/xre/nsWindowsRestart.cpp b/toolkit/xre/nsWindowsRestart.cpp index af92cd876402..e7ceaabae7ad 100644 --- a/toolkit/xre/nsWindowsRestart.cpp +++ b/toolkit/xre/nsWindowsRestart.cpp @@ -152,12 +152,12 @@ MakeCommandLine(int argc, wchar_t **argv) * Convert UTF8 to UTF16 without using the normal XPCOM goop, which we * can't link to updater.exe. */ -static PRUnichar* +static char16_t* AllocConvertUTF8toUTF16(const char *arg) { // UTF16 can't be longer in units than UTF8 int len = strlen(arg); - PRUnichar *s = new PRUnichar[(len + 1) * sizeof(PRUnichar)]; + char16_t *s = new char16_t[(len + 1) * sizeof(char16_t)]; if (!s) return nullptr; diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 3f2852889259..61460a8d99fd 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -801,7 +801,7 @@ nsXREDirProvider::DoStartup() } } - static const PRUnichar kStartup[] = {'s','t','a','r','t','u','p','\0'}; + static const char16_t kStartup[] = {'s','t','a','r','t','u','p','\0'}; obsSvc->NotifyObservers(nullptr, "profile-do-change", kStartup); // Init the Extension Manager nsCOMPtr em = do_GetService("@mozilla.org/addons/integration;1"); @@ -822,7 +822,7 @@ nsXREDirProvider::DoStartup() "profile-after-change"); if (gSafeMode && safeModeNecessary) { - static const PRUnichar kCrashed[] = {'c','r','a','s','h','e','d','\0'}; + static const char16_t kCrashed[] = {'c','r','a','s','h','e','d','\0'}; obsSvc->NotifyObservers(nullptr, "safemode-forced", kCrashed); } @@ -849,7 +849,7 @@ nsXREDirProvider::DoShutdown() mozilla::services::GetObserverService(); NS_ASSERTION(obsSvc, "No observer service?"); if (obsSvc) { - static const PRUnichar kShutdownPersist[] = + static const char16_t kShutdownPersist[] = {'s','h','u','t','d','o','w','n','-','p','e','r','s','i','s','t','\0'}; obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist); obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist); diff --git a/tools/profiler/JSCustomObjectBuilder.cpp b/tools/profiler/JSCustomObjectBuilder.cpp index 713f45b853a4..c2ca764f1d75 100644 --- a/tools/profiler/JSCustomObjectBuilder.cpp +++ b/tools/profiler/JSCustomObjectBuilder.cpp @@ -86,7 +86,7 @@ void EscapeToStream(std::ostream& stream, const char* str) { } else if (ucs4Char == '\\') { stream << "\\\\"; } else if (ucs4Char > 0xFF) { - PRUnichar chr[2]; + char16_t chr[2]; ConvertUTF8toUTF16 encoder(chr); encoder.write(utf8CharStart, uint32_t(str-utf8CharStart)); char escChar[13]; diff --git a/tools/profiler/nsProfiler.cpp b/tools/profiler/nsProfiler.cpp index f636f2fbff8b..1a987fffb2dc 100644 --- a/tools/profiler/nsProfiler.cpp +++ b/tools/profiler/nsProfiler.cpp @@ -52,7 +52,7 @@ nsProfiler::Init() { NS_IMETHODIMP nsProfiler::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, "chrome-document-global-created") == 0) { nsCOMPtr requestor = do_QueryInterface(aSubject); diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 17c6339d95a4..b57e7d191d9f 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -1113,7 +1113,7 @@ NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest *aRequest, nsISupports* ctxt, } NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsISupports* ctxt, - nsresult aStatus, const PRUnichar* aStatusArg) + nsresult aStatus, const char16_t* aStatusArg) { // // Fire progress notifications out to any registered nsIWebProgressListeners @@ -1383,7 +1383,7 @@ void nsDocLoader::FireOnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { /* * First notify any listeners of the new state info... diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index 06ee1423b63c..28fccda4f509 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -146,7 +146,7 @@ protected: void FireOnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar* aMessage); + const char16_t* aMessage); void FireOnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, diff --git a/uriloader/exthandler/mac/nsLocalHandlerAppMac.h b/uriloader/exthandler/mac/nsLocalHandlerAppMac.h index 5c9da2b4e1c4..402ec52953bd 100644 --- a/uriloader/exthandler/mac/nsLocalHandlerAppMac.h +++ b/uriloader/exthandler/mac/nsLocalHandlerAppMac.h @@ -12,7 +12,7 @@ class nsLocalHandlerAppMac : public nsLocalHandlerApp { public: nsLocalHandlerAppMac() { } - nsLocalHandlerAppMac(const PRUnichar *aName, nsIFile *aExecutable) + nsLocalHandlerAppMac(const char16_t *aName, nsIFile *aExecutable) : nsLocalHandlerApp(aName, aExecutable) {} nsLocalHandlerAppMac(const nsAString & aName, nsIFile *aExecutable) diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.h b/uriloader/exthandler/mac/nsOSHelperAppService.h index 899b6a35b55b..5fb0a26c2c88 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.h +++ b/uriloader/exthandler/mac/nsOSHelperAppService.h @@ -36,7 +36,7 @@ public: // platformAppPath --> a platform specific path to an application that we got out of the // rdf data source. This can be a mac file spec, a unix path or a windows path depending on the platform // aFile --> an nsIFile representation of that platform application path. - virtual nsresult GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile); + virtual nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile); nsresult OSProtocolHandlerExists(const char * aScheme, bool * aHandlerExists); diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.mm b/uriloader/exthandler/mac/nsOSHelperAppService.mm index 301c85430bac..9b7417cab272 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.mm +++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm @@ -132,7 +132,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& buffer.SetLength(bundleNameLength); ::CFStringGetCharacters(bundleName, CFRangeMake(0, bundleNameLength), buffer.Elements()); - _retval.Assign(reinterpret_cast(buffer.Elements()), bundleNameLength); + _retval.Assign(reinterpret_cast(buffer.Elements()), bundleNameLength); rv = NS_OK; } @@ -156,7 +156,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } -nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * aPlatformAppPath, nsIFile ** aFile) +nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * aPlatformAppPath, nsIFile ** aFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; @@ -481,7 +481,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, ::CFStringGetCharacters(cfAppName, CFRangeMake(0, appNameLength), buffer.Elements()); nsAutoString appName; - appName.Assign(reinterpret_cast(buffer.Elements()), appNameLength); + appName.Assign(reinterpret_cast(buffer.Elements()), appNameLength); mimeInfoMac->SetDefaultDescription(appName); ::CFRelease(cfAppName); } @@ -516,7 +516,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, ::CFStringGetCharacters(cfTypeDesc, CFRangeMake(0, typeDescLength), buffer.Elements()); nsAutoString typeDesc; - typeDesc.Assign(reinterpret_cast(buffer.Elements()), typeDescLength); + typeDesc.Assign(reinterpret_cast(buffer.Elements()), typeDescLength); mimeInfoMac->SetDescription(typeDesc); } if (cfTypeDesc) { diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 5f78566d28fb..68543511f6ff 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -282,7 +282,7 @@ static bool GetFilenameAndExtensionFromChannel(nsIChannel* aChannel, // XXX RFindCharInReadable!! nsAutoString fileNameStr(aFileName); - int32_t idx = fileNameStr.RFindChar(PRUnichar('.')); + int32_t idx = fileNameStr.RFindChar(char16_t('.')); if (idx != kNotFound) CopyUTF16toUTF8(StringTail(fileNameStr, fileNameStr.Length() - idx - 1), aExtension); } @@ -862,7 +862,7 @@ NS_IMETHODIMP nsExternalHelperAppService::ApplyDecodingForExtension(const nsACSt return NS_OK; } -nsresult nsExternalHelperAppService::GetFileTokenForPath(const PRUnichar * aPlatformAppPath, +nsresult nsExternalHelperAppService::GetFileTokenForPath(const char16_t * aPlatformAppPath, nsIFile ** aFile) { nsDependentString platformAppPath(aPlatformAppPath); @@ -1180,7 +1180,7 @@ nsExternalHelperAppService::SetProtocolHandlerDefaults(nsIHandlerInfo *aHandlerI // XPCOM profile change observer NS_IMETHODIMP -nsExternalHelperAppService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData ) +nsExternalHelperAppService::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData ) { if (!strcmp(aTopic, "profile-before-change")) { ExpungeTemporaryFiles(); @@ -1233,7 +1233,7 @@ nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo, // make sure the extention includes the '.' if (!aTempFileExtension.IsEmpty() && aTempFileExtension.First() != '.') - mTempFileExtension = PRUnichar('.'); + mTempFileExtension = char16_t('.'); AppendUTF8toUTF16(aTempFileExtension, mTempFileExtension); // replace platform specific path separator and illegal characters to avoid any confusion @@ -1241,19 +1241,19 @@ nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo, mTempFileExtension.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_'); // Remove unsafe bidi characters which might have spoofing implications (bug 511521). - const PRUnichar unsafeBidiCharacters[] = { - PRUnichar(0x061c), // Arabic Letter Mark - PRUnichar(0x200e), // Left-to-Right Mark - PRUnichar(0x200f), // Right-to-Left Mark - PRUnichar(0x202a), // Left-to-Right Embedding - PRUnichar(0x202b), // Right-to-Left Embedding - PRUnichar(0x202c), // Pop Directional Formatting - PRUnichar(0x202d), // Left-to-Right Override - PRUnichar(0x202e), // Right-to-Left Override - PRUnichar(0x2066), // Left-to-Right Isolate - PRUnichar(0x2067), // Right-to-Left Isolate - PRUnichar(0x2068), // First Strong Isolate - PRUnichar(0x2069) // Pop Directional Isolate + const char16_t unsafeBidiCharacters[] = { + char16_t(0x061c), // Arabic Letter Mark + char16_t(0x200e), // Left-to-Right Mark + char16_t(0x200f), // Right-to-Left Mark + char16_t(0x202a), // Left-to-Right Embedding + char16_t(0x202b), // Right-to-Left Embedding + char16_t(0x202c), // Pop Directional Formatting + char16_t(0x202d), // Left-to-Right Override + char16_t(0x202e), // Right-to-Left Override + char16_t(0x2066), // Left-to-Right Isolate + char16_t(0x2067), // Right-to-Left Isolate + char16_t(0x2068), // First Strong Isolate + char16_t(0x2069) // Pop Directional Isolate }; for (uint32_t i = 0; i < ArrayLength(unsafeBidiCharacters); ++i) { mSuggestedFileName.ReplaceChar(unsafeBidiCharacters[i], '_'); @@ -1827,7 +1827,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ if (NS_SUCCEEDED(stringService->CreateBundle("chrome://global/locale/nsWebBrowserPersist.properties", getter_AddRefs(bundle)))) { nsXPIDLString msgText; - const PRUnichar *strings[] = { path.get() }; + const char16_t *strings[] = { path.get() }; if(NS_SUCCEEDED(bundle->FormatStringFromName(msgId.get(), strings, 1, getter_Copies(msgText)))) { if (mDialogProgressListener) @@ -2717,7 +2717,7 @@ NS_IMETHODIMP nsExternalHelperAppService::GetTypeFromFile(nsIFile* aFile, nsACSt int32_t len = fileName.Length(); for (int32_t i = len; i >= 0; i--) { - if (fileName[i] == PRUnichar('.')) + if (fileName[i] == char16_t('.')) { CopyUTF16toUTF8(fileName.get() + i + 1, fileExt); break; diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 9a22ed85fe68..49e3c18faed9 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -107,7 +107,7 @@ public: * @param aFile [out] An nsIFile representation of that platform * application path. */ - virtual nsresult GetFileTokenForPath(const PRUnichar * platformAppPath, + virtual nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile); virtual NS_HIDDEN_(nsresult) OSProtocolHandlerExists(const char *aScheme, diff --git a/uriloader/exthandler/nsLocalHandlerApp.h b/uriloader/exthandler/nsLocalHandlerApp.h index 27c803735a91..ee26268e7fce 100644 --- a/uriloader/exthandler/nsLocalHandlerApp.h +++ b/uriloader/exthandler/nsLocalHandlerApp.h @@ -21,7 +21,7 @@ public: nsLocalHandlerApp() { } - nsLocalHandlerApp(const PRUnichar *aName, nsIFile *aExecutable) + nsLocalHandlerApp(const char16_t *aName, nsIFile *aExecutable) : mName(aName), mExecutable(aExecutable) { } nsLocalHandlerApp(const nsAString & aName, nsIFile *aExecutable) diff --git a/uriloader/exthandler/nsMIMEInfoImpl.cpp b/uriloader/exthandler/nsMIMEInfoImpl.cpp index 451f4f0ca7c5..b9490eb9ec11 100644 --- a/uriloader/exthandler/nsMIMEInfoImpl.cpp +++ b/uriloader/exthandler/nsMIMEInfoImpl.cpp @@ -381,7 +381,7 @@ nsMIMEInfoBase::LaunchWithIProcess(nsIFile* aApp, const nsString& aArg) if (NS_FAILED(rv)) return rv; - const PRUnichar *string = aArg.get(); + const char16_t *string = aArg.get(); return process->Runw(false, &string, 1); } diff --git a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp index 31de1c8b6119..ad922f9317d6 100644 --- a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp +++ b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp @@ -29,7 +29,7 @@ using namespace mozilla; #define SALT_SIZE 8 #define TABLE_SIZE 36 -static const PRUnichar table[] = +static const char16_t table[] = { 'a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t', 'u','v','w','x','y','z','0','1','2','3', diff --git a/uriloader/exthandler/os2/nsOSHelperAppService.cpp b/uriloader/exthandler/os2/nsOSHelperAppService.cpp index 0d55f16ebf6f..ed8cf5def741 100644 --- a/uriloader/exthandler/os2/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/os2/nsOSHelperAppService.cpp @@ -353,7 +353,7 @@ nsOSHelperAppService::GetTypeAndDescriptionFromMimetypesFile(const nsAString& aF entry.Append(buf); if (entry.Last() == '\\') { entry.Truncate(entry.Length() - 1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -522,7 +522,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri entry.Append(buf); if (entry.Last() == '\\') { entry.Truncate(entry.Length() - 1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -828,7 +828,7 @@ nsOSHelperAppService::ParseNormalMIMETypesEntry(const nsAString& aEntry, } aExtensions.Append(Substring(start_iter, iter)); if (iter != end_iter) { // not the last extension - aExtensions.Append(PRUnichar(',')); + aExtensions.Append(char16_t(',')); } } @@ -938,7 +938,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a entry.Append(buffer); if (entry.Last() == '\\') { // entry continues on next line entry.Truncate(entry.Length()-1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry in entry. Check it for the type LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -1292,7 +1292,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) { // returns a localized string from unknownContentType.properties static nsresult -GetNLSString(const PRUnichar *aKey, nsAString& result) +GetNLSString(const char16_t *aKey, nsAString& result) { nsCOMPtr bundleSvc = mozilla::services::GetStringBundleService(); diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp index 4ab9cbacbb8b..e8db9c7e0904 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp @@ -165,7 +165,7 @@ nsMIMEInfoUnix::GetPossibleApplicationHandlers(nsIMutableArray ** aPossibleAppHa for (int i = 0; i < actions.size(); ++i) { nsContentHandlerApp* app = - new nsContentHandlerApp(nsString((PRUnichar*)actions[i].name().data()), + new nsContentHandlerApp(nsString((char16_t*)actions[i].name().data()), mSchemeOrType, actions[i]); mPossibleApplications->AppendElement(app, false); } diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index d4fd8d530b52..52557c31a503 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -353,7 +353,7 @@ nsOSHelperAppService::GetTypeAndDescriptionFromMimetypesFile(const nsAString& aF entry.Append(buf); if (entry.Last() == '\\') { entry.Truncate(entry.Length() - 1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -521,7 +521,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri entry.Append(buf); if (entry.Last() == '\\') { entry.Truncate(entry.Length() - 1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -827,7 +827,7 @@ nsOSHelperAppService::ParseNormalMIMETypesEntry(const nsAString& aEntry, } aExtensions.Append(Substring(start_iter, iter)); if (iter != end_iter) { // not the last extension - aExtensions.Append(PRUnichar(',')); + aExtensions.Append(char16_t(',')); } } @@ -985,7 +985,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a entry.Append(buffer); if (entry.Last() == '\\') { // entry continues on next line entry.Truncate(entry.Length()-1); - entry.Append(PRUnichar(' ')); // in case there is no trailing whitespace on this line + entry.Append(char16_t(' ')); // in case there is no trailing whitespace on this line } else { // we have a full entry in entry. Check it for the type LOG(("Current entry: '%s'\n", NS_LossyConvertUTF16toASCII(entry).get())); @@ -1178,7 +1178,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& #endif } -nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile) +nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile) { LOG(("-- nsOSHelperAppService::GetFileTokenForPath: '%s'\n", NS_LossyConvertUTF16toASCII(platformAppPath).get())); @@ -1198,7 +1198,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformApp return rv; // If we get here, we really should have a relative path. - NS_ASSERTION(*platformAppPath != PRUnichar('/'), "Unexpected absolute path"); + NS_ASSERTION(*platformAppPath != char16_t('/'), "Unexpected absolute path"); nsCOMPtr localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.h b/uriloader/exthandler/unix/nsOSHelperAppService.h index 8ae9394cea5c..aa8744bd255b 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.h +++ b/uriloader/exthandler/unix/nsOSHelperAppService.h @@ -41,7 +41,7 @@ public: // platformAppPath --> a platform specific path to an application that we got out of the // rdf data source. This can be a mac file spec, a unix path or a windows path depending on the platform // aFile --> an nsIFile representation of that platform application path. - virtual nsresult GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile); + virtual nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile); protected: already_AddRefed GetFromType(const nsCString& aMimeType); diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 93a95b28682b..44124be52a95 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -614,7 +614,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray **_retval) nsAutoString fileExtToUse; if (fileExt.First() != '.') - fileExtToUse = PRUnichar('.'); + fileExtToUse = char16_t('.'); fileExtToUse.Append(NS_ConvertUTF8toUTF16(fileExt)); // Note, the order in which these occur has an effect on the diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index 9e5ef84f3a09..4c174d71d554 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -98,12 +98,12 @@ static nsresult GetExtensionFrom4xRegistryInfo(const nsACString& aMimeType, if (NS_FAILED(rv)) return NS_OK; - aFileExtension.Insert(PRUnichar('.'), 0); + aFileExtension.Insert(char16_t('.'), 0); // this may be a comma separated list of extensions...just take the // first one for now... - int32_t pos = aFileExtension.FindChar(PRUnichar(',')); + int32_t pos = aFileExtension.FindChar(char16_t(',')); if (pos > 0) { // we have a comma separated list of types... // truncate everything after the first comma (including the comma) @@ -238,13 +238,13 @@ nsresult nsOSHelperAppService::GetMIMEInfoFromRegistry(const nsAFlatString& file /// Looks up the type for the extension aExt and compares it to aType /* static */ bool -nsOSHelperAppService::typeFromExtEquals(const PRUnichar* aExt, const char *aType) +nsOSHelperAppService::typeFromExtEquals(const char16_t* aExt, const char *aType) { if (!aType) return false; nsAutoString fileExtToUse; - if (aExt[0] != PRUnichar('.')) - fileExtToUse = PRUnichar('.'); + if (aExt[0] != char16_t('.')) + fileExtToUse = char16_t('.'); fileExtToUse.Append(aExt); @@ -498,8 +498,8 @@ already_AddRefed nsOSHelperAppService::GetByExtension(const nsAFl // windows registry assumes your file extension is going to include the '.'. // so make sure it's there... nsAutoString fileExtToUse; - if (aFileExt.First() != PRUnichar('.')) - fileExtToUse = PRUnichar('.'); + if (aFileExt.First() != char16_t('.')) + fileExtToUse = char16_t('.'); fileExtToUse.Append(aFileExt); diff --git a/uriloader/exthandler/win/nsOSHelperAppService.h b/uriloader/exthandler/win/nsOSHelperAppService.h index a94abd107fc4..8e1c961dca5c 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.h +++ b/uriloader/exthandler/win/nsOSHelperAppService.h @@ -45,7 +45,7 @@ public: /** Get the string value of a registry value and store it in result. * @return true on success, false on failure */ - static bool GetValueString(HKEY hKey, const PRUnichar* pValueName, nsAString& result); + static bool GetValueString(HKEY hKey, const char16_t* pValueName, nsAString& result); // Removes registry command handler parameters, quotes, and expands environment strings. static bool CleanupCmdHandlerPath(nsAString& aCommandHandler); @@ -58,7 +58,7 @@ protected: static nsresult GetMIMEInfoFromRegistry(const nsAFlatString& fileType, nsIMIMEInfo *pInfo); /// Looks up the type for the extension aExt and compares it to aType - static bool typeFromExtEquals(const PRUnichar* aExt, const char *aType); + static bool typeFromExtEquals(const char16_t* aExt, const char *aType); private: IApplicationAssociationRegistration* mAppAssoc; diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 3cfe7c708c16..c38f2269751b 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -256,7 +256,7 @@ NS_IMETHODIMP nsOfflineCachePendingUpdate::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; @@ -635,7 +635,7 @@ NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI, NS_IMETHODIMP nsOfflineCacheUpdateService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { if (mUpdates.Length() > 0) diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 64bdbc10d52e..f93d265d3710 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -802,7 +802,7 @@ NS_IMETHODIMP nsPrefetchService::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; @@ -824,7 +824,7 @@ nsPrefetchService::OnSecurityChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP nsPrefetchService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { LOG(("nsPrefetchService::Observe [topic=%s]\n", aTopic)); diff --git a/widget/ContentEvents.h b/widget/ContentEvents.h index b10cf110c26c..47b5fd90ac43 100644 --- a/widget/ContentEvents.h +++ b/widget/ContentEvents.h @@ -38,8 +38,8 @@ public: } int32_t lineNr; - const PRUnichar* errorMsg; - const PRUnichar* fileName; + const char16_t* errorMsg; + const char16_t* fileName; // XXX Not tested by test_assign_event_data.html void AssignScriptErrorEventData(const InternalScriptErrorEvent& aEvent, diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h index c3139bb95e43..79042f2458e3 100644 --- a/widget/LookAndFeel.h +++ b/widget/LookAndFeel.h @@ -548,7 +548,7 @@ public: * GetPasswordCharacter() returns a unicode character which should be used * for a masked character in password editor. E.g., '*'. */ - static PRUnichar GetPasswordCharacter(); + static char16_t GetPasswordCharacter(); /** * If the latest character in password field shouldn't be hidden by the diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 368022bab1c6..f202fbb4925b 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -225,7 +225,7 @@ AndroidBridge::SetMainThread(pthread_t thr) } // Raw JNIEnv variants. -jstring AndroidBridge::NewJavaString(JNIEnv* env, const PRUnichar* string, uint32_t len) { +jstring AndroidBridge::NewJavaString(JNIEnv* env, const char16_t* string, uint32_t len) { jstring ret = env->NewString(reinterpret_cast(string), len); if (env->ExceptionCheck()) { ALOG_BRIDGE("Exceptional exit of: %s", __PRETTY_FUNCTION__); @@ -249,7 +249,7 @@ jstring AndroidBridge::NewJavaString(JNIEnv* env, const nsACString& string) { } // AutoLocalJNIFrame variants.. -jstring AndroidBridge::NewJavaString(AutoLocalJNIFrame* frame, const PRUnichar* string, uint32_t len) { +jstring AndroidBridge::NewJavaString(AutoLocalJNIFrame* frame, const char16_t* string, uint32_t len) { return NewJavaString(frame->GetEnv(), string, len); } diff --git a/widget/android/AndroidBridge.h b/widget/android/AndroidBridge.h index ae6861e22c34..00316f3d3ab3 100644 --- a/widget/android/AndroidBridge.h +++ b/widget/android/AndroidBridge.h @@ -305,12 +305,12 @@ public: nsACString & aResult); // Utility methods. - static jstring NewJavaString(JNIEnv* env, const PRUnichar* string, uint32_t len); + static jstring NewJavaString(JNIEnv* env, const char16_t* string, uint32_t len); static jstring NewJavaString(JNIEnv* env, const nsAString& string); static jstring NewJavaString(JNIEnv* env, const char* string); static jstring NewJavaString(JNIEnv* env, const nsACString& string); - static jstring NewJavaString(AutoLocalJNIFrame* frame, const PRUnichar* string, uint32_t len); + static jstring NewJavaString(AutoLocalJNIFrame* frame, const char16_t* string, uint32_t len); static jstring NewJavaString(AutoLocalJNIFrame* frame, const nsAString& string); static jstring NewJavaString(AutoLocalJNIFrame* frame, const char* string); static jstring NewJavaString(AutoLocalJNIFrame* frame, const nsACString& string); diff --git a/widget/android/AndroidJavaWrappers.cpp b/widget/android/AndroidJavaWrappers.cpp index 263cdb10eb05..1e1aff113647 100644 --- a/widget/android/AndroidJavaWrappers.cpp +++ b/widget/android/AndroidJavaWrappers.cpp @@ -985,7 +985,7 @@ nsJNIString::nsJNIString(jstring jstr, JNIEnv *jenv) if (len <= 0) { SetIsVoid(true); } else { - Assign(reinterpret_cast(jCharPtr), len); + Assign(reinterpret_cast(jCharPtr), len); } jni->ReleaseStringChars(jstr, jCharPtr); } diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 65dd113f62cd..d1fb2745bf1b 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -195,7 +195,7 @@ nsAppShell::Init() NS_IMETHODIMP nsAppShell::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown")) { // We need to ensure no observers stick around after XPCOM shuts down @@ -547,7 +547,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) case AndroidGeckoEvent::PREFERENCES_OBSERVE: { const nsTArray &prefNames = curEvent->PrefNames(); size_t count = prefNames.Length(); - nsAutoArrayPtr prefNamePtrs(new const PRUnichar*[count]); + nsAutoArrayPtr prefNamePtrs(new const char16_t*[count]); for (size_t i = 0; i < count; ++i) { prefNamePtrs[i] = prefNames[i].get(); } diff --git a/widget/android/nsClipboard.cpp b/widget/android/nsClipboard.cpp index 93f2d416c625..e135b5de13e3 100644 --- a/widget/android/nsClipboard.cpp +++ b/widget/android/nsClipboard.cpp @@ -85,7 +85,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) nsCOMPtr nsisupportsDataWrapper = do_QueryInterface(dataWrapper); rv = aTransferable->SetTransferData(kUnicodeMime, nsisupportsDataWrapper, - buffer.Length() * sizeof(PRUnichar)); + buffer.Length() * sizeof(char16_t)); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; diff --git a/widget/android/nsDeviceContextAndroid.cpp b/widget/android/nsDeviceContextAndroid.cpp index 30a0d6474b5f..e9d489beae7d 100644 --- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -52,7 +52,7 @@ nsDeviceContextSpecAndroid::Init(nsIWidget* aWidget, NS_IMETHODIMP nsDeviceContextSpecAndroid::BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { diff --git a/widget/android/nsDeviceContextAndroid.h b/widget/android/nsDeviceContextAndroid.h index d3b79db43554..cac5f5eb8d95 100644 --- a/widget/android/nsDeviceContextAndroid.h +++ b/widget/android/nsDeviceContextAndroid.h @@ -16,7 +16,7 @@ public: nsIPrintSettings* aPS, bool aIsPrintPreview); NS_IMETHOD BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage); NS_IMETHOD EndDocument(); diff --git a/widget/android/nsLookAndFeel.cpp b/widget/android/nsLookAndFeel.cpp index f50810830921..97ae10b09522 100644 --- a/widget/android/nsLookAndFeel.cpp +++ b/widget/android/nsLookAndFeel.cpp @@ -20,7 +20,7 @@ AndroidSystemColors nsLookAndFeel::mSystemColors; bool nsLookAndFeel::mInitializedShowPassword = false; bool nsLookAndFeel::mShowPassword = true; -static const PRUnichar UNICODE_BULLET = 0x2022; +static const char16_t UNICODE_BULLET = 0x2022; nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel() @@ -487,7 +487,7 @@ nsLookAndFeel::GetPasswordMaskDelayImpl() } /* virtual */ -PRUnichar +char16_t nsLookAndFeel::GetPasswordCharacterImpl() { // This value is hard-coded in Android OS's PasswordTransformationMethod.java diff --git a/widget/android/nsLookAndFeel.h b/widget/android/nsLookAndFeel.h index 6f9331a2643a..9b33279a8bca 100644 --- a/widget/android/nsLookAndFeel.h +++ b/widget/android/nsLookAndFeel.h @@ -21,7 +21,7 @@ public: float aDevPixPerCSSPixel); virtual bool GetEchoPasswordImpl(); virtual uint32_t GetPasswordMaskDelayImpl(); - virtual PRUnichar GetPasswordCharacterImpl(); + virtual char16_t GetPasswordCharacterImpl(); protected: static bool mInitializedSystemColors; diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index c31b4518fe85..5021b837ddf0 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -88,7 +88,7 @@ class ContentCreationNotifier MOZ_FINAL : public nsIObserver NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "ipc:content-created")) { nsCOMPtr cpo = do_QueryInterface(aSubject); @@ -1575,7 +1575,7 @@ nsWindow::InitKeyEvent(WidgetKeyboardEvent& event, AndroidGeckoEvent& key, if (event.mKeyNameIndex == KEY_NAME_INDEX_USE_STRING) { int keyValue = key.DOMPrintableKeyValue(); if (keyValue) { - event.mKeyValue = static_cast(keyValue); + event.mKeyValue = static_cast(keyValue); } } uint32_t domKeyCode = ConvertAndroidKeyCodeToDOMKeyCode(key.KeyCode()); diff --git a/widget/cocoa/TextInputHandler.h b/widget/cocoa/TextInputHandler.h index cf2a3de05de6..d6c46550b14b 100644 --- a/widget/cocoa/TextInputHandler.h +++ b/widget/cocoa/TextInputHandler.h @@ -292,7 +292,7 @@ protected: * this is a result of ::LMGetKbdType(). */ void InitKeyPressEvent(NSEvent *aNativeKeyEvent, - PRUnichar aInsertChar, + char16_t aInsertChar, WidgetKeyboardEvent& aKeyEvent, UInt32 aKbType); @@ -635,7 +635,7 @@ protected: * if aChar is a non-printable ASCII character, * FALSE. */ - static bool IsPrintableChar(PRUnichar aChar); + static bool IsPrintableChar(char16_t aChar); /** * IsNormalCharInputtingEvent() checks whether aKeyEvent causes text input. diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm index fc79c2b3930f..173886ba89d3 100644 --- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -221,7 +221,7 @@ GetCharacters(const NSString* aString) nsAutoString escapedStr; for (uint32_t i = 0; i < str.Length(); i++) { - PRUnichar ch = str[i]; + char16_t ch = str[i]; if (ch < 0x20) { nsPrintfCString utf8str("(U+%04X)", ch); escapedStr += NS_ConvertUTF8toUTF16(utf8str); @@ -432,9 +432,9 @@ TISInputSourceWrapper::TranslateToString(UInt32 aKeyCode, UInt32 aModifiers, return true; } NS_ENSURE_TRUE(EnsureStringLength(aStr, len), false); - NS_ASSERTION(sizeof(PRUnichar) == sizeof(UniChar), - "size of PRUnichar and size of UniChar are different"); - memcpy(aStr.BeginWriting(), chars, len * sizeof(PRUnichar)); + NS_ASSERTION(sizeof(char16_t) == sizeof(UniChar), + "size of char16_t and size of UniChar are different"); + memcpy(aStr.BeginWriting(), chars, len * sizeof(char16_t)); PR_LOG(gLog, PR_LOG_ALWAYS, ("%p TISInputSourceWrapper::TranslateToString, aStr=\"%s\"", @@ -754,7 +754,7 @@ TISInputSourceWrapper::IsForRTLLanguage() nsAutoString str; bool ret = TranslateToString(kVK_ANSI_A, 0, eKbdType_ANSI, str); NS_ENSURE_TRUE(ret, ret); - PRUnichar ch = str.IsEmpty() ? PRUnichar(0) : str.CharAt(0); + char16_t ch = str.IsEmpty() ? char16_t(0) : str.CharAt(0); mIsRTL = UCS2_CHAR_IS_BIDI(ch) || ch == 0xD802 || ch == 0xD803; } return mIsRTL != 0; @@ -864,10 +864,10 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, // If control key is pressed and the eventChars is a non-printable control // character, we should convert it to ASCII alphabet. if (aKeyEvent.IsControl() && - !insertString.IsEmpty() && insertString[0] <= PRUnichar(26)) { + !insertString.IsEmpty() && insertString[0] <= char16_t(26)) { insertString = (aKeyEvent.IsShift() ^ aKeyEvent.IsCapsLocked()) ? - static_cast(insertString[0] + ('A' - 1)) : - static_cast(insertString[0] + ('a' - 1)); + static_cast(insertString[0] + ('A' - 1)) : + static_cast(insertString[0] + ('a' - 1)); } // If Meta key is pressed, it may cause to switch the keyboard layout like // Arabic, Russian, Hebrew, Greek and Dvorak-QWERTY. @@ -1052,7 +1052,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, void TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, - PRUnichar aInsertChar, + char16_t aInsertChar, WidgetKeyboardEvent& aKeyEvent, UInt32 aKbType) { @@ -1066,7 +1066,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, nsAutoString chars; nsCocoaUtils::GetStringForNSString([aNativeKeyEvent characters], chars); NS_ConvertUTF16toUTF8 utf8Chars(chars); - PRUnichar expectedChar = static_cast(aInsertChar); + char16_t expectedChar = static_cast(aInsertChar); NS_ConvertUTF16toUTF8 utf8ExpectedChar(&expectedChar, 1); PR_LOG(gLog, PR_LOG_ALWAYS, ("%p TISInputSourceWrapper::InitKeyPressEvent, aNativeKeyEvent=%p, " @@ -4468,7 +4468,7 @@ TextInputHandlerBase::SetSelection(NSRange& aRange) } /* static */ bool -TextInputHandlerBase::IsPrintableChar(PRUnichar aChar) +TextInputHandlerBase::IsPrintableChar(char16_t aChar) { return (aChar >= 0x20 && aChar <= 0x7E) || aChar >= 0xA0; } diff --git a/widget/cocoa/nsClipboard.mm b/widget/cocoa/nsClipboard.mm index 33f430424e4a..4d246c31a1e6 100644 --- a/widget/cocoa/nsClipboard.mm +++ b/widget/cocoa/nsClipboard.mm @@ -149,11 +149,11 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb dataLength = signedDataLength; // skip BOM (Byte Order Mark to distinguish little or big endian) - PRUnichar* clipboardDataPtrNoBOM = (PRUnichar*)clipboardDataPtr; + char16_t* clipboardDataPtrNoBOM = (char16_t*)clipboardDataPtr; if ((dataLength > 2) && ((clipboardDataPtrNoBOM[0] == 0xFEFF) || (clipboardDataPtrNoBOM[0] == 0xFFFE))) { - dataLength -= sizeof(PRUnichar); + dataLength -= sizeof(char16_t); clipboardDataPtrNoBOM += 1; } @@ -401,7 +401,7 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable) NSString* nativeString; if (data) - nativeString = [NSString stringWithCharacters:(const unichar*)data length:(dataSize / sizeof(PRUnichar))]; + nativeString = [NSString stringWithCharacters:(const unichar*)data length:(dataSize / sizeof(char16_t))]; else nativeString = [NSString string]; @@ -515,7 +515,7 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable) urlObject->GetData(url); // A newline embedded in the URL means that the form is actually URL + title. - int32_t newlinePos = url.FindChar(PRUnichar('\n')); + int32_t newlinePos = url.FindChar(char16_t('\n')); if (newlinePos >= 0) { url.Truncate(newlinePos); diff --git a/widget/cocoa/nsDeviceContextSpecX.h b/widget/cocoa/nsDeviceContextSpecX.h index 41df26966c24..21add83ad3e2 100644 --- a/widget/cocoa/nsDeviceContextSpecX.h +++ b/widget/cocoa/nsDeviceContextSpecX.h @@ -20,7 +20,7 @@ public: NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview); NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); NS_IMETHOD BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage); NS_IMETHOD EndDocument(); diff --git a/widget/cocoa/nsDeviceContextSpecX.mm b/widget/cocoa/nsDeviceContextSpecX.mm index b95d6e03c217..f7ccbaccd9fa 100644 --- a/widget/cocoa/nsDeviceContextSpecX.mm +++ b/widget/cocoa/nsDeviceContextSpecX.mm @@ -58,7 +58,7 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget, } NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm index 279179aaafaf..129f794a2c8c 100644 --- a/widget/cocoa/nsDragService.mm +++ b/widget/cocoa/nsDragService.mm @@ -369,8 +369,8 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) continue; unsigned int stringLength = [filePath length]; - unsigned int dataLength = (stringLength + 1) * sizeof(PRUnichar); // in bytes - PRUnichar* clipboardDataPtr = (PRUnichar*)malloc(dataLength); + unsigned int dataLength = (stringLength + 1) * sizeof(char16_t); // in bytes + char16_t* clipboardDataPtr = (char16_t*)malloc(dataLength); if (!clipboardDataPtr) return NS_ERROR_OUT_OF_MEMORY; [filePath getCharacters:reinterpret_cast(clipboardDataPtr)]; @@ -410,11 +410,11 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) dataLength = signedDataLength; // skip BOM (Byte Order Mark to distinguish little or big endian) - PRUnichar* clipboardDataPtrNoBOM = (PRUnichar*)clipboardDataPtr; + char16_t* clipboardDataPtrNoBOM = (char16_t*)clipboardDataPtr; if ((dataLength > 2) && ((clipboardDataPtrNoBOM[0] == 0xFEFF) || (clipboardDataPtrNoBOM[0] == 0xFFFE))) { - dataLength -= sizeof(PRUnichar); + dataLength -= sizeof(char16_t); clipboardDataPtrNoBOM += 1; } diff --git a/widget/cocoa/nsLookAndFeel.h b/widget/cocoa/nsLookAndFeel.h index df54450fcad9..57ccff719b14 100644 --- a/widget/cocoa/nsLookAndFeel.h +++ b/widget/cocoa/nsLookAndFeel.h @@ -18,7 +18,7 @@ public: virtual bool GetFontImpl(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle, float aDevPixPerCSSPixel); - virtual PRUnichar GetPasswordCharacterImpl() + virtual char16_t GetPasswordCharacterImpl() { // unicode value for the bullet character, used for password textfields. return 0x2022; diff --git a/widget/cocoa/nsPrintDialogX.mm b/widget/cocoa/nsPrintDialogX.mm index cbd2d558c704..d4a21ee0068f 100644 --- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -49,7 +49,7 @@ nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings, return NS_ERROR_FAILURE; // Set the print job title - PRUnichar** docTitles; + char16_t** docTitles; uint32_t titleCount; nsresult rv = aWebBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles); if (NS_SUCCEEDED(rv) && titleCount > 0) { @@ -169,7 +169,7 @@ nsPrintDialogServiceX::ShowPageSetup(nsIDOMWindow *aParent, - (NSButton*)checkboxWithLabel:(const char*)aLabel andFrame:(NSRect)aRect; - (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect - selectedItem:(const PRUnichar*)aCurrentString; + selectedItem:(const char16_t*)aCurrentString; - (void)addOptionsSection; @@ -298,7 +298,7 @@ static const char sHeaderFooterTags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"}; } - (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect - selectedItem:(const PRUnichar*)aCurrentString + selectedItem:(const char16_t*)aCurrentString { NSPopUpButton* list = [[[NSPopUpButton alloc] initWithFrame:aRect pullsDown:NO] autorelease]; [list setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; diff --git a/widget/gonk/GonkMemoryPressureMonitoring.cpp b/widget/gonk/GonkMemoryPressureMonitoring.cpp index 374a09fbf8e0..2db5dd8af7a7 100644 --- a/widget/gonk/GonkMemoryPressureMonitoring.cpp +++ b/widget/gonk/GonkMemoryPressureMonitoring.cpp @@ -94,7 +94,7 @@ public: } NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0); LOG("Observed XPCOM shutdown."); diff --git a/widget/gonk/nsAppShell.cpp b/widget/gonk/nsAppShell.cpp index 058fe81ef167..836f14f35d75 100644 --- a/widget/gonk/nsAppShell.cpp +++ b/widget/gonk/nsAppShell.cpp @@ -233,7 +233,7 @@ private: uint32_t mDOMKeyCode; KeyNameIndex mDOMKeyNameIndex; - PRUnichar mDOMPrintableKeyValue; + char16_t mDOMPrintableKeyValue; bool IsKeyPress() const { @@ -245,7 +245,7 @@ private: } uint32_t CharCode() const; - PRUnichar PrintableKeyValue() const; + char16_t PrintableKeyValue() const; void DispatchKeyDownEvent(); void DispatchKeyUpEvent(); @@ -276,7 +276,7 @@ KeyEventDispatcher::CharCode() const return (ch >= ' ') ? static_cast(ch) : 0; } -PRUnichar +char16_t KeyEventDispatcher::PrintableKeyValue() const { if (mDOMKeyNameIndex != KEY_NAME_INDEX_USE_STRING || !mKeyCharMap.get()) { @@ -284,7 +284,7 @@ KeyEventDispatcher::PrintableKeyValue() const } char16_t ch = mKeyCharMap->getCharacter(mData.key.keyCode, mData.metaState); if (ch >= ' ') { - return static_cast(ch); + return static_cast(ch); } int32_t unmodifiedMetaState = mData.metaState & ~(AMETA_ALT_ON | AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON | @@ -294,7 +294,7 @@ KeyEventDispatcher::PrintableKeyValue() const return 0; } ch = mKeyCharMap->getCharacter(mData.key.keyCode, unmodifiedMetaState); - return (ch >= ' ') ? static_cast(ch) : 0; + return (ch >= ' ') ? static_cast(ch) : 0; } nsEventStatus @@ -848,7 +848,7 @@ nsAppShell::Init() NS_IMETHODIMP nsAppShell::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, "browser-ui-startup-complete")) { return nsBaseAppShell::Observe(aSubject, aTopic, aData); diff --git a/widget/gonk/nsLookAndFeel.cpp b/widget/gonk/nsLookAndFeel.cpp index ec6531fc58d6..d0d324ddc2c0 100644 --- a/widget/gonk/nsLookAndFeel.cpp +++ b/widget/gonk/nsLookAndFeel.cpp @@ -21,7 +21,7 @@ #include "mozilla/gfx/2D.h" #include "cutils/properties.h" -static const PRUnichar UNICODE_BULLET = 0x2022; +static const char16_t UNICODE_BULLET = 0x2022; nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel() @@ -446,7 +446,7 @@ nsLookAndFeel::GetPasswordMaskDelayImpl() } /* virtual */ -PRUnichar +char16_t nsLookAndFeel::GetPasswordCharacterImpl() { return UNICODE_BULLET; diff --git a/widget/gonk/nsLookAndFeel.h b/widget/gonk/nsLookAndFeel.h index 238da8e8fd6f..aa7dce823cdd 100644 --- a/widget/gonk/nsLookAndFeel.h +++ b/widget/gonk/nsLookAndFeel.h @@ -31,7 +31,7 @@ public: virtual nsresult GetFloatImpl(FloatID aID, float &aResult); virtual bool GetEchoPasswordImpl(); virtual uint32_t GetPasswordMaskDelayImpl(); - virtual PRUnichar GetPasswordCharacterImpl(); + virtual char16_t GetPasswordCharacterImpl(); protected: virtual nsresult NativeGetColor(ColorID aID, nscolor &aColor); diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index a3181d68a2fd..71c4b25c9172 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -51,7 +51,7 @@ clipboard_clear_cb(GtkClipboard *aGtkClipboard, static void ConvertHTMLtoUCS2 (guchar *data, int32_t dataLength, - PRUnichar **unicodeData, + char16_t **unicodeData, int32_t &outUnicodeLen); static void @@ -100,7 +100,7 @@ nsClipboard::Init(void) } NS_IMETHODIMP -nsClipboard::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +nsClipboard::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (strcmp(aTopic, "quit-application") == 0) { // application is going to quit, save clipboard content @@ -324,7 +324,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) length = gtk_selection_data_get_length(selectionData); // Special case text/html since we can convert into UCS2 if (!strcmp(flavorStr, kHTMLMime)) { - PRUnichar* htmlBody= nullptr; + char16_t* htmlBody= nullptr; int32_t htmlBodyLen = 0; // Convert text/html into our unicode format ConvertHTMLtoUCS2(const_cast(clipboardData), length, @@ -606,10 +606,10 @@ nsClipboard::SelectionGetEvent(GtkClipboard *aClipboard, * detect mozilla use UCS2 encoding when copy-paste. */ guchar *buffer = (guchar *) - nsMemory::Alloc((len * sizeof(guchar)) + sizeof(PRUnichar)); + nsMemory::Alloc((len * sizeof(guchar)) + sizeof(char16_t)); if (!buffer) return; - PRUnichar prefix = 0xFEFF; + char16_t prefix = 0xFEFF; memcpy(buffer, &prefix, sizeof(prefix)); memcpy(buffer + sizeof(prefix), primitive_data, len); nsMemory::Free((guchar *)primitive_data); @@ -681,18 +681,18 @@ clipboard_clear_cb(GtkClipboard *aGtkClipboard, * bodyLength: pass to Mozilla */ void ConvertHTMLtoUCS2(guchar * data, int32_t dataLength, - PRUnichar** unicodeData, int32_t& outUnicodeLen) + char16_t** unicodeData, int32_t& outUnicodeLen) { nsAutoCString charset; GetHTMLCharset(data, dataLength, charset);// get charset of HTML if (charset.EqualsLiteral("UTF-16")) {//current mozilla outUnicodeLen = (dataLength / 2) - 1; - *unicodeData = reinterpret_cast + *unicodeData = reinterpret_cast (nsMemory::Alloc((outUnicodeLen + sizeof('\0')) * - sizeof(PRUnichar))); + sizeof(char16_t))); if (*unicodeData) { - memcpy(*unicodeData, data + sizeof(PRUnichar), - outUnicodeLen * sizeof(PRUnichar)); + memcpy(*unicodeData, data + sizeof(char16_t), + outUnicodeLen * sizeof(char16_t)); (*unicodeData)[outUnicodeLen] = '\0'; } } else if (charset.EqualsLiteral("UNKNOWN")) { @@ -724,9 +724,9 @@ void ConvertHTMLtoUCS2(guchar * data, int32_t dataLength, decoder->GetMaxLength((const char *)data, dataLength, &outUnicodeLen); // |outUnicodeLen| is number of chars if (outUnicodeLen) { - *unicodeData = reinterpret_cast + *unicodeData = reinterpret_cast (nsMemory::Alloc((outUnicodeLen + sizeof('\0')) * - sizeof(PRUnichar))); + sizeof(char16_t))); if (*unicodeData) { int32_t numberTmp = dataLength; decoder->Convert((const char *)data, &numberTmp, @@ -752,7 +752,7 @@ void ConvertHTMLtoUCS2(guchar * data, int32_t dataLength, void GetHTMLCharset(guchar * data, int32_t dataLength, nsCString& str) { // if detect "FFFE" or "FEFF", assume UTF-16 - PRUnichar* beginChar = (PRUnichar*)data; + char16_t* beginChar = (char16_t*)data; if ((beginChar[0] == 0xFFFE) || (beginChar[0] == 0xFEFF)) { str.AssignLiteral("UTF-16"); return; diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index 29c903fd0c73..66762a2ac885 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -72,7 +72,7 @@ public: uint32_t GetNumPrinters() { return mGlobalPrinterList ? mGlobalPrinterList->Length() : 0; } nsString* GetStringAt(int32_t aInx) { return &mGlobalPrinterList->ElementAt(aInx); } - void GetDefaultPrinterName(PRUnichar **aDefaultPrinterName); + void GetDefaultPrinterName(char16_t **aDefaultPrinterName); protected: GlobalPrinters() {} @@ -555,7 +555,7 @@ ns_release_macro(gpointer aData) { NS_RELEASE(spoolFile); } -NS_IMETHODIMP nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle, PRUnichar * aPrintToFileName, +NS_IMETHODIMP nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { if (mToPrinter) { @@ -706,7 +706,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::GetPrinterNameList(nsIStringEnumerator **a } /* readonly attribute wstring defaultPrinterName; */ -NS_IMETHODIMP nsPrinterEnumeratorGTK::GetDefaultPrinterName(PRUnichar **aDefaultPrinterName) +NS_IMETHODIMP nsPrinterEnumeratorGTK::GetDefaultPrinterName(char16_t **aDefaultPrinterName) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorGTK::GetDefaultPrinterName()\n")); NS_ENSURE_ARG_POINTER(aDefaultPrinterName); @@ -718,7 +718,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::GetDefaultPrinterName(PRUnichar **aDefault } /* void initPrintSettingsFromPrinter (in wstring aPrinterName, in nsIPrintSettings aPrintSettings); */ -NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName, nsIPrintSettings *aPrintSettings) +NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter()")); nsresult rv; @@ -918,7 +918,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich return NS_ERROR_UNEXPECTED; } -NS_IMETHODIMP nsPrinterEnumeratorGTK::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings) +NS_IMETHODIMP nsPrinterEnumeratorGTK::DisplayPropertiesDlg(const char16_t *aPrinter, nsIPrintSettings *aPrintSettings) { return NS_OK; } @@ -968,7 +968,7 @@ void GlobalPrinters::FreeGlobalPrinters() } void -GlobalPrinters::GetDefaultPrinterName(PRUnichar **aDefaultPrinterName) +GlobalPrinters::GetDefaultPrinterName(char16_t **aDefaultPrinterName) { *aDefaultPrinterName = nullptr; diff --git a/widget/gtk/nsDeviceContextSpecG.h b/widget/gtk/nsDeviceContextSpecG.h index 20e80cd9c16a..ac30fb42ce55 100644 --- a/widget/gtk/nsDeviceContextSpecG.h +++ b/widget/gtk/nsDeviceContextSpecG.h @@ -42,7 +42,7 @@ public: NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview); - NS_IMETHOD BeginDocument(const nsAString& aTitle, PRUnichar * aPrintToFileName, int32_t aStartPage, int32_t aEndPage); + NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage); NS_IMETHOD EndDocument(); NS_IMETHOD BeginPage() { return NS_OK; } NS_IMETHOD EndPage() { return NS_OK; } diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index 40997d7a9f07..7049dd6b75b4 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -152,7 +152,7 @@ nsDragService::GetInstance() NS_IMETHODIMP nsDragService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "quit-application")) { PR_LOG(sDragLm, PR_LOG_DEBUG, @@ -526,7 +526,7 @@ static void GetTextUriListItem(const char *data, uint32_t datalen, uint32_t aItemIndex, - PRUnichar **convertedText, + char16_t **convertedText, int32_t *convertedTextLen) { const char *p = data; @@ -716,7 +716,7 @@ nsDragService::GetData(nsITransferable * aTransferable, } if (mTargetDragData) { const char* text = static_cast(mTargetDragData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; int32_t convertedTextLen = 0; GetTextUriListItem(text, mTargetDragDataLen, aItemIndex, @@ -764,7 +764,7 @@ nsDragService::GetData(nsITransferable * aTransferable, PR_LOG(sDragLm, PR_LOG_DEBUG, ("Got textplain data\n")); const char* castedText = reinterpret_cast(mTargetDragData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; NS_ConvertUTF8toUTF16 ucs2string(castedText, mTargetDragDataLen); convertedText = ToNewUnicode(ucs2string); @@ -788,7 +788,7 @@ nsDragService::GetData(nsITransferable * aTransferable, PR_LOG(sDragLm, PR_LOG_DEBUG, ("Got textplain data\n")); const char* castedText = reinterpret_cast(mTargetDragData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; int32_t convertedTextLen = 0; nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode( castedText, mTargetDragDataLen, @@ -821,7 +821,7 @@ nsDragService::GetData(nsITransferable * aTransferable, ("Got text/uri-list data\n")); const char *data = reinterpret_cast(mTargetDragData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; int32_t convertedTextLen = 0; GetTextUriListItem(data, mTargetDragDataLen, aItemIndex, @@ -853,7 +853,7 @@ nsDragService::GetData(nsITransferable * aTransferable, ("Got _NETSCAPE_URL data\n")); const char* castedText = reinterpret_cast(mTargetDragData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; int32_t convertedTextLen = 0; nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode(castedText, mTargetDragDataLen, &convertedText, &convertedTextLen); if ( convertedText ) { @@ -1407,7 +1407,7 @@ CreateUriList(nsISupportsArray *items, gchar **text, gint *length) &tmpData, tmpDataLen); char* plainTextData = nullptr; - PRUnichar* castedUnicode = reinterpret_cast + char16_t* castedUnicode = reinterpret_cast (tmpData); int32_t plainTextLen = 0; nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText( @@ -1513,7 +1513,7 @@ nsDragService::SourceDataGet(GtkWidget *aWidget, // text and replace the output values with the plain text. if (needToDoConversionToPlainText) { char* plainTextData = nullptr; - PRUnichar* castedUnicode = reinterpret_cast + char16_t* castedUnicode = reinterpret_cast (tmpData); int32_t plainTextLen = 0; if (strcmp(mimeFlavor, gTextPlainUTF8Type) == 0) { diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index 3f7585228cee..a3a10d844b02 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -1192,7 +1192,7 @@ nsLookAndFeel::Init() // invisible character styles guint value; g_object_get (entry, "invisible-char", &value, nullptr); - sInvisibleCharacter = PRUnichar(value); + sInvisibleCharacter = char16_t(value); // caret styles gtk_widget_style_get(entry, @@ -1203,7 +1203,7 @@ nsLookAndFeel::Init() } // virtual -PRUnichar +char16_t nsLookAndFeel::GetPasswordCharacterImpl() { return sInvisibleCharacter; diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h index 804e9742112e..c3e0c8ef7a54 100644 --- a/widget/gtk/nsLookAndFeel.h +++ b/widget/gtk/nsLookAndFeel.h @@ -27,7 +27,7 @@ public: float aDevPixPerCSSPixel); virtual void RefreshImpl(); - virtual PRUnichar GetPasswordCharacterImpl(); + virtual char16_t GetPasswordCharacterImpl(); virtual bool GetEchoPasswordImpl(); protected: @@ -77,7 +77,7 @@ protected: nscolor sMozWindowSelectedText; nscolor sMozWindowSelectedBackground; nscolor sMozScrollbar; - PRUnichar sInvisibleCharacter; + char16_t sInvisibleCharacter; float sCaretRatio; bool sMenuSupportsDrag; diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp index 6171f565dcea..7504d51cb2a3 100644 --- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -57,7 +57,7 @@ nsNativeThemeGTK::~nsNativeThemeGTK() { NS_IMETHODIMP nsNativeThemeGTK::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) { moz_gtk_shutdown(); diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp index 9b314f98da5f..72288fc6d856 100644 --- a/widget/gtk/nsPrintDialogGTK.cpp +++ b/widget/gtk/nsPrintDialogGTK.cpp @@ -142,7 +142,7 @@ class nsPrintDialogWidgetGTK { bool useNativeSelection; - GtkWidget* ConstructHeaderFooterDropdown(const PRUnichar *currentString); + GtkWidget* ConstructHeaderFooterDropdown(const char16_t *currentString); const char* OptionWidgetToString(GtkWidget *dropdown); /* Code to copy between GTK and NS print settings structures. @@ -469,7 +469,7 @@ nsPrintDialogWidgetGTK::ExportSettings(nsIPrintSettings *aNSSettings) } GtkWidget* -nsPrintDialogWidgetGTK::ConstructHeaderFooterDropdown(const PRUnichar *currentString) +nsPrintDialogWidgetGTK::ConstructHeaderFooterDropdown(const char16_t *currentString) { #if (MOZ_WIDGET_GTK == 2) GtkWidget* dropdown = gtk_combo_box_new_text(); diff --git a/widget/gtk/nsPrintSettingsGTK.cpp b/widget/gtk/nsPrintSettingsGTK.cpp index ac76c57a1f53..66c7a4fb8237 100644 --- a/widget/gtk/nsPrintSettingsGTK.cpp +++ b/widget/gtk/nsPrintSettingsGTK.cpp @@ -376,7 +376,7 @@ nsPrintSettingsGTK::SetOrientation(int32_t aOrientation) /* attribute wstring toFileName; */ NS_IMETHODIMP -nsPrintSettingsGTK::GetToFileName(PRUnichar * *aToFileName) +nsPrintSettingsGTK::GetToFileName(char16_t * *aToFileName) { // Get the gtk output filename const char* gtk_output_uri = gtk_print_settings_get(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI); @@ -402,7 +402,7 @@ nsPrintSettingsGTK::GetToFileName(PRUnichar * *aToFileName) } NS_IMETHODIMP -nsPrintSettingsGTK::SetToFileName(const PRUnichar * aToFileName) +nsPrintSettingsGTK::SetToFileName(const char16_t * aToFileName) { if (aToFileName[0] == 0) { mToFileName.SetLength(0); @@ -434,7 +434,7 @@ nsPrintSettingsGTK::SetToFileName(const PRUnichar * aToFileName) } NS_IMETHODIMP -nsPrintSettingsGTK::GetPrinterName(PRUnichar * *aPrinter) +nsPrintSettingsGTK::GetPrinterName(char16_t * *aPrinter) { const char* gtkPrintName = gtk_print_settings_get_printer(mPrintSettings); if (!gtkPrintName) { @@ -452,7 +452,7 @@ nsPrintSettingsGTK::GetPrinterName(PRUnichar * *aPrinter) } NS_IMETHODIMP -nsPrintSettingsGTK::SetPrinterName(const PRUnichar * aPrinter) +nsPrintSettingsGTK::SetPrinterName(const char16_t * aPrinter) { NS_ConvertUTF16toUTF8 gtkPrinter(aPrinter); @@ -507,14 +507,14 @@ nsPrintSettingsGTK::SetScaling(double aScaling) /* attribute wstring paperName; */ NS_IMETHODIMP -nsPrintSettingsGTK::GetPaperName(PRUnichar * *aPaperName) +nsPrintSettingsGTK::GetPaperName(char16_t * *aPaperName) { NS_ENSURE_ARG_POINTER(aPaperName); *aPaperName = ToNewUnicode(NS_ConvertUTF8toUTF16(gtk_paper_size_get_name(mPaperSize))); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsGTK::SetPaperName(const PRUnichar * aPaperName) +nsPrintSettingsGTK::SetPaperName(const char16_t * aPaperName) { NS_ConvertUTF16toUTF8 gtkPaperName(aPaperName); diff --git a/widget/gtk/nsPrintSettingsGTK.h b/widget/gtk/nsPrintSettingsGTK.h index cc9ee8ec7544..1999a99b0ba4 100644 --- a/widget/gtk/nsPrintSettingsGTK.h +++ b/widget/gtk/nsPrintSettingsGTK.h @@ -74,13 +74,13 @@ public: NS_IMETHOD GetOrientation(int32_t *aOrientation); NS_IMETHOD SetOrientation(int32_t aOrientation); - NS_IMETHOD GetToFileName(PRUnichar * *aToFileName); - NS_IMETHOD SetToFileName(const PRUnichar * aToFileName); + NS_IMETHOD GetToFileName(char16_t * *aToFileName); + NS_IMETHOD SetToFileName(const char16_t * aToFileName); // Gets/Sets the printer name in the GtkPrintSettings. If no printer name is specified there, // you will get back the name of the current internal GtkPrinter. - NS_IMETHOD GetPrinterName(PRUnichar * *aPrinter); - NS_IMETHOD SetPrinterName(const PRUnichar * aPrinter); + NS_IMETHOD GetPrinterName(char16_t * *aPrinter); + NS_IMETHOD SetPrinterName(const char16_t * aPrinter); // Number of copies is stored/gotten from the GtkPrintSettings. NS_IMETHOD GetNumCopies(int32_t *aNumCopies); @@ -90,8 +90,8 @@ public: NS_IMETHOD SetScaling(double aScaling); // A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize. - NS_IMETHOD GetPaperName(PRUnichar * *aPaperName); - NS_IMETHOD SetPaperName(const PRUnichar * aPaperName); + NS_IMETHOD GetPaperName(char16_t * *aPaperName); + NS_IMETHOD SetPaperName(const char16_t * aPaperName); NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin); NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop); diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index f30fb4767d01..c930b94e935b 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -3054,7 +3054,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) } else { WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this); - PRUnichar textString[3]; + char16_t textString[3]; textString[0] = H_SURROGATE(event.charCode); textString[1] = L_SURROGATE(event.charCode); textString[2] = 0; diff --git a/widget/nsIDeviceContextSpec.h b/widget/nsIDeviceContextSpec.h index 444e3873600e..c91436a0362f 100644 --- a/widget/nsIDeviceContextSpec.h +++ b/widget/nsIDeviceContextSpec.h @@ -35,7 +35,7 @@ public: NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface) = 0; NS_IMETHOD BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) = 0; diff --git a/widget/os2/nsClipboard.cpp b/widget/os2/nsClipboard.cpp index e494c7972ea6..0a9168e58f57 100644 --- a/widget/os2/nsClipboard.cpp +++ b/widget/os2/nsClipboard.cpp @@ -256,7 +256,7 @@ void nsClipboard::SetClipboardData(const char *aFlavor) NumOfBytes + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE ) == NO_ERROR) { - PRUnichar* uchtemp = (PRUnichar*)pMozData; + char16_t* uchtemp = (char16_t*)pMozData; for (uint32_t i=0;i(pMozData), + WideCharToMultiByte(0, static_cast(pMozData), NumOfBytes, buffer, bufLength); memcpy(pByteMem, buffer.Elements(), NumOfBytes); // With Warp4 copying more than 64K to the clipboard works well, but diff --git a/widget/os2/nsDeviceContextSpecOS2.cpp b/widget/os2/nsDeviceContextSpecOS2.cpp index e5bc013ed65a..0a319963bf35 100644 --- a/widget/os2/nsDeviceContextSpecOS2.cpp +++ b/widget/os2/nsDeviceContextSpecOS2.cpp @@ -50,7 +50,7 @@ public: bool PrintersAreAllocated() { return mGlobalPrinterList != nullptr; } uint32_t GetNumPrinters() { return mGlobalNumPrinters; } nsString* GetStringAt(int32_t aInx) { return &mGlobalPrinterList->ElementAt(aInx); } - void GetDefaultPrinterName(PRUnichar*& aDefaultPrinterName); + void GetDefaultPrinterName(char16_t*& aDefaultPrinterName); protected: GlobalPrinters() {} @@ -205,8 +205,8 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIWidget *aWidget, if (aPS) { bool tofile = false; int32_t copies = 1; - PRUnichar *printer = nullptr; - PRUnichar *printfile = nullptr; + char16_t *printer = nullptr; + char16_t *printfile = nullptr; mPrintSettings->GetPrinterName(&printer); mPrintSettings->GetToFileName(&printfile); @@ -447,14 +447,14 @@ char *GetACPString(const nsAString& aStr) // Helper function to convert the string to the native codepage, // similar to UnicodeToCodepage() in nsDragService.cpp. -char *GetACPString(const PRUnichar* aStr) +char *GetACPString(const char16_t* aStr) { nsString str(aStr); return GetACPString(str); } NS_IMETHODIMP nsDeviceContextSpecOS2::BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { @@ -564,7 +564,7 @@ NS_IMETHODIMP nsPrinterEnumeratorOS2::GetPrinterNameList(nsIStringEnumerator **a return NS_NewAdoptingStringEnumerator(aPrinterNameList, printers); } -NS_IMETHODIMP nsPrinterEnumeratorOS2::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName) +NS_IMETHODIMP nsPrinterEnumeratorOS2::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) { NS_ENSURE_ARG_POINTER(aDefaultPrinterName); GlobalPrinters::GetInstance()->GetDefaultPrinterName(*aDefaultPrinterName); @@ -572,7 +572,7 @@ NS_IMETHODIMP nsPrinterEnumeratorOS2::GetDefaultPrinterName(PRUnichar * *aDefaul } /* void initPrintSettingsFromPrinter (in wstring aPrinterName, in nsIPrintSettings aPrintSettings); */ -NS_IMETHODIMP nsPrinterEnumeratorOS2::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName, nsIPrintSettings *aPrintSettings) +NS_IMETHODIMP nsPrinterEnumeratorOS2::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) { NS_ENSURE_ARG_POINTER(aPrinterName); NS_ENSURE_ARG_POINTER(aPrintSettings); @@ -595,7 +595,7 @@ NS_IMETHODIMP nsPrinterEnumeratorOS2::InitPrintSettingsFromPrinter(const PRUnich return NS_OK; } -NS_IMETHODIMP nsPrinterEnumeratorOS2::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings) +NS_IMETHODIMP nsPrinterEnumeratorOS2::DisplayPropertiesDlg(const char16_t *aPrinter, nsIPrintSettings *aPrintSettings) { nsresult rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); if (NS_FAILED(rv)) { @@ -660,7 +660,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters () return NS_OK; } -void GlobalPrinters::GetDefaultPrinterName(PRUnichar*& aDefaultPrinterName) +void GlobalPrinters::GetDefaultPrinterName(char16_t*& aDefaultPrinterName) { aDefaultPrinterName = nullptr; diff --git a/widget/os2/nsDeviceContextSpecOS2.h b/widget/os2/nsDeviceContextSpecOS2.h index 4a7b6f5c5063..3629754a6232 100644 --- a/widget/os2/nsDeviceContextSpecOS2.h +++ b/widget/os2/nsDeviceContextSpecOS2.h @@ -63,7 +63,7 @@ public: NS_IMETHOD GetPRTQUEUE(PRTQUEUE *&p); NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface); - NS_IMETHOD BeginDocument(const nsAString& aTitle, PRUnichar* aPrintToFileName, + NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage); NS_IMETHOD EndDocument(); NS_IMETHOD BeginPage(); diff --git a/widget/os2/nsDragService.cpp b/widget/os2/nsDragService.cpp index 14ba21170bb3..26b058eda8d0 100644 --- a/widget/os2/nsDragService.cpp +++ b/widget/os2/nsDragService.cpp @@ -66,7 +66,7 @@ nsresult GetTempFileName(char** outText); void SaveTypeAndSource(nsIFile *file, nsIDOMDocument *domDoc, PCSZ pszType); int UnicodeToCodepage( const nsAString& inString, char **outText); -int CodepageToUnicode( const nsACString& inString, PRUnichar **outText); +int CodepageToUnicode( const nsACString& inString, char16_t **outText); void RemoveCarriageReturns(char * pszText); MRESULT EXPENTRY nsDragWindowProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); @@ -702,7 +702,7 @@ nsresult nsDragService::GetUniTextTitle(nsISupports *aGenericData, // alloc a buffer to hold the unicode title text int bufsize = (MAXTITLELTH+1)*2; - PRUnichar * buffer = (PRUnichar*)nsMemory::Alloc(bufsize); + char16_t * buffer = (char16_t*)nsMemory::Alloc(bufsize); if (!buffer) return NS_ERROR_FAILURE; @@ -1751,7 +1751,7 @@ int UnicodeToCodepage(const nsAString& aString, char **aResult) // -------------------------------------------------------------------------- -int CodepageToUnicode(const nsACString& aString, PRUnichar **aResult) +int CodepageToUnicode(const nsACString& aString, char16_t **aResult) { nsAutoChar16Buffer buffer; int32_t bufLength; diff --git a/widget/os2/nsFilePicker.cpp b/widget/os2/nsFilePicker.cpp index 36639c9e1cfd..f224face16a2 100644 --- a/widget/os2/nsFilePicker.cpp +++ b/widget/os2/nsFilePicker.cpp @@ -536,9 +536,9 @@ char * nsFilePicker::ConvertToFileSystemCharset(const nsAString& inString) } //------------------------------------------------------------------------- -PRUnichar * nsFilePicker::ConvertFromFileSystemCharset(const char *inString) +char16_t * nsFilePicker::ConvertFromFileSystemCharset(const char *inString) { - PRUnichar *outString = nullptr; + char16_t *outString = nullptr; nsresult rv = NS_OK; // get file system charset and create a unicode encoder @@ -559,7 +559,7 @@ PRUnichar * nsFilePicker::ConvertFromFileSystemCharset(const char *inString) int32_t outLength; rv = mUnicodeDecoder->GetMaxLength(inString, inLength, &outLength); if (NS_SUCCEEDED(rv)) { - outString = static_cast(nsMemory::Alloc( (outLength+1) * sizeof( PRUnichar ) )); + outString = static_cast(nsMemory::Alloc( (outLength+1) * sizeof( char16_t ) )); if (nullptr == outString) { return nullptr; } diff --git a/widget/os2/nsFilePicker.h b/widget/os2/nsFilePicker.h index bf9ee4501b17..04bedb7fb8e4 100644 --- a/widget/os2/nsFilePicker.h +++ b/widget/os2/nsFilePicker.h @@ -55,7 +55,7 @@ protected: void GetFilterListArray(nsString& aFilterList); static void GetFileSystemCharset(nsCString & fileSystemCharset); char * ConvertToFileSystemCharset(const nsAString& inString); - PRUnichar * ConvertFromFileSystemCharset(const char *inString); + char16_t * ConvertFromFileSystemCharset(const char *inString); HWND mWnd; nsString mTitle; diff --git a/widget/os2/nsOS2Uni.cpp b/widget/os2/nsOS2Uni.cpp index 8b1884797106..a538bc1cf0a4 100644 --- a/widget/os2/nsOS2Uni.cpp +++ b/widget/os2/nsOS2Uni.cpp @@ -104,7 +104,7 @@ void OS2Uni::FreeUconvObjects() WideCharToMultiByte **********************************************************/ nsresult -WideCharToMultiByte(int aCodePage, const PRUnichar* aSrc, +WideCharToMultiByte(int aCodePage, const char16_t* aSrc, int32_t aSrcLength, nsAutoCharBuffer& aResult, int32_t& aResultLength) { @@ -141,7 +141,7 @@ MultiByteToWideChar(int aCodePage, const char* aSrc, } if (!aResult.SetLength(aResultLength + 1)) return NS_ERROR_OUT_OF_MEMORY; - PRUnichar* str = aResult.Elements(); + char16_t* str = aResult.Elements(); rv = uco->Convert(aSrc, &aSrcLength, str, &aResultLength); aResult[aResultLength] = '\0'; diff --git a/widget/os2/nsOS2Uni.h b/widget/os2/nsOS2Uni.h index be44f0eea8c5..9bb0d21dc66a 100644 --- a/widget/os2/nsOS2Uni.h +++ b/widget/os2/nsOS2Uni.h @@ -25,9 +25,9 @@ private: #define CHAR_BUFFER_SIZE 1024 typedef nsAutoTArray nsAutoCharBuffer; -typedef nsAutoTArray nsAutoChar16Buffer; +typedef nsAutoTArray nsAutoChar16Buffer; -nsresult WideCharToMultiByte(int aCodePage, const PRUnichar* aSrc, +nsresult WideCharToMultiByte(int aCodePage, const char16_t* aSrc, int32_t aSrcLength, nsAutoCharBuffer& aResult, int32_t& aResultLength); nsresult MultiByteToWideChar(int aCodePage, const char* aSrc, diff --git a/widget/os2/nsRwsService.cpp b/widget/os2/nsRwsService.cpp index ea9220b4c6e1..daaa2943dc63 100644 --- a/widget/os2/nsRwsService.cpp +++ b/widget/os2/nsRwsService.cpp @@ -61,7 +61,7 @@ static nsresult IsDescendedFrom(uint32_t wpsFilePtr, const char *pszClassname); static nsresult CreateFileForExtension(const char *aFileExt, nsACString& aPath); static nsresult DeleteFileForExtension(const char *aPath); -static void AssignNLSString(const PRUnichar *aKey, nsAString& _retval); +static void AssignNLSString(const char16_t *aKey, nsAString& _retval); static nsresult AssignTitleString(const char *aTitle, nsAString& result); //------------------------------------------------------------------------ @@ -94,7 +94,7 @@ typedef struct _ExtInfo uint32_t icon; uint32_t mini; uint32_t handler; - PRUnichar *title; + char16_t *title; } ExtInfo; #define kGrowBy 8 @@ -631,7 +631,7 @@ nsRwsService::RwsConvert(uint32_t type, uint32_t value, nsAString& result) NS_IMETHODIMP nsRwsService::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aSomeData) + const char16_t *aSomeData) { if (strcmp(aTopic, "quit-application") == 0) { uint32_t rc = sRwsClientTerminate(); @@ -726,7 +726,7 @@ static nsresult DeleteFileForExtension(const char *aPath) // returns a localized string from unknownContentType.properties; // if there's a failure, returns "WPS Default" -static void AssignNLSString(const PRUnichar *aKey, nsAString& result) +static void AssignNLSString(const char16_t *aKey, nsAString& result) { nsresult rv; nsXPIDLString title; @@ -772,8 +772,8 @@ static nsresult AssignTitleString(const char *aTitle, nsAString& result) buffer, bufLength))) return NS_ERROR_FAILURE; - PRUnichar *pSrc; - PRUnichar *pDst; + char16_t *pSrc; + char16_t *pDst; bool fSkip; // remove line breaks, leading whitespace, & extra embedded whitespace diff --git a/widget/os2/os2FrameWindow.cpp b/widget/os2/os2FrameWindow.cpp index b12dfa3124bc..560c13346676 100644 --- a/widget/os2/os2FrameWindow.cpp +++ b/widget/os2/os2FrameWindow.cpp @@ -428,7 +428,7 @@ nsresult os2FrameWindow::HideWindowChrome(bool aShouldHide) nsresult os2FrameWindow::SetTitle(const nsAString& aTitle) { - PRUnichar* uchtemp = ToNewUnicode(aTitle); + char16_t* uchtemp = ToNewUnicode(aTitle); for (uint32_t i = 0; i < aTitle.Length(); i++) { switch (uchtemp[i]) { case 0x2018: diff --git a/widget/qt/nsDeviceContextSpecQt.cpp b/widget/qt/nsDeviceContextSpecQt.cpp index 05307d167de1..a11c1feeded0 100644 --- a/widget/qt/nsDeviceContextSpecQt.cpp +++ b/widget/qt/nsDeviceContextSpecQt.cpp @@ -162,7 +162,7 @@ NS_IMETHODIMP nsDeviceContextSpecQt::GetPath(const char** aPath) NS_IMETHODIMP nsDeviceContextSpecQt::BeginDocument( const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { @@ -232,21 +232,21 @@ NS_IMETHODIMP nsPrinterEnumeratorQt::GetPrinterNameList( for (int32_t i = 0; i < qprinters.size(); ++i) { printers->AppendElement( nsDependentString( - (const PRUnichar*)qprinters[i].printerName().constData())); + (const char16_t*)qprinters[i].printerName().constData())); } return NS_NewAdoptingStringEnumerator(aPrinterNameList, printers); } NS_IMETHODIMP nsPrinterEnumeratorQt::GetDefaultPrinterName( - PRUnichar** aDefaultPrinterName) + char16_t** aDefaultPrinterName) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorQt::GetDefaultPrinterName()\n")); NS_ENSURE_ARG_POINTER(aDefaultPrinterName); QString defprinter = QPrinterInfo::defaultPrinter().printerName(); *aDefaultPrinterName = ToNewUnicode(nsDependentString( - (const PRUnichar*)defprinter.constData())); + (const char16_t*)defprinter.constData())); DO_PR_DEBUG_LOG(("GetDefaultPrinterName(): default printer='%s'.\n", NS_ConvertUTF16toUTF8(*aDefaultPrinterName).get())); @@ -255,7 +255,7 @@ NS_IMETHODIMP nsPrinterEnumeratorQt::GetDefaultPrinterName( } NS_IMETHODIMP nsPrinterEnumeratorQt::InitPrintSettingsFromPrinter( - const PRUnichar* aPrinterName, + const char16_t* aPrinterName, nsIPrintSettings* aPrintSettings) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorQt::InitPrintSettingsFromPrinter()")); @@ -265,7 +265,7 @@ NS_IMETHODIMP nsPrinterEnumeratorQt::InitPrintSettingsFromPrinter( } NS_IMETHODIMP nsPrinterEnumeratorQt::DisplayPropertiesDlg( - const PRUnichar* aPrinter, + const char16_t* aPrinter, nsIPrintSettings* aPrintSettings) { return NS_ERROR_NOT_IMPLEMENTED; diff --git a/widget/qt/nsDeviceContextSpecQt.h b/widget/qt/nsDeviceContextSpecQt.h index caebf5f8ce40..cd51b68c5df3 100644 --- a/widget/qt/nsDeviceContextSpecQt.h +++ b/widget/qt/nsDeviceContextSpecQt.h @@ -29,7 +29,7 @@ public: nsIPrintSettings* aPS, bool aIsPrintPreview); NS_IMETHOD BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage); NS_IMETHOD EndDocument(); diff --git a/widget/qt/nsLookAndFeel.cpp b/widget/qt/nsLookAndFeel.cpp index 366c3ec16038..35eb2defb28b 100644 --- a/widget/qt/nsLookAndFeel.cpp +++ b/widget/qt/nsLookAndFeel.cpp @@ -430,7 +430,7 @@ GetSystemFontInfo(const char *aClassName, nsString *aFontName, QFont qFont = QApplication::font(aClassName); NS_NAMED_LITERAL_STRING(quote, "\""); - nsString family((PRUnichar*)qFont.family().data()); + nsString family((char16_t*)qFont.family().data()); *aFontName = quote + family + quote; aFontStyle->systemFont = true; diff --git a/widget/qt/nsPrintSettingsQt.cpp b/widget/qt/nsPrintSettingsQt.cpp index 342439b88bfd..fcb6f0dfc02f 100644 --- a/widget/qt/nsPrintSettingsQt.cpp +++ b/widget/qt/nsPrintSettingsQt.cpp @@ -196,18 +196,18 @@ nsPrintSettingsQt::SetOrientation(int32_t aOrientation) } NS_IMETHODIMP -nsPrintSettingsQt::GetToFileName(PRUnichar** aToFileName) +nsPrintSettingsQt::GetToFileName(char16_t** aToFileName) { NS_ENSURE_ARG_POINTER(aToFileName); QString filename; filename = mQPrinter->outputFileName(); *aToFileName = ToNewUnicode( - nsDependentString((PRUnichar*)filename.data())); + nsDependentString((char16_t*)filename.data())); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsQt::SetToFileName(const PRUnichar* aToFileName) +nsPrintSettingsQt::SetToFileName(const char16_t* aToFileName) { nsCOMPtr file; nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), true, @@ -221,16 +221,16 @@ nsPrintSettingsQt::SetToFileName(const PRUnichar* aToFileName) } NS_IMETHODIMP -nsPrintSettingsQt::GetPrinterName(PRUnichar** aPrinter) +nsPrintSettingsQt::GetPrinterName(char16_t** aPrinter) { NS_ENSURE_ARG_POINTER(aPrinter); *aPrinter = ToNewUnicode(nsDependentString( - (const PRUnichar*)mQPrinter->printerName().constData())); + (const char16_t*)mQPrinter->printerName().constData())); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsQt::SetPrinterName(const PRUnichar* aPrinter) +nsPrintSettingsQt::SetPrinterName(const char16_t* aPrinter) { QString printername((const QChar*)aPrinter, NS_strlen(aPrinter)); mQPrinter->setPrinterName(printername); @@ -289,7 +289,7 @@ static const QPrinter::PageSize indexToQtPaperEnum[] = }; NS_IMETHODIMP -nsPrintSettingsQt::GetPaperName(PRUnichar** aPaperName) +nsPrintSettingsQt::GetPaperName(char16_t** aPaperName) { PR_STATIC_ASSERT(sizeof(indexToPaperName)/ sizeof(char*) == QPrinter::NPageSize); @@ -299,12 +299,12 @@ nsPrintSettingsQt::GetPaperName(PRUnichar** aPaperName) QPrinter::PaperSize size = mQPrinter->paperSize(); QString name(indexToPaperName[size]); *aPaperName = ToNewUnicode(nsDependentString - ((const PRUnichar*)name.constData())); + ((const char16_t*)name.constData())); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsQt::SetPaperName(const PRUnichar* aPaperName) +nsPrintSettingsQt::SetPaperName(const char16_t* aPaperName) { QString ref((QChar*)aPaperName, NS_strlen(aPaperName)); for (uint32_t i = 0; i < QPrinter::NPageSize; i++) diff --git a/widget/qt/nsPrintSettingsQt.h b/widget/qt/nsPrintSettingsQt.h index 801a573a77e4..fa74ac5c3d6d 100644 --- a/widget/qt/nsPrintSettingsQt.h +++ b/widget/qt/nsPrintSettingsQt.h @@ -39,11 +39,11 @@ public: NS_IMETHOD GetOrientation(int32_t* aOrientation); NS_IMETHOD SetOrientation(int32_t aOrientation); - NS_IMETHOD GetToFileName(PRUnichar** aToFileName); - NS_IMETHOD SetToFileName(const PRUnichar* aToFileName); + NS_IMETHOD GetToFileName(char16_t** aToFileName); + NS_IMETHOD SetToFileName(const char16_t* aToFileName); - NS_IMETHOD GetPrinterName(PRUnichar** aPrinter); - NS_IMETHOD SetPrinterName(const PRUnichar* aPrinter); + NS_IMETHOD GetPrinterName(char16_t** aPrinter); + NS_IMETHOD SetPrinterName(const char16_t* aPrinter); NS_IMETHOD GetNumCopies(int32_t* aNumCopies); NS_IMETHOD SetNumCopies(int32_t aNumCopies); @@ -51,8 +51,8 @@ public: NS_IMETHOD GetScaling(double* aScaling); NS_IMETHOD SetScaling(double aScaling); - NS_IMETHOD GetPaperName(PRUnichar** aPaperName); - NS_IMETHOD SetPaperName(const PRUnichar* aPaperName); + NS_IMETHOD GetPaperName(char16_t** aPaperName); + NS_IMETHOD SetPaperName(const char16_t* aPaperName); NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin); NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop); diff --git a/widget/shared/SharedWidgetUtils.cpp b/widget/shared/SharedWidgetUtils.cpp index 64f729d6a837..24409a935317 100644 --- a/widget/shared/SharedWidgetUtils.cpp +++ b/widget/shared/SharedWidgetUtils.cpp @@ -168,7 +168,7 @@ WidgetUtils::GetLatinCharCodeForKeyCode(uint32_t aKeyCode, // static KeyNameIndex -WidgetUtils::GetDeadKeyNameIndex(PRUnichar aChar) +WidgetUtils::GetDeadKeyNameIndex(char16_t aChar) { switch (aChar) { case '`': diff --git a/widget/shared/WidgetUtils.h b/widget/shared/WidgetUtils.h index 681b4b3e4a90..9d8cfd8f174c 100644 --- a/widget/shared/WidgetUtils.h +++ b/widget/shared/WidgetUtils.h @@ -58,7 +58,7 @@ public: * unicode character, e.g., '`' returns KEY_NAME_INDEX_DeadGrave. * So, you cannot use this method for checking if the char is a dead char. */ - static KeyNameIndex GetDeadKeyNameIndex(PRUnichar aChar); + static KeyNameIndex GetDeadKeyNameIndex(char16_t aChar); }; } // namespace widget diff --git a/widget/tests/TestWinTSF.cpp b/widget/tests/TestWinTSF.cpp index eb5e9b783600..765b2d2d7fda 100644 --- a/widget/tests/TestWinTSF.cpp +++ b/widget/tests/TestWinTSF.cpp @@ -166,7 +166,7 @@ NS_IMETHODIMP TestApp::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) + const char16_t *aMessage) { return NS_OK; } @@ -1749,7 +1749,7 @@ TestApp::TestClustering(void) { // Text for testing const uint32_t STRING_LENGTH = 2; - PRUnichar string[3]; + char16_t string[3]; string[0] = 'e'; string[1] = 0x0301; // U+0301 'acute accent' string[2] = nullptr; @@ -1950,7 +1950,7 @@ TestApp::TestText(void) const uint32_t RUNINFO_SIZE = (0x10); bool succeeded = true, continueTest; - PRUnichar buffer[BUFFER_SIZE]; + char16_t buffer[BUFFER_SIZE]; TS_RUNINFO runInfo[RUNINFO_SIZE]; ULONG bufferRet, runInfoRet; LONG acpRet, acpCurrent; @@ -2320,7 +2320,7 @@ TestApp::TestCompositionSelectionAndText(char* aTestName, } const uint32_t bufferSize = 0x100, runInfoSize = 0x10; - PRUnichar buffer[bufferSize]; + char16_t buffer[bufferSize]; TS_RUNINFO runInfo[runInfoSize]; ULONG bufferRet, runInfoRet; LONG acpRet, acpCurrent = 0; diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 34e975774e49..3d4893e5995d 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -513,15 +513,15 @@ GfxInfo::Init() // with bad Intel driver installations where the DriverVersion reported // by the registry was not the version of the DLL. bool is64bitApp = sizeof(void*) == 8; - const PRUnichar *dllFileName = is64bitApp + const char16_t *dllFileName = is64bitApp ? MOZ_UTF16("igd10umd64.dll") : MOZ_UTF16("igd10umd32.dll"), *dllFileName2 = is64bitApp ? MOZ_UTF16("igd10iumd64.dll") : MOZ_UTF16("igd10iumd32.dll"); nsString dllVersion, dllVersion2; - gfxWindowsPlatform::GetDLLVersion((PRUnichar*)dllFileName, dllVersion); - gfxWindowsPlatform::GetDLLVersion((PRUnichar*)dllFileName2, dllVersion2); + gfxWindowsPlatform::GetDLLVersion((char16_t*)dllFileName, dllVersion); + gfxWindowsPlatform::GetDLLVersion((char16_t*)dllFileName2, dllVersion2); uint64_t dllNumericVersion = 0, dllNumericVersion2 = 0, driverNumericVersion = 0, knownSafeMismatchVersion = 0; diff --git a/widget/windows/JumpListBuilder.cpp b/widget/windows/JumpListBuilder.cpp index e35a205b2f11..4ca8a1b27d3a 100644 --- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -502,7 +502,7 @@ nsresult JumpListBuilder::TransferIObjectArrayToIMutableArray(IObjectArray *objA NS_IMETHODIMP JumpListBuilder::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (nsDependentString(aData).EqualsASCII(kPrefTaskbarEnabled)) { bool enabled = Preferences::GetBool(kPrefTaskbarEnabled, true); diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 6849aca096a3..97ed8690e08b 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -50,8 +50,8 @@ static uint32_t sUniqueKeyEventId = 0; struct DeadKeyEntry { - PRUnichar BaseChar; - PRUnichar CompositeChar; + char16_t BaseChar; + char16_t CompositeChar; }; @@ -88,7 +88,7 @@ public: aEntries * sizeof(DeadKeyEntry))); } - PRUnichar GetCompositeChar(PRUnichar aBaseChar) const; + char16_t GetCompositeChar(char16_t aBaseChar) const; }; @@ -290,7 +290,7 @@ ModifierKeyState::EnsureAltGr() *****************************************************************************/ void -UniCharsAndModifiers::Append(PRUnichar aUniChar, Modifiers aModifiers) +UniCharsAndModifiers::Append(char16_t aUniChar, Modifiers aModifiers) { MOZ_ASSERT(mLength < 5); mChars[mLength] = aUniChar; @@ -312,7 +312,7 @@ UniCharsAndModifiers::UniCharsEqual(const UniCharsAndModifiers& aOther) const if (mLength != aOther.mLength) { return false; } - return !memcmp(mChars, aOther.mChars, mLength * sizeof(PRUnichar)); + return !memcmp(mChars, aOther.mChars, mLength * sizeof(char16_t)); } bool @@ -332,7 +332,7 @@ UniCharsAndModifiers::operator+=(const UniCharsAndModifiers& aOther) { uint32_t copyCount = std::min(aOther.mLength, 5 - mLength); NS_ENSURE_TRUE(copyCount > 0, *this); - memcpy(&mChars[mLength], aOther.mChars, copyCount * sizeof(PRUnichar)); + memcpy(&mChars[mLength], aOther.mChars, copyCount * sizeof(char16_t)); memcpy(&mModifiers[mLength], aOther.mModifiers, copyCount * sizeof(Modifiers)); mLength += copyCount; @@ -395,8 +395,8 @@ VirtualKey::ShiftStateToModifiers(ShiftState aShiftState) return modifiers; } -inline PRUnichar -VirtualKey::GetCompositeChar(ShiftState aShiftState, PRUnichar aBaseChar) const +inline char16_t +VirtualKey::GetCompositeChar(ShiftState aShiftState, char16_t aBaseChar) const { return mShiftStates[aShiftState].DeadKey.Table->GetCompositeChar(aBaseChar); } @@ -424,7 +424,7 @@ VirtualKey::MatchingDeadKeyTable(const DeadKeyEntry* aDeadKeyArray, void VirtualKey::SetNormalChars(ShiftState aShiftState, - const PRUnichar* aChars, + const char16_t* aChars, uint32_t aNumOfChars) { NS_ASSERTION(aShiftState < ArrayLength(mShiftStates), "invalid index"); @@ -444,7 +444,7 @@ VirtualKey::SetNormalChars(ShiftState aShiftState, } void -VirtualKey::SetDeadChar(ShiftState aShiftState, PRUnichar aDeadChar) +VirtualKey::SetDeadChar(ShiftState aShiftState, char16_t aDeadChar) { NS_ASSERTION(aShiftState < ArrayLength(mShiftStates), "invalid index"); @@ -900,10 +900,10 @@ NativeKey::ComputeVirtualKeyCodeFromScanCodeEx() const mKeyboardLayout)); } -PRUnichar +char16_t NativeKey::ComputeUnicharFromScanCode() const { - return static_cast( + return static_cast( ::MapVirtualKeyEx(ComputeVirtualKeyCodeFromScanCode(), MAPVK_VK_TO_CHAR, mKeyboardLayout)); } @@ -1127,8 +1127,8 @@ NativeKey::HandleCharMessage(const MSG& aCharMsg, // should cause composition events because they are not caused // by actual keyboard operation. - static const PRUnichar U_SPACE = 0x20; - static const PRUnichar U_EQUAL = 0x3D; + static const char16_t U_SPACE = 0x20; + static const char16_t U_EQUAL = 0x3D; // First, handle normal text input or non-printable key case here. if ((!mModKeyState.IsAlt() && !mModKeyState.IsControl()) || @@ -1160,7 +1160,7 @@ NativeKey::HandleCharMessage(const MSG& aCharMsg, // WM_KEYDOWN. I think that we don't need to keypress event in such // case especially for shortcut keys. - PRUnichar uniChar; + char16_t uniChar; // Ctrl+A Ctrl+Z, see Programming Windows 3.1 page 110 for details if (mModKeyState.IsControl() && aCharMsg.wParam <= 0x1A) { // Bug 16486: Need to account for shift here. @@ -1182,7 +1182,7 @@ NativeKey::HandleCharMessage(const MSG& aCharMsg, // accesskeys and make sure that numbers are always passed as such. if (uniChar && (mModKeyState.IsControl() || mModKeyState.IsAlt())) { KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance(); - PRUnichar unshiftedCharCode = + char16_t unshiftedCharCode = (mVirtualKeyCode >= '0' && mVirtualKeyCode <= '9') ? mVirtualKeyCode : mModKeyState.IsShift() ? ComputeUnicharFromScanCode() : 0; @@ -1495,7 +1495,7 @@ NativeKey::DispatchKeyPressEventsWithKeyboardLayout() const // inputs '+' on Thai keyboard layout, a key which is at '=/+' // key on ANSI keyboard layout is VK_OEM_PLUS. Native applications // handle it as '+' key if Ctrl key is pressed. - PRUnichar charForOEMKeyCode = 0; + char16_t charForOEMKeyCode = 0; switch (mVirtualKeyCode) { case VK_OEM_PLUS: charForOEMKeyCode = '+'; break; case VK_OEM_COMMA: charForOEMKeyCode = ','; break; @@ -1746,7 +1746,7 @@ KeyboardLayout::InitNativeKey(NativeKey& aNativeKey, // Dead-key was active. See if pressed base character does produce // valid composite character. int32_t activeDeadKeyIndex = GetKeyIndex(mActiveDeadKey); - PRUnichar compositeChar = (baseChars.mLength == 1 && baseChars.mChars[0]) ? + char16_t compositeChar = (baseChars.mLength == 1 && baseChars.mChars[0]) ? mVirtualKeys[activeDeadKeyIndex].GetCompositeChar(mDeadKeyShiftState, baseChars.mChars[0]) : 0; if (compositeChar) { @@ -1825,7 +1825,7 @@ KeyboardLayout::LoadLayout(HKL aLayout) continue; } NS_ASSERTION(uint32_t(vki) < ArrayLength(mVirtualKeys), "invalid index"); - PRUnichar uniChars[5]; + char16_t uniChars[5]; int32_t ret = ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)uniChars, ArrayLength(uniChars), 0, mKeyboardLayout); @@ -1834,7 +1834,7 @@ KeyboardLayout::LoadLayout(HKL aLayout) shiftStatesWithDeadKeys |= (1 << shiftState); // Repeat dead-key to deactivate it and get its character // representation. - PRUnichar deadChar[2]; + char16_t deadChar[2]; ret = ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)deadChar, ArrayLength(deadChar), 0, mKeyboardLayout); NS_ASSERTION(ret == 2, "Expecting twice repeated dead-key character"); @@ -1988,7 +1988,7 @@ KeyboardLayout::EnsureDeadKeyActive(bool aIsActive, { int32_t ret; do { - PRUnichar dummyChars[5]; + char16_t dummyChars[5]; ret = ::ToUnicodeEx(aDeadKey, 0, (PBYTE)aDeadKeyKbdState, (LPWSTR)dummyChars, ArrayLength(dummyChars), 0, mKeyboardLayout); @@ -2021,8 +2021,8 @@ KeyboardLayout::DeactivateDeadKeyState() } bool -KeyboardLayout::AddDeadKeyEntry(PRUnichar aBaseChar, - PRUnichar aCompositeChar, +KeyboardLayout::AddDeadKeyEntry(char16_t aBaseChar, + char16_t aCompositeChar, DeadKeyEntry* aDeadKeyArray, uint32_t aEntries) { @@ -2073,7 +2073,7 @@ KeyboardLayout::GetDeadKeyCombinations(uint8_t aDeadKey, // Depending on the character the followed the dead-key, the keyboard // driver can produce one composite character, or a dead-key character // followed by a second character. - PRUnichar compositeChars[5]; + char16_t compositeChars[5]; int32_t ret = ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)compositeChars, ArrayLength(compositeChars), 0, mKeyboardLayout); @@ -2086,7 +2086,7 @@ KeyboardLayout::GetDeadKeyCombinations(uint8_t aDeadKey, // Exactly one composite character produced. Now, when dead-key // is not active, repeat the last character one more time to // determine the base character. - PRUnichar baseChars[5]; + char16_t baseChars[5]; ret = ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)baseChars, ArrayLength(baseChars), 0, mKeyboardLayout); NS_ASSERTION(ret == 1, "One base character expected"); @@ -2603,8 +2603,8 @@ KeyboardLayout::SynthesizeNativeKeyEvent(nsWindowBase* aWidget, * mozilla::widget::DeadKeyTable *****************************************************************************/ -PRUnichar -DeadKeyTable::GetCompositeChar(PRUnichar aBaseChar) const +char16_t +DeadKeyTable::GetCompositeChar(char16_t aBaseChar) const { // Dead-key table is sorted by BaseChar in ascending order. // Usually they are too small to use binary search. diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h index d8d18313eb12..2e32e52923c4 100644 --- a/widget/windows/KeyboardLayout.h +++ b/widget/windows/KeyboardLayout.h @@ -92,7 +92,7 @@ private: struct UniCharsAndModifiers { // Dead-key + up to 4 characters - PRUnichar mChars[5]; + char16_t mChars[5]; Modifiers mModifiers[5]; uint32_t mLength; @@ -103,7 +103,7 @@ struct UniCharsAndModifiers /** * Append a pair of unicode character and the final modifier. */ - void Append(PRUnichar aUniChar, Modifiers aModifiers); + void Append(char16_t aUniChar, Modifiers aModifiers); void Clear() { mLength = 0; } bool IsEmpty() const { return !mLength; } @@ -157,12 +157,12 @@ private: { struct { - PRUnichar Chars[4]; + char16_t Chars[4]; } Normal; struct { const DeadKeyTable* Table; - PRUnichar DeadChar; + char16_t DeadChar; } DeadKey; }; @@ -192,13 +192,13 @@ public: mShiftStates[aShiftState].DeadKey.Table = aDeadKeyTable; } - void SetNormalChars(ShiftState aShiftState, const PRUnichar* aChars, + void SetNormalChars(ShiftState aShiftState, const char16_t* aChars, uint32_t aNumOfChars); - void SetDeadChar(ShiftState aShiftState, PRUnichar aDeadChar); + void SetDeadChar(ShiftState aShiftState, char16_t aDeadChar); const DeadKeyTable* MatchingDeadKeyTable(const DeadKeyEntry* aDeadKeyArray, uint32_t aEntries) const; - inline PRUnichar GetCompositeChar(ShiftState aShiftState, - PRUnichar aBaseChar) const; + inline char16_t GetCompositeChar(ShiftState aShiftState, + char16_t aBaseChar) const; UniCharsAndModifiers GetNativeUniChars(ShiftState aShiftState) const; UniCharsAndModifiers GetUniChars(ShiftState aShiftState) const; }; @@ -355,7 +355,7 @@ private: /** * Wraps MapVirtualKeyEx() with MAPVK_VSC_TO_VK and MAPVK_VK_TO_CHAR. */ - PRUnichar ComputeUnicharFromScanCode() const; + char16_t ComputeUnicharFromScanCode() const; /** * Initializes the aKeyEvent with the information stored in the instance. @@ -432,7 +432,7 @@ private: static inline int32_t GetKeyIndex(uint8_t aVirtualKey); static int CompareDeadKeyEntries(const void* aArg1, const void* aArg2, void* aData); - static bool AddDeadKeyEntry(PRUnichar aBaseChar, PRUnichar aCompositeChar, + static bool AddDeadKeyEntry(char16_t aBaseChar, char16_t aCompositeChar, DeadKeyEntry* aDeadKeyArray, uint32_t aEntries); bool EnsureDeadKeyActive(bool aIsActive, uint8_t aDeadKey, const PBYTE aDeadKeyKbdState); diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index f646df2026ff..0fd706deefe7 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -78,7 +78,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsClipboard, nsBaseClipboard, nsIObserver) NS_IMETHODIMP nsClipboard::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { // This will be called on shutdown. ::OleFlushClipboard(); @@ -282,7 +282,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe if (aHGBL != nullptr) { LPSTR lpStr = (LPSTR) GlobalLock(aHGBL); DWORD allocSize = GlobalSize(aHGBL); - char* data = static_cast(nsMemory::Alloc(allocSize + sizeof(PRUnichar))); + char* data = static_cast(nsMemory::Alloc(allocSize + sizeof(char16_t))); if ( data ) { memcpy ( data, lpStr, allocSize ); data[allocSize] = data[allocSize + 1] = '\0'; // null terminate for safety @@ -458,7 +458,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT // (on 98, these are not the same) so we can't use that. uint32_t allocLen = 0; if ( NS_SUCCEEDED(GetGlobalData(stm.hGlobal, aData, &allocLen)) ) { - *aLen = NS_strlen(reinterpret_cast(*aData)) * 2; + *aLen = NS_strlen(reinterpret_cast(*aData)) * 2; result = NS_OK; } } break; @@ -498,7 +498,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT if ( buffer ) { ::DragQueryFileW(dropFiles, aIndex, buffer, fileNameLen + 1); *aData = buffer; - *aLen = fileNameLen * sizeof(PRUnichar); + *aLen = fileNameLen * sizeof(char16_t); result = NS_OK; } else @@ -540,8 +540,8 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT "CFSTR_PREFERREDDROPEFFECT should return a DWORD"); *aLen = allocLen; } else { - *aLen = NS_strlen(reinterpret_cast(*aData)) * - sizeof(PRUnichar); + *aLen = NS_strlen(reinterpret_cast(*aData)) * + sizeof(char16_t); } result = NS_OK; } @@ -635,7 +635,7 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject, nsCOMPtr genericDataWrapper; if ( strcmp(flavorStr, kFileMime) == 0 ) { // we have a file path in |data|. Create an nsLocalFile object. - nsDependentString filepath(reinterpret_cast(data)); + nsDependentString filepath(reinterpret_cast(data)); nsCOMPtr file; if ( NS_SUCCEEDED(NS_NewLocalFile(filepath, false, getter_AddRefs(file))) ) genericDataWrapper = do_QueryInterface(file); @@ -759,7 +759,7 @@ nsClipboard :: FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inInde nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, GetFormat(kTextMime), nullptr, outData, outDataLen); if ( NS_SUCCEEDED(loadResult) && *outData ) { const char* castedText = reinterpret_cast(*outData); - PRUnichar* convertedText = nullptr; + char16_t* convertedText = nullptr; int32_t convertedTextLen = 0; nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode ( castedText, *outDataLen, &convertedText, &convertedTextLen ); @@ -767,7 +767,7 @@ nsClipboard :: FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inInde // out with the old, in with the new nsMemory::Free(*outData); *outData = convertedText; - *outDataLen = convertedTextLen * sizeof(PRUnichar); + *outDataLen = convertedTextLen * sizeof(char16_t); dataFound = true; } } // if plain text data on clipboard @@ -793,7 +793,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, GetFormat(kFileMime), nullptr, outData, outDataLen); if ( NS_SUCCEEDED(loadResult) && *outData ) { // we have a file path in |data|. Is it an internet shortcut or a normal file? - const nsDependentString filepath(static_cast(*outData)); + const nsDependentString filepath(static_cast(*outData)); nsCOMPtr file; nsresult rv = NS_NewLocalFile(filepath, true, getter_AddRefs(file)); if (NS_FAILED(rv)) { @@ -817,7 +817,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v if (title.IsEmpty()) title = urlString; *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + title); - *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(PRUnichar); + *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(char16_t); dataFound = true; } @@ -830,7 +830,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v // convert it to unicode and pass it out nsMemory::Free(*outData); *outData = UTF8ToNewUnicode(urlSpec); - *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(PRUnichar); + *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(char16_t); dataFound = true; } // else regular file } @@ -855,12 +855,12 @@ nsClipboard :: FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, v nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, ::RegisterClipboardFormat(CFSTR_INETURLW), nullptr, &tempOutData, &tempDataLen); if ( NS_SUCCEEDED(loadResult) && tempOutData ) { - nsDependentString urlString(static_cast(tempOutData)); + nsDependentString urlString(static_cast(tempOutData)); // the internal mozilla URL format, text/x-moz-url, contains // URL\ntitle. Since we don't actually have a title here, // just repeat the URL to fake it. *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + urlString); - *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(PRUnichar); + *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(char16_t); nsMemory::Free(tempOutData); dataFound = true; } @@ -882,7 +882,7 @@ nsClipboard :: FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, v // URL\ntitle. Since we don't actually have a title here, // just repeat the URL to fake it. *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + urlString); - *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(PRUnichar); + *outDataLen = NS_strlen(static_cast(*outData)) * sizeof(char16_t); nsMemory::Free(tempOutData); dataFound = true; } diff --git a/widget/windows/nsColorPicker.cpp b/widget/windows/nsColorPicker.cpp index 77778b6a40ac..c9343066993d 100644 --- a/widget/windows/nsColorPicker.cpp +++ b/widget/windows/nsColorPicker.cpp @@ -42,7 +42,7 @@ static DWORD ColorStringToRGB(const nsAString& aColor) for (uint32_t i = 1; i < aColor.Length(); ++i) { result *= 16; - PRUnichar c = aColor[i]; + char16_t c = aColor[i]; if (c >= '0' && c <= '9') { result += c - '0'; } else if (c >= 'a' && c <= 'f') { diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index 29919f0237c7..188896c987e6 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -912,7 +912,7 @@ MangleTextToValidFilename(nsString & aText) nameLen = (uint32_t) strlen(forbiddenNames[n]); if (aText.EqualsIgnoreCase(forbiddenNames[n], nameLen)) { // invalid name is either the entire string, or a prefix with a period - if (aText.Length() == nameLen || aText.CharAt(nameLen) == PRUnichar('.')) { + if (aText.Length() == nameLen || aText.CharAt(nameLen) == char16_t('.')) { aText.Truncate(); break; } @@ -984,7 +984,7 @@ CreateFilenameFromTextW(nsString & aText, const wchar_t * aExtension, #define PAGEINFO_PROPERTIES "chrome://navigator/locale/pageInfo.properties" static bool -GetLocalizedString(const PRUnichar * aName, nsXPIDLString & aString) +GetLocalizedString(const char16_t * aName, nsXPIDLString & aString) { nsCOMPtr stringService = mozilla::services::GetStringBundleService(); @@ -1262,14 +1262,14 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME // // The transferable gives us data that is null-terminated, but this isn't reflected in // the |len| parameter. Windoze apps expect this null to be there so bump our data buffer - // by the appropriate size to account for the null (one char for CF_TEXT, one PRUnichar for + // by the appropriate size to account for the null (one char for CF_TEXT, one char16_t for // CF_UNICODETEXT). DWORD allocLen = (DWORD)len; if ( aFE.cfFormat == CF_TEXT ) { // Someone is asking for text/plain; convert the unicode (assuming it's present) // to text with the correct platform encoding. char* plainTextData = nullptr; - PRUnichar* castedUnicode = reinterpret_cast(data); + char16_t* castedUnicode = reinterpret_cast(data); int32_t plainTextLen = 0; nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText ( castedUnicode, len / 2, &plainTextData, &plainTextLen ); @@ -1288,7 +1288,7 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME else if ( aFE.cfFormat == nsClipboard::CF_HTML ) { // Someone is asking for win32's HTML flavor. Convert our html fragment // from unicode to UTF-8 then put it into a format specified by msft. - NS_ConvertUTF16toUTF8 converter ( reinterpret_cast(data) ); + NS_ConvertUTF16toUTF8 converter ( reinterpret_cast(data) ); char* utf8HTML = nullptr; nsresult rv = BuildPlatformHTML ( converter.get(), &utf8HTML ); // null terminates @@ -1306,7 +1306,7 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME else { // we assume that any data that isn't caught above is unicode. This may // be an erroneous assumption, but is true so far. - allocLen += sizeof(PRUnichar); + allocLen += sizeof(char16_t); } hGlobalMemory = (HGLOBAL)GlobalAlloc(GMEM_MOVEABLE, allocLen); @@ -1376,10 +1376,10 @@ HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG) uint32_t allocLen = path.Length() + 2; HGLOBAL hGlobalMemory = nullptr; - PRUnichar *dest; + char16_t *dest; hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + - allocLen * sizeof(PRUnichar)); + allocLen * sizeof(char16_t)); if (!hGlobalMemory) return E_FAIL; @@ -1393,8 +1393,8 @@ HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG) pDropFile->fWide = TRUE; // Copy the filename right after the DROPFILES structure - dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles); - memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); + dest = (char16_t*)(((char*)pDropFile) + pDropFile->pFiles); + memcpy(dest, path.get(), (allocLen - 1) * sizeof(char16_t)); // Two null characters are needed at the end of the file name. // Lookup the CF_HDROP shell clipboard format for more info. @@ -1519,7 +1519,7 @@ HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG) aSTG.tymed = TYMED_HGLOBAL; aSTG.pUnkForRelease = nullptr; - hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar)); + hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(char16_t)); if (!hGlobalMemory) return E_FAIL; @@ -1533,8 +1533,8 @@ HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG) pDropFile->fWide = TRUE; // Copy the filename right after the DROPFILES structure. - PRUnichar* dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles); - memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); // Copies the null character in path as well. + char16_t* dest = (char16_t*)(((char*)pDropFile) + pDropFile->pFiles); + memcpy(dest, path.get(), (allocLen - 1) * sizeof(char16_t)); // Copies the null character in path as well. // Two null characters are needed at the end of the file name. // Lookup the CF_HDROP shell clipboard format for more info. @@ -1620,7 +1620,7 @@ HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG) aSTG.tymed = TYMED_HGLOBAL; aSTG.pUnkForRelease = nullptr; - hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar)); + hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(char16_t)); if (!hGlobalMemory) return E_FAIL; @@ -1634,8 +1634,8 @@ HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG) pDropFile->fWide = TRUE; // Copy the filename right after the DROPFILES structure. - PRUnichar* dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles); - memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); // Copies the null character in path as well. + char16_t* dest = (char16_t*)(((char*)pDropFile) + pDropFile->pFiles); + memcpy(dest, path.get(), (allocLen - 1) * sizeof(char16_t)); // Copies the null character in path as well. // Two null characters are needed at the end of the file name. // Lookup the CF_HDROP shell clipboard format for more info. @@ -1964,7 +1964,7 @@ nsDataObj::ExtractUniformResourceLocatorW(FORMATETC& aFE, STGMEDIUM& aSTG ) if (NS_FAILED(ExtractShortcutURL(url))) return E_OUTOFMEMORY; - const int totalLen = (url.Length() + 1) * sizeof(PRUnichar); + const int totalLen = (url.Length() + 1) * sizeof(char16_t); HGLOBAL hGlobalMemory = GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE, totalLen); if (!hGlobalMemory) return E_OUTOFMEMORY; diff --git a/widget/windows/nsDataObjCollection.cpp b/widget/windows/nsDataObjCollection.cpp index 28a69a37ae11..8cd1ce1d714d 100644 --- a/widget/windows/nsDataObjCollection.cpp +++ b/widget/windows/nsDataObjCollection.cpp @@ -232,9 +232,9 @@ HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM) HGLOBAL hGlobalMemory; HRESULT hr; // Make enough space for the header and the trailing null - uint32_t buffersize = sizeof(DROPFILES) + sizeof(PRUnichar); + uint32_t buffersize = sizeof(DROPFILES) + sizeof(char16_t); uint32_t alloclen = 0; - PRUnichar* realbuffer; + char16_t* realbuffer; nsAutoString filename; hGlobalMemory = GlobalAlloc(GHND, buffersize); @@ -251,19 +251,19 @@ HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM) } } // Now we need to pull out the filename - PRUnichar* buffer = (PRUnichar*)GlobalLock(workingmedium.hGlobal); + char16_t* buffer = (char16_t*)GlobalLock(workingmedium.hGlobal); if (buffer == nullptr) return E_FAIL; - buffer += sizeof(DROPFILES)/sizeof(PRUnichar); + buffer += sizeof(DROPFILES)/sizeof(char16_t); filename = buffer; GlobalUnlock(workingmedium.hGlobal); ReleaseStgMedium(&workingmedium); // Now put the filename into our buffer - alloclen = (filename.Length() + 1) * sizeof(PRUnichar); + alloclen = (filename.Length() + 1) * sizeof(char16_t); hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen, GHND); if (hGlobalMemory == nullptr) return E_FAIL; - realbuffer = (PRUnichar*)((char*)GlobalLock(hGlobalMemory) + buffersize); + realbuffer = (char16_t*)((char*)GlobalLock(hGlobalMemory) + buffersize); if (!realbuffer) return E_FAIL; realbuffer--; // Overwrite the preceding null @@ -341,7 +341,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM) return S_OK; } if (pFE->cfFormat == CF_UNICODETEXT) { - buffersize = sizeof(PRUnichar); + buffersize = sizeof(char16_t); nsAutoString text; for (uint32_t i = 0; i < mDataObjects.Length(); ++i) { nsDataObj* dataObj = mDataObjects.ElementAt(i); @@ -355,19 +355,19 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM) } } // Now we need to pull out the text - PRUnichar* buffer = (PRUnichar*)GlobalLock(workingmedium.hGlobal); + char16_t* buffer = (char16_t*)GlobalLock(workingmedium.hGlobal); if (buffer == nullptr) return E_FAIL; text = buffer; GlobalUnlock(workingmedium.hGlobal); ReleaseStgMedium(&workingmedium); // Now put the text into our buffer - alloclen = text.Length() * sizeof(PRUnichar); + alloclen = text.Length() * sizeof(char16_t); hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen, GHND); if (hGlobalMemory == nullptr) return E_FAIL; - buffer = (PRUnichar*)((char*)GlobalLock(hGlobalMemory) + buffersize); + buffer = (char16_t*)((char*)GlobalLock(hGlobalMemory) + buffersize); if (!buffer) return E_FAIL; buffer--; // Overwrite the preceding null diff --git a/widget/windows/nsDeviceContextSpecWin.cpp b/widget/windows/nsDeviceContextSpecWin.cpp index 746f2a116673..efd8b343c539 100644 --- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -174,7 +174,7 @@ nsDeviceContextSpecWin::~nsDeviceContextSpecWin() //------------------------------------------------------------------ // helper -static PRUnichar * GetDefaultPrinterNameFromGlobalPrinters() +static char16_t * GetDefaultPrinterNameFromGlobalPrinters() { nsAutoString printerName; GlobalPrinters::GetInstance()->GetDefaultPrinterName(printerName); @@ -276,7 +276,7 @@ GetFileNameForPrintSettings(nsIPrintSettings* aPS) rv = filePicker->AppendFilters(nsIFilePicker::filterAll); NS_ENSURE_SUCCESS(rv, rv); - PRUnichar* fileName; + char16_t* fileName; aPS->GetToFileName(&fileName); if (fileName) { @@ -334,7 +334,7 @@ GetFileNameForPrintSettings(nsIPrintSettings* aPS) //---------------------------------------------------------------------------------- static nsresult -CheckForPrintToFile(nsIPrintSettings* aPS, const PRUnichar* aPrinterName, const PRUnichar* aUPrinterName) +CheckForPrintToFile(nsIPrintSettings* aPS, const char16_t* aPrinterName, const char16_t* aUPrinterName) { nsresult rv = NS_OK; @@ -375,8 +375,8 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, if (aPrintSettings) { nsCOMPtr psWin(do_QueryInterface(aPrintSettings)); if (psWin) { - PRUnichar* deviceName; - PRUnichar* driverName; + char16_t* deviceName; + char16_t* driverName; psWin->GetDeviceName(&deviceName); // creates new memory (makes a copy) psWin->GetDriverName(&driverName); // creates new memory (makes a copy) @@ -424,7 +424,7 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, } // Get the Print Name to be used - PRUnichar * printerName = nullptr; + char16_t * printerName = nullptr; if (mPrintSettings) { mPrintSettings->GetPrinterName(&printerName); } @@ -812,7 +812,7 @@ NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorWin, nsIPrinterEnumerator) // Return the Default Printer name /* readonly attribute wstring defaultPrinterName; */ NS_IMETHODIMP -nsPrinterEnumeratorWin::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName) +nsPrinterEnumeratorWin::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) { NS_ENSURE_ARG_POINTER(aDefaultPrinterName); @@ -823,7 +823,7 @@ nsPrinterEnumeratorWin::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName) /* void initPrintSettingsFromPrinter (in wstring aPrinterName, in nsIPrintSettings aPrintSettings); */ NS_IMETHODIMP -nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName, nsIPrintSettings *aPrintSettings) +nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) { NS_ENSURE_ARG_POINTER(aPrinterName); NS_ENSURE_ARG_POINTER(aPrintSettings); @@ -886,7 +886,7 @@ nsPrinterEnumeratorWin::GetPrinterNameList(nsIStringEnumerator **aPrinterNameLis //---------------------------------------------------------------------------------- // Display the AdvancedDocumentProperties for the selected Printer -NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPrinterName, nsIPrintSettings* aPrintSettings) +NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const char16_t *aPrinterName, nsIPrintSettings* aPrintSettings) { // Implementation removed because it is unused return NS_OK; diff --git a/widget/windows/nsDeviceContextSpecWin.h b/widget/windows/nsDeviceContextSpecWin.h index afe9884726c1..9e1f17bea305 100644 --- a/widget/windows/nsDeviceContextSpecWin.h +++ b/widget/windows/nsDeviceContextSpecWin.h @@ -25,7 +25,7 @@ public: NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); NS_IMETHOD BeginDocument(const nsAString& aTitle, - PRUnichar* aPrintToFileName, + char16_t* aPrintToFileName, int32_t aStartPage, int32_t aEndPage) { return NS_OK; } NS_IMETHOD EndDocument() { return NS_OK; } diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index 364b1813c3ee..63446aae6214 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -28,7 +28,7 @@ using mozilla::IsVistaOrLater; using namespace mozilla::widget; -PRUnichar *nsFilePicker::mLastUsedUnicodeDirectory; +char16_t *nsFilePicker::mLastUsedUnicodeDirectory; char nsFilePicker::mLastUsedDirectory[MAX_PATH+1] = { 0 }; static const wchar_t kDialogPtrProp[] = L"DialogPtrProperty"; @@ -222,7 +222,7 @@ BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { if (uMsg == BFFM_INITIALIZED) { - PRUnichar * filePath = (PRUnichar *) lpData; + char16_t * filePath = (char16_t *) lpData; if (filePath) ::SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE /* true because lpData is a path string */, @@ -809,7 +809,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir) nsAutoString dirName(current); // Sometimes dirName contains a trailing slash and sometimes it doesn't: if (current[dirName.Length() - 1] != '\\') - dirName.Append((PRUnichar)'\\'); + dirName.Append((char16_t)'\\'); while (current && *current && *(current + wcslen(current) + 1)) { current = current + wcslen(current) + 1; @@ -1225,7 +1225,7 @@ void nsFilePicker::AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter) { mFilterList.Append(aTitle); - mFilterList.Append(PRUnichar('\0')); + mFilterList.Append(char16_t('\0')); if (aFilter.EqualsLiteral("..apps")) mFilterList.AppendLiteral("*.exe;*.com"); @@ -1238,7 +1238,7 @@ nsFilePicker::AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter) mFilterList.Append(filter); } - mFilterList.Append(PRUnichar('\0')); + mFilterList.Append(char16_t('\0')); } NS_IMETHODIMP diff --git a/widget/windows/nsFilePicker.h b/widget/windows/nsFilePicker.h index ac7212ec3da6..7f0697be75d7 100644 --- a/widget/windows/nsFilePicker.h +++ b/widget/windows/nsFilePicker.h @@ -123,7 +123,7 @@ protected: nsCOMArray mFiles; static char mLastUsedDirectory[]; nsString mUnicodeFile; - static PRUnichar *mLastUsedUnicodeDirectory; + static char16_t *mLastUsedUnicodeDirectory; HWND mDlgWnd; class ComDlgFilterSpec diff --git a/widget/windows/nsIMM32Handler.cpp b/widget/windows/nsIMM32Handler.cpp index fdc50cad6ab8..09a372ea32f6 100644 --- a/widget/windows/nsIMM32Handler.cpp +++ b/widget/windows/nsIMM32Handler.cpp @@ -1236,7 +1236,7 @@ DumpReconvertString(RECONVERTSTRING* aReconv) PR_LOG(gIMM32Log, PR_LOG_ALWAYS, (" result str=\"%s\"\n", NS_ConvertUTF16toUTF8( - nsAutoString((PRUnichar*)((char*)(aReconv) + aReconv->dwStrOffset), + nsAutoString((char16_t*)((char*)(aReconv) + aReconv->dwStrOffset), aReconv->dwStrLen)).get())); } diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 159369ed303a..6ae61f5d9741 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -563,7 +563,7 @@ GetSysFontInfo(HDC aHDC, LookAndFeel::FontID anID, LOGFONTW logFont; NONCLIENTMETRICSW ncm; HGDIOBJ hGDI; - PRUnichar name[LF_FACESIZE]; + char16_t name[LF_FACESIZE]; // Depending on which stock font we want, there are three different // places we might have to look it up. @@ -677,7 +677,7 @@ GetSysFontInfo(HDC aHDC, LookAndFeel::FontID anID, aFontStyle.systemFont = true; name[0] = 0; - memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar)); + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(char16_t)); aFontName = name; return true; @@ -697,7 +697,7 @@ nsLookAndFeel::GetFontImpl(FontID anID, nsString &aFontName, } /* virtual */ -PRUnichar +char16_t nsLookAndFeel::GetPasswordCharacterImpl() { #define UNICODE_BLACK_CIRCLE_CHAR 0x25cf diff --git a/widget/windows/nsLookAndFeel.h b/widget/windows/nsLookAndFeel.h index 899ac93fbf20..9c45b9888ed8 100644 --- a/widget/windows/nsLookAndFeel.h +++ b/widget/windows/nsLookAndFeel.h @@ -32,7 +32,7 @@ public: virtual bool GetFontImpl(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle, float aDevPixPerCSSPixel); - virtual PRUnichar GetPasswordCharacterImpl(); + virtual char16_t GetPasswordCharacterImpl(); }; #endif diff --git a/widget/windows/nsPrintSettingsWin.cpp b/widget/windows/nsPrintSettingsWin.cpp index 40fc4e0b80eb..12e862ca44b9 100644 --- a/widget/windows/nsPrintSettingsWin.cpp +++ b/widget/windows/nsPrintSettingsWin.cpp @@ -46,7 +46,7 @@ nsPrintSettingsWin::~nsPrintSettingsWin() } /* [noscript] attribute charPtr deviceName; */ -NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const PRUnichar * aDeviceName) +NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const char16_t * aDeviceName) { if (mDeviceName) { nsMemory::Free(mDeviceName); @@ -54,15 +54,15 @@ NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const PRUnichar * aDeviceName) mDeviceName = aDeviceName?wcsdup(char16ptr_t(aDeviceName)):nullptr; return NS_OK; } -NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(PRUnichar **aDeviceName) +NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(char16_t **aDeviceName) { NS_ENSURE_ARG_POINTER(aDeviceName); - *aDeviceName = mDeviceName?reinterpret_cast(wcsdup(mDeviceName)):nullptr; + *aDeviceName = mDeviceName?reinterpret_cast(wcsdup(mDeviceName)):nullptr; return NS_OK; } /* [noscript] attribute charPtr driverName; */ -NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const PRUnichar * aDriverName) +NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const char16_t * aDriverName) { if (mDriverName) { nsMemory::Free(mDriverName); @@ -70,10 +70,10 @@ NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const PRUnichar * aDriverName) mDriverName = aDriverName?wcsdup(char16ptr_t(aDriverName)):nullptr; return NS_OK; } -NS_IMETHODIMP nsPrintSettingsWin::GetDriverName(PRUnichar **aDriverName) +NS_IMETHODIMP nsPrintSettingsWin::GetDriverName(char16_t **aDriverName) { NS_ENSURE_ARG_POINTER(aDriverName); - *aDriverName = mDriverName?reinterpret_cast(wcsdup(mDriverName)):nullptr; + *aDriverName = mDriverName?reinterpret_cast(wcsdup(mDriverName)):nullptr; return NS_OK; } diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index f5baf64d2d01..bb8d0f48a58b 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -1794,7 +1794,7 @@ nsTextStore::GetText(LONG acpStart, } if (length) { if (pchPlain && cchPlainReq) { - const PRUnichar* startChar = + const char16_t* startChar = currentContent.Text().BeginReading() + acpStart; memcpy(pchPlain, startChar, length * sizeof(*pchPlain)); pchPlain[length] = 0; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 8b85f49fcf53..f76fa2443b01 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -4233,7 +4233,7 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam) HWND focusWnd = (HWND)lParam; if (IsWindowVisible(focusWnd) && GetClassNameW(focusWnd, szClass, - sizeof(szClass)/sizeof(PRUnichar)) && + sizeof(szClass)/sizeof(char16_t)) && !wcscmp(szClass, L"Edit") && !WinUtils::IsOurProcessWindow(focusWnd)) { break; diff --git a/widget/windows/tests/TestWinDND.cpp b/widget/windows/tests/TestWinDND.cpp index 994d5d2a018c..23590f1cf124 100644 --- a/widget/windows/tests/TestWinDND.cpp +++ b/widget/windows/tests/TestWinDND.cpp @@ -44,7 +44,7 @@ nsresult CheckValidHDROP(STGMEDIUM* pSTG) nsString s; unsigned long offset = 0; while (1) { - s = (PRUnichar*)((char*)pDropFiles + pDropFiles->pFiles + offset); + s = (char16_t*)((char*)pDropFiles + pDropFiles->pFiles + offset); if (s.IsEmpty()) break; nsresult rv; @@ -55,7 +55,7 @@ nsresult CheckValidHDROP(STGMEDIUM* pSTG) fail("File could not be opened"); return NS_ERROR_UNEXPECTED; } - offset += sizeof(PRUnichar) * (s.Length() + 1); + offset += sizeof(char16_t) * (s.Length() + 1); } return NS_OK; } @@ -118,8 +118,8 @@ nsresult CheckValidUNICODE(STGMEDIUM* pSTG) } HGLOBAL hGlobal = pSTG->hGlobal; - PRUnichar* pText; - pText = (PRUnichar*)GlobalLock(hGlobal); + char16_t* pText; + pText = (char16_t*)GlobalLock(hGlobal); if (!pText) { fail("There is no data at the given HGLOBAL"); return NS_ERROR_UNEXPECTED; @@ -143,8 +143,8 @@ nsresult CheckValidUNICODETwo(STGMEDIUM* pSTG) } HGLOBAL hGlobal = pSTG->hGlobal; - PRUnichar* pText; - pText = (PRUnichar*)GlobalLock(hGlobal); + char16_t* pText; + pText = (char16_t*)GlobalLock(hGlobal); if (!pText) { fail("There is no data at the given HGLOBAL"); return NS_ERROR_UNEXPECTED; @@ -187,7 +187,7 @@ nsresult GetTransferableText(nsCOMPtr& pTransferable) pTransferable = do_CreateInstance("@mozilla.org/widget/transferable;1"); pTransferable->Init(nullptr); rv = pTransferable->SetTransferData("text/unicode", genericWrapper, - mozString.Length() * sizeof(PRUnichar)); + mozString.Length() * sizeof(char16_t)); return rv; } @@ -205,7 +205,7 @@ nsresult GetTransferableTextTwo(nsCOMPtr& pTransferable) pTransferable = do_CreateInstance("@mozilla.org/widget/transferable;1"); pTransferable->Init(nullptr); rv = pTransferable->SetTransferData("text/unicode", genericWrapper, - mozString.Length() * sizeof(PRUnichar)); + mozString.Length() * sizeof(char16_t)); return rv; } diff --git a/widget/windows/winrt/MetroAppShell.cpp b/widget/windows/winrt/MetroAppShell.cpp index 15937c9d117e..b0f69869f4b0 100644 --- a/widget/windows/winrt/MetroAppShell.cpp +++ b/widget/windows/winrt/MetroAppShell.cpp @@ -67,7 +67,7 @@ MetroAppShell::Init() WNDCLASSW wc; HINSTANCE module = GetModuleHandle(nullptr); - const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass"; + const char16_t *const kWindowClass = L"nsAppShell:EventWindowClass"; if (!GetClassInfoW(module, kWindowClass, &wc)) { wc.style = 0; wc.lpfnWndProc = EventWindowProc; @@ -434,7 +434,7 @@ PowerSetRequestDyn(HANDLE powerRequest, POWER_REQUEST_TYPE requestType) NS_IMETHODIMP MetroAppShell::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { NS_ENSURE_ARG_POINTER(topic); if (!strcmp(topic, "dl-start")) { diff --git a/widget/windows/winrt/MetroUtils.cpp b/widget/windows/winrt/MetroUtils.cpp index c5e0acb14487..e6731b44c7c2 100644 --- a/widget/windows/winrt/MetroUtils.cpp +++ b/widget/windows/winrt/MetroUtils.cpp @@ -124,7 +124,7 @@ MetroUtils::PhysToLog(const nsIntPoint& aPt) } nsresult -MetroUtils::FireObserver(const char* aMessage, const PRUnichar* aData) +MetroUtils::FireObserver(const char* aMessage, const char16_t* aData) { nsCOMPtr observerService = mozilla::services::GetObserverService(); diff --git a/widget/windows/winrt/MetroUtils.h b/widget/windows/winrt/MetroUtils.h index 5b4a110d4c2a..ec1b650dbd00 100644 --- a/widget/windows/winrt/MetroUtils.h +++ b/widget/windows/winrt/MetroUtils.h @@ -82,7 +82,7 @@ public: // Resolution scale factor static double ScaleFactor(); - static nsresult FireObserver(const char* aMessage, const PRUnichar* aData = nullptr); + static nsresult FireObserver(const char* aMessage, const char16_t* aData = nullptr); static HRESULT CreateUri(HSTRING aUriStr, Microsoft::WRL::ComPtr& aUriOut); static HRESULT CreateUri(HString& aHString, Microsoft::WRL::ComPtr& aUriOut); @@ -92,5 +92,5 @@ public: private: static nsresult GetBrowserDOMWindow(nsCOMPtr &aBWin); - static nsresult GetMostRecentWindow(const PRUnichar* aType, nsIDOMWindow** aWindow); + static nsresult GetMostRecentWindow(const char16_t* aType, nsIDOMWindow** aWindow); }; diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp index 409a54ea63e6..1ac28ce9c133 100644 --- a/widget/windows/winrt/MetroWidget.cpp +++ b/widget/windows/winrt/MetroWidget.cpp @@ -65,7 +65,7 @@ extern PRLogModuleInfo* gWindowsLog; #endif static uint32_t gInstanceCount = 0; -const PRUnichar* kMetroSubclassThisProp = L"MetroSubclassThisProp"; +const char16_t* kMetroSubclassThisProp = L"MetroSubclassThisProp"; HWND MetroWidget::sICoreHwnd = nullptr; namespace mozilla { @@ -1586,7 +1586,7 @@ MetroWidget::HasPendingInputEvent() } NS_IMETHODIMP -MetroWidget::Observe(nsISupports *subject, const char *topic, const PRUnichar *data) +MetroWidget::Observe(nsISupports *subject, const char *topic, const char16_t *data) { NS_ENSURE_ARG_POINTER(topic); if (!strcmp(topic, "apzc-zoom-to-rect")) { diff --git a/widget/windows/winrt/UIAAccessibilityBridge.cpp b/widget/windows/winrt/UIAAccessibilityBridge.cpp index a80d765c8f25..b4562afa7bf5 100644 --- a/widget/windows/winrt/UIAAccessibilityBridge.cpp +++ b/widget/windows/winrt/UIAAccessibilityBridge.cpp @@ -30,7 +30,7 @@ using namespace Microsoft::WRL; NS_IMPL_ISUPPORTS1(AccessibilityBridge, nsIObserver) nsresult -AccessibilityBridge::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +AccessibilityBridge::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { nsCOMPtr ev = do_QueryInterface(aSubject); if (!ev) { diff --git a/widget/windows/winrt/nsMetroFilePicker.cpp b/widget/windows/winrt/nsMetroFilePicker.cpp index 29d3c22e4309..5ba92fd776ea 100644 --- a/widget/windows/winrt/nsMetroFilePicker.cpp +++ b/widget/windows/winrt/nsMetroFilePicker.cpp @@ -396,11 +396,11 @@ nsMetroFilePicker::ParseFiltersIntoVector(ComPtr>& aVector, const nsAString& aFilter, bool aAllowAll) { - const PRUnichar *beg = aFilter.BeginReading(); - const PRUnichar *end = aFilter.EndReading(); - for (const PRUnichar *cur = beg, *fileTypeStart = beg; cur <= end; ++cur) { + const char16_t *beg = aFilter.BeginReading(); + const char16_t *end = aFilter.EndReading(); + for (const char16_t *cur = beg, *fileTypeStart = beg; cur <= end; ++cur) { // Start of a a filetype, example: *.png - if (cur == end || PRUnichar(' ') == *cur) { + if (cur == end || char16_t(' ') == *cur) { int32_t startPos = fileTypeStart - beg; int32_t endPos = cur - fileTypeStart - (cur == end ? 0 : 1); const nsAString& fileType = Substring(aFilter, diff --git a/widget/xpwidgets/GfxInfoBase.cpp b/widget/xpwidgets/GfxInfoBase.cpp index 137d8fdd8e55..aa6a8888931c 100644 --- a/widget/xpwidgets/GfxInfoBase.cpp +++ b/widget/xpwidgets/GfxInfoBase.cpp @@ -48,7 +48,7 @@ public: NS_DECL_ISUPPORTS NS_IMETHOD Observe(nsISupports *subject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { MOZ_ASSERT(strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0); @@ -512,7 +512,7 @@ BlacklistEntriesToDriverInfo(nsIDOMHTMLCollection* aBlacklistEntries, NS_IMETHODIMP GfxInfoBase::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (strcmp(aTopic, "blocklist-data-gfxItems") == 0) { nsCOMPtr gfxItems = do_QueryInterface(aSubject); diff --git a/widget/xpwidgets/nsBaseAppShell.cpp b/widget/xpwidgets/nsBaseAppShell.cpp index c8d37700de29..1193a2a9e501 100644 --- a/widget/xpwidgets/nsBaseAppShell.cpp +++ b/widget/xpwidgets/nsBaseAppShell.cpp @@ -409,7 +409,7 @@ nsBaseAppShell::AfterProcessNextEvent(nsIThreadInternal *thr, NS_IMETHODIMP nsBaseAppShell::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { NS_ASSERTION(!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID), "oops"); Exit(); diff --git a/widget/xpwidgets/nsBaseWidget.cpp b/widget/xpwidgets/nsBaseWidget.cpp index 7a47f0f2ddcb..1f14d2f6dd64 100644 --- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -142,7 +142,7 @@ NS_IMPL_ISUPPORTS1(WidgetShutdownObserver, nsIObserver) NS_IMETHODIMP WidgetShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0 && mWidget) { @@ -1766,7 +1766,7 @@ NS_IMPL_ISUPPORTS1(Debug_PrefObserver, nsIObserver) NS_IMETHODIMP Debug_PrefObserver::Observe(nsISupports* subject, const char* topic, - const PRUnichar* data) + const char16_t* data) { NS_ConvertUTF16toUTF8 prefName(data); diff --git a/widget/xpwidgets/nsClipboardPrivacyHandler.cpp b/widget/xpwidgets/nsClipboardPrivacyHandler.cpp index 0285d50e9d6f..c489d37462dd 100644 --- a/widget/xpwidgets/nsClipboardPrivacyHandler.cpp +++ b/widget/xpwidgets/nsClipboardPrivacyHandler.cpp @@ -70,7 +70,7 @@ nsClipboardPrivacyHandler::PrepareDataForClipboard(nsITransferable * aTransferab } NS_IMETHODIMP -nsClipboardPrivacyHandler::Observe(nsISupports *aSubject, char const *aTopic, PRUnichar const *aData) +nsClipboardPrivacyHandler::Observe(nsISupports *aSubject, char const *aTopic, char16_t const *aData) { nsresult rv; nsCOMPtr clipboard = diff --git a/widget/xpwidgets/nsIdleService.cpp b/widget/xpwidgets/nsIdleService.cpp index d1184baefc39..c925f04dd5ff 100644 --- a/widget/xpwidgets/nsIdleService.cpp +++ b/widget/xpwidgets/nsIdleService.cpp @@ -69,7 +69,7 @@ NS_IMPL_ISUPPORTS2(nsIdleServiceDaily, nsIObserver, nsISupportsWeakReference) NS_IMETHODIMP nsIdleServiceDaily::Observe(nsISupports *, const char *aTopic, - const PRUnichar *) + const char16_t *) { PR_LOG(sLog, PR_LOG_DEBUG, ("nsIdleServiceDaily: Observe '%s' (%d)", diff --git a/widget/xpwidgets/nsPrimitiveHelpers.cpp b/widget/xpwidgets/nsPrimitiveHelpers.cpp index 58c5601c3d6f..f08d414c5752 100644 --- a/widget/xpwidgets/nsPrimitiveHelpers.cpp +++ b/widget/xpwidgets/nsPrimitiveHelpers.cpp @@ -16,7 +16,7 @@ // // For now, this is the assumption that we are making: // - text/plain is always a char* -// - anything else is a PRUnichar* +// - anything else is a char16_t* // @@ -73,11 +73,11 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void* memcpy(buffer, aDataBuff, aDataLen); buffer[aDataLen] = 0; - const PRUnichar* start = reinterpret_cast(buffer.get()); + const char16_t* start = reinterpret_cast(buffer.get()); // recall that length takes length as characters, not bytes primitive->SetData(Substring(start, start + (aDataLen + 1) / 2)); } else { - const PRUnichar* start = reinterpret_cast(aDataBuff); + const char16_t* start = reinterpret_cast(aDataBuff); // recall that length takes length as characters, not bytes primitive->SetData(Substring(start, start + (aDataLen / 2))); } @@ -133,7 +133,7 @@ nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports // but its length parameter, |outPlainTextLen|, does not reflect that. // nsresult -nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( PRUnichar* inUnicode, int32_t inUnicodeLen, +nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, int32_t inUnicodeLen, char** outPlainTextData, int32_t* outPlainTextLen ) { if ( !outPlainTextData || !outPlainTextLen ) @@ -179,7 +179,7 @@ nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( PRUnichar* inUnicode, // nsresult nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, int32_t inTextLen, - PRUnichar** outUnicode, int32_t* outUnicodeLen ) + char16_t** outUnicode, int32_t* outUnicodeLen ) { if ( !outUnicode || !outUnicodeLen ) return NS_ERROR_INVALID_ARG; @@ -215,7 +215,7 @@ nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, in // the conversion. decoder->GetMaxLength(inText, inTextLen, outUnicodeLen); // |outUnicodeLen| is number of chars if ( *outUnicodeLen ) { - *outUnicode = reinterpret_cast(nsMemory::Alloc((*outUnicodeLen + 1) * sizeof(PRUnichar))); + *outUnicode = reinterpret_cast(nsMemory::Alloc((*outUnicodeLen + 1) * sizeof(char16_t))); if ( *outUnicode ) { rv = decoder->Convert(inText, &inTextLen, *outUnicode, outUnicodeLen); (*outUnicode)[*outUnicodeLen] = '\0'; // null terminate. Convert() doesn't do it for us @@ -264,17 +264,17 @@ nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, voi // I'd assume we don't want to do anything for binary data.... } else { - PRUnichar* buffAsUnichar = reinterpret_cast(*ioData); - PRUnichar* oldBuffer = buffAsUnichar; + char16_t* buffAsUnichar = reinterpret_cast(*ioData); + char16_t* oldBuffer = buffAsUnichar; int32_t newLengthInChars; retVal = nsLinebreakConverter::ConvertUnicharLineBreaksInSitu ( &buffAsUnichar, nsLinebreakConverter::eLinebreakAny, nsLinebreakConverter::eLinebreakContent, - *ioLengthInBytes / sizeof(PRUnichar), &newLengthInChars ); + *ioLengthInBytes / sizeof(char16_t), &newLengthInChars ); if ( NS_SUCCEEDED(retVal) ) { if ( buffAsUnichar != oldBuffer ) // check if buffer was reallocated nsMemory::Free ( oldBuffer ); *ioData = buffAsUnichar; - *ioLengthInBytes = newLengthInChars * sizeof(PRUnichar); + *ioLengthInBytes = newLengthInChars * sizeof(char16_t); } } diff --git a/widget/xpwidgets/nsPrimitiveHelpers.h b/widget/xpwidgets/nsPrimitiveHelpers.h index a751f89e3dd1..33c08f2581d2 100644 --- a/widget/xpwidgets/nsPrimitiveHelpers.h +++ b/widget/xpwidgets/nsPrimitiveHelpers.h @@ -33,7 +33,7 @@ public: // the appropriate platform charset encoding. |inUnicodeLen| is the length of the input // string, not the # of bytes in the buffer. |outPlainTextData| is null terminated, // but its length parameter, |outPlainTextLen|, does not reflect that. - static nsresult ConvertUnicodeToPlatformPlainText ( PRUnichar* inUnicode, int32_t inUnicodeLen, + static nsresult ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, int32_t inUnicodeLen, char** outPlainTextData, int32_t* outPlainTextLen ) ; // Given a char buffer (flavor text/plaikn), this converts it to unicode using @@ -41,7 +41,7 @@ public: // but its length parameter, |outUnicodeLen|, does not reflect that. |outUnicodeLen| is // the length of the string in characters, not bytes. static nsresult ConvertPlatformPlainTextToUnicode ( const char* inText, int32_t inTextLen, - PRUnichar** outUnicode, int32_t* outUnicodeLen ) ; + char16_t** outUnicode, int32_t* outUnicodeLen ) ; }; // class nsPrimitiveHelpers diff --git a/widget/xpwidgets/nsPrintOptionsImpl.cpp b/widget/xpwidgets/nsPrintOptionsImpl.cpp index 69c3e97ed470..f32ab234f25c 100644 --- a/widget/xpwidgets/nsPrintOptionsImpl.cpp +++ b/widget/xpwidgets/nsPrintOptionsImpl.cpp @@ -170,11 +170,11 @@ nsPrintOptions::GetPrefName(const char * aPrefName, // This define controls debug output #ifdef DEBUG_rods_X static void WriteDebugStr(const char* aArg1, const char* aArg2, - const PRUnichar* aStr) + const char16_t* aStr) { nsString str(aStr); - PRUnichar s = '&'; - PRUnichar r = '_'; + char16_t s = '&'; + char16_t r = '_'; str.ReplaceChar(s, r); printf("%s %s = %s \n", aArg1, aArg2, ToNewUTF8String(str)); @@ -586,7 +586,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, if (aFlags & nsIPrintSettings::kInitSavePaperSize) { int16_t sizeUnit, sizeType; double width, height; - PRUnichar *name; + char16_t *name; if ( NS_SUCCEEDED(aPS->GetPaperSizeUnit(&sizeUnit)) && @@ -611,7 +611,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } bool b; - PRUnichar* uStr; + char16_t* uStr; int32_t iVal; int16_t iVal16; double dbl; @@ -826,7 +826,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } NS_IMETHODIMP -nsPrintOptions::DisplayJobProperties(const PRUnichar *aPrinter, +nsPrintOptions::DisplayJobProperties(const char16_t *aPrinter, nsIPrintSettings* aPrintSettings, bool *aDisplayed) { @@ -896,7 +896,7 @@ nsPrintOptions::GetNewPrintSettings(nsIPrintSettings * *aNewPrintSettings) } NS_IMETHODIMP -nsPrintOptions::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName) +nsPrintOptions::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) { nsresult rv; nsCOMPtr prtEnum = @@ -933,7 +933,7 @@ nsPrintOptions::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName) } NS_IMETHODIMP -nsPrintOptions::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName, +nsPrintOptions::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) { NS_ENSURE_ARG_POINTER(aPrintSettings); @@ -979,7 +979,7 @@ GetAdjustedPrinterName(nsIPrintSettings* aPS, bool aUsePNP, // Get the Printer Name from the PrintSettings // to use as a prefix for Pref Names - PRUnichar* prtName = nullptr; + char16_t* prtName = nullptr; nsresult rv = aPS->GetPrinterName(&prtName); NS_ENSURE_SUCCESS(rv, rv); @@ -993,7 +993,7 @@ GetAdjustedPrinterName(nsIPrintSettings* aPS, bool aUsePNP, int32_t x; for (x=0; x < (int32_t)strlen(replaceStr); x++) { - PRUnichar uChar = replaceStr[x]; + char16_t uChar = replaceStr[x]; int32_t i = 0; while ((i = aPrinterName.FindChar(uChar, i)) != kNotFound) { @@ -1006,7 +1006,7 @@ GetAdjustedPrinterName(nsIPrintSettings* aPS, bool aUsePNP, NS_IMETHODIMP nsPrintOptions::GetPrinterPrefInt(nsIPrintSettings *aPrintSettings, - const PRUnichar *aPrefName, int32_t *_retval) + const char16_t *aPrefName, int32_t *_retval) { NS_ENSURE_ARG_POINTER(aPrintSettings); NS_ENSURE_ARG_POINTER(aPrefName); diff --git a/widget/xpwidgets/nsPrintSettingsImpl.cpp b/widget/xpwidgets/nsPrintSettingsImpl.cpp index 278fe3b651b6..19c007a4ec0f 100644 --- a/widget/xpwidgets/nsPrintSettingsImpl.cpp +++ b/widget/xpwidgets/nsPrintSettingsImpl.cpp @@ -177,7 +177,7 @@ NS_IMETHODIMP nsPrintSettings::SetOrientation(int32_t aOrientation) } /* attribute wstring colorspace; */ -NS_IMETHODIMP nsPrintSettings::GetColorspace(PRUnichar * *aColorspace) +NS_IMETHODIMP nsPrintSettings::GetColorspace(char16_t * *aColorspace) { NS_ENSURE_ARG_POINTER(aColorspace); if (!mColorspace.IsEmpty()) { @@ -187,7 +187,7 @@ NS_IMETHODIMP nsPrintSettings::GetColorspace(PRUnichar * *aColorspace) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetColorspace(const PRUnichar * aColorspace) +NS_IMETHODIMP nsPrintSettings::SetColorspace(const char16_t * aColorspace) { if (aColorspace) { mColorspace = aColorspace; @@ -198,7 +198,7 @@ NS_IMETHODIMP nsPrintSettings::SetColorspace(const PRUnichar * aColorspace) } /* attribute wstring resolutionname; */ -NS_IMETHODIMP nsPrintSettings::GetResolutionName(PRUnichar * *aResolutionName) +NS_IMETHODIMP nsPrintSettings::GetResolutionName(char16_t * *aResolutionName) { NS_ENSURE_ARG_POINTER(aResolutionName); if (!mResolutionName.IsEmpty()) { @@ -208,7 +208,7 @@ NS_IMETHODIMP nsPrintSettings::GetResolutionName(PRUnichar * *aResolutionName) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetResolutionName(const PRUnichar * aResolutionName) +NS_IMETHODIMP nsPrintSettings::SetResolutionName(const char16_t * aResolutionName) { if (aResolutionName) { mResolutionName = aResolutionName; @@ -258,7 +258,7 @@ NS_IMETHODIMP nsPrintSettings::SetDownloadFonts(bool aDownloadFonts) } /* attribute wstring printer; */ -NS_IMETHODIMP nsPrintSettings::GetPrinterName(PRUnichar * *aPrinter) +NS_IMETHODIMP nsPrintSettings::GetPrinterName(char16_t * *aPrinter) { NS_ENSURE_ARG_POINTER(aPrinter); @@ -268,7 +268,7 @@ NS_IMETHODIMP nsPrintSettings::GetPrinterName(PRUnichar * *aPrinter) return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPrinterName(const PRUnichar * aPrinter) +NS_IMETHODIMP nsPrintSettings::SetPrinterName(const char16_t * aPrinter) { if (!aPrinter || !mPrinter.Equals(aPrinter)) { mIsInitedFromPrinter = false; @@ -293,13 +293,13 @@ NS_IMETHODIMP nsPrintSettings::SetNumCopies(int32_t aNumCopies) } /* attribute wstring printCommand; */ -NS_IMETHODIMP nsPrintSettings::GetPrintCommand(PRUnichar * *aPrintCommand) +NS_IMETHODIMP nsPrintSettings::GetPrintCommand(char16_t * *aPrintCommand) { //NS_ENSURE_ARG_POINTER(aPrintCommand); *aPrintCommand = ToNewUnicode(mPrintCommand); return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPrintCommand(const PRUnichar * aPrintCommand) +NS_IMETHODIMP nsPrintSettings::SetPrintCommand(const char16_t * aPrintCommand) { if (aPrintCommand) { mPrintCommand = aPrintCommand; @@ -323,13 +323,13 @@ NS_IMETHODIMP nsPrintSettings::SetPrintToFile(bool aPrintToFile) } /* attribute wstring toFileName; */ -NS_IMETHODIMP nsPrintSettings::GetToFileName(PRUnichar * *aToFileName) +NS_IMETHODIMP nsPrintSettings::GetToFileName(char16_t * *aToFileName) { //NS_ENSURE_ARG_POINTER(aToFileName); *aToFileName = ToNewUnicode(mToFileName); return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetToFileName(const PRUnichar * aToFileName) +NS_IMETHODIMP nsPrintSettings::SetToFileName(const char16_t * aToFileName) { if (aToFileName) { mToFileName = aToFileName; @@ -621,7 +621,7 @@ NS_IMETHODIMP nsPrintSettings::SetPrintRange(int16_t aPrintRange) } /* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintSettings::GetTitle(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetTitle(char16_t * *aTitle) { NS_ENSURE_ARG_POINTER(aTitle); if (!mTitle.IsEmpty()) { @@ -631,7 +631,7 @@ NS_IMETHODIMP nsPrintSettings::GetTitle(PRUnichar * *aTitle) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetTitle(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetTitle(const char16_t * aTitle) { if (aTitle) { mTitle = aTitle; @@ -642,7 +642,7 @@ NS_IMETHODIMP nsPrintSettings::SetTitle(const PRUnichar * aTitle) } /* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintSettings::GetDocURL(PRUnichar * *aDocURL) +NS_IMETHODIMP nsPrintSettings::GetDocURL(char16_t * *aDocURL) { NS_ENSURE_ARG_POINTER(aDocURL); if (!mURL.IsEmpty()) { @@ -652,7 +652,7 @@ NS_IMETHODIMP nsPrintSettings::GetDocURL(PRUnichar * *aDocURL) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetDocURL(const PRUnichar * aDocURL) +NS_IMETHODIMP nsPrintSettings::SetDocURL(const char16_t * aDocURL) { if (aDocURL) { mURL = aDocURL; @@ -702,7 +702,7 @@ nsPrintSettings::GetPrintOptionsBits(int32_t *aBits) /* attribute wstring docTitle; */ nsresult -nsPrintSettings::GetMarginStrs(PRUnichar * *aTitle, +nsPrintSettings::GetMarginStrs(char16_t * *aTitle, nsHeaderFooterEnum aType, int16_t aJust) { @@ -725,7 +725,7 @@ nsPrintSettings::GetMarginStrs(PRUnichar * *aTitle, } nsresult -nsPrintSettings::SetMarginStrs(const PRUnichar * aTitle, +nsPrintSettings::SetMarginStrs(const char16_t * aTitle, nsHeaderFooterEnum aType, int16_t aJust) { @@ -747,62 +747,62 @@ nsPrintSettings::SetMarginStrs(const PRUnichar * aTitle, } /* attribute wstring Header String Left */ -NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(char16_t * *aTitle) { return GetMarginStrs(aTitle, eHeader, kJustLeft); } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const char16_t * aTitle) { return SetMarginStrs(aTitle, eHeader, kJustLeft); } /* attribute wstring Header String Center */ -NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(char16_t * *aTitle) { return GetMarginStrs(aTitle, eHeader, kJustCenter); } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const char16_t * aTitle) { return SetMarginStrs(aTitle, eHeader, kJustCenter); } /* attribute wstring Header String Right */ -NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(char16_t * *aTitle) { return GetMarginStrs(aTitle, eHeader, kJustRight); } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const char16_t * aTitle) { return SetMarginStrs(aTitle, eHeader, kJustRight); } /* attribute wstring Footer String Left */ -NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(char16_t * *aTitle) { return GetMarginStrs(aTitle, eFooter, kJustLeft); } -NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const char16_t * aTitle) { return SetMarginStrs(aTitle, eFooter, kJustLeft); } /* attribute wstring Footer String Center */ -NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(char16_t * *aTitle) { return GetMarginStrs(aTitle, eFooter, kJustCenter); } -NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const char16_t * aTitle) { return SetMarginStrs(aTitle, eFooter, kJustCenter); } /* attribute wstring Footer String Right */ -NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(PRUnichar * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(char16_t * *aTitle) { return GetMarginStrs(aTitle, eFooter, kJustRight); } -NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const PRUnichar * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const char16_t * aTitle) { return SetMarginStrs(aTitle, eFooter, kJustRight); } @@ -873,7 +873,7 @@ NS_IMETHODIMP nsPrintSettings::SetShowPrintProgress(bool aShowPrintProgress) } /* attribute wstring paperName; */ -NS_IMETHODIMP nsPrintSettings::GetPaperName(PRUnichar * *aPaperName) +NS_IMETHODIMP nsPrintSettings::GetPaperName(char16_t * *aPaperName) { NS_ENSURE_ARG_POINTER(aPaperName); if (!mPaperName.IsEmpty()) { @@ -883,7 +883,7 @@ NS_IMETHODIMP nsPrintSettings::GetPaperName(PRUnichar * *aPaperName) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPaperName(const PRUnichar * aPaperName) +NS_IMETHODIMP nsPrintSettings::SetPaperName(const char16_t * aPaperName) { if (aPaperName) { mPaperName = aPaperName; @@ -894,7 +894,7 @@ NS_IMETHODIMP nsPrintSettings::SetPaperName(const PRUnichar * aPaperName) } /* attribute wstring plexName; */ -NS_IMETHODIMP nsPrintSettings::GetPlexName(PRUnichar * *aPlexName) +NS_IMETHODIMP nsPrintSettings::GetPlexName(char16_t * *aPlexName) { NS_ENSURE_ARG_POINTER(aPlexName); if (!mPlexName.IsEmpty()) { @@ -904,7 +904,7 @@ NS_IMETHODIMP nsPrintSettings::GetPlexName(PRUnichar * *aPlexName) } return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPlexName(const PRUnichar * aPlexName) +NS_IMETHODIMP nsPrintSettings::SetPlexName(const char16_t * aPlexName) { if (aPlexName) { mPlexName = aPlexName; diff --git a/widget/xpwidgets/nsPrintSettingsImpl.h b/widget/xpwidgets/nsPrintSettingsImpl.h index 6d9613813d30..3966fd738c92 100644 --- a/widget/xpwidgets/nsPrintSettingsImpl.h +++ b/widget/xpwidgets/nsPrintSettingsImpl.h @@ -42,8 +42,8 @@ protected: } nsHeaderFooterEnum; - nsresult GetMarginStrs(PRUnichar * *aTitle, nsHeaderFooterEnum aType, int16_t aJust); - nsresult SetMarginStrs(const PRUnichar * aTitle, nsHeaderFooterEnum aType, int16_t aJust); + nsresult GetMarginStrs(char16_t * *aTitle, nsHeaderFooterEnum aType, int16_t aJust); + nsresult SetMarginStrs(const char16_t * aTitle, nsHeaderFooterEnum aType, int16_t aJust); // Members nsWeakPtr mSession; // Should never be touched by Clone or Assign diff --git a/widget/xpwidgets/nsXPLookAndFeel.cpp b/widget/xpwidgets/nsXPLookAndFeel.cpp index 826c7e9d7bef..c16133c5b7c3 100644 --- a/widget/xpwidgets/nsXPLookAndFeel.cpp +++ b/widget/xpwidgets/nsXPLookAndFeel.cpp @@ -320,7 +320,7 @@ nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName) } if (!colorStr.IsEmpty()) { nscolor thecolor; - if (colorStr[0] == PRUnichar('#')) { + if (colorStr[0] == char16_t('#')) { if (NS_HexToRGB(nsDependentString(colorStr, 1), &thecolor)) { int32_t id = NS_PTR_TO_INT32(index); CACHE_COLOR(id, thecolor); @@ -372,7 +372,7 @@ nsXPLookAndFeel::InitColorFromPref(int32_t i) return; } nscolor thecolor; - if (colorStr[0] == PRUnichar('#')) { + if (colorStr[0] == char16_t('#')) { nsAutoString hexString; colorStr.Right(hexString, colorStr.Length() - 1); if (NS_HexToRGB(hexString, &thecolor)) { @@ -733,7 +733,7 @@ LookAndFeel::GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle, } // static -PRUnichar +char16_t LookAndFeel::GetPasswordCharacter() { return nsLookAndFeel::GetInstance()->GetPasswordCharacterImpl(); diff --git a/widget/xpwidgets/nsXPLookAndFeel.h b/widget/xpwidgets/nsXPLookAndFeel.h index 949aaac94180..a0ee2f59af1d 100644 --- a/widget/xpwidgets/nsXPLookAndFeel.h +++ b/widget/xpwidgets/nsXPLookAndFeel.h @@ -64,9 +64,9 @@ public: virtual void RefreshImpl(); - virtual PRUnichar GetPasswordCharacterImpl() + virtual char16_t GetPasswordCharacterImpl() { - return PRUnichar('*'); + return char16_t('*'); } virtual bool GetEchoPasswordImpl() diff --git a/xpcom/base/AvailableMemoryTracker.cpp b/xpcom/base/AvailableMemoryTracker.cpp index 5292835beddd..93d9b298adfa 100644 --- a/xpcom/base/AvailableMemoryTracker.cpp +++ b/xpcom/base/AvailableMemoryTracker.cpp @@ -459,7 +459,7 @@ nsMemoryPressureWatcher::Init() */ NS_IMETHODIMP nsMemoryPressureWatcher::Observe(nsISupports *subject, const char *topic, - const PRUnichar *data) + const char16_t *data) { MOZ_ASSERT(!strcmp(topic, "memory-pressure"), "Unknown topic"); diff --git a/xpcom/base/nsConsoleMessage.cpp b/xpcom/base/nsConsoleMessage.cpp index daebab35aa86..864b9fee5455 100644 --- a/xpcom/base/nsConsoleMessage.cpp +++ b/xpcom/base/nsConsoleMessage.cpp @@ -18,14 +18,14 @@ nsConsoleMessage::nsConsoleMessage() { } -nsConsoleMessage::nsConsoleMessage(const PRUnichar *message) +nsConsoleMessage::nsConsoleMessage(const char16_t *message) { mTimeStamp = JS_Now() / 1000; mMessage.Assign(message); } NS_IMETHODIMP -nsConsoleMessage::GetMessageMoz(PRUnichar **result) +nsConsoleMessage::GetMessageMoz(char16_t **result) { *result = ToNewUnicode(mMessage); diff --git a/xpcom/base/nsConsoleMessage.h b/xpcom/base/nsConsoleMessage.h index 706f7fd7b5d0..9f92771489a2 100644 --- a/xpcom/base/nsConsoleMessage.h +++ b/xpcom/base/nsConsoleMessage.h @@ -14,7 +14,7 @@ class nsConsoleMessage MOZ_FINAL : public nsIConsoleMessage { public: nsConsoleMessage(); - nsConsoleMessage(const PRUnichar *message); + nsConsoleMessage(const char16_t *message); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICONSOLEMESSAGE diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index f501e02183dc..d3394f86df3e 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -248,7 +248,7 @@ nsConsoleService::EnumerateListeners(ListenerHash::EnumReadFunction aFunction, } NS_IMETHODIMP -nsConsoleService::LogStringMessage(const PRUnichar *message) +nsConsoleService::LogStringMessage(const char16_t *message) { if (!sLoggingEnabled) { return NS_OK; diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 8ad80a626563..27668a34a302 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -99,7 +99,7 @@ nsMemoryImpl::Create(nsISupports* outer, const nsIID& aIID, void **aResult) } nsresult -nsMemoryImpl::FlushMemory(const PRUnichar* aReason, bool aImmediate) +nsMemoryImpl::FlushMemory(const char16_t* aReason, bool aImmediate) { nsresult rv = NS_OK; @@ -137,7 +137,7 @@ nsMemoryImpl::FlushMemory(const PRUnichar* aReason, bool aImmediate) } nsresult -nsMemoryImpl::RunFlushers(const PRUnichar* aReason) +nsMemoryImpl::RunFlushers(const char16_t* aReason) { nsCOMPtr os = mozilla::services::GetObserverService(); if (os) { diff --git a/xpcom/base/nsMemoryImpl.h b/xpcom/base/nsMemoryImpl.h index 36b1b48f3f8b..2d04c1bdc8b6 100644 --- a/xpcom/base/nsMemoryImpl.h +++ b/xpcom/base/nsMemoryImpl.h @@ -28,14 +28,14 @@ public: static nsresult Create(nsISupports* outer, const nsIID& aIID, void **aResult); - NS_HIDDEN_(nsresult) FlushMemory(const PRUnichar* aReason, bool aImmediate); - NS_HIDDEN_(nsresult) RunFlushers(const PRUnichar* aReason); + NS_HIDDEN_(nsresult) FlushMemory(const char16_t* aReason, bool aImmediate); + NS_HIDDEN_(nsresult) RunFlushers(const char16_t* aReason); protected: struct FlushEvent : public nsIRunnable { NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIRUNNABLE - const PRUnichar* mReason; + const char16_t* mReason; }; static mozilla::Atomic sIsFlushing; diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 1313d5cd06ba..a96bc759fae5 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -249,7 +249,7 @@ public: } NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown")); diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index b522bdeb7c29..438667d79d45 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1048,10 +1048,10 @@ nsMemoryReporterManager::GetReports( do_GetService("@mozilla.org/observer-service;1"); NS_ENSURE_STATE(obs); - // Casting the uint32_t generation to |const PRUnichar*| is a hack, but + // Casting the uint32_t generation to |const char16_t*| is a hack, but // simpler than converting the number to an actual string. obs->NotifyObservers(nullptr, "child-memory-reporter-request", - (const PRUnichar*)(uintptr_t)generation); + (const char16_t*)(uintptr_t)generation); nsCOMPtr timer = do_CreateInstance(NS_TIMER_CONTRACTID); NS_ENSURE_TRUE(timer, NS_ERROR_FAILURE); diff --git a/xpcom/base/nsrootidl.idl b/xpcom/base/nsrootidl.idl index f660769e1124..55795b7bc677 100644 --- a/xpcom/base/nsrootidl.idl +++ b/xpcom/base/nsrootidl.idl @@ -27,7 +27,7 @@ class nsACString; typedef boolean bool ; typedef octet uint8_t ; typedef unsigned short uint16_t ; -typedef unsigned short PRUnichar; +typedef unsigned short char16_t; typedef unsigned long uint32_t ; typedef unsigned long long uint64_t ; typedef long long PRTime ; @@ -44,7 +44,7 @@ typedef unsigned long size_t; [ptr] native voidPtr(void); [ptr] native charPtr(char); -[ptr] native unicharPtr(PRUnichar); +[ptr] native unicharPtr(char16_t); [ref, nsid] native nsIDRef(nsID); [ref, nsid] native nsIIDRef(nsIID); diff --git a/xpcom/build/nsXPCOMPrivate.h b/xpcom/build/nsXPCOMPrivate.h index c29678a382d9..8046aa7bb492 100644 --- a/xpcom/build/nsXPCOMPrivate.h +++ b/xpcom/build/nsXPCOMPrivate.h @@ -43,13 +43,13 @@ typedef nsresult (* GetDebugFunc)(nsIDebug* *result); typedef nsresult (* GetTraceRefcntFunc)(nsITraceRefcnt* *result); typedef nsresult (* StringContainerInitFunc)(nsStringContainer&); -typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const PRUnichar *, uint32_t, uint32_t); +typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const char16_t *, uint32_t, uint32_t); typedef void (* StringContainerFinishFunc)(nsStringContainer&); -typedef uint32_t (* StringGetDataFunc)(const nsAString&, const PRUnichar**, bool*); -typedef uint32_t (* StringGetMutableDataFunc)(nsAString&, uint32_t, PRUnichar**); -typedef PRUnichar* (* StringCloneDataFunc)(const nsAString&); -typedef nsresult (* StringSetDataFunc)(nsAString&, const PRUnichar*, uint32_t); -typedef nsresult (* StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t, const PRUnichar*, uint32_t); +typedef uint32_t (* StringGetDataFunc)(const nsAString&, const char16_t**, bool*); +typedef uint32_t (* StringGetMutableDataFunc)(nsAString&, uint32_t, char16_t**); +typedef char16_t* (* StringCloneDataFunc)(const nsAString&); +typedef nsresult (* StringSetDataFunc)(nsAString&, const char16_t*, uint32_t); +typedef nsresult (* StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t, const char16_t*, uint32_t); typedef nsresult (* StringCopyFunc)(nsAString &, const nsAString &); typedef void (* StringSetIsVoidFunc)(nsAString &, const bool); typedef bool (* StringGetIsVoidFunc)(const nsAString &); diff --git a/xpcom/build/nsXPCOMStrings.cpp b/xpcom/build/nsXPCOMStrings.cpp index 02796a835b1e..87b0f902720d 100644 --- a/xpcom/build/nsXPCOMStrings.cpp +++ b/xpcom/build/nsXPCOMStrings.cpp @@ -25,7 +25,7 @@ NS_StringContainerInit(nsStringContainer &aContainer) XPCOM_API(nsresult) NS_StringContainerInit2(nsStringContainer &aContainer, - const PRUnichar *aData, + const char16_t *aData, uint32_t aDataLength, uint32_t aFlags) { @@ -42,7 +42,7 @@ NS_StringContainerInit2(nsStringContainer &aContainer, { if (NS_WARN_IF(aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING)) return NS_ERROR_INVALID_ARG; - aDataLength = nsCharTraits::length(aData); + aDataLength = nsCharTraits::length(aData); } if (aFlags & (NS_STRING_CONTAINER_INIT_DEPEND | @@ -57,7 +57,7 @@ NS_StringContainerInit2(nsStringContainer &aContainer, if (aFlags & NS_STRING_CONTAINER_INIT_ADOPT) flags |= nsSubstring::F_OWNED; - new (&aContainer) nsSubstring(const_cast(aData), + new (&aContainer) nsSubstring(const_cast(aData), aDataLength, flags); } else @@ -79,7 +79,7 @@ NS_StringContainerFinish(nsStringContainer &aContainer) /* ------------------------------------------------------------------------- */ XPCOM_API(uint32_t) -NS_StringGetData(const nsAString &aStr, const PRUnichar **aData, +NS_StringGetData(const nsAString &aStr, const char16_t **aData, bool *aTerminated) { if (aTerminated) @@ -93,7 +93,7 @@ NS_StringGetData(const nsAString &aStr, const PRUnichar **aData, XPCOM_API(uint32_t) NS_StringGetMutableData(nsAString &aStr, uint32_t aDataLength, - PRUnichar **aData) + char16_t **aData) { if (aDataLength != UINT32_MAX) { aStr.SetLength(aDataLength); @@ -109,14 +109,14 @@ NS_StringGetMutableData(nsAString &aStr, uint32_t aDataLength, return begin.size_forward(); } -XPCOM_API(PRUnichar *) +XPCOM_API(char16_t *) NS_StringCloneData(const nsAString &aStr) { return ToNewUnicode(aStr); } XPCOM_API(nsresult) -NS_StringSetData(nsAString &aStr, const PRUnichar *aData, uint32_t aDataLength) +NS_StringSetData(nsAString &aStr, const char16_t *aData, uint32_t aDataLength) { aStr.Assign(aData, aDataLength); return NS_OK; // XXX report errors @@ -125,7 +125,7 @@ NS_StringSetData(nsAString &aStr, const PRUnichar *aData, uint32_t aDataLength) XPCOM_API(nsresult) NS_StringSetDataRange(nsAString &aStr, uint32_t aCutOffset, uint32_t aCutLength, - const PRUnichar *aData, uint32_t aDataLength) + const char16_t *aData, uint32_t aDataLength) { if (aCutOffset == UINT32_MAX) { diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 1e05809f4496..bbb7e3146499 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -443,7 +443,7 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn if (NS_SUCCEEDED(rv) && osTarget.Length()) { ToLowerCase(s); CopyUTF8toUTF16(s, abi); - abi.Insert(PRUnichar('_'), 0); + abi.Insert(char16_t('_'), 0); abi.Insert(osTarget, 0); } } diff --git a/xpcom/ds/CharTokenizer.h b/xpcom/ds/CharTokenizer.h index 37967df7c72e..a7d1466253df 100644 --- a/xpcom/ds/CharTokenizer.h +++ b/xpcom/ds/CharTokenizer.h @@ -10,7 +10,7 @@ namespace mozilla { -template +template class CharTokenizer { public: diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index 6ada3722dd6a..3da66602f967 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -76,7 +76,7 @@ protected: AtomImpl() { // We can't really assert that mString is a valid nsStringBuffer string, // so do the best we can do and check for some consistencies. - NS_ASSERTION((mLength + 1) * sizeof(PRUnichar) <= + NS_ASSERTION((mLength + 1) * sizeof(char16_t) <= nsStringBuffer::FromData(mString)->StorageSize() && mString[mLength] == 0, "Not initialized atom"); @@ -145,7 +145,7 @@ struct AtomTableEntry : public PLDHashEntryHdr { struct AtomTableKey { - AtomTableKey(const PRUnichar* aUTF16String, uint32_t aLength, + AtomTableKey(const char16_t* aUTF16String, uint32_t aLength, /*inout*/ uint32_t& aHash) : mUTF16String(aUTF16String), mUTF8String(nullptr), @@ -176,7 +176,7 @@ struct AtomTableKey } } - const PRUnichar* mUTF16String; + const char16_t* mUTF16String; const char* mUTF8String; uint32_t mLength; uint32_t mHash; @@ -224,7 +224,7 @@ AtomTableMatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry, } return memcmp(he->mAtom->GetUTF16String(), - k->mUTF16String, length * sizeof(PRUnichar)) == 0; + k->mUTF16String, length * sizeof(char16_t)) == 0; } static void @@ -327,19 +327,19 @@ AtomImpl::AtomImpl(const nsAString& aString, uint32_t aHash) mLength = aString.Length(); nsRefPtr buf = nsStringBuffer::FromString(aString); if (buf) { - mString = static_cast(buf->Data()); + mString = static_cast(buf->Data()); } else { - buf = nsStringBuffer::Alloc((mLength + 1) * sizeof(PRUnichar)); - mString = static_cast(buf->Data()); + buf = nsStringBuffer::Alloc((mLength + 1) * sizeof(char16_t)); + mString = static_cast(buf->Data()); CopyUnicodeTo(aString, 0, mString, mLength); - mString[mLength] = PRUnichar(0); + mString[mLength] = char16_t(0); } mHash = aHash; MOZ_ASSERT(mHash == HashString(mString, mLength)); - NS_ASSERTION(mString[mLength] == PRUnichar(0), "null terminated"); - NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(PRUnichar), + NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated"); + NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(char16_t), "enough storage"); NS_ASSERTION(Equals(aString), "correct data"); @@ -351,7 +351,7 @@ AtomImpl::AtomImpl(nsStringBuffer* aStringBuffer, uint32_t aLength, uint32_t aHash) { mLength = aLength; - mString = static_cast(aStringBuffer->Data()); + mString = static_cast(aStringBuffer->Data()); // Technically we could currently avoid doing this addref by instead making // the static atom buffers have an initial refcount of 2. aStringBuffer->AddRef(); @@ -359,9 +359,9 @@ AtomImpl::AtomImpl(nsStringBuffer* aStringBuffer, uint32_t aLength, mHash = aHash; MOZ_ASSERT(mHash == HashString(mString, mLength)); - NS_ASSERTION(mString[mLength] == PRUnichar(0), "null terminated"); + NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated"); NS_ASSERTION(aStringBuffer && - aStringBuffer->StorageSize() == (mLength+1) * sizeof(PRUnichar), + aStringBuffer->StorageSize() == (mLength+1) * sizeof(char16_t), "correct storage"); } @@ -530,7 +530,7 @@ GetAtomHashEntry(const char* aString, uint32_t aLength, uint32_t& aHash) } static inline AtomTableEntry* -GetAtomHashEntry(const PRUnichar* aString, uint32_t aLength, uint32_t& aHash) +GetAtomHashEntry(const char16_t* aString, uint32_t aLength, uint32_t& aHash) { MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); EnsureTableExists(); @@ -574,15 +574,15 @@ RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount) } for (uint32_t i=0; iData()), + NS_ASSERTION(nsCRT::IsAscii((char16_t*)aAtoms[i].mStringBuffer->Data()), "Static atoms must be ASCII!"); uint32_t stringLen = - aAtoms[i].mStringBuffer->StorageSize() / sizeof(PRUnichar) - 1; + aAtoms[i].mStringBuffer->StorageSize() / sizeof(char16_t) - 1; uint32_t hash = 0; AtomTableEntry *he = - GetAtomHashEntry((PRUnichar*)aAtoms[i].mStringBuffer->Data(), + GetAtomHashEntry((char16_t*)aAtoms[i].mStringBuffer->Data(), stringLen, hash); if (he->mAtom) { @@ -645,7 +645,7 @@ NS_NewAtom(const nsACString& aUTF8String) } already_AddRefed -NS_NewAtom(const PRUnichar* aUTF16String) +NS_NewAtom(const char16_t* aUTF16String) { return NS_NewAtom(nsDependentString(aUTF16String)); } diff --git a/xpcom/ds/nsCRT.cpp b/xpcom/ds/nsCRT.cpp index 6d63f8697571..80b60e6c46de 100644 --- a/xpcom/ds/nsCRT.cpp +++ b/xpcom/ds/nsCRT.cpp @@ -79,11 +79,11 @@ char* nsCRT::strtok(char* string, const char* delims, char* *newStr) * @param s1 and s2 both point to unichar strings * @return 0 if they match, -1 if s1s2 */ -int32_t nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) { +int32_t nsCRT::strcmp(const char16_t* s1, const char16_t* s2) { if(s1 && s2) { for (;;) { - PRUnichar c1 = *s1++; - PRUnichar c2 = *s2++; + char16_t c1 = *s1++; + char16_t c2 = *s2++; if (c1 != c2) { if (c1 < c2) return -1; return 1; @@ -109,12 +109,12 @@ int32_t nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) { * @param s1 and s2 both point to unichar strings * @return 0 if they match, -1 if s1s2 */ -int32_t nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, uint32_t n) { +int32_t nsCRT::strncmp(const char16_t* s1, const char16_t* s2, uint32_t n) { if(s1 && s2) { if(n != 0) { do { - PRUnichar c1 = *s1++; - PRUnichar c2 = *s2++; + char16_t c1 = *s1++; + char16_t c2 = *s2++; if (c1 != c2) { if (c1 < c2) return -1; return 1; diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index 02b3fb9fee29..22e2c646d42a 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -21,7 +21,7 @@ # endif /* XP_UNIX */ #endif /* XP_WIN || XP_OS2 */ -extern const PRUnichar kIsoLatin1ToUCS2[256]; +extern const char16_t kIsoLatin1ToUCS2[256]; // This macro can be used in a class declaration for classes that want // to ensure that their instance memory is zeroed. @@ -122,9 +122,9 @@ public: static char* strtok(char* str, const char* delims, char* *newStr); /// Like strcmp except for ucs2 strings - static int32_t strcmp(const PRUnichar* s1, const PRUnichar* s2); + static int32_t strcmp(const char16_t* s1, const char16_t* s2); /// Like strcmp except for ucs2 strings - static int32_t strncmp(const PRUnichar* s1, const PRUnichar* s2, + static int32_t strncmp(const char16_t* s1, const char16_t* s2, uint32_t aMaxLen); // The GNU libc has memmem, which is strstr except for binary data @@ -142,18 +142,18 @@ public: static bool IsUpper(char aChar) { return NS_IsUpper(aChar); } static bool IsLower(char aChar) { return NS_IsLower(aChar); } - static bool IsAscii(PRUnichar aChar) { return NS_IsAscii(aChar); } - static bool IsAscii(const PRUnichar* aString) { return NS_IsAscii(aString); } - static bool IsAsciiAlpha(PRUnichar aChar) { return NS_IsAsciiAlpha(aChar); } - static bool IsAsciiDigit(PRUnichar aChar) { return NS_IsAsciiDigit(aChar); } - static bool IsAsciiSpace(PRUnichar aChar) { return NS_IsAsciiWhitespace(aChar); } + static bool IsAscii(char16_t aChar) { return NS_IsAscii(aChar); } + static bool IsAscii(const char16_t* aString) { return NS_IsAscii(aString); } + static bool IsAsciiAlpha(char16_t aChar) { return NS_IsAsciiAlpha(aChar); } + static bool IsAsciiDigit(char16_t aChar) { return NS_IsAsciiDigit(aChar); } + static bool IsAsciiSpace(char16_t aChar) { return NS_IsAsciiWhitespace(aChar); } static bool IsAscii(const char* aString) { return NS_IsAscii(aString); } static bool IsAscii(const char* aString, uint32_t aLength) { return NS_IsAscii(aString, aLength); } }; inline bool -NS_IS_SPACE(PRUnichar c) +NS_IS_SPACE(char16_t c) { return ((int(c) & 0x7f) == int(c)) && isspace(int(c)); } diff --git a/xpcom/ds/nsCharSeparatedTokenizer.h b/xpcom/ds/nsCharSeparatedTokenizer.h index e6915ae6d933..21bb1d4ba6d3 100644 --- a/xpcom/ds/nsCharSeparatedTokenizer.h +++ b/xpcom/ds/nsCharSeparatedTokenizer.h @@ -29,7 +29,7 @@ * The function used for whitespace detection is a template argument. * By default, it is NS_IsAsciiWhitespace. */ -template +template class nsCharSeparatedTokenizerTemplate { public: @@ -40,7 +40,7 @@ public: }; nsCharSeparatedTokenizerTemplate(const nsSubstring& aSource, - PRUnichar aSeparatorChar, + char16_t aSeparatorChar, uint32_t aFlags = 0) : mIter(aSource.Data(), aSource.Length()), mEnd(aSource.Data() + aSource.Length(), aSource.Data(), @@ -100,7 +100,7 @@ public: */ const nsDependentSubstring nextToken() { - mozilla::RangedPtr tokenStart = mIter, tokenEnd = mIter; + mozilla::RangedPtr tokenStart = mIter, tokenEnd = mIter; MOZ_ASSERT(mIter == mEnd || !IsWhitespace(*mIter), "Should be at beginning of token if there is one"); @@ -150,9 +150,9 @@ public: } private: - mozilla::RangedPtr mIter; - const mozilla::RangedPtr mEnd; - PRUnichar mSeparatorChar; + mozilla::RangedPtr mIter; + const mozilla::RangedPtr mEnd; + char16_t mSeparatorChar; bool mWhitespaceBeforeFirstToken; bool mWhitespaceAfterCurrentToken; bool mSeparatorAfterCurrentToken; @@ -163,14 +163,14 @@ class nsCharSeparatedTokenizer: public nsCharSeparatedTokenizerTemplate<> { public: nsCharSeparatedTokenizer(const nsSubstring& aSource, - PRUnichar aSeparatorChar, + char16_t aSeparatorChar, uint32_t aFlags = 0) : nsCharSeparatedTokenizerTemplate<>(aSource, aSeparatorChar, aFlags) { } }; -template +template class nsCCharSeparatedTokenizerTemplate { public: diff --git a/xpcom/ds/nsExpirationTracker.h b/xpcom/ds/nsExpirationTracker.h index 70fb495a17d0..cec0ec32d04b 100644 --- a/xpcom/ds/nsExpirationTracker.h +++ b/xpcom/ds/nsExpirationTracker.h @@ -333,7 +333,7 @@ template NS_IMETHODIMP nsExpirationTracker::ExpirationTrackerObserver::Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, "memory-pressure") && mOwner) mOwner->AgeAllGenerations(); diff --git a/xpcom/ds/nsHashtable.cpp b/xpcom/ds/nsHashtable.cpp index 5e6157919d5c..f0f2a4ba8914 100644 --- a/xpcom/ds/nsHashtable.cpp +++ b/xpcom/ds/nsHashtable.cpp @@ -566,8 +566,8 @@ nsStringKey::nsStringKey(const nsStringKey& aKey) : mStr(aKey.mStr), mStrLen(aKey.mStrLen), mOwnership(aKey.mOwnership) { if (mOwnership != NEVER_OWN) { - uint32_t len = mStrLen * sizeof(PRUnichar); - PRUnichar* str = reinterpret_cast(nsMemory::Alloc(len + sizeof(PRUnichar))); + uint32_t len = mStrLen * sizeof(char16_t); + char16_t* str = reinterpret_cast(nsMemory::Alloc(len + sizeof(char16_t))); if (!str) { // Pray we don't dangle! mOwnership = NEVER_OWN; @@ -586,7 +586,7 @@ nsStringKey::nsStringKey(const nsStringKey& aKey) } nsStringKey::nsStringKey(const nsAFlatString& str) - : mStr((PRUnichar*)str.get()), + : mStr((char16_t*)str.get()), mStrLen(str.Length()), mOwnership(OWN_CLONE) { @@ -609,8 +609,8 @@ nsStringKey::nsStringKey(const nsAString& str) MOZ_COUNT_CTOR(nsStringKey); } -nsStringKey::nsStringKey(const PRUnichar* str, int32_t strLen, Ownership own) - : mStr((PRUnichar*)str), mStrLen(strLen), mOwnership(own) +nsStringKey::nsStringKey(const char16_t* str, int32_t strLen, Ownership own) + : mStr((char16_t*)str), mStrLen(strLen), mOwnership(own) { NS_ASSERTION(mStr, "null string key"); if (mStrLen == uint32_t(-1)) @@ -643,7 +643,7 @@ nsStringKey::Equals(const nsHashKey* aKey) const NS_ASSERTION(other->mStrLen != uint32_t(-1), "never called HashCode"); if (mStrLen != other->mStrLen) return false; - return memcmp(mStr, other->mStr, mStrLen * sizeof(PRUnichar)) == 0; + return memcmp(mStr, other->mStr, mStrLen * sizeof(char16_t)) == 0; } nsHashKey* @@ -652,8 +652,8 @@ nsStringKey::Clone() const if (mOwnership == NEVER_OWN) return new nsStringKey(mStr, mStrLen, NEVER_OWN); - uint32_t len = (mStrLen+1) * sizeof(PRUnichar); - PRUnichar* str = (PRUnichar*)nsMemory::Alloc(len); + uint32_t len = (mStrLen+1) * sizeof(char16_t); + char16_t* str = (char16_t*)nsMemory::Alloc(len); if (str == nullptr) return nullptr; memcpy(str, mStr, len); diff --git a/xpcom/ds/nsHashtable.h b/xpcom/ds/nsHashtable.h index 8967630a605d..eadb78294a23 100644 --- a/xpcom/ds/nsHashtable.h +++ b/xpcom/ds/nsHashtable.h @@ -341,7 +341,7 @@ class nsStringKey : public nsHashKey { }; nsStringKey(const nsStringKey& aKey); - nsStringKey(const PRUnichar* str, int32_t strLen = -1, Ownership own = OWN_CLONE); + nsStringKey(const char16_t* str, int32_t strLen = -1, Ownership own = OWN_CLONE); nsStringKey(const nsAFlatString& str); nsStringKey(const nsAString& str); ~nsStringKey(void); @@ -354,11 +354,11 @@ class nsStringKey : public nsHashKey { // For when the owner of the hashtable wants to peek at the actual // string in the key. No copy is made, so be careful. - const PRUnichar* GetString() const { return mStr; } + const char16_t* GetString() const { return mStr; } uint32_t GetStringLength() const { return mStrLen; } protected: - PRUnichar* mStr; + char16_t* mStr; uint32_t mStrLen; Ownership mOwnership; }; diff --git a/xpcom/ds/nsIAtom.idl b/xpcom/ds/nsIAtom.idl index 9ad9064b5802..a4c117c29c13 100644 --- a/xpcom/ds/nsIAtom.idl +++ b/xpcom/ds/nsIAtom.idl @@ -72,7 +72,7 @@ interface nsIAtom : nsISupports protected: uint32_t mLength; uint32_t mHash; - PRUnichar* mString; + char16_t* mString; %} }; @@ -115,8 +115,8 @@ inline already_AddRefed do_GetAtom(const nsACString& aUTF8String) * Find an atom that matches the given UTF-16 string. * The string is assumed to be zero terminated. Never returns null. */ -extern already_AddRefed NS_NewAtom(const PRUnichar* aUTF16String); -inline already_AddRefed do_GetAtom(const PRUnichar* aUTF16String) +extern already_AddRefed NS_NewAtom(const char16_t* aUTF16String); +inline already_AddRefed do_GetAtom(const char16_t* aUTF16String) { return NS_NewAtom(aUTF16String); } /** diff --git a/xpcom/ds/nsObserverList.cpp b/xpcom/ds/nsObserverList.cpp index f162e744d027..8be87894c7cb 100644 --- a/xpcom/ds/nsObserverList.cpp +++ b/xpcom/ds/nsObserverList.cpp @@ -87,7 +87,7 @@ nsObserverList::FillObserverArray(nsCOMArray &aArray) void nsObserverList::NotifyObservers(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { nsCOMArray observers; FillObserverArray(observers); diff --git a/xpcom/ds/nsObserverList.h b/xpcom/ds/nsObserverList.h index dca1fb7527e3..2839d411b92f 100644 --- a/xpcom/ds/nsObserverList.h +++ b/xpcom/ds/nsObserverList.h @@ -59,7 +59,7 @@ public: void NotifyObservers(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData); + const char16_t *someData); nsresult GetObserverList(nsISimpleEnumerator** anEnumerator); // Fill an array with the observers of this category. diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index 320a6f4c8719..2388bfa045aa 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -289,7 +289,7 @@ nsObserverService::EnumerateObservers(const char* aTopic, // Enumerate observers of aTopic and call Observe on each. NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData) + const char16_t *someData) { LOG(("nsObserverService::NotifyObservers(%s)", aTopic)); diff --git a/xpcom/ds/nsPersistentProperties.cpp b/xpcom/ds/nsPersistentProperties.cpp index 0b9b2606b643..c581920db86d 100644 --- a/xpcom/ds/nsPersistentProperties.cpp +++ b/xpcom/ds/nsPersistentProperties.cpp @@ -17,21 +17,21 @@ struct PropertyTableEntry : public PLDHashEntryHdr { // both of these are arena-allocated const char *mKey; - const PRUnichar *mValue; + const char16_t *mValue; }; -static PRUnichar* +static char16_t* ArenaStrdup(const nsAFlatString& aString, PLArenaPool* aArena) { void *mem; // add one to include the null terminator - int32_t len = (aString.Length()+1) * sizeof(PRUnichar); + int32_t len = (aString.Length()+1) * sizeof(char16_t); PL_ARENA_ALLOCATE(mem, aArena, len); NS_ASSERTION(mem, "Couldn't allocate space!\n"); if (mem) { memcpy(mem, aString.get(), len); } - return static_cast(mem); + return static_cast(mem); } static char* @@ -87,7 +87,7 @@ public: mKey.Trim(trimThese, false, true); // This is really ugly hack but it should be fast - PRUnichar backup_char; + char16_t backup_char; uint32_t minLength = mMinLength; if (minLength) { @@ -107,18 +107,18 @@ public: static NS_METHOD SegmentWriter(nsIUnicharInputStream* aStream, void* aClosure, - const PRUnichar *aFromSegment, + const char16_t *aFromSegment, uint32_t aToOffset, uint32_t aCount, uint32_t *aWriteCount); - nsresult ParseBuffer(const PRUnichar* aBuffer, uint32_t aBufferLength); + nsresult ParseBuffer(const char16_t* aBuffer, uint32_t aBufferLength); private: bool ParseValueCharacter( - PRUnichar c, // character that is just being parsed - const PRUnichar* cur, // pointer to character c in the buffer - const PRUnichar* &tokenStart, // string copying is done in blocks as big as + char16_t c, // character that is just being parsed + const char16_t* cur, // pointer to character c in the buffer + const char16_t* &tokenStart, // string copying is done in blocks as big as // possible, tokenStart points to the beginning // of this block nsAString& oldValue); // when duplicate property is found, new value @@ -153,7 +153,7 @@ private: nsAutoString mValue; uint32_t mUnicodeValuesRead; // should be 4! - PRUnichar mUnicodeValue; // currently parsed unicode value + char16_t mUnicodeValue; // currently parsed unicode value bool mHaveMultiLine; // is TRUE when last processed characters form // any of following sequences: // - "\\\r" @@ -170,20 +170,20 @@ private: nsIPersistentProperties* mProps; }; -inline bool IsWhiteSpace(PRUnichar aChar) +inline bool IsWhiteSpace(char16_t aChar) { return (aChar == ' ') || (aChar == '\t') || (aChar == '\r') || (aChar == '\n'); } -inline bool IsEOL(PRUnichar aChar) +inline bool IsEOL(char16_t aChar) { return (aChar == '\r') || (aChar == '\n'); } bool nsPropertiesParser::ParseValueCharacter( - PRUnichar c, const PRUnichar* cur, const PRUnichar* &tokenStart, + char16_t c, const char16_t* cur, const char16_t* &tokenStart, nsAString& oldValue) { switch (mSpecialState) { @@ -254,19 +254,19 @@ bool nsPropertiesParser::ParseValueCharacter( // the easy characters - \t, \n, and so forth case 't': - mValue += PRUnichar('\t'); + mValue += char16_t('\t'); mMinLength = mValue.Length(); break; case 'n': - mValue += PRUnichar('\n'); + mValue += char16_t('\n'); mMinLength = mValue.Length(); break; case 'r': - mValue += PRUnichar('\r'); + mValue += char16_t('\r'); mMinLength = mValue.Length(); break; case '\\': - mValue += PRUnichar('\\'); + mValue += char16_t('\\'); break; // switch to unicode mode! @@ -333,7 +333,7 @@ bool nsPropertiesParser::ParseValueCharacter( NS_METHOD nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream, void* aClosure, - const PRUnichar *aFromSegment, + const char16_t *aFromSegment, uint32_t aToOffset, uint32_t aCount, uint32_t *aWriteCount) @@ -347,14 +347,14 @@ NS_METHOD nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream, return NS_OK; } -nsresult nsPropertiesParser::ParseBuffer(const PRUnichar* aBuffer, +nsresult nsPropertiesParser::ParseBuffer(const char16_t* aBuffer, uint32_t aBufferLength) { - const PRUnichar* cur = aBuffer; - const PRUnichar* end = aBuffer + aBufferLength; + const char16_t* cur = aBuffer; + const char16_t* end = aBuffer + aBufferLength; // points to the start/end of the current key or value - const PRUnichar* tokenStart = nullptr; + const char16_t* tokenStart = nullptr; // if we're in the middle of parsing a key or value, make sure // the current token points to the beginning of the current buffer @@ -367,7 +367,7 @@ nsresult nsPropertiesParser::ParseBuffer(const PRUnichar* aBuffer, while (cur != end) { - PRUnichar c = *cur; + char16_t c = *cur; switch (mState) { case eParserState_AwaitingKey: diff --git a/xpcom/ds/nsStaticNameTable.cpp b/xpcom/ds/nsStaticNameTable.cpp index fdd0a4d70d1b..9e4bb5e4b5d1 100644 --- a/xpcom/ds/nsStaticNameTable.cpp +++ b/xpcom/ds/nsStaticNameTable.cpp @@ -78,7 +78,7 @@ caseInsensitiveStringHashKey(PLDHashTable *table, const void *key) PLDHashNumber h = 0; const NameTableKey* tableKey = static_cast(key); if (tableKey->mIsUnichar) { - for (const PRUnichar* s = tableKey->mKeyStr.m2b->get(); + for (const char16_t* s = tableKey->mKeyStr.m2b->get(); *s != '\0'; s++) h = AddToHash(h, *s & ~0x20); diff --git a/xpcom/ds/nsStringEnumerator.h b/xpcom/ds/nsStringEnumerator.h index 5c322d4972bd..1cec94a9e5c1 100644 --- a/xpcom/ds/nsStringEnumerator.h +++ b/xpcom/ds/nsStringEnumerator.h @@ -12,7 +12,7 @@ template class nsTArray; // // Currently all implementations support both interfaces. The // constructors below provide the most common interface for the given -// type (i.e. nsIStringEnumerator for PRUnichar* strings, and so +// type (i.e. nsIStringEnumerator for char16_t* strings, and so // forth) but any resulting enumerators can be queried to the other // type. Internally, the enumerators will hold onto the type that was // passed in and do conversion if GetNext() for the other type of diff --git a/xpcom/ds/nsSupportsPrimitives.cpp b/xpcom/ds/nsSupportsPrimitives.cpp index 505d560ebda9..d446834790c8 100644 --- a/xpcom/ds/nsSupportsPrimitives.cpp +++ b/xpcom/ds/nsSupportsPrimitives.cpp @@ -127,7 +127,7 @@ NS_IMETHODIMP nsSupportsStringImpl::GetData(nsAString& aData) return NS_OK; } -NS_IMETHODIMP nsSupportsStringImpl::ToString(PRUnichar **_retval) +NS_IMETHODIMP nsSupportsStringImpl::ToString(char16_t **_retval) { *_retval = ToNewUnicode(mData); diff --git a/xpcom/ds/nsVariant.cpp b/xpcom/ds/nsVariant.cpp index a913b3661123..c3fad3952558 100644 --- a/xpcom/ds/nsVariant.cpp +++ b/xpcom/ds/nsVariant.cpp @@ -202,7 +202,7 @@ static void FreeArray(nsDiscriminatedUnion* data) // XXX We ASSUME that "array of nsID" means "array of pointers to nsID". CASE__FREE_ARRAY_PTR(VTYPE_ID, nsID) CASE__FREE_ARRAY_PTR(VTYPE_CHAR_STR, char) - CASE__FREE_ARRAY_PTR(VTYPE_WCHAR_STR, PRUnichar) + CASE__FREE_ARRAY_PTR(VTYPE_WCHAR_STR, char16_t) CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE, nsISupports) CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE_IS, nsISupports) @@ -290,7 +290,7 @@ static nsresult CloneArray(uint16_t inType, const nsIID* inIID, elementSize = sizeof(char); break; case nsIDataType::VTYPE_WCHAR: - elementSize = sizeof(PRUnichar); + elementSize = sizeof(char16_t); break; // XXX We ASSUME that "array of nsID" means "array of pointers to nsID". @@ -404,16 +404,16 @@ static nsresult CloneArray(uint16_t inType, const nsIID* inIID, case nsIDataType::VTYPE_WCHAR_STR: { - PRUnichar** inp = (PRUnichar**) inValue; - PRUnichar** outp = (PRUnichar**) *outValue; + char16_t** inp = (char16_t**) inValue; + char16_t** outp = (char16_t**) *outValue; for(i = inCount; i > 0; i--) { - PRUnichar* str = *(inp++); + char16_t* str = *(inp++); if(str) { - if(nullptr == (*(outp++) = (PRUnichar*) + if(nullptr == (*(outp++) = (char16_t*) nsMemory::Clone(str, - (NS_strlen(str) + 1) * sizeof(PRUnichar)))) + (NS_strlen(str) + 1) * sizeof(char16_t)))) goto bad; } else @@ -598,10 +598,10 @@ NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_CHAR, char, Char) NUMERIC_CONVERSION_METHOD_END // XXX toWChar convertions need to be fixed! -NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_WCHAR, PRUnichar, WChar) - CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(PRUnichar) - CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(PRUnichar) - CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(PRUnichar) +NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_WCHAR, char16_t, WChar) + CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(char16_t) + CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(char16_t) + CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(char16_t) NUMERIC_CONVERSION_METHOD_END #undef NUMERIC_CONVERSION_METHOD_BEGIN @@ -917,7 +917,7 @@ nsVariant::ConvertToACString(const nsDiscriminatedUnion& data, return NS_OK; case nsIDataType::VTYPE_WCHAR: { - const PRUnichar* str = &data.u.mWCharValue; + const char16_t* str = &data.u.mWCharValue; LossyCopyUTF16toASCII(Substring(str, 1), _retval); return NS_OK; } @@ -968,7 +968,7 @@ nsVariant::ConvertToAUTF8String(const nsDiscriminatedUnion& data, return NS_OK; case nsIDataType::VTYPE_WCHAR: { - const PRUnichar* str = &data.u.mWCharValue; + const char16_t* str = &data.u.mWCharValue; CopyUTF16toUTF8(Substring(str, 1), _retval); return NS_OK; } @@ -994,7 +994,7 @@ nsVariant::ConvertToString(const nsDiscriminatedUnion& data, char **_retval) } /* static */ nsresult -nsVariant::ConvertToWString(const nsDiscriminatedUnion& data, PRUnichar **_retval) +nsVariant::ConvertToWString(const nsDiscriminatedUnion& data, char16_t **_retval) { uint32_t ignored; return nsVariant::ConvertToWStringWithSize(data, &ignored, _retval); @@ -1080,7 +1080,7 @@ nsVariant::ConvertToStringWithSize(const nsDiscriminatedUnion& data, } /* static */ nsresult nsVariant::ConvertToWStringWithSize(const nsDiscriminatedUnion& data, - uint32_t *size, PRUnichar **str) + uint32_t *size, char16_t **str) { nsAutoString tempString; nsAutoCString tempCString; @@ -1434,7 +1434,7 @@ nsVariant::SetFromChar(nsDiscriminatedUnion* data, char aValue) DATA_SETTER(data, VTYPE_CHAR, mCharValue, aValue) } /* static */ nsresult -nsVariant::SetFromWChar(nsDiscriminatedUnion* data, PRUnichar aValue) +nsVariant::SetFromWChar(nsDiscriminatedUnion* data, char16_t aValue) { DATA_SETTER(data, VTYPE_WCHAR, mWCharValue, aValue) } @@ -1481,7 +1481,7 @@ nsVariant::SetFromString(nsDiscriminatedUnion* data, const char *aValue) return SetFromStringWithSize(data, strlen(aValue), aValue); } /* static */ nsresult -nsVariant::SetFromWString(nsDiscriminatedUnion* data, const PRUnichar *aValue) +nsVariant::SetFromWString(nsDiscriminatedUnion* data, const char16_t *aValue) { DATA_SETTER_PROLOGUE(data); if(!aValue) @@ -1533,13 +1533,13 @@ nsVariant::SetFromStringWithSize(nsDiscriminatedUnion* data, uint32_t size, cons DATA_SETTER_EPILOGUE(data, VTYPE_STRING_SIZE_IS); } /* static */ nsresult -nsVariant::SetFromWStringWithSize(nsDiscriminatedUnion* data, uint32_t size, const PRUnichar *aValue) +nsVariant::SetFromWStringWithSize(nsDiscriminatedUnion* data, uint32_t size, const char16_t *aValue) { DATA_SETTER_PROLOGUE(data); if(!aValue) return NS_ERROR_NULL_POINTER; if(!(data->u.wstr.mWStringValue = - (PRUnichar*) nsMemory::Clone(aValue, (size+1)*sizeof(PRUnichar)))) + (char16_t*) nsMemory::Clone(aValue, (size+1)*sizeof(char16_t)))) return NS_ERROR_OUT_OF_MEMORY; data->u.wstr.mWStringLength = size; DATA_SETTER_EPILOGUE(data, VTYPE_WSTRING_SIZE_IS); @@ -1804,7 +1804,7 @@ NS_IMETHODIMP nsVariant::GetAsChar(char *_retval) } /* wchar getAsWChar (); */ -NS_IMETHODIMP nsVariant::GetAsWChar(PRUnichar *_retval) +NS_IMETHODIMP nsVariant::GetAsWChar(char16_t *_retval) { return nsVariant::ConvertToWChar(mData, _retval); } @@ -1848,7 +1848,7 @@ NS_IMETHODIMP nsVariant::GetAsString(char **_retval) } /* wstring getAsWString (); */ -NS_IMETHODIMP nsVariant::GetAsWString(PRUnichar **_retval) +NS_IMETHODIMP nsVariant::GetAsWString(char16_t **_retval) { return nsVariant::ConvertToWString(mData, _retval); } @@ -1885,7 +1885,7 @@ NS_IMETHODIMP nsVariant::GetAsStringWithSize(uint32_t *size, char **str) } /* void getAsWStringWithSize (out uint32_t size, [size_is (size), retval] out wstring str); */ -NS_IMETHODIMP nsVariant::GetAsWStringWithSize(uint32_t *size, PRUnichar **str) +NS_IMETHODIMP nsVariant::GetAsWStringWithSize(uint32_t *size, char16_t **str) { return nsVariant::ConvertToWStringWithSize(mData, size, str); } @@ -1996,7 +1996,7 @@ NS_IMETHODIMP nsVariant::SetAsChar(char aValue) } /* void setAsWChar (in wchar aValue); */ -NS_IMETHODIMP nsVariant::SetAsWChar(PRUnichar aValue) +NS_IMETHODIMP nsVariant::SetAsWChar(char16_t aValue) { if(!mWritable) return NS_ERROR_OBJECT_IS_IMMUTABLE; return nsVariant::SetFromWChar(&mData, aValue); @@ -2049,7 +2049,7 @@ NS_IMETHODIMP nsVariant::SetAsString(const char *aValue) } /* void setAsWString (in wstring aValue); */ -NS_IMETHODIMP nsVariant::SetAsWString(const PRUnichar *aValue) +NS_IMETHODIMP nsVariant::SetAsWString(const char16_t *aValue) { if(!mWritable) return NS_ERROR_OBJECT_IS_IMMUTABLE; return nsVariant::SetFromWString(&mData, aValue); @@ -2084,7 +2084,7 @@ NS_IMETHODIMP nsVariant::SetAsStringWithSize(uint32_t size, const char *str) } /* void setAsWStringWithSize (in uint32_t size, [size_is (size)] in wstring str); */ -NS_IMETHODIMP nsVariant::SetAsWStringWithSize(uint32_t size, const PRUnichar *str) +NS_IMETHODIMP nsVariant::SetAsWStringWithSize(uint32_t size, const char16_t *str) { if(!mWritable) return NS_ERROR_OBJECT_IS_IMMUTABLE; return nsVariant::SetFromWStringWithSize(&mData, size, str); diff --git a/xpcom/ds/nsVariant.h b/xpcom/ds/nsVariant.h index c4c13a4519aa..ac4e9172310b 100644 --- a/xpcom/ds/nsVariant.h +++ b/xpcom/ds/nsVariant.h @@ -45,7 +45,7 @@ struct nsDiscriminatedUnion double mDoubleValue; bool mBoolValue; char mCharValue; - PRUnichar mWCharValue; + char16_t mWCharValue; nsIID mIDValue; nsAString* mAStringValue; nsAUTF8String* mUTF8StringValue; @@ -65,7 +65,7 @@ struct nsDiscriminatedUnion uint32_t mStringLength; } str; struct { - PRUnichar* mWStringValue; + char16_t* mWStringValue; uint32_t mWStringLength; } wstr; } u; @@ -107,18 +107,18 @@ public: static nsresult ConvertToDouble(const nsDiscriminatedUnion& data, double *_retval); static nsresult ConvertToBool(const nsDiscriminatedUnion& data, bool *_retval); static nsresult ConvertToChar(const nsDiscriminatedUnion& data, char *_retval); - static nsresult ConvertToWChar(const nsDiscriminatedUnion& data, PRUnichar *_retval); + static nsresult ConvertToWChar(const nsDiscriminatedUnion& data, char16_t *_retval); static nsresult ConvertToID(const nsDiscriminatedUnion& data, nsID * _retval); static nsresult ConvertToAString(const nsDiscriminatedUnion& data, nsAString & _retval); static nsresult ConvertToAUTF8String(const nsDiscriminatedUnion& data, nsAUTF8String & _retval); static nsresult ConvertToACString(const nsDiscriminatedUnion& data, nsACString & _retval); static nsresult ConvertToString(const nsDiscriminatedUnion& data, char **_retval); - static nsresult ConvertToWString(const nsDiscriminatedUnion& data, PRUnichar **_retval); + static nsresult ConvertToWString(const nsDiscriminatedUnion& data, char16_t **_retval); static nsresult ConvertToISupports(const nsDiscriminatedUnion& data, nsISupports **_retval); static nsresult ConvertToInterface(const nsDiscriminatedUnion& data, nsIID * *iid, void * *iface); static nsresult ConvertToArray(const nsDiscriminatedUnion& data, uint16_t *type, nsIID* iid, uint32_t *count, void * *ptr); static nsresult ConvertToStringWithSize(const nsDiscriminatedUnion& data, uint32_t *size, char **str); - static nsresult ConvertToWStringWithSize(const nsDiscriminatedUnion& data, uint32_t *size, PRUnichar **str); + static nsresult ConvertToWStringWithSize(const nsDiscriminatedUnion& data, uint32_t *size, char16_t **str); static nsresult SetFromVariant(nsDiscriminatedUnion* data, nsIVariant* aValue); @@ -134,18 +134,18 @@ public: static nsresult SetFromDouble(nsDiscriminatedUnion* data, double aValue); static nsresult SetFromBool(nsDiscriminatedUnion* data, bool aValue); static nsresult SetFromChar(nsDiscriminatedUnion* data, char aValue); - static nsresult SetFromWChar(nsDiscriminatedUnion* data, PRUnichar aValue); + static nsresult SetFromWChar(nsDiscriminatedUnion* data, char16_t aValue); static nsresult SetFromID(nsDiscriminatedUnion* data, const nsID & aValue); static nsresult SetFromAString(nsDiscriminatedUnion* data, const nsAString & aValue); static nsresult SetFromAUTF8String(nsDiscriminatedUnion* data, const nsAUTF8String & aValue); static nsresult SetFromACString(nsDiscriminatedUnion* data, const nsACString & aValue); static nsresult SetFromString(nsDiscriminatedUnion* data, const char *aValue); - static nsresult SetFromWString(nsDiscriminatedUnion* data, const PRUnichar *aValue); + static nsresult SetFromWString(nsDiscriminatedUnion* data, const char16_t *aValue); static nsresult SetFromISupports(nsDiscriminatedUnion* data, nsISupports *aValue); static nsresult SetFromInterface(nsDiscriminatedUnion* data, const nsIID& iid, nsISupports *aValue); static nsresult SetFromArray(nsDiscriminatedUnion* data, uint16_t type, const nsIID* iid, uint32_t count, void * aValue); static nsresult SetFromStringWithSize(nsDiscriminatedUnion* data, uint32_t size, const char *aValue); - static nsresult SetFromWStringWithSize(nsDiscriminatedUnion* data, uint32_t size, const PRUnichar *aValue); + static nsresult SetFromWStringWithSize(nsDiscriminatedUnion* data, uint32_t size, const char16_t *aValue); static nsresult SetToVoid(nsDiscriminatedUnion* data); static nsresult SetToEmpty(nsDiscriminatedUnion* data); diff --git a/xpcom/ds/nsWhitespaceTokenizer.h b/xpcom/ds/nsWhitespaceTokenizer.h index 1968e2f19e51..406632bd5d06 100644 --- a/xpcom/ds/nsWhitespaceTokenizer.h +++ b/xpcom/ds/nsWhitespaceTokenizer.h @@ -10,7 +10,7 @@ #include "nsDependentSubstring.h" #include "nsCRT.h" -template +template class nsWhitespaceTokenizerTemplate { public: @@ -57,11 +57,11 @@ public: */ const nsDependentSubstring nextToken() { - const mozilla::RangedPtr tokenStart = mIter; + const mozilla::RangedPtr tokenStart = mIter; while (mIter < mEnd && !IsWhitespace(*mIter)) { ++mIter; } - const mozilla::RangedPtr tokenEnd = mIter; + const mozilla::RangedPtr tokenEnd = mIter; mWhitespaceAfterCurrentToken = false; while (mIter < mEnd && IsWhitespace(*mIter)) { mWhitespaceAfterCurrentToken = true; @@ -71,8 +71,8 @@ public: } private: - mozilla::RangedPtr mIter; - const mozilla::RangedPtr mEnd; + mozilla::RangedPtr mIter; + const mozilla::RangedPtr mEnd; bool mWhitespaceBeforeFirstToken; bool mWhitespaceAfterCurrentToken; }; @@ -86,7 +86,7 @@ public: } }; -template +template class nsCWhitespaceTokenizerTemplate { public: diff --git a/xpcom/ds/nsWindowsRegKey.cpp b/xpcom/ds/nsWindowsRegKey.cpp index dfd00561dad9..31859249a63c 100644 --- a/xpcom/ds/nsWindowsRegKey.cpp +++ b/xpcom/ds/nsWindowsRegKey.cpp @@ -410,7 +410,7 @@ nsWindowsRegKey::WriteStringValue(const nsAString &name, const nsAString &value) LONG rv = RegSetValueExW(mKey, PromiseFlatString(name).get(), 0, REG_SZ, (const BYTE *) flatValue.get(), - (flatValue.Length() + 1) * sizeof(PRUnichar)); + (flatValue.Length() + 1) * sizeof(char16_t)); return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE; } diff --git a/xpcom/glue/nsCRTGlue.cpp b/xpcom/glue/nsCRTGlue.cpp index f3a73aebe3fa..d81ad07dfdd2 100644 --- a/xpcom/glue/nsCRTGlue.cpp +++ b/xpcom/glue/nsCRTGlue.cpp @@ -67,9 +67,9 @@ NS_strtok(const char *delims, char **str) } uint32_t -NS_strlen(const PRUnichar *aString) +NS_strlen(const char16_t *aString) { - const PRUnichar *end; + const char16_t *end; for (end = aString; *end; ++end) { // empty loop @@ -79,7 +79,7 @@ NS_strlen(const PRUnichar *aString) } int -NS_strcmp(const PRUnichar *a, const PRUnichar *b) +NS_strcmp(const char16_t *a, const char16_t *b) { while (*b) { int r = *a - *b; @@ -93,19 +93,19 @@ NS_strcmp(const PRUnichar *a, const PRUnichar *b) return *a != '\0'; } -PRUnichar* -NS_strdup(const PRUnichar *aString) +char16_t* +NS_strdup(const char16_t *aString) { uint32_t len = NS_strlen(aString); return NS_strndup(aString, len); } -PRUnichar* -NS_strndup(const PRUnichar *aString, uint32_t aLen) +char16_t* +NS_strndup(const char16_t *aString, uint32_t aLen) { - PRUnichar *newBuf = (PRUnichar*) NS_Alloc((aLen + 1) * sizeof(PRUnichar)); + char16_t *newBuf = (char16_t*) NS_Alloc((aLen + 1) * sizeof(char16_t)); if (newBuf) { - memcpy(newBuf, aString, aLen * sizeof(PRUnichar)); + memcpy(newBuf, aString, aLen * sizeof(char16_t)); newBuf[aLen] = '\0'; } return newBuf; @@ -183,12 +183,12 @@ bool NS_IsLower(char aChar) return aChar != (char)nsLowerUpperUtils::kLower2Upper[(unsigned char)aChar]; } -bool NS_IsAscii(PRUnichar aChar) +bool NS_IsAscii(char16_t aChar) { return (0x0080 > aChar); } -bool NS_IsAscii(const PRUnichar *aString) +bool NS_IsAscii(const char16_t *aString) { while(*aString) { if( 0x0080 <= *aString) @@ -219,13 +219,13 @@ bool NS_IsAscii(const char* aString, uint32_t aLength) return true; } -bool NS_IsAsciiAlpha(PRUnichar aChar) +bool NS_IsAsciiAlpha(char16_t aChar) { return ((aChar >= 'A') && (aChar <= 'Z')) || ((aChar >= 'a') && (aChar <= 'z')); } -bool NS_IsAsciiWhitespace(PRUnichar aChar) +bool NS_IsAsciiWhitespace(char16_t aChar) { return aChar == ' ' || aChar == '\r' || @@ -233,7 +233,7 @@ bool NS_IsAsciiWhitespace(PRUnichar aChar) aChar == '\t'; } -bool NS_IsAsciiDigit(PRUnichar aChar) +bool NS_IsAsciiDigit(char16_t aChar) { return aChar >= '0' && aChar <= '9'; } diff --git a/xpcom/glue/nsCRTGlue.h b/xpcom/glue/nsCRTGlue.h index 9c8dc88a01f3..85f0b4770c9c 100644 --- a/xpcom/glue/nsCRTGlue.h +++ b/xpcom/glue/nsCRTGlue.h @@ -38,22 +38,22 @@ NS_COM_GLUE char* NS_strtok(const char *delims, char **str); /** - * "strlen" for PRUnichar strings + * "strlen" for char16_t strings */ NS_COM_GLUE uint32_t -NS_strlen(const PRUnichar *aString); +NS_strlen(const char16_t *aString); /** - * "strcmp" for PRUnichar strings + * "strcmp" for char16_t strings */ NS_COM_GLUE int -NS_strcmp(const PRUnichar *a, const PRUnichar *b); +NS_strcmp(const char16_t *a, const char16_t *b); /** - * "strdup" for PRUnichar strings, uses the NS_Alloc allocator. + * "strdup" for char16_t strings, uses the NS_Alloc allocator. */ -NS_COM_GLUE PRUnichar* -NS_strdup(const PRUnichar *aString); +NS_COM_GLUE char16_t* +NS_strdup(const char16_t *aString); /** * "strdup", but using the NS_Alloc allocator. @@ -62,11 +62,11 @@ NS_COM_GLUE char* NS_strdup(const char *aString); /** - * strndup for PRUnichar strings... this function will ensure that the + * strndup for char16_t strings... this function will ensure that the * new string is null-terminated. Uses the NS_Alloc allocator. */ -NS_COM_GLUE PRUnichar* -NS_strndup(const PRUnichar *aString, uint32_t aLen); +NS_COM_GLUE char16_t* +NS_strndup(const char16_t *aString, uint32_t aLen); // The following case-conversion methods only deal in the ascii repertoire // A-Z and a-z @@ -91,11 +91,11 @@ inline char NS_ToLower(char aChar) NS_COM_GLUE bool NS_IsUpper(char aChar); NS_COM_GLUE bool NS_IsLower(char aChar); -NS_COM_GLUE bool NS_IsAscii(PRUnichar aChar); -NS_COM_GLUE bool NS_IsAscii(const PRUnichar* aString); -NS_COM_GLUE bool NS_IsAsciiAlpha(PRUnichar aChar); -NS_COM_GLUE bool NS_IsAsciiDigit(PRUnichar aChar); -NS_COM_GLUE bool NS_IsAsciiWhitespace(PRUnichar aChar); +NS_COM_GLUE bool NS_IsAscii(char16_t aChar); +NS_COM_GLUE bool NS_IsAscii(const char16_t* aString); +NS_COM_GLUE bool NS_IsAsciiAlpha(char16_t aChar); +NS_COM_GLUE bool NS_IsAsciiDigit(char16_t aChar); +NS_COM_GLUE bool NS_IsAsciiWhitespace(char16_t aChar); NS_COM_GLUE bool NS_IsAscii(const char* aString); NS_COM_GLUE bool NS_IsAscii(const char* aString, uint32_t aLength); diff --git a/xpcom/glue/nsCategoryCache.cpp b/xpcom/glue/nsCategoryCache.cpp index 9a7f85086f46..853a5e4c0635 100644 --- a/xpcom/glue/nsCategoryCache.cpp +++ b/xpcom/glue/nsCategoryCache.cpp @@ -87,7 +87,7 @@ nsCategoryObserver::RemoveObservers() { NS_IMETHODIMP nsCategoryObserver::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) { + const char16_t* aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { mHash.Clear(); RemoveObservers(); diff --git a/xpcom/glue/nsHashKeys.h b/xpcom/glue/nsHashKeys.h index 89949558974a..bef264e7b69f 100644 --- a/xpcom/glue/nsHashKeys.h +++ b/xpcom/glue/nsHashKeys.h @@ -508,17 +508,17 @@ private: }; /** - * hashkey wrapper for const PRUnichar*; at construction, this class duplicates + * hashkey wrapper for const char16_t*; at construction, this class duplicates * a string pointed to by the pointer so that it doesn't matter whether or not * the string lives longer than the hash table. */ class nsUnicharPtrHashKey : public PLDHashEntryHdr { public: - typedef const PRUnichar* KeyType; - typedef const PRUnichar* KeyTypePointer; + typedef const char16_t* KeyType; + typedef const char16_t* KeyTypePointer; - nsUnicharPtrHashKey(const PRUnichar* aKey) : mKey(NS_strdup(aKey)) { } + nsUnicharPtrHashKey(const char16_t* aKey) : mKey(NS_strdup(aKey)) { } nsUnicharPtrHashKey(const nsUnicharPtrHashKey& toCopy) : mKey(NS_strdup(toCopy.mKey)) { } nsUnicharPtrHashKey(nsUnicharPtrHashKey&& other) @@ -527,9 +527,9 @@ public: other.mKey = nullptr; } - ~nsUnicharPtrHashKey() { if (mKey) NS_Free(const_cast(mKey)); } + ~nsUnicharPtrHashKey() { if (mKey) NS_Free(const_cast(mKey)); } - const PRUnichar* GetKey() const { return mKey; } + const char16_t* GetKey() const { return mKey; } bool KeyEquals(KeyTypePointer aKey) const { return !NS_strcmp(mKey, aKey); @@ -541,7 +541,7 @@ public: enum { ALLOW_MEMMOVE = true }; private: - const PRUnichar* mKey; + const char16_t* mKey; }; /** diff --git a/xpcom/glue/nsStringAPI.cpp b/xpcom/glue/nsStringAPI.cpp index 6a2db49ec6ce..63570f0c8d1d 100644 --- a/xpcom/glue/nsStringAPI.cpp +++ b/xpcom/glue/nsStringAPI.cpp @@ -82,7 +82,7 @@ void nsAString::AssignLiteral(const char *aStr) { uint32_t len = strlen(aStr); - PRUnichar *buf = BeginWriting(len); + char16_t *buf = BeginWriting(len); if (!buf) return; @@ -96,7 +96,7 @@ nsAString::AppendLiteral(const char *aASCIIStr) uint32_t appendLen = strlen(aASCIIStr); uint32_t thisLen = Length(); - PRUnichar *begin, *end; + char16_t *begin, *end; BeginWriting(&begin, &end, appendLen + thisLen); if (!begin) return; @@ -142,7 +142,7 @@ nsAString::Trim(const char *aSet, bool aLeading, bool aTrailing) { NS_ASSERTION(aLeading || aTrailing, "Ineffective Trim"); - const PRUnichar *start, *end; + const char16_t *start, *end; uint32_t cutLen; if (aLeading) { @@ -258,7 +258,7 @@ nsAString::Equals(const self_type &other, ComparatorFunc c) const bool nsAString::EqualsLiteral(const char *aASCIIString) const { - const PRUnichar *begin, *end; + const char16_t *begin, *end; BeginReading(&begin, &end); for (; begin < end; ++begin, ++aASCIIString) { @@ -274,7 +274,7 @@ nsAString::EqualsLiteral(const char *aASCIIString) const bool nsAString::LowerCaseEqualsLiteral(const char *aASCIIString) const { - const PRUnichar *begin, *end; + const char16_t *begin, *end; BeginReading(&begin, &end); for (; begin < end; ++begin, ++aASCIIString) { @@ -313,7 +313,7 @@ nsAString::Find(const self_type& aStr, uint32_t aOffset, return -1; } -static bool ns_strnmatch(const PRUnichar *aStr, const char* aSubstring, +static bool ns_strnmatch(const char16_t *aStr, const char* aSubstring, uint32_t aLen) { for (; aLen; ++aStr, ++aSubstring, --aLen) { @@ -327,7 +327,7 @@ static bool ns_strnmatch(const PRUnichar *aStr, const char* aSubstring, return true; } -static bool ns_strnimatch(const PRUnichar *aStr, const char* aSubstring, +static bool ns_strnimatch(const char16_t *aStr, const char* aSubstring, uint32_t aLen) { for (; aLen; ++aStr, ++aSubstring, --aLen) { @@ -344,7 +344,7 @@ static bool ns_strnimatch(const PRUnichar *aStr, const char* aSubstring, int32_t nsAString::Find(const char *aStr, uint32_t aOffset, bool aIgnoreCase) const { - bool (*match)(const PRUnichar*, const char*, uint32_t) = + bool (*match)(const char16_t*, const char*, uint32_t) = aIgnoreCase ? ns_strnimatch : ns_strnmatch; const char_type *begin, *end; @@ -396,7 +396,7 @@ nsAString::RFind(const self_type& aStr, int32_t aOffset, ComparatorFunc c) const int32_t nsAString::RFind(const char *aStr, int32_t aOffset, bool aIgnoreCase) const { - bool (*match)(const PRUnichar*, const char*, uint32_t) = + bool (*match)(const char16_t*, const char*, uint32_t) = aIgnoreCase ? ns_strnimatch : ns_strnmatch; const char_type *begin, *end; @@ -440,7 +440,7 @@ nsAString::FindChar(char_type aChar, uint32_t aOffset) const int32_t nsAString::RFindChar(char_type aChar) const { - const PRUnichar *start, *end; + const char16_t *start, *end; BeginReading(&start, &end); do { @@ -986,7 +986,7 @@ nsACString::ToInteger64(nsresult *aErrorCode, uint32_t aRadix) const nsDependentSubstring::nsDependentSubstring(const abstract_string_type& aStr, uint32_t aStartPos) { - const PRUnichar* data; + const char16_t* data; uint32_t len = NS_StringGetData(aStr, &data); if (aStartPos > len) @@ -1001,7 +1001,7 @@ nsDependentSubstring::nsDependentSubstring(const abstract_string_type& aStr, uint32_t aStartPos, uint32_t aLength) { - const PRUnichar* data; + const char16_t* data; uint32_t len = NS_StringGetData(aStr, &data); if (aStartPos > len) @@ -1060,17 +1060,17 @@ ToNewUTF8String(const nsAString& aSource) void CompressWhitespace(nsAString& aString) { - PRUnichar *start; + char16_t *start; uint32_t len = NS_StringGetMutableData(aString, UINT32_MAX, &start); - PRUnichar *end = start + len; - PRUnichar *from = start, *to = start; + char16_t *end = start + len; + char16_t *from = start, *to = start; // Skip any leading whitespace while (from < end && NS_IsAsciiWhitespace(*from)) from++; while (from < end) { - PRUnichar theChar = *from++; + char16_t theChar = *from++; if (NS_IsAsciiWhitespace(theChar)) { // We found a whitespace char, so skip over any more diff --git a/xpcom/glue/nsStringAPI.h b/xpcom/glue/nsStringAPI.h index ab2a99f47c49..a1e941d52675 100644 --- a/xpcom/glue/nsStringAPI.h +++ b/xpcom/glue/nsStringAPI.h @@ -33,7 +33,7 @@ CaseInsensitiveCompare(const char *a, const char *b, class nsAString { public: - typedef PRUnichar char_type; + typedef char16_t char_type; typedef nsAString self_type; typedef uint32_t size_type; typedef uint32_t index_type; @@ -1055,7 +1055,7 @@ public: } explicit - NS_ConvertUTF16toUTF8(const PRUnichar* aData, uint32_t aLength = UINT32_MAX) + NS_ConvertUTF16toUTF8(const char16_t* aData, uint32_t aLength = UINT32_MAX) { NS_UTF16ToCString(nsDependentString(aData, aLength), NS_CSTRING_ENCODING_UTF8, *this); @@ -1077,7 +1077,7 @@ public: } explicit - NS_LossyConvertUTF16toASCII(const PRUnichar* aData, uint32_t aLength = UINT32_MAX) + NS_LossyConvertUTF16toASCII(const char16_t* aData, uint32_t aLength = UINT32_MAX) { NS_UTF16ToCString(nsDependentString(aData, aLength), NS_CSTRING_ENCODING_ASCII, *this); @@ -1099,8 +1099,8 @@ static_assert(char16_t(-1) > char16_t(0), "char16_t must be unsigned"); #define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const nsDependentString n(reinterpret_cast(s), uint32_t((sizeof(s)/2)-1)) typedef nsDependentString nsLiteralString; -/* Check that PRUnichar is unsigned */ -static_assert(PRUnichar(-1) > PRUnichar(0), "PRUnichar is by definition an unsigned type"); +/* Check that char16_t is unsigned */ +static_assert(char16_t(-1) > char16_t(0), "char16_t is by definition an unsigned type"); #define NS_LITERAL_STRING(s) static_cast(NS_MULTILINE_LITERAL_STRING(MOZ_UTF16(s))) #define NS_LITERAL_STRING_INIT(n,s) NS_MULTILINE_LITERAL_STRING_INIT(n, MOZ_UTF16(s)) @@ -1116,7 +1116,7 @@ typedef nsDependentCString nsLiteralCString; /** * getter_Copies support * - * NS_IMETHOD GetBlah(PRUnichar**); + * NS_IMETHOD GetBlah(char16_t**); * * void some_function() * { @@ -1129,7 +1129,7 @@ typedef nsDependentCString nsLiteralCString; class nsGetterCopies { public: - typedef PRUnichar char_type; + typedef char16_t char_type; nsGetterCopies(nsString& aStr) : mString(aStr), mData(nullptr) @@ -1276,7 +1276,7 @@ private: * Various nsDependentC?Substring constructor functions */ -// PRUnichar +// char16_t inline const nsDependentSubstring Substring( const nsAString& str, uint32_t startPos ) { @@ -1290,14 +1290,14 @@ Substring( const nsAString& str, uint32_t startPos, uint32_t length ) } inline const nsDependentSubstring -Substring( const PRUnichar* start, const PRUnichar* end ) +Substring( const char16_t* start, const char16_t* end ) { NS_ABORT_IF_FALSE(uint32_t(end - start) == uintptr_t(end - start), "string too long"); return nsDependentSubstring(start, uint32_t(end - start)); } inline const nsDependentSubstring -Substring( const PRUnichar* start, uint32_t length ) +Substring( const char16_t* start, uint32_t length ) { return nsDependentSubstring(start, length); } @@ -1425,7 +1425,7 @@ ToNewCString(const nsACString& aStr) return NS_CStringCloneData(aStr); } -inline PRUnichar* +inline char16_t* ToNewUnicode(const nsAString& aStr) { return NS_StringCloneData(aStr); diff --git a/xpcom/glue/nsTextFormatter.cpp b/xpcom/glue/nsTextFormatter.cpp index 65c82321f1fb..d11ca12e22e0 100644 --- a/xpcom/glue/nsTextFormatter.cpp +++ b/xpcom/glue/nsTextFormatter.cpp @@ -48,10 +48,10 @@ typedef struct SprintfStateStr SprintfState; struct SprintfStateStr { - int (*stuff)(SprintfState *ss, const PRUnichar *sp, uint32_t len); + int (*stuff)(SprintfState *ss, const char16_t *sp, uint32_t len); - PRUnichar *base; - PRUnichar *cur; + char16_t *base; + char16_t *cur; uint32_t maxlen; void *stuffclosure; @@ -94,10 +94,10 @@ struct NumArgState{ /* ** Fill into the buffer using the data in src */ -static int fill2(SprintfState *ss, const PRUnichar *src, int srclen, +static int fill2(SprintfState *ss, const char16_t *src, int srclen, int width, int flags) { - PRUnichar space = ' '; + char16_t space = ' '; int rv; width -= srclen; @@ -135,7 +135,7 @@ static int fill2(SprintfState *ss, const PRUnichar *src, int srclen, /* ** Fill a number. The order is: optional-sign zero-filling conversion-digits */ -static int fill_n(SprintfState *ss, const PRUnichar *src, int srclen, +static int fill_n(SprintfState *ss, const char16_t *src, int srclen, int width, int prec, int type, int flags) { int zerowidth = 0; @@ -145,9 +145,9 @@ static int fill_n(SprintfState *ss, const PRUnichar *src, int srclen, int rightspaces = 0; int cvtwidth; int rv; - PRUnichar sign; - PRUnichar space = ' '; - PRUnichar zero = '0'; + char16_t sign; + char16_t space = ' '; + char16_t zero = '0'; if ((type & 1) == 0) { if (flags & _NEG) { @@ -231,10 +231,10 @@ static int fill_n(SprintfState *ss, const PRUnichar *src, int srclen, ** Convert a long into its printable form */ static int cvt_l(SprintfState *ss, long num, int width, int prec, - int radix, int type, int flags, const PRUnichar *hexp) + int radix, int type, int flags, const char16_t *hexp) { - PRUnichar cvtbuf[100]; - PRUnichar *cvt; + char16_t cvtbuf[100]; + char16_t *cvt; int digits; /* according to the man page this needs to happen */ @@ -271,10 +271,10 @@ static int cvt_l(SprintfState *ss, long num, int width, int prec, ** Convert a 64-bit integer into its printable form */ static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec, - int radix, int type, int flags, const PRUnichar *hexp) + int radix, int type, int flags, const char16_t *hexp) { - PRUnichar cvtbuf[100]; - PRUnichar *cvt; + char16_t cvtbuf[100]; + char16_t *cvt; int digits; int64_t rad; @@ -313,7 +313,7 @@ static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec, ** form. */ static int cvt_f(SprintfState *ss, double d, int width, int prec, - const PRUnichar type, int flags) + const char16_t type, int flags) { int mode = 2; int decpt; @@ -480,10 +480,10 @@ static int cvt_f(SprintfState *ss, double d, int width, int prec, } } - PRUnichar rbuf[256]; - PRUnichar *rbufp = rbuf; + char16_t rbuf[256]; + char16_t *rbufp = rbuf; bufp = buf; - // cast to PRUnichar + // cast to char16_t while ((*rbufp++ = *bufp++)) { } *rbufp = '\0'; @@ -495,7 +495,7 @@ static int cvt_f(SprintfState *ss, double d, int width, int prec, ** width. "prec" is the maximum number of characters of "s" to output, ** where -1 means until NUL. */ -static int cvt_S(SprintfState *ss, const PRUnichar *s, int width, +static int cvt_S(SprintfState *ss, const char16_t *s, int width, int prec, int flags) { int slen; @@ -537,13 +537,13 @@ static int cvt_s(SprintfState *ss, const char *s, int width, ** the number must start from 1, and no gap among them */ -static struct NumArgState* BuildArgArray(const PRUnichar *fmt, +static struct NumArgState* BuildArgArray(const char16_t *fmt, va_list ap, int * rv, struct NumArgState * nasArray) { int number = 0, cn = 0, i; - const PRUnichar* p; - PRUnichar c; + const char16_t* p; + char16_t c; struct NumArgState* nas; /* @@ -784,7 +784,7 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt, case NumArgState::DOUBLE: (void)va_arg(ap, double); break; - case NumArgState::UNISTRING: (void)va_arg(ap, PRUnichar*); break; + case NumArgState::UNISTRING: (void)va_arg(ap, char16_t*); break; default: if( nas != nasArray ) { @@ -801,21 +801,21 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt, /* ** The workhorse sprintf code. */ -static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) +static int dosprintf(SprintfState *ss, const char16_t *fmt, va_list ap) { - PRUnichar c; + char16_t c; int flags, width, prec, radix, type; union { - PRUnichar ch; + char16_t ch; int i; long l; int64_t ll; double d; const char *s; - const PRUnichar *S; + const char16_t *S; int *ip; } u; - PRUnichar space = ' '; + char16_t space = ' '; nsAutoString hex; hex.AssignLiteral("0123456789abcdef"); @@ -823,7 +823,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) nsAutoString HEX; HEX.AssignLiteral("0123456789ABCDEF"); - const PRUnichar *hexp; + const char16_t *hexp; int rv, i; struct NumArgState* nas = nullptr; struct NumArgState nasArray[NAS_DEFAULT_NUM]; @@ -1091,7 +1091,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) #endif case 'S': - u.S = va_arg(ap, const PRUnichar*); + u.S = va_arg(ap, const char16_t*); rv = cvt_S(ss, u.S, width, prec, flags); if (rv < 0) { return rv; @@ -1118,7 +1118,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) #if 0 PR_ASSERT(0); #endif - PRUnichar perct = '%'; + char16_t perct = '%'; rv = (*ss->stuff)(ss, &perct, 1); if (rv < 0) { return rv; @@ -1131,7 +1131,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) } /* Stuff trailing NUL */ - PRUnichar null = '\0'; + char16_t null = '\0'; rv = (*ss->stuff)(ss, &null, 1); @@ -1145,7 +1145,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap) /************************************************************************/ static int -StringStuff(SprintfState* ss, const PRUnichar* sp, uint32_t len) +StringStuff(SprintfState* ss, const char16_t* sp, uint32_t len) { if (*sp == '\0') return 0; @@ -1165,10 +1165,10 @@ StringStuff(SprintfState* ss, const PRUnichar* sp, uint32_t len) ** Stuff routine that automatically grows the malloc'd output buffer ** before it overflows. */ -static int GrowStuff(SprintfState *ss, const PRUnichar *sp, uint32_t len) +static int GrowStuff(SprintfState *ss, const char16_t *sp, uint32_t len) { ptrdiff_t off; - PRUnichar *newbase; + char16_t *newbase; uint32_t newlen; off = ss->cur - ss->base; @@ -1176,9 +1176,9 @@ static int GrowStuff(SprintfState *ss, const PRUnichar *sp, uint32_t len) /* Grow the buffer */ newlen = ss->maxlen + ((len > 32) ? len : 32); if (ss->base) { - newbase = (PRUnichar*) nsMemory::Realloc(ss->base, newlen*sizeof(PRUnichar)); + newbase = (char16_t*) nsMemory::Realloc(ss->base, newlen*sizeof(char16_t)); } else { - newbase = (PRUnichar*) nsMemory::Alloc(newlen*sizeof(PRUnichar)); + newbase = (char16_t*) nsMemory::Alloc(newlen*sizeof(char16_t)); } if (!newbase) { /* Ran out of memory */ @@ -1201,10 +1201,10 @@ static int GrowStuff(SprintfState *ss, const PRUnichar *sp, uint32_t len) /* ** sprintf into a malloc'd buffer */ -PRUnichar * nsTextFormatter::smprintf(const PRUnichar *fmt, ...) +char16_t * nsTextFormatter::smprintf(const char16_t *fmt, ...) { va_list ap; - PRUnichar *rv; + char16_t *rv; va_start(ap, fmt); rv = nsTextFormatter::vsmprintf(fmt, ap); @@ -1212,7 +1212,7 @@ PRUnichar * nsTextFormatter::smprintf(const PRUnichar *fmt, ...) return rv; } -uint32_t nsTextFormatter::ssprintf(nsAString& out, const PRUnichar* fmt, ...) +uint32_t nsTextFormatter::ssprintf(nsAString& out, const char16_t* fmt, ...) { va_list ap; uint32_t rv; @@ -1223,7 +1223,7 @@ uint32_t nsTextFormatter::ssprintf(nsAString& out, const PRUnichar* fmt, ...) return rv; } -uint32_t nsTextFormatter::vssprintf(nsAString& out, const PRUnichar* fmt, va_list ap) +uint32_t nsTextFormatter::vssprintf(nsAString& out, const char16_t* fmt, va_list ap) { SprintfState ss; ss.stuff = StringStuff; @@ -1237,7 +1237,7 @@ uint32_t nsTextFormatter::vssprintf(nsAString& out, const PRUnichar* fmt, va_lis return n ? n - 1 : n; } -PRUnichar * nsTextFormatter::vsmprintf(const PRUnichar *fmt, va_list ap) +char16_t * nsTextFormatter::vsmprintf(const char16_t *fmt, va_list ap) { SprintfState ss; int rv; @@ -1259,7 +1259,7 @@ PRUnichar * nsTextFormatter::vsmprintf(const PRUnichar *fmt, va_list ap) /* ** Stuff routine that discards overflow data */ -static int LimitStuff(SprintfState *ss, const PRUnichar *sp, uint32_t len) +static int LimitStuff(SprintfState *ss, const char16_t *sp, uint32_t len) { uint32_t limit = ss->maxlen - (ss->cur - ss->base); @@ -1277,7 +1277,7 @@ static int LimitStuff(SprintfState *ss, const PRUnichar *sp, uint32_t len) ** sprintf into a fixed size buffer. Make sure there is a NUL at the end ** when finished. */ -uint32_t nsTextFormatter::snprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, ...) +uint32_t nsTextFormatter::snprintf(char16_t *out, uint32_t outlen, const char16_t *fmt, ...) { va_list ap; uint32_t rv; @@ -1293,7 +1293,7 @@ uint32_t nsTextFormatter::snprintf(PRUnichar *out, uint32_t outlen, const PRUnic return rv; } -uint32_t nsTextFormatter::vsnprintf(PRUnichar *out, uint32_t outlen,const PRUnichar *fmt, +uint32_t nsTextFormatter::vsnprintf(char16_t *out, uint32_t outlen,const char16_t *fmt, va_list ap) { SprintfState ss; @@ -1321,7 +1321,7 @@ uint32_t nsTextFormatter::vsnprintf(PRUnichar *out, uint32_t outlen,const PRUnic /* * Free memory allocated, for the caller, by smprintf */ -void nsTextFormatter::smprintf_free(PRUnichar *mem) +void nsTextFormatter::smprintf_free(char16_t *mem) { nsMemory::Free(mem); } diff --git a/xpcom/glue/nsTextFormatter.h b/xpcom/glue/nsTextFormatter.h index 89cc31192e3b..42c0bfdc3281 100644 --- a/xpcom/glue/nsTextFormatter.h +++ b/xpcom/glue/nsTextFormatter.h @@ -23,7 +23,7 @@ ** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above ** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above ** %s - utf8 string - ** %S - PRUnichar string + ** %S - char16_t string ** %c - character ** %p - pointer (deals with machine dependent pointer size) ** %f - float @@ -48,29 +48,29 @@ class NS_COM_GLUE nsTextFormatter { * terminated. Returns the length of the written output, NOT including the * null terminator, or (uint32_t)-1 if an error occurs. */ - static uint32_t snprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, ...); + static uint32_t snprintf(char16_t *out, uint32_t outlen, const char16_t *fmt, ...); /* * sprintf into a nsMemory::Alloc'd buffer. Return a pointer to * buffer on success, nullptr on failure. */ - static PRUnichar* smprintf(const PRUnichar *fmt, ...); + static char16_t* smprintf(const char16_t *fmt, ...); - static uint32_t ssprintf(nsAString& out, const PRUnichar* fmt, ...); + static uint32_t ssprintf(nsAString& out, const char16_t* fmt, ...); /* * va_list forms of the above. */ - static uint32_t vsnprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, va_list ap); - static PRUnichar* vsmprintf(const PRUnichar *fmt, va_list ap); - static uint32_t vssprintf(nsAString& out, const PRUnichar *fmt, va_list ap); + static uint32_t vsnprintf(char16_t *out, uint32_t outlen, const char16_t *fmt, va_list ap); + static char16_t* vsmprintf(const char16_t *fmt, va_list ap); + static uint32_t vssprintf(nsAString& out, const char16_t *fmt, va_list ap); /* * Free the memory allocated, for the caller, by smprintf. * -- Deprecated -- * Callers can substitute calling smprintf_free with nsMemory::Free */ - static void smprintf_free(PRUnichar *mem); + static void smprintf_free(char16_t *mem); }; diff --git a/xpcom/glue/nsVersionComparator.cpp b/xpcom/glue/nsVersionComparator.cpp index 0eb04b13a0fd..1e35daafc7bc 100644 --- a/xpcom/glue/nsVersionComparator.cpp +++ b/xpcom/glue/nsVersionComparator.cpp @@ -280,7 +280,7 @@ namespace mozilla { #ifdef XP_WIN int32_t -CompareVersions(const PRUnichar *A, const PRUnichar *B) +CompareVersions(const char16_t *A, const char16_t *B) { wchar_t *A2 = wcsdup(char16ptr_t(A)); if (!A2) diff --git a/xpcom/glue/nsVersionComparator.h b/xpcom/glue/nsVersionComparator.h index f5f65af61eff..22659f14faba 100644 --- a/xpcom/glue/nsVersionComparator.h +++ b/xpcom/glue/nsVersionComparator.h @@ -46,7 +46,7 @@ CompareVersions(const char *A, const char *B); #ifdef XP_WIN int32_t NS_COM_GLUE -CompareVersions(const PRUnichar *A, const PRUnichar *B); +CompareVersions(const char16_t *A, const char16_t *B); #endif struct NS_COM_GLUE Version @@ -98,12 +98,12 @@ struct NS_COM_GLUE Version #ifdef XP_WIN struct NS_COM_GLUE VersionW { - VersionW(const PRUnichar *versionStringW) + VersionW(const char16_t *versionStringW) { versionContentW = wcsdup(versionStringW); } - const PRUnichar* ReadContentW() const + const char16_t* ReadContentW() const { return versionContentW; } @@ -139,7 +139,7 @@ struct NS_COM_GLUE VersionW } private: - PRUnichar* versionContentW; + char16_t* versionContentW; }; #endif diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp index e2b7000864c9..45ac98ceb1c8 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -615,7 +615,7 @@ NS_StringContainerInit(nsStringContainer &aStr) XPCOM_API(nsresult) NS_StringContainerInit2(nsStringContainer &aStr, - const PRUnichar *aData, + const char16_t *aData, uint32_t aDataLength, uint32_t aFlags) { @@ -632,7 +632,7 @@ NS_StringContainerFinish(nsStringContainer &aStr) } XPCOM_API(uint32_t) -NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, bool *aTerm) +NS_StringGetData(const nsAString &aStr, const char16_t **aBuf, bool *aTerm) { if (!xpcomFunctions.stringGetData) { *aBuf = nullptr; @@ -642,7 +642,7 @@ NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, bool *aTerm) } XPCOM_API(uint32_t) -NS_StringGetMutableData(nsAString &aStr, uint32_t aLen, PRUnichar **aBuf) +NS_StringGetMutableData(nsAString &aStr, uint32_t aLen, char16_t **aBuf) { if (!xpcomFunctions.stringGetMutableData) { *aBuf = nullptr; @@ -651,7 +651,7 @@ NS_StringGetMutableData(nsAString &aStr, uint32_t aLen, PRUnichar **aBuf) return xpcomFunctions.stringGetMutableData(aStr, aLen, aBuf); } -XPCOM_API(PRUnichar*) +XPCOM_API(char16_t*) NS_StringCloneData(const nsAString &aStr) { if (!xpcomFunctions.stringCloneData) @@ -660,7 +660,7 @@ NS_StringCloneData(const nsAString &aStr) } XPCOM_API(nsresult) -NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, uint32_t aCount) +NS_StringSetData(nsAString &aStr, const char16_t *aBuf, uint32_t aCount) { if (!xpcomFunctions.stringSetData) return NS_ERROR_NOT_INITIALIZED; @@ -670,7 +670,7 @@ NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, uint32_t aCount) XPCOM_API(nsresult) NS_StringSetDataRange(nsAString &aStr, uint32_t aCutStart, uint32_t aCutLength, - const PRUnichar *aBuf, uint32_t aCount) + const char16_t *aBuf, uint32_t aCount) { if (!xpcomFunctions.stringSetDataRange) return NS_ERROR_NOT_INITIALIZED; diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 352df026c397..b81caa629efe 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -505,7 +505,7 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, int32_t len = ::GetWindowsDirectoryW(path, MAX_PATH); if (len == 0) break; - if (path[1] == PRUnichar(':') && path[2] == PRUnichar('\\')) + if (path[1] == char16_t(':') && path[2] == char16_t('\\')) path[3] = 0; return NS_NewLocalFile(nsDependentString(path), diff --git a/xpcom/io/nsAnonymousTemporaryFile.cpp b/xpcom/io/nsAnonymousTemporaryFile.cpp index de0cc43caf23..27fc50a4898d 100644 --- a/xpcom/io/nsAnonymousTemporaryFile.cpp +++ b/xpcom/io/nsAnonymousTemporaryFile.cpp @@ -191,7 +191,7 @@ public: NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (nsCRT::strcmp(aTopic, NS_TIMER_CALLBACK_TOPIC) == 0 && NS_FAILED(RegisterIdleObserver())) { diff --git a/xpcom/io/nsBinaryStream.cpp b/xpcom/io/nsBinaryStream.cpp index 67784f9eea54..e4e9315b73ab 100644 --- a/xpcom/io/nsBinaryStream.cpp +++ b/xpcom/io/nsBinaryStream.cpp @@ -172,7 +172,7 @@ nsBinaryOutputStream::WriteStringZ(const char *aString) } NS_IMETHODIMP -nsBinaryOutputStream::WriteWStringZ(const PRUnichar* aString) +nsBinaryOutputStream::WriteWStringZ(const char16_t* aString) { uint32_t length, byteCount; nsresult rv; @@ -183,17 +183,17 @@ nsBinaryOutputStream::WriteWStringZ(const PRUnichar* aString) if (length == 0) return NS_OK; - byteCount = length * sizeof(PRUnichar); + byteCount = length * sizeof(char16_t); #ifdef IS_BIG_ENDIAN rv = WriteBytes(reinterpret_cast(aString), byteCount); #else // XXX use WriteSegments here to avoid copy! - PRUnichar *copy, temp[64]; + char16_t *copy, temp[64]; if (length <= 64) { copy = temp; } else { - copy = reinterpret_cast(moz_malloc(byteCount)); + copy = reinterpret_cast(moz_malloc(byteCount)); if (!copy) return NS_ERROR_OUT_OF_MEMORY; } @@ -208,7 +208,7 @@ nsBinaryOutputStream::WriteWStringZ(const PRUnichar* aString) } NS_IMETHODIMP -nsBinaryOutputStream::WriteUtf8Z(const PRUnichar* aString) +nsBinaryOutputStream::WriteUtf8Z(const char16_t* aString) { return WriteStringZ(NS_ConvertUTF16toUTF8(aString).get()); } @@ -573,9 +573,9 @@ nsBinaryInputStream::ReadCString(nsACString& aString) // sometimes, WriteSegmentToString will be handed an odd-number of -// bytes, which means we only have half of the last PRUnichar +// bytes, which means we only have half of the last char16_t struct WriteStringClosure { - PRUnichar *mWriteCursor; + char16_t *mWriteCursor; bool mHasCarryoverByte; char mCarryoverByte; }; @@ -605,10 +605,10 @@ WriteSegmentToString(nsIInputStream* aStream, uint32_t *aWriteCount) { NS_PRECONDITION(aCount > 0, "Why are we being told to write 0 bytes?"); - NS_PRECONDITION(sizeof(PRUnichar) == 2, "We can't handle other sizes!"); + NS_PRECONDITION(sizeof(char16_t) == 2, "We can't handle other sizes!"); WriteStringClosure* closure = static_cast(aClosure); - PRUnichar *cursor = closure->mWriteCursor; + char16_t *cursor = closure->mWriteCursor; // we're always going to consume the whole buffer no matter what // happens, so take care of that right now.. that allows us to @@ -619,7 +619,7 @@ WriteSegmentToString(nsIInputStream* aStream, if (closure->mHasCarryoverByte) { // re-create the two-byte sequence we want to work with char bytes[2] = { closure->mCarryoverByte, *aFromSegment }; - *cursor = *(PRUnichar*)bytes; + *cursor = *(char16_t*)bytes; // Now the little endianness dance mozilla::NativeEndian::swapToBigEndianInPlace(cursor, 1); ++cursor; @@ -634,23 +634,23 @@ WriteSegmentToString(nsIInputStream* aStream, } // this array is possibly unaligned... be careful how we access it! - const PRUnichar *unicodeSegment = - reinterpret_cast(aFromSegment); + const char16_t *unicodeSegment = + reinterpret_cast(aFromSegment); // calculate number of full characters in segment (aCount could be odd!) - uint32_t segmentLength = aCount / sizeof(PRUnichar); + uint32_t segmentLength = aCount / sizeof(char16_t); // copy all data into our aligned buffer. byte swap if necessary. // cursor may be unaligned, so we cannot use copyAndSwapToBigEndian directly - memcpy(cursor, unicodeSegment, segmentLength * sizeof(PRUnichar)); - PRUnichar *end = cursor + segmentLength; + memcpy(cursor, unicodeSegment, segmentLength * sizeof(char16_t)); + char16_t *end = cursor + segmentLength; mozilla::NativeEndian::swapToBigEndianInPlace(cursor, segmentLength); closure->mWriteCursor = end; // remember this is the modifed aCount and aFromSegment, // so that will take into account the fact that we might have // skipped the first byte in the buffer - if (aCount % sizeof(PRUnichar) != 0) { + if (aCount % sizeof(char16_t) != 0) { // we must have had a carryover byte, that we'll need the next // time around closure->mCarryoverByte = aFromSegment[aCount - 1]; @@ -687,12 +687,12 @@ nsBinaryInputStream::ReadString(nsAString& aString) closure.mHasCarryoverByte = false; rv = ReadSegments(WriteSegmentToString, &closure, - length*sizeof(PRUnichar), &bytesRead); + length*sizeof(char16_t), &bytesRead); if (NS_FAILED(rv)) return rv; NS_ASSERTION(!closure.mHasCarryoverByte, "some strange stream corruption!"); - if (bytesRead != length*sizeof(PRUnichar)) + if (bytesRead != length*sizeof(char16_t)) return NS_ERROR_FAILURE; return NS_OK; diff --git a/xpcom/io/nsEscape.cpp b/xpcom/io/nsEscape.cpp index 28393596ac81..d1511db9a8c7 100644 --- a/xpcom/io/nsEscape.cpp +++ b/xpcom/io/nsEscape.cpp @@ -253,8 +253,8 @@ nsEscapeHTML(const char * string) return(rv); } -PRUnichar * -nsEscapeHTML2(const PRUnichar *aSourceBuffer, int32_t aSourceBufferLen) +char16_t * +nsEscapeHTML2(const char16_t *aSourceBuffer, int32_t aSourceBufferLen) { // Calculate the length, if the caller didn't. if (aSourceBufferLen < 0) { @@ -263,12 +263,12 @@ nsEscapeHTML2(const PRUnichar *aSourceBuffer, int32_t aSourceBufferLen) /* XXX Hardcoded max entity len. */ if (uint32_t(aSourceBufferLen) >= - ((UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) ) + ((UINT32_MAX - sizeof(char16_t)) / (6 * sizeof(char16_t))) ) return nullptr; - PRUnichar *resultBuffer = (PRUnichar *)nsMemory::Alloc(aSourceBufferLen * - 6 * sizeof(PRUnichar) + sizeof(PRUnichar('\0'))); - PRUnichar *ptr = resultBuffer; + char16_t *resultBuffer = (char16_t *)nsMemory::Alloc(aSourceBufferLen * + 6 * sizeof(char16_t) + sizeof(char16_t('\0'))); + char16_t *ptr = resultBuffer; if (resultBuffer) { int32_t i; diff --git a/xpcom/io/nsEscape.h b/xpcom/io/nsEscape.h index a734bce6ccb7..7e190ea9466a 100644 --- a/xpcom/io/nsEscape.h +++ b/xpcom/io/nsEscape.h @@ -51,8 +51,8 @@ int32_t nsUnescapeCount (char * str); char * nsEscapeHTML(const char * string); -PRUnichar * -nsEscapeHTML2(const PRUnichar *aSourceBuffer, +char16_t * +nsEscapeHTML2(const char16_t *aSourceBuffer, int32_t aSourceBufferLen = -1); /* * Escape problem char's for HTML display diff --git a/xpcom/io/nsIBinaryOutputStream.idl b/xpcom/io/nsIBinaryOutputStream.idl index 68b82642de93..4d426d580e9e 100644 --- a/xpcom/io/nsIBinaryOutputStream.idl +++ b/xpcom/io/nsIBinaryOutputStream.idl @@ -78,7 +78,7 @@ NS_WriteOptionalStringZ(nsIBinaryOutputStream* aStream, const char* aString) } inline nsresult -NS_WriteOptionalWStringZ(nsIBinaryOutputStream* aStream, const PRUnichar* aString) +NS_WriteOptionalWStringZ(nsIBinaryOutputStream* aStream, const char16_t* aString) { bool nonnull = (aString != nullptr); nsresult rv = aStream->WriteBoolean(nonnull); diff --git a/xpcom/io/nsIConverterInputStream.idl b/xpcom/io/nsIConverterInputStream.idl index 6f3d0107130e..7f35d8c5cead 100644 --- a/xpcom/io/nsIConverterInputStream.idl +++ b/xpcom/io/nsIConverterInputStream.idl @@ -17,7 +17,7 @@ interface nsIConverterInputStream : nsIUnicharInputStream { /** * Default replacement char value, U+FFFD REPLACEMENT CHARACTER. */ - const PRUnichar DEFAULT_REPLACEMENT_CHARACTER = 0xFFFD; + const char16_t DEFAULT_REPLACEMENT_CHARACTER = 0xFFFD; /** * Initialize this stream. @@ -35,6 +35,6 @@ interface nsIConverterInputStream : nsIUnicharInputStream { * byte sequences are encountered in the stream. */ void init (in nsIInputStream aStream, in string aCharset, - in long aBufferSize, in PRUnichar aReplacementChar); + in long aBufferSize, in char16_t aReplacementChar); }; diff --git a/xpcom/io/nsIConverterOutputStream.idl b/xpcom/io/nsIConverterOutputStream.idl index 66c30f0bcd7b..a93d3cfa6d5f 100644 --- a/xpcom/io/nsIConverterOutputStream.idl +++ b/xpcom/io/nsIConverterOutputStream.idl @@ -40,5 +40,5 @@ interface nsIConverterOutputStream : nsIUnicharOutputStream */ void init(in nsIOutputStream aOutStream, in string aCharset, in unsigned long aBufferSize, - in PRUnichar aReplacementCharacter); + in char16_t aReplacementCharacter); }; diff --git a/xpcom/io/nsIUnicharInputStream.idl b/xpcom/io/nsIUnicharInputStream.idl index f57557cc9057..c7176d26b8e6 100644 --- a/xpcom/io/nsIUnicharInputStream.idl +++ b/xpcom/io/nsIUnicharInputStream.idl @@ -30,7 +30,7 @@ interface nsIInputStream; */ typedef NS_CALLBACK(nsWriteUnicharSegmentFun)(nsIUnicharInputStream *aInStream, void *aClosure, - const PRUnichar *aFromSegment, + const char16_t *aFromSegment, uint32_t aToOffset, uint32_t aCount, uint32_t *aWriteCount); @@ -52,7 +52,7 @@ interface nsIUnicharInputStream : nsISupports { * * @note To read more than 2^32 characters, call this method multiple times. */ - [noscript] unsigned long read([array, size_is(aCount)] in PRUnichar aBuf, + [noscript] unsigned long read([array, size_is(aCount)] in char16_t aBuf, in unsigned long aCount); /** diff --git a/xpcom/io/nsIUnicharOutputStream.idl b/xpcom/io/nsIUnicharOutputStream.idl index fb5fd241b7ea..599224dd0a1e 100644 --- a/xpcom/io/nsIUnicharOutputStream.idl +++ b/xpcom/io/nsIUnicharOutputStream.idl @@ -19,7 +19,7 @@ interface nsIUnicharOutputStream : nsISupports * @retval false Not all bytes of the character could be written. */ boolean write(in unsigned long aCount, - [const, array, size_is(aCount)] in PRUnichar c); + [const, array, size_is(aCount)] in char16_t c); /** * Write a string to the stream. diff --git a/xpcom/io/nsLinebreakConverter.cpp b/xpcom/io/nsLinebreakConverter.cpp index dd4609b00833..9d69ce9b0b32 100644 --- a/xpcom/io/nsLinebreakConverter.cpp +++ b/xpcom/io/nsLinebreakConverter.cpp @@ -362,7 +362,7 @@ nsresult nsLinebreakConverter::ConvertLineBreaksInSitu(char **ioBuffer, ELinebre ConvertUnicharLineBreaks ----------------------------------------------------------------------------*/ -PRUnichar* nsLinebreakConverter::ConvertUnicharLineBreaks(const PRUnichar* aSrc, +char16_t* nsLinebreakConverter::ConvertUnicharLineBreaks(const char16_t* aSrc, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen) { NS_ASSERTION(aDestBreaks != eLinebreakAny && @@ -371,7 +371,7 @@ PRUnichar* nsLinebreakConverter::ConvertUnicharLineBreaks(const PRUnichar* aSrc, int32_t bufLen = (aSrcLen == kIgnoreLen) ? NS_strlen(aSrc) + 1 : aSrcLen; - PRUnichar* resultString; + char16_t* resultString; if (aSrcBreaks == eLinebreakAny) resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks)); else @@ -387,7 +387,7 @@ PRUnichar* nsLinebreakConverter::ConvertUnicharLineBreaks(const PRUnichar* aSrc, ConvertStringLineBreaks ----------------------------------------------------------------------------*/ -nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(PRUnichar **ioBuffer, +nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(char16_t **ioBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen) { NS_ASSERTION(ioBuffer && *ioBuffer, "Null pointer passed"); @@ -411,7 +411,7 @@ nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(PRUnichar **ioBuff } else { - PRUnichar* destBuffer; + char16_t* destBuffer; if (aSrcBreaks == eLinebreakAny) destBuffer = ConvertUnknownBreaks(*ioBuffer, sourceLen, dstBreaks); diff --git a/xpcom/io/nsLinebreakConverter.h b/xpcom/io/nsLinebreakConverter.h index ad445430aa41..264b4383779a 100644 --- a/xpcom/io/nsLinebreakConverter.h +++ b/xpcom/io/nsLinebreakConverter.h @@ -64,7 +64,7 @@ public: * terminated string. * @param aOutLen: used to return character length of returned buffer, if not null. */ - static PRUnichar* ConvertUnicharLineBreaks(const PRUnichar* aSrc, + static char16_t* ConvertUnicharLineBreaks(const char16_t* aSrc, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen = kIgnoreLen, int32_t* aOutLen = nullptr); @@ -114,7 +114,7 @@ public: * terminated string. * @param aOutLen: used to return character length of returned buffer, if not null. */ - static nsresult ConvertUnicharLineBreaksInSitu(PRUnichar **ioBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, + static nsresult ConvertUnicharLineBreaksInSitu(char16_t **ioBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen = kIgnoreLen, int32_t* aOutLen = nullptr); }; diff --git a/xpcom/io/nsLocalFile.h b/xpcom/io/nsLocalFile.h index e0eb90684245..896d34370984 100644 --- a/xpcom/io/nsLocalFile.h +++ b/xpcom/io/nsLocalFile.h @@ -19,16 +19,16 @@ #define NS_LOCAL_FILE_CID {0x2e23e220, 0x60be, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}} #define NS_DECL_NSLOCALFILE_UNICODE_METHODS \ - nsresult AppendUnicode(const PRUnichar *aNode); \ - nsresult GetUnicodeLeafName(PRUnichar **aLeafName); \ - nsresult SetUnicodeLeafName(const PRUnichar *aLeafName); \ - nsresult CopyToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \ - nsresult CopyToFollowingLinksUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \ - nsresult MoveToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \ - nsresult GetUnicodeTarget(PRUnichar **aTarget); \ - nsresult GetUnicodePath(PRUnichar **aPath); \ - nsresult InitWithUnicodePath(const PRUnichar *aPath); \ - nsresult AppendRelativeUnicodePath(const PRUnichar *aRelativePath); + nsresult AppendUnicode(const char16_t *aNode); \ + nsresult GetUnicodeLeafName(char16_t **aLeafName); \ + nsresult SetUnicodeLeafName(const char16_t *aLeafName); \ + nsresult CopyToUnicode(nsIFile *aNewParentDir, const char16_t *aNewLeafName); \ + nsresult CopyToFollowingLinksUnicode(nsIFile *aNewParentDir, const char16_t *aNewLeafName); \ + nsresult MoveToUnicode(nsIFile *aNewParentDir, const char16_t *aNewLeafName); \ + nsresult GetUnicodeTarget(char16_t **aTarget); \ + nsresult GetUnicodePath(char16_t **aPath); \ + nsresult InitWithUnicodePath(const char16_t *aPath); \ + nsresult AppendRelativeUnicodePath(const char16_t *aRelativePath); // nsXPComInit needs to know about how we are implemented, // so here we will export it. Other users should not depend diff --git a/xpcom/io/nsLocalFileCommon.cpp b/xpcom/io/nsLocalFileCommon.cpp index 4f235e52d272..f88ad368631a 100644 --- a/xpcom/io/nsLocalFileCommon.cpp +++ b/xpcom/io/nsLocalFileCommon.cpp @@ -79,7 +79,7 @@ nsLocalFile::CreateUnique(uint32_t type, uint32_t attributes) if (NS_FAILED(rv)) return rv; - const int32_t lastDot = leafName.RFindChar(PRUnichar('.')); + const int32_t lastDot = leafName.RFindChar(char16_t('.')); #else rv = GetNativeLeafName(leafName); if (NS_FAILED(rv)) @@ -156,24 +156,24 @@ nsLocalFile::CreateUnique(uint32_t type, uint32_t attributes) } #if defined(XP_WIN) || defined(XP_OS2) -static const PRUnichar kPathSeparatorChar = '\\'; +static const char16_t kPathSeparatorChar = '\\'; #elif defined(XP_UNIX) -static const PRUnichar kPathSeparatorChar = '/'; +static const char16_t kPathSeparatorChar = '/'; #else #error Need to define file path separator for your platform #endif -static int32_t SplitPath(PRUnichar *path, PRUnichar **nodeArray, int32_t arrayLen) +static int32_t SplitPath(char16_t *path, char16_t **nodeArray, int32_t arrayLen) { if (*path == 0) return 0; - PRUnichar **nodePtr = nodeArray; + char16_t **nodePtr = nodeArray; if (*path == kPathSeparatorChar) path++; *nodePtr++ = path; - for (PRUnichar *cp = path; *cp != 0; cp++) { + for (char16_t *cp = path; *cp != 0; cp++) { if (*cp == kPathSeparatorChar) { *cp++ = 0; if (*cp == 0) @@ -202,7 +202,7 @@ nsLocalFile::GetRelativeDescriptor(nsIFile *fromFile, nsACString& _retval) _retval.Truncate(0); nsAutoString thisPath, fromPath; - PRUnichar *thisNodes[kMaxNodesInPath], *fromNodes[kMaxNodesInPath]; + char16_t *thisNodes[kMaxNodesInPath], *fromNodes[kMaxNodesInPath]; int32_t thisNodeCnt, fromNodeCnt, nodeIndex; rv = GetPath(thisPath); @@ -213,8 +213,8 @@ nsLocalFile::GetRelativeDescriptor(nsIFile *fromFile, nsACString& _retval) return rv; // get raw pointer to mutable string buffer - PRUnichar *thisPathPtr; thisPath.BeginWriting(thisPathPtr); - PRUnichar *fromPathPtr; fromPath.BeginWriting(fromPathPtr); + char16_t *thisPathPtr; thisPath.BeginWriting(thisPathPtr); + char16_t *fromPathPtr; fromPath.BeginWriting(fromPathPtr); thisNodeCnt = SplitPath(thisPathPtr, thisNodes, kMaxNodesInPath); fromNodeCnt = SplitPath(fromPathPtr, fromNodes, kMaxNodesInPath); diff --git a/xpcom/io/nsLocalFileOS2.cpp b/xpcom/io/nsLocalFileOS2.cpp index 946701c3357c..6e7da4cd75e3 100644 --- a/xpcom/io/nsLocalFileOS2.cpp +++ b/xpcom/io/nsLocalFileOS2.cpp @@ -916,7 +916,7 @@ nsLocalFile::Normalize() // assign the root nsAutoString normal; - const PRUnichar * pathBuffer = path.get(); // simplify access to the buffer + const char16_t * pathBuffer = path.get(); // simplify access to the buffer normal.SetCapacity(path.Length()); // it won't ever grow longer normal.Assign(pathBuffer, rootIdx); diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 1607c3dfac88..215388e9d415 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1440,10 +1440,10 @@ nsLocalFile::IsExecutable(bool *_retval) else GetPath(path); - int32_t dotIdx = path.RFindChar(PRUnichar('.')); + int32_t dotIdx = path.RFindChar(char16_t('.')); if (dotIdx != kNotFound) { // Convert extension to lower case. - PRUnichar *p = path.BeginWriting(); + char16_t *p = path.BeginWriting(); for(p += dotIdx + 1; *p; p++) *p += (*p >= L'A' && *p <= L'Z') ? 'a' - 'A' : 0; diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 6c5d736eca62..5fc6d112d0a7 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -1021,7 +1021,7 @@ nsLocalFile::ResolveShortcut() if (mResolvedPath.Length() != MAX_PATH) return NS_ERROR_OUT_OF_MEMORY; - PRUnichar *resolvedPath = mResolvedPath.BeginWriting(); + char16_t *resolvedPath = mResolvedPath.BeginWriting(); // resolve this shortcut nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath); @@ -1178,8 +1178,8 @@ nsLocalFile::InitWithPath(const nsAString &filePath) if (begin == end) return NS_ERROR_FAILURE; - PRUnichar firstChar = *begin; - PRUnichar secondChar = *(++begin); + char16_t firstChar = *begin; + char16_t secondChar = *(++begin); // just do a sanity check. if it has any forward slashes, it is not a Native path // on windows. Also, it must have a colon at after the first char. @@ -1256,7 +1256,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes) // Skip the first 'X:\' for the first form, and skip the first full // '\\machine\volume\' segment for the second form. - PRUnichar* path = mResolvedPath.BeginWriting(); + char16_t* path = mResolvedPath.BeginWriting(); if (path[0] == L'\\' && path[1] == L'\\') { @@ -1484,7 +1484,7 @@ nsLocalFile::Normalize() return NS_OK; // assign the root - const PRUnichar * pathBuffer = path.get(); // simplify access to the buffer + const char16_t * pathBuffer = path.get(); // simplify access to the buffer mWorkingPath.SetCapacity(path.Length()); // it won't ever grow longer mWorkingPath.Assign(pathBuffer, rootIdx); @@ -1672,7 +1672,7 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& _retval) queryResult = ::VerQueryValueW(ver, subBlock, &value, &size); if (queryResult && value) { - _retval.Assign(static_cast(value)); + _retval.Assign(static_cast(value)); if (!_retval.IsEmpty()) { rv = NS_OK; @@ -1690,8 +1690,8 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& _retval) NS_IMETHODIMP nsLocalFile::SetShortcut(nsIFile* targetFile, nsIFile* workingDir, - const PRUnichar* args, - const PRUnichar* description, + const char16_t* args, + const char16_t* description, nsIFile* iconFile, int32_t iconIndex) { @@ -2343,7 +2343,7 @@ nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModifiedTime) } nsresult -nsLocalFile::SetModDate(PRTime aLastModifiedTime, const PRUnichar *filePath) +nsLocalFile::SetModDate(PRTime aLastModifiedTime, const char16_t *filePath) { // The FILE_FLAG_BACKUP_SEMANTICS is required in order to change the // modification time for directories. @@ -2603,7 +2603,7 @@ nsLocalFile::GetParent(nsIFile * *aParent) return NS_OK; } - int32_t offset = mWorkingPath.RFindChar(PRUnichar('\\')); + int32_t offset = mWorkingPath.RFindChar(char16_t('\\')); // adding this offset check that was removed in bug 241708 fixes mail // directories that aren't relative to/underneath the profile dir. // e.g., on a different drive. Before you remove them, please make @@ -2763,10 +2763,10 @@ nsLocalFile::IsExecutable(bool *_retval) } // Get extension. - int32_t dotIdx = path.RFindChar(PRUnichar('.')); + int32_t dotIdx = path.RFindChar(char16_t('.')); if ( dotIdx != kNotFound ) { // Convert extension to lower case. - PRUnichar *p = path.BeginWriting(); + char16_t *p = path.BeginWriting(); for( p+= dotIdx + 1; *p; p++ ) *p += (*p >= L'A' && *p <= L'Z') ? 'a' - 'A' : 0; diff --git a/xpcom/io/nsLocalFileWin.h b/xpcom/io/nsLocalFileWin.h index 9a796dfd6ea7..e5f39887594b 100644 --- a/xpcom/io/nsLocalFileWin.h +++ b/xpcom/io/nsLocalFileWin.h @@ -94,7 +94,7 @@ private: bool followSymlinks, bool move, bool skipNtfsAclReset = false); - nsresult SetModDate(int64_t aLastModifiedTime, const PRUnichar *filePath); + nsresult SetModDate(int64_t aLastModifiedTime, const char16_t *filePath); nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval); nsresult AppendInternal(const nsAFlatString &node, bool multipleComponents); diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp index 34b076b50c00..619c7a08a894 100644 --- a/xpcom/io/nsNativeCharsetUtils.cpp +++ b/xpcom/io/nsNativeCharsetUtils.cpp @@ -67,7 +67,7 @@ using namespace mozilla; #endif static void -isolatin1_to_utf16(const char **input, uint32_t *inputLeft, PRUnichar **output, uint32_t *outputLeft) +isolatin1_to_utf16(const char **input, uint32_t *inputLeft, char16_t **output, uint32_t *outputLeft) { while (*inputLeft && *outputLeft) { **output = (unsigned char) **input; @@ -79,7 +79,7 @@ isolatin1_to_utf16(const char **input, uint32_t *inputLeft, PRUnichar **output, } static void -utf16_to_isolatin1(const PRUnichar **input, uint32_t *inputLeft, char **output, uint32_t *outputLeft) +utf16_to_isolatin1(const char16_t **input, uint32_t *inputLeft, char **output, uint32_t *outputLeft) { while (*inputLeft && *outputLeft) { **output = (unsigned char) **input; @@ -182,7 +182,7 @@ xp_iconv_open(const char **to_list, const char **from_list) } /* - * PRUnichar[] is NOT a UCS-2 array BUT a UTF-16 string. Therefore, we + * char16_t[] is NOT a UCS-2 array BUT a UTF-16 string. Therefore, we * have to use UTF-16 with iconv(3) on platforms where it's supported. * However, the way UTF-16 and UCS-2 are interpreted varies across platforms * and implementations of iconv(3). On Tru64, it also depends on the environment @@ -254,8 +254,8 @@ public: ~nsNativeCharsetConverter(); nsresult NativeToUnicode(const char **input , uint32_t *inputLeft, - PRUnichar **output, uint32_t *outputLeft); - nsresult UnicodeToNative(const PRUnichar **input , uint32_t *inputLeft, + char16_t **output, uint32_t *outputLeft); + nsresult UnicodeToNative(const char16_t **input , uint32_t *inputLeft, char **output, uint32_t *outputLeft); static void GlobalInit(); @@ -450,7 +450,7 @@ nsNativeCharsetConverter::~nsNativeCharsetConverter() nsresult nsNativeCharsetConverter::NativeToUnicode(const char **input, uint32_t *inputLeft, - PRUnichar **output, + char16_t **output, uint32_t *outputLeft) { size_t res = 0; @@ -520,7 +520,7 @@ nsNativeCharsetConverter::NativeToUnicode(const char **input, } nsresult -nsNativeCharsetConverter::UnicodeToNative(const PRUnichar **input, +nsNativeCharsetConverter::UnicodeToNative(const char16_t **input, uint32_t *inputLeft, char **output, uint32_t *outputLeft) @@ -553,7 +553,7 @@ nsNativeCharsetConverter::UnicodeToNative(const PRUnichar **input, // convert one uchar at a time... while (inLeft && outLeft) { char *p = ubuf; - size_t n = sizeof(ubuf), one_uchar = sizeof(PRUnichar); + size_t n = sizeof(ubuf), one_uchar = sizeof(char16_t); res = xp_iconv(gUnicodeToUTF8, &in, &one_uchar, &p, &n); if (res == (size_t) -1) { NS_ERROR("conversion from utf-16 to utf-8 failed"); @@ -565,14 +565,14 @@ nsNativeCharsetConverter::UnicodeToNative(const PRUnichar **input, if (res == (size_t) -1) { if (errno == E2BIG) { // not enough room for last uchar... back up and return. - in -= sizeof(PRUnichar); + in -= sizeof(char16_t); res = 0; } else NS_ERROR("conversion from utf-8 to native failed"); break; } - inLeft -= sizeof(PRUnichar); + inLeft -= sizeof(char16_t); } (*input) += (*inputLeft - inLeft / 2); @@ -623,8 +623,8 @@ public: nsNativeCharsetConverter(); nsresult NativeToUnicode(const char **input , uint32_t *inputLeft, - PRUnichar **output, uint32_t *outputLeft); - nsresult UnicodeToNative(const PRUnichar **input , uint32_t *inputLeft, + char16_t **output, uint32_t *outputLeft); + nsresult UnicodeToNative(const char16_t **input , uint32_t *inputLeft, char **output, uint32_t *outputLeft); static void GlobalInit(); @@ -682,7 +682,7 @@ nsNativeCharsetConverter::GlobalInit() nsresult nsNativeCharsetConverter::NativeToUnicode(const char **input, uint32_t *inputLeft, - PRUnichar **output, + char16_t **output, uint32_t *outputLeft) { if (gWCharIsUnicode) { @@ -704,7 +704,7 @@ nsNativeCharsetConverter::NativeToUnicode(const char **input, tmp = (unsigned char) **input; incr = 1; } - **output = (PRUnichar) tmp; + **output = (char16_t) tmp; (*input) += incr; (*inputLeft) -= incr; (*output)++; @@ -721,7 +721,7 @@ nsNativeCharsetConverter::NativeToUnicode(const char **input, } nsresult -nsNativeCharsetConverter::UnicodeToNative(const PRUnichar **input, +nsNativeCharsetConverter::UnicodeToNative(const char16_t **input, uint32_t *inputLeft, char **output, uint32_t *outputLeft) @@ -793,7 +793,7 @@ NS_CopyNativeToUnicode(const nsACString &input, nsAString &output) nsAString::iterator out_iter; output.BeginWriting(out_iter); - PRUnichar *result = out_iter.get(); + char16_t *result = out_iter.get(); uint32_t resultLeft = inputLen; const char *buf = iter.get(); @@ -822,7 +822,7 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output) nsNativeCharsetConverter conv; - const PRUnichar *buf = iter.get(); + const char16_t *buf = iter.get(); uint32_t bufLeft = Distance(iter, end); while (bufLeft) { char *p = temp; @@ -899,7 +899,7 @@ NS_CopyNativeToUnicode(const nsACString &input, nsAString &output) nsAString::iterator out_iter; output.BeginWriting(out_iter); - PRUnichar *result = out_iter.get(); + char16_t *result = out_iter.get(); ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen); } @@ -945,13 +945,13 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output) // moved from widget/windows/nsToolkit.cpp int32_t -NS_ConvertAtoW(const char *aStrInA, int aBufferSize, PRUnichar *aStrOutW) +NS_ConvertAtoW(const char *aStrInA, int aBufferSize, char16_t *aStrOutW) { return MultiByteToWideChar(CP_ACP, 0, aStrInA, -1, aStrOutW, aBufferSize); } int32_t -NS_ConvertWtoA(const PRUnichar *aStrInW, int aBufferSizeOut, +NS_ConvertWtoA(const char16_t *aStrInW, int aBufferSizeOut, char *aStrOutA, const char *aDefault) { if ((!aStrInW) || (!aStrOutA) || (aBufferSizeOut <= 0)) @@ -1043,7 +1043,7 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output) nsAString::const_iterator iter; input.BeginReading(iter); - UniChar* inputStr = (UniChar*) const_cast(iter.get()); + UniChar* inputStr = (UniChar*) const_cast(iter.get()); // maximum length of unicode string of length x converted to native // codepage is x*2 diff --git a/xpcom/io/nsUnicharInputStream.cpp b/xpcom/io/nsUnicharInputStream.cpp index d79419395e9e..49346133e2c4 100644 --- a/xpcom/io/nsUnicharInputStream.cpp +++ b/xpcom/io/nsUnicharInputStream.cpp @@ -39,7 +39,7 @@ private: }; NS_IMETHODIMP -StringUnicharInputStream::Read(PRUnichar* aBuf, +StringUnicharInputStream::Read(char16_t* aBuf, uint32_t aCount, uint32_t *aReadCount) { @@ -49,12 +49,12 @@ StringUnicharInputStream::Read(PRUnichar* aBuf, } nsAString::const_iterator iter; mString.BeginReading(iter); - const PRUnichar* us = iter.get(); + const char16_t* us = iter.get(); uint32_t amount = mLen - mPos; if (amount > aCount) { amount = aCount; } - memcpy(aBuf, us + mPos, sizeof(PRUnichar) * amount); + memcpy(aBuf, us + mPos, sizeof(char16_t) * amount); mPos += amount; *aReadCount = amount; return NS_OK; @@ -139,7 +139,7 @@ protected: nsCOMPtr mInput; FallibleTArray mByteData; - FallibleTArray mUnicharData; + FallibleTArray mUnicharData; uint32_t mByteDataOffset; uint32_t mUnicharDataOffset; @@ -180,7 +180,7 @@ nsresult UTF8InputStream::Close() return NS_OK; } -nsresult UTF8InputStream::Read(PRUnichar* aBuf, +nsresult UTF8InputStream::Read(char16_t* aBuf, uint32_t aCount, uint32_t *aReadCount) { @@ -200,7 +200,7 @@ nsresult UTF8InputStream::Read(PRUnichar* aBuf, readCount = aCount; } memcpy(aBuf, mUnicharData.Elements() + mUnicharDataOffset, - readCount * sizeof(PRUnichar)); + readCount * sizeof(char16_t)); mUnicharDataOffset += readCount; *aReadCount = readCount; return NS_OK; @@ -269,7 +269,7 @@ UTF8InputStream::ReadString(uint32_t aCount, nsAString& aString, if (readCount > aCount) { readCount = aCount; } - const PRUnichar* buf = mUnicharData.Elements() + mUnicharDataOffset; + const char16_t* buf = mUnicharData.Elements() + mUnicharDataOffset; aString.Assign(buf, readCount); mUnicharDataOffset += readCount; diff --git a/xpcom/io/nsWildCard.cpp b/xpcom/io/nsWildCard.cpp index 39107adf2e77..60e39c7e7964 100644 --- a/xpcom/io/nsWildCard.cpp +++ b/xpcom/io/nsWildCard.cpp @@ -145,7 +145,7 @@ NS_WildCardValid(const char *expr) } int -NS_WildCardValid(const PRUnichar *expr) +NS_WildCardValid(const char16_t *expr) { return NS_WildCardValid_(expr); } @@ -432,7 +432,7 @@ NS_WildCardMatch(const char *str, const char *xp, } int -NS_WildCardMatch(const PRUnichar *str, const PRUnichar *xp, +NS_WildCardMatch(const char16_t *str, const char16_t *xp, bool case_insensitive) { return NS_WildCardMatch_(str, xp, case_insensitive); diff --git a/xpcom/io/nsWildCard.h b/xpcom/io/nsWildCard.h index 85bff098f0cf..e579bbf339a9 100644 --- a/xpcom/io/nsWildCard.h +++ b/xpcom/io/nsWildCard.h @@ -39,7 +39,7 @@ int NS_WildCardValid(const char *expr); -int NS_WildCardValid(const PRUnichar *expr); +int NS_WildCardValid(const char16_t *expr); /* return values for the search routines */ #define MATCH 0 @@ -57,7 +57,7 @@ int NS_WildCardValid(const PRUnichar *expr); int NS_WildCardMatch(const char *str, const char *expr, bool case_insensitive); -int NS_WildCardMatch(const PRUnichar *str, const PRUnichar *expr, +int NS_WildCardMatch(const char16_t *str, const char16_t *expr, bool case_insensitive); #endif /* nsWildCard_h__ */ diff --git a/xpcom/reflect/xptcall/public/xptcall.h b/xpcom/reflect/xptcall/public/xptcall.h index af32024c7e1c..67ad2655ea08 100644 --- a/xpcom/reflect/xptcall/public/xptcall.h +++ b/xpcom/reflect/xptcall/public/xptcall.h @@ -32,7 +32,7 @@ struct nsXPTCMiniVariant double d; bool b; char c; - PRUnichar wc; + char16_t wc; void* p; // Types below here are unknown to the assembly implementations, and diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_alpha_openbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_alpha_openbsd.cpp index 60e5428d966c..bf449050a5c1 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_alpha_openbsd.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_alpha_openbsd.cpp @@ -84,7 +84,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args) break; case nsXPTType::T_BOOL : dp->val.b = (bool) *ap; break; case nsXPTType::T_CHAR : dp->val.c = (char) *ap; break; - case nsXPTType::T_WCHAR : dp->val.wc = (PRUnichar) *ap; break; + case nsXPTType::T_WCHAR : dp->val.wc = (char16_t) *ap; break; default: NS_ERROR("bad type"); break; diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp index 3d5a0969a7c6..2f928b1085ec 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp @@ -81,7 +81,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args) break; case nsXPTType::T_BOOL : dp->val.b = (bool) *ap; break; case nsXPTType::T_CHAR : dp->val.c = (char) *ap; break; - case nsXPTType::T_WCHAR : dp->val.wc = (PRUnichar) *ap; break; + case nsXPTType::T_WCHAR : dp->val.wc = (char16_t) *ap; break; default: NS_ERROR("bad type"); break; diff --git a/xpcom/sample/nsSample.cpp b/xpcom/sample/nsSample.cpp index 9445567bfab6..28013080453b 100644 --- a/xpcom/sample/nsSample.cpp +++ b/xpcom/sample/nsSample.cpp @@ -126,13 +126,13 @@ nsSampleImpl::WriteValue(const char* aPrefix) // This next part illustrates the nsEmbedString: nsEmbedString foopy; - foopy.Append(PRUnichar('f')); - foopy.Append(PRUnichar('o')); - foopy.Append(PRUnichar('o')); - foopy.Append(PRUnichar('p')); - foopy.Append(PRUnichar('y')); + foopy.Append(char16_t('f')); + foopy.Append(char16_t('o')); + foopy.Append(char16_t('o')); + foopy.Append(char16_t('p')); + foopy.Append(char16_t('y')); - const PRUnichar* f = foopy.get(); + const char16_t* f = foopy.get(); uint32_t l = foopy.Length(); printf("%c%c%c%c%c %d\n", char(f[0]), char(f[1]), char(f[2]), char(f[3]), char(f[4]), l); diff --git a/xpcom/sample/nsSample.h b/xpcom/sample/nsSample.h index 8122c5ae129b..fef66e7bad16 100644 --- a/xpcom/sample/nsSample.h +++ b/xpcom/sample/nsSample.h @@ -90,7 +90,7 @@ public: * of wstring (wide string), the Unicode type. If the world were a * perfect place, all normal strings in XPCOM interfaces would be unicode. * If this type had been specified as wstring, it would appear as - * PRUnichar * in C++, which is the NSPR type for unicode characters. + * char16_t * in C++, which is the NSPR type for unicode characters. */ /* NS_IMETHOD Poke(const char* aValue); */ diff --git a/xpcom/string/public/nsCharTraits.h b/xpcom/string/public/nsCharTraits.h index 46c34a935705..0c424ea0b45d 100644 --- a/xpcom/string/public/nsCharTraits.h +++ b/xpcom/string/public/nsCharTraits.h @@ -14,7 +14,7 @@ #ifndef nscore_h___ #include "nscore.h" - // for |PRUnichar| + // for |char16_t| #endif // This file may be used (through nsUTF8Utils.h) from non-XPCOM code, in @@ -33,7 +33,7 @@ #endif /* - * Some macros for converting PRUnichar (UTF-16) to and from Unicode scalar + * Some macros for converting char16_t (UTF-16) to and from Unicode scalar * values. * * Note that UTF-16 represents all Unicode scalar values up to U+10FFFF by @@ -73,19 +73,19 @@ // Since (c - 0x10000) >> 10 == (c >> 10) - 0x0080 and // 0xD7C0 == 0xD800 - 0x0080, // ((c - 0x10000) >> 10) + 0xD800 can be simplified to -#define H_SURROGATE(c) PRUnichar(PRUnichar(uint32_t(c) >> 10) + \ - PRUnichar(0xD7C0)) +#define H_SURROGATE(c) char16_t(char16_t(uint32_t(c) >> 10) + \ + char16_t(0xD7C0)) // where it's to be noted that 0xD7C0 is not bitwise-OR'd // but added. // Since 0x10000 & 0x03FF == 0, // (c - 0x10000) & 0x03FF == c & 0x03FF so that // ((c - 0x10000) & 0x03FF) | 0xDC00 is equivalent to -#define L_SURROGATE(c) PRUnichar(PRUnichar(uint32_t(c) & uint32_t(0x03FF)) | \ - PRUnichar(0xDC00)) +#define L_SURROGATE(c) char16_t(char16_t(uint32_t(c) & uint32_t(0x03FF)) | \ + char16_t(0xDC00)) #define IS_IN_BMP(ucs) (uint32_t(ucs) < PLANE1_BASE) -#define UCS2_REPLACEMENT_CHAR PRUnichar(0xFFFD) +#define UCS2_REPLACEMENT_CHAR char16_t(0xFFFD) #define UCS_END uint32_t(0x00110000) #define IS_VALID_CHAR(c) ((uint32_t(c) < UCS_END) && !IS_SURROGATE(c)) @@ -94,9 +94,9 @@ template struct nsCharTraits {}; template <> -struct nsCharTraits +struct nsCharTraits { - typedef PRUnichar char_type; + typedef char16_t char_type; typedef uint16_t unsigned_char_type; typedef char incompatible_char_type; @@ -324,7 +324,7 @@ struct nsCharTraits { typedef char char_type; typedef unsigned char unsigned_char_type; - typedef PRUnichar incompatible_char_type; + typedef char16_t incompatible_char_type; static char_type *sEmptyBuffer; diff --git a/xpcom/string/public/nsReadableUtils.h b/xpcom/string/public/nsReadableUtils.h index 137666d79ed7..a44514524ff4 100644 --- a/xpcom/string/public/nsReadableUtils.h +++ b/xpcom/string/public/nsReadableUtils.h @@ -18,7 +18,7 @@ template class nsTArray; -inline size_t Distance( const nsReadingIterator& start, const nsReadingIterator& end ) +inline size_t Distance( const nsReadingIterator& start, const nsReadingIterator& end ) { return end.get() - start.get(); } @@ -30,19 +30,19 @@ inline size_t Distance( const nsReadingIterator& start, const nsReadingIte void LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest ); void CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest ); -void LossyCopyUTF16toASCII( const PRUnichar* aSource, nsACString& aDest ); +void LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest ); void CopyASCIItoUTF16( const char* aSource, nsAString& aDest ); void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest ); void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest ); -void CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest ); +void CopyUTF16toUTF8( const char16_t* aSource, nsACString& aDest ); void CopyUTF8toUTF16( const char* aSource, nsAString& aDest ); void LossyAppendUTF16toASCII( const nsAString& aSource, nsACString& aDest ); void AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest ); -void LossyAppendUTF16toASCII( const PRUnichar* aSource, nsACString& aDest ); +void LossyAppendUTF16toASCII( const char16_t* aSource, nsACString& aDest ); void AppendASCIItoUTF16( const char* aSource, nsAString& aDest ); void AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest ); @@ -50,7 +50,7 @@ void AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest ); bool AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest, const mozilla::fallible_t& ) NS_WARN_UNUSED_RESULT; -void AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest ); +void AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest ); void AppendUTF8toUTF16( const char* aSource, nsAString& aDest ); #ifdef MOZ_USE_CHAR16_WRAPPER @@ -95,7 +95,7 @@ char* ToNewCString( const nsACString& aSource ); * The new buffer is zero-terminated, but that may not help you if |aSource| * contains embedded nulls. * - * @param aSource a UTF-16 string (made of PRUnichar's) + * @param aSource a UTF-16 string (made of char16_t's) * @param aUTF8Count the number of 8-bit units that was returned * @return a new |char| buffer you must free with |nsMemory::Free|. */ @@ -104,35 +104,35 @@ char* ToNewUTF8String( const nsAString& aSource, uint32_t *aUTF8Count = nullptr /** - * Returns a new |PRUnichar| buffer containing a zero-terminated copy of + * Returns a new |char16_t| buffer containing a zero-terminated copy of * |aSource|. * - * Allocates and returns a new |PRUnichar| buffer which you must free with + * Allocates and returns a new |char16_t| buffer which you must free with * |nsMemory::Free|. * The new buffer is zero-terminated, but that may not help you if |aSource| * contains embedded nulls. * * @param aSource a UTF-16 string - * @return a new |PRUnichar| buffer you must free with |nsMemory::Free|. + * @return a new |char16_t| buffer you must free with |nsMemory::Free|. */ -PRUnichar* ToNewUnicode( const nsAString& aSource ); +char16_t* ToNewUnicode( const nsAString& aSource ); /** - * Returns a new |PRUnichar| buffer containing a zero-terminated copy of |aSource|. + * Returns a new |char16_t| buffer containing a zero-terminated copy of |aSource|. * - * Allocates and returns a new |PRUnichar| buffer which you must free with |nsMemory::Free|. + * Allocates and returns a new |char16_t| buffer which you must free with |nsMemory::Free|. * Performs an encoding conversion by 0-padding 8-bit wide characters up to 16-bits wide while copying |aSource| to your new buffer. * This conversion is not well defined; but it reproduces legacy string behavior. * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls. * * @param aSource an 8-bit wide string (a C-string, NOT UTF-8) - * @return a new |PRUnichar| buffer you must free with |nsMemory::Free|. + * @return a new |char16_t| buffer you must free with |nsMemory::Free|. */ -PRUnichar* ToNewUnicode( const nsACString& aSource ); +char16_t* ToNewUnicode( const nsACString& aSource ); /** - * Returns the required length for a PRUnichar buffer holding + * Returns the required length for a char16_t buffer holding * a copy of aSource, using UTF-8 to UTF-16 conversion. * The length does NOT include any space for zero-termination. * @@ -147,7 +147,7 @@ uint32_t CalcUTF8ToUnicodeLength( const nsACString& aSource ); * strings. * The copied string will be zero-terminated! Any embedded nulls will be * copied nonetheless. It is the caller's responsiblity to ensure the buffer - * is large enough to hold the string copy plus one PRUnichar for + * is large enough to hold the string copy plus one char16_t for * zero-termination! * * @see CalcUTF8ToUnicodeLength( const nsACString& ) @@ -159,12 +159,12 @@ uint32_t CalcUTF8ToUnicodeLength( const nsACString& aSource ); * were copied * @return aBuffer pointer, for convenience */ -PRUnichar* UTF8ToUnicodeBuffer( const nsACString& aSource, - PRUnichar *aBuffer, +char16_t* UTF8ToUnicodeBuffer( const nsACString& aSource, + char16_t *aBuffer, uint32_t *aUTF16Count = nullptr ); /** - * Returns a new |PRUnichar| buffer containing a zero-terminated copy + * Returns a new |char16_t| buffer containing a zero-terminated copy * of |aSource|. * * Allocates and returns a new |char| buffer which you must free with @@ -175,26 +175,26 @@ PRUnichar* UTF8ToUnicodeBuffer( const nsACString& aSource, * * @param aSource an 8-bit wide string, UTF-8 encoded * @param aUTF16Count the number of 16-bit units that was returned - * @return a new |PRUnichar| buffer you must free with |nsMemory::Free|. + * @return a new |char16_t| buffer you must free with |nsMemory::Free|. * (UTF-16 encoded) */ -PRUnichar* UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count = nullptr ); +char16_t* UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count = nullptr ); /** * Copies |aLength| 16-bit code units from the start of |aSource| to the - * |PRUnichar| buffer |aDest|. + * |char16_t| buffer |aDest|. * * After this operation |aDest| is not null terminated. * * @param aSource a UTF-16 string * @param aSrcOffset start offset in the source string - * @param aDest a |PRUnichar| buffer + * @param aDest a |char16_t| buffer * @param aLength the number of 16-bit code units to copy * @return pointer to destination buffer - identical to |aDest| */ -PRUnichar* CopyUnicodeTo( const nsAString& aSource, +char16_t* CopyUnicodeTo( const nsAString& aSource, uint32_t aSrcOffset, - PRUnichar* aDest, + char16_t* aDest, uint32_t aLength ); @@ -346,14 +346,14 @@ bool RFindInReadable( const nsACString& aPattern, nsACString::const_iterator&, n * point to the match. If no match was found, returns |false| and * makes |aSearchStart == aSearchEnd|. */ -bool FindCharInReadable( PRUnichar aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd ); +bool FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd ); bool FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const nsACString::const_iterator& aSearchEnd ); /** * Finds the number of occurences of |aChar| in the string |aStr| */ uint32_t CountCharInReadable( const nsAString& aStr, - PRUnichar aChar ); + char16_t aChar ); uint32_t CountCharInReadable( const nsACString& aStr, char aChar ); diff --git a/xpcom/string/public/nsString.h b/xpcom/string/public/nsString.h index cd32c6959992..2f53b8712975 100644 --- a/xpcom/string/public/nsString.h +++ b/xpcom/string/public/nsString.h @@ -48,7 +48,7 @@ #include "nsTString.h" #include "string-template-undef.h" -static_assert(sizeof(PRUnichar) == 2, "size of PRUnichar must be 2"); +static_assert(sizeof(char16_t) == 2, "size of char16_t must be 2"); static_assert(sizeof(nsString::char_type) == 2, "size of nsString::char_type must be 2"); static_assert(nsString::char_type(-1) > nsString::char_type(0), @@ -64,12 +64,12 @@ class NS_LossyConvertUTF16toASCII : public nsAutoCString { public: explicit - NS_LossyConvertUTF16toASCII( const PRUnichar* aString ) + NS_LossyConvertUTF16toASCII( const char16_t* aString ) { LossyAppendUTF16toASCII(aString, *this); } - NS_LossyConvertUTF16toASCII( const PRUnichar* aString, uint32_t aLength ) + NS_LossyConvertUTF16toASCII( const char16_t* aString, uint32_t aLength ) { LossyAppendUTF16toASCII(Substring(aString, aLength), *this); } @@ -117,7 +117,7 @@ class NS_ConvertASCIItoUTF16 : public nsAutoString private: // NOT TO BE IMPLEMENTED - NS_ConvertASCIItoUTF16( PRUnichar ); + NS_ConvertASCIItoUTF16( char16_t ); }; @@ -128,21 +128,21 @@ class NS_ConvertUTF16toUTF8 : public nsAutoCString { public: explicit - NS_ConvertUTF16toUTF8( const PRUnichar* aString ) + NS_ConvertUTF16toUTF8( const char16_t* aString ) { AppendUTF16toUTF8(aString, *this); } - NS_ConvertUTF16toUTF8( const PRUnichar* aString, uint32_t aLength ) + NS_ConvertUTF16toUTF8( const char16_t* aString, uint32_t aLength ) { AppendUTF16toUTF8(Substring(aString, aLength), *this); } #ifdef MOZ_USE_CHAR16_WRAPPER - NS_ConvertUTF16toUTF8( char16ptr_t aString ) : NS_ConvertUTF16toUTF8(static_cast(aString)) {} + NS_ConvertUTF16toUTF8( char16ptr_t aString ) : NS_ConvertUTF16toUTF8(static_cast(aString)) {} NS_ConvertUTF16toUTF8( char16ptr_t aString, uint32_t aLength ) - : NS_ConvertUTF16toUTF8(static_cast(aString), aLength) {} + : NS_ConvertUTF16toUTF8(static_cast(aString), aLength) {} #endif explicit @@ -179,7 +179,7 @@ class NS_ConvertUTF8toUTF16 : public nsAutoString private: // NOT TO BE IMPLEMENTED - NS_ConvertUTF8toUTF16( PRUnichar ); + NS_ConvertUTF8toUTF16( char16_t ); }; @@ -220,6 +220,6 @@ inline int32_t MaxInt(int32_t x, int32_t y) * Return the given buffer to the heap manager. Calls allocator::Free() */ inline void Recycle( char* aBuffer) { nsMemory::Free(aBuffer); } -inline void Recycle( PRUnichar* aBuffer) { nsMemory::Free(aBuffer); } +inline void Recycle( char16_t* aBuffer) { nsMemory::Free(aBuffer); } #endif // !defined(nsString_h___) diff --git a/xpcom/string/public/nsStringFwd.h b/xpcom/string/public/nsStringFwd.h index 0a91390f39ce..d88266af4f4f 100644 --- a/xpcom/string/public/nsStringFwd.h +++ b/xpcom/string/public/nsStringFwd.h @@ -17,7 +17,7 @@ #endif /** - * double-byte (PRUnichar) string types + * double-byte (char16_t) string types */ class nsAString; diff --git a/xpcom/string/public/nsTString.h b/xpcom/string/public/nsTString.h index c097d4778046..43c4090303d6 100644 --- a/xpcom/string/public/nsTString.h +++ b/xpcom/string/public/nsTString.h @@ -130,7 +130,7 @@ class nsTString_CharT : public nsTSubstring_CharT #ifdef CharT_is_PRUnichar int32_t Find( const nsAFlatString& aString, int32_t aOffset=0, int32_t aCount=-1 ) const; - int32_t Find( const PRUnichar* aString, int32_t aOffset=0, int32_t aCount=-1 ) const; + int32_t Find( const char16_t* aString, int32_t aOffset=0, int32_t aCount=-1 ) const; #ifdef MOZ_USE_CHAR16_WRAPPER int32_t Find( char16ptr_t aString, int32_t aOffset=0, int32_t aCount=-1 ) const { @@ -157,7 +157,7 @@ class nsTString_CharT : public nsTSubstring_CharT #ifdef CharT_is_PRUnichar int32_t RFind( const nsAFlatString& aString, int32_t aOffset=-1, int32_t aCount=-1 ) const; - int32_t RFind( const PRUnichar* aString, int32_t aOffset=-1, int32_t aCount=-1 ) const; + int32_t RFind( const char16_t* aString, int32_t aOffset=-1, int32_t aCount=-1 ) const; #endif @@ -171,8 +171,8 @@ class nsTString_CharT : public nsTSubstring_CharT * @return offset in string, or kNotFound */ - // int32_t FindChar( PRUnichar aChar, int32_t aOffset=0, int32_t aCount=-1 ) const; - int32_t RFindChar( PRUnichar aChar, int32_t aOffset=-1, int32_t aCount=-1 ) const; + // int32_t FindChar( char16_t aChar, int32_t aOffset=0, int32_t aCount=-1 ) const; + int32_t RFindChar( char16_t aChar, int32_t aOffset=-1, int32_t aCount=-1 ) const; /** @@ -192,7 +192,7 @@ class nsTString_CharT : public nsTSubstring_CharT } #ifdef CharT_is_PRUnichar - int32_t FindCharInSet( const PRUnichar* aString, int32_t aOffset=0 ) const; + int32_t FindCharInSet( const char16_t* aString, int32_t aOffset=0 ) const; #endif @@ -320,7 +320,7 @@ class nsTString_CharT : public nsTSubstring_CharT * @return TRUE if successful */ - bool SetCharAt( PRUnichar aChar, uint32_t aIndex ); + bool SetCharAt( char16_t aChar, uint32_t aIndex ); /** diff --git a/xpcom/string/public/nsUTF8Utils.h b/xpcom/string/public/nsUTF8Utils.h index be9ea17582f1..e94e08ad3207 100644 --- a/xpcom/string/public/nsUTF8Utils.h +++ b/xpcom/string/public/nsUTF8Utils.h @@ -172,12 +172,12 @@ private: class UTF16CharEnumerator { public: - static uint32_t NextChar(const PRUnichar **buffer, const PRUnichar *end, + static uint32_t NextChar(const char16_t **buffer, const char16_t *end, bool *err = nullptr) { NS_ASSERTION(buffer && *buffer, "null buffer!"); - const PRUnichar *p = *buffer; + const char16_t *p = *buffer; if (p >= end) { @@ -188,7 +188,7 @@ public: return 0; } - PRUnichar c = *p++; + char16_t c = *p++; if (!IS_SURROGATE(c)) // U+0000 - U+D7FF,U+E000 - U+FFFF { @@ -214,7 +214,7 @@ public: } // D800- DBFF - High Surrogate - PRUnichar h = c; + char16_t h = c; c = *p++; @@ -277,7 +277,7 @@ class ConvertUTF8toUTF16 { public: typedef char value_type; - typedef PRUnichar buffer_type; + typedef char16_t buffer_type; ConvertUTF8toUTF16( buffer_type* aBuffer ) : mStart(aBuffer), mBuffer(aBuffer), mErrorEncountered(false) {} @@ -437,7 +437,7 @@ class CalculateUTF8Length class ConvertUTF16toUTF8 { public: - typedef PRUnichar value_type; + typedef char16_t value_type; typedef char buffer_type; // The error handling here is more lenient than that in @@ -559,7 +559,7 @@ class ConvertUTF16toUTF8 class CalculateUTF8Size { public: - typedef PRUnichar value_type; + typedef char16_t value_type; CalculateUTF8Size() : mSize(0) { } @@ -633,17 +633,17 @@ class CalculateUTF8Size #ifdef MOZILLA_INTERNAL_API /** * A character sink that performs a |reinterpret_cast|-style conversion - * from char to PRUnichar. + * from char to char16_t. */ class LossyConvertEncoding8to16 { public: typedef char value_type; typedef char input_type; - typedef PRUnichar output_type; + typedef char16_t output_type; public: - LossyConvertEncoding8to16( PRUnichar* aDestination ) : + LossyConvertEncoding8to16( char16_t* aDestination ) : mDestination(aDestination) { } void @@ -658,7 +658,7 @@ class LossyConvertEncoding8to16 #endif const char* done_writing = aSource + aSourceLength; while ( aSource < done_writing ) - *mDestination++ = (PRUnichar)(unsigned char)(*aSource++); + *mDestination++ = (char16_t)(unsigned char)(*aSource++); } void @@ -667,28 +667,28 @@ class LossyConvertEncoding8to16 void write_terminator() { - *mDestination = (PRUnichar)(0); + *mDestination = (char16_t)(0); } private: - PRUnichar* mDestination; + char16_t* mDestination; }; /** * A character sink that performs a |reinterpret_cast|-style conversion - * from PRUnichar to char. + * from char16_t to char. */ class LossyConvertEncoding16to8 { public: - typedef PRUnichar value_type; - typedef PRUnichar input_type; + typedef char16_t value_type; + typedef char16_t input_type; typedef char output_type; LossyConvertEncoding16to8( char* aDestination ) : mDestination(aDestination) { } void - write( const PRUnichar* aSource, uint32_t aSourceLength) + write( const char16_t* aSource, uint32_t aSourceLength) { #ifdef MOZILLA_MAY_SUPPORT_SSE2 if (mozilla::supports_sse2()) @@ -697,14 +697,14 @@ class LossyConvertEncoding16to8 return; } #endif - const PRUnichar* done_writing = aSource + aSourceLength; + const char16_t* done_writing = aSource + aSourceLength; while ( aSource < done_writing ) *mDestination++ = (char)(*aSource++); } #ifdef MOZILLA_MAY_SUPPORT_SSE2 void - write_sse2( const PRUnichar* aSource, uint32_t aSourceLength ); + write_sse2( const char16_t* aSource, uint32_t aSourceLength ); #endif void diff --git a/xpcom/string/public/nsXPCOMStrings.h b/xpcom/string/public/nsXPCOMStrings.h index a2e7ded668a9..69289e1eab48 100644 --- a/xpcom/string/public/nsXPCOMStrings.h +++ b/xpcom/string/public/nsXPCOMStrings.h @@ -56,7 +56,7 @@ class nsACString; * rv = GetBlah(sc); * if (NS_SUCCEEDED(rv)) * { - * const PRUnichar *data; + * const char16_t *data; * NS_StringGetData(sc, &data); * // * // |data| now points to the result of the GetBlah function @@ -81,7 +81,7 @@ class nsACString; * if (NS_FAILED(rv)) * return rv; * - * const PRUnichar kData[] = {'x','y','z','\0'}; + * const char16_t kData[] = {'x','y','z','\0'}; * rv = NS_StringSetData(sc, kData, sizeof(kData)/2 - 1); * if (NS_SUCCEEDED(rv)) * rv = SetBlah(sc); @@ -165,7 +165,7 @@ NS_StringContainerInit(nsStringContainer &aContainer); */ XPCOM_API(nsresult) NS_StringContainerInit2 - (nsStringContainer &aContainer, const PRUnichar *aData = nullptr, + (nsStringContainer &aContainer, const char16_t *aData = nullptr, uint32_t aDataLength = UINT32_MAX, uint32_t aFlags = 0); /** @@ -197,7 +197,7 @@ NS_StringContainerFinish(nsStringContainer &aContainer); */ XPCOM_API(uint32_t) NS_StringGetData - (const nsAString &aStr, const PRUnichar **aData, + (const nsAString &aStr, const char16_t **aData, bool *aTerminated = nullptr); /** @@ -229,7 +229,7 @@ NS_StringGetData */ XPCOM_API(uint32_t) NS_StringGetMutableData - (nsAString &aStr, uint32_t aDataLength, PRUnichar **aData); + (nsAString &aStr, uint32_t aDataLength, char16_t **aData); /** * NS_StringCloneData @@ -241,7 +241,7 @@ NS_StringGetMutableData * @return null-terminated copy of the string's internal buffer * (it must be free'd using using nsMemory::Free) */ -XPCOM_API(PRUnichar *) +XPCOM_API(char16_t *) NS_StringCloneData (const nsAString &aStr); @@ -264,7 +264,7 @@ NS_StringCloneData */ XPCOM_API(nsresult) NS_StringSetData - (nsAString &aStr, const PRUnichar *aData, + (nsAString &aStr, const char16_t *aData, uint32_t aDataLength = UINT32_MAX); /** @@ -296,7 +296,7 @@ NS_StringSetData XPCOM_API(nsresult) NS_StringSetDataRange (nsAString &aStr, uint32_t aCutOffset, uint32_t aCutLength, - const PRUnichar *aData, uint32_t aDataLength = UINT32_MAX); + const char16_t *aData, uint32_t aDataLength = UINT32_MAX); /** * NS_StringCopy @@ -334,7 +334,7 @@ NS_StringCopy * terminated by this function. */ inline NS_HIDDEN_(nsresult) -NS_StringAppendData(nsAString &aStr, const PRUnichar *aData, +NS_StringAppendData(nsAString &aStr, const char16_t *aData, uint32_t aDataLength = UINT32_MAX) { return NS_StringSetDataRange(aStr, UINT32_MAX, 0, aData, aDataLength); @@ -359,7 +359,7 @@ NS_StringAppendData(nsAString &aStr, const PRUnichar *aData, * terminated by this function. */ inline NS_HIDDEN_(nsresult) -NS_StringInsertData(nsAString &aStr, uint32_t aOffset, const PRUnichar *aData, +NS_StringInsertData(nsAString &aStr, uint32_t aOffset, const char16_t *aData, uint32_t aDataLength = UINT32_MAX) { return NS_StringSetDataRange(aStr, aOffset, 0, aData, aDataLength); diff --git a/xpcom/string/public/string-template-def-unichar.h b/xpcom/string/public/string-template-def-unichar.h index 5e1583a5d88d..72da57204814 100644 --- a/xpcom/string/public/string-template-def-unichar.h +++ b/xpcom/string/public/string-template-def-unichar.h @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // IWYU pragma: private, include "nsString.h" -#define CharT PRUnichar +#define CharT char16_t #define CharT_is_PRUnichar 1 #define nsTAString_IncompatibleCharT nsACString #define nsTString_CharT nsString diff --git a/xpcom/string/src/nsReadableUtils.cpp b/xpcom/string/src/nsReadableUtils.cpp index ab2bbc2df15b..afceee48a3f1 100644 --- a/xpcom/string/src/nsReadableUtils.cpp +++ b/xpcom/string/src/nsReadableUtils.cpp @@ -25,7 +25,7 @@ CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest ) } void -LossyCopyUTF16toASCII( const PRUnichar* aSource, nsACString& aDest ) +LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest ) { aDest.Truncate(); if (aSource) { @@ -57,7 +57,7 @@ CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest ) } void -CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest ) +CopyUTF16toUTF8( const char16_t* aSource, nsACString& aDest ) { aDest.Truncate(); AppendUTF16toUTF8(aSource, aDest); @@ -109,7 +109,7 @@ AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest ) } void -LossyAppendUTF16toASCII( const PRUnichar* aSource, nsACString& aDest ) +LossyAppendUTF16toASCII( const char16_t* aSource, nsACString& aDest ) { if (aSource) { LossyAppendUTF16toASCII(nsDependentString(aSource), aDest); @@ -203,7 +203,7 @@ AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest, } void -AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest ) +AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest ) { if (aSource) { AppendUTF16toUTF8(nsDependentString(aSource), aDest); @@ -287,25 +287,25 @@ ToNewCString( const nsACString& aSource ) return result; } -PRUnichar* +char16_t* ToNewUnicode( const nsAString& aSource ) { // no conversion needed, just allocate a buffer of the correct length and copy into it - PRUnichar* result = AllocateStringCopy(aSource, (PRUnichar*)0); + char16_t* result = AllocateStringCopy(aSource, (char16_t*)0); if (!result) return nullptr; nsAString::const_iterator fromBegin, fromEnd; - PRUnichar* toBegin = result; - *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = PRUnichar(0); + char16_t* toBegin = result; + *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0); return result; } -PRUnichar* +char16_t* ToNewUnicode( const nsACString& aSource ) { - PRUnichar* result = AllocateStringCopy(aSource, (PRUnichar*)0); + char16_t* result = AllocateStringCopy(aSource, (char16_t*)0); if (!result) return nullptr; @@ -325,8 +325,8 @@ CalcUTF8ToUnicodeLength( const nsACString& aSource) return calculator.Length(); } -PRUnichar* -UTF8ToUnicodeBuffer( const nsACString& aSource, PRUnichar* aBuffer, uint32_t *aUTF16Count ) +char16_t* +UTF8ToUnicodeBuffer( const nsACString& aSource, char16_t* aBuffer, uint32_t *aUTF16Count ) { nsACString::const_iterator start, end; ConvertUTF8toUTF16 converter(aBuffer); @@ -338,12 +338,12 @@ UTF8ToUnicodeBuffer( const nsACString& aSource, PRUnichar* aBuffer, uint32_t *aU return aBuffer; } -PRUnichar* +char16_t* UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count ) { const uint32_t length = CalcUTF8ToUnicodeLength(aSource); - const size_t buffer_size = (length + 1) * sizeof(PRUnichar); - PRUnichar *buffer = static_cast(nsMemory::Alloc(buffer_size)); + const size_t buffer_size = (length + 1) * sizeof(char16_t); + char16_t *buffer = static_cast(nsMemory::Alloc(buffer_size)); if (!buffer) return nullptr; @@ -356,11 +356,11 @@ UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count ) return buffer; } -PRUnichar* -CopyUnicodeTo( const nsAString& aSource, uint32_t aSrcOffset, PRUnichar* aDest, uint32_t aLength ) +char16_t* +CopyUnicodeTo( const nsAString& aSource, uint32_t aSrcOffset, char16_t* aDest, uint32_t aLength ) { nsAString::const_iterator fromBegin, fromEnd; - PRUnichar* toBegin = aDest; + char16_t* toBegin = aDest; copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ), toBegin); return aDest; } @@ -397,7 +397,7 @@ AppendUnicodeTo( const nsAString::const_iterator& aSrcStart, bool IsASCII( const nsAString& aString ) { - static const PRUnichar NOT_ASCII = PRUnichar(~0x007F); + static const char16_t NOT_ASCII = char16_t(~0x007F); // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character @@ -406,8 +406,8 @@ IsASCII( const nsAString& aString ) aString.BeginReading(iter); aString.EndReading(done_reading); - const PRUnichar* c = iter.get(); - const PRUnichar* end = done_reading.get(); + const char16_t* c = iter.get(); + const char16_t* end = done_reading.get(); while ( c < end ) { @@ -881,11 +881,11 @@ RFindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearch } bool -FindCharInReadable( PRUnichar aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd ) +FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd ) { int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get(); - const PRUnichar* charFoundAt = nsCharTraits::find(aSearchStart.get(), fragmentLength, aChar); + const char16_t* charFoundAt = nsCharTraits::find(aSearchStart.get(), fragmentLength, aChar); if ( charFoundAt ) { aSearchStart.advance( charFoundAt - aSearchStart.get() ); return true; @@ -912,7 +912,7 @@ FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const uint32_t CountCharInReadable( const nsAString& aStr, - PRUnichar aChar ) + char16_t aChar ) { uint32_t count = 0; nsAString::const_iterator begin, end; @@ -998,7 +998,7 @@ StringEndsWith( const nsACString& aSource, const nsACString& aSubstring, -static const PRUnichar empty_buffer[1] = { '\0' }; +static const char16_t empty_buffer[1] = { '\0' }; const nsAFlatString& EmptyString() @@ -1042,7 +1042,7 @@ CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String, aUTF8String.BeginReading(u8); aUTF8String.EndReading(u8end); - const PRUnichar *u16, *u16end; + const char16_t *u16, *u16end; aUTF16String.BeginReading(u16); aUTF16String.EndReading(u16end); @@ -1115,7 +1115,7 @@ AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest) NS_ASSERTION(IS_VALID_CHAR(aSource), "Invalid UCS4 char"); if (IS_IN_BMP(aSource)) { - aDest.Append(PRUnichar(aSource)); + aDest.Append(char16_t(aSource)); } else { diff --git a/xpcom/string/src/nsStringObsolete.cpp b/xpcom/string/src/nsStringObsolete.cpp index af068ee26e18..83da8f5235ba 100644 --- a/xpcom/string/src/nsStringObsolete.cpp +++ b/xpcom/string/src/nsStringObsolete.cpp @@ -55,7 +55,7 @@ ascii_tolower(char aChar) * @return index of pos if found, else -1 (kNotFound) */ static int32_t -FindChar1(const char* aDest,uint32_t aDestLength,int32_t anOffset,const PRUnichar aChar,int32_t aCount) { +FindChar1(const char* aDest,uint32_t aDestLength,int32_t anOffset,const char16_t aChar,int32_t aCount) { if(anOffset < 0) anOffset=0; @@ -104,7 +104,7 @@ FindChar1(const char* aDest,uint32_t aDestLength,int32_t anOffset,const PRUnicha * @return index of pos if found, else -1 (kNotFound) */ static int32_t -FindChar2(const PRUnichar* aDest,uint32_t aDestLength,int32_t anOffset,const PRUnichar aChar,int32_t aCount) { +FindChar2(const char16_t* aDest,uint32_t aDestLength,int32_t anOffset,const char16_t aChar,int32_t aCount) { if(anOffset < 0) anOffset=0; @@ -116,11 +116,11 @@ FindChar2(const PRUnichar* aDest,uint32_t aDestLength,int32_t anOffset,const PRU if(0::compare(aStr1, aStr2, aCount); + result = nsCharTraits::compare(aStr1, aStr2, aCount); // The following cases are rare and survivable caller errors. // Two null pointers are equal, but any string, even 0 length @@ -319,16 +319,16 @@ static inline #endif /* __SUNPRO_CC */ int32_t -Compare2To1(const PRUnichar* aStr1,const char* aStr2,uint32_t aCount,bool aIgnoreCase){ - const PRUnichar* s1 = aStr1; +Compare2To1(const char16_t* aStr1,const char* aStr2,uint32_t aCount,bool aIgnoreCase){ + const char16_t* s1 = aStr1; const char *s2 = aStr2; if (aStr1 && aStr2) { if (aCount != 0) { do { - PRUnichar c1 = *s1++; - PRUnichar c2 = PRUnichar((unsigned char)*s2++); + char16_t c1 = *s1++; + char16_t c2 = char16_t((unsigned char)*s2++); if (c1 != c2) { #ifdef DEBUG @@ -369,7 +369,7 @@ Compare2To1(const PRUnichar* aStr1,const char* aStr2,uint32_t aCount,bool aIgnor * @return -1,0,1 depending on <,==,> */ inline int32_t -Compare1To2(const char* aStr1,const PRUnichar* aStr2,uint32_t aCount,bool aIgnoreCase){ +Compare1To2(const char* aStr1,const char16_t* aStr2,uint32_t aCount,bool aIgnoreCase){ return Compare2To1(aStr2, aStr1, aCount, aIgnoreCase) * -1; } @@ -437,11 +437,11 @@ CompressChars1(char* aString,uint32_t aLength,const char* aSet){ * @return the new length of the given buffer */ static int32_t -CompressChars2(PRUnichar* aString,uint32_t aLength,const char* aSet){ +CompressChars2(char16_t* aString,uint32_t aLength,const char* aSet){ - PRUnichar* from = aString; - PRUnichar* end = from + aLength; - PRUnichar* to = from; + char16_t* from = aString; + char16_t* end = from + aLength; + char16_t* to = from; //this code converts /n, /t, /r into normal space ' '; //it also compresses runs of whitespace down to a single char... @@ -449,7 +449,7 @@ CompressChars2(PRUnichar* aString,uint32_t aLength,const char* aSet){ uint32_t aSetLen=strlen(aSet); while (from < end) { - PRUnichar theChar = *from++; + char16_t theChar = *from++; *to++=theChar; //always copy this char... @@ -465,7 +465,7 @@ CompressChars2(PRUnichar* aString,uint32_t aLength,const char* aSet){ } //if *to = 0; } - return to - (PRUnichar*)aString; + return to - (char16_t*)aString; } /** @@ -514,18 +514,18 @@ StripChars1(char* aString,uint32_t aLength,const char* aSet){ * @return the new length of the given buffer */ static int32_t -StripChars2(PRUnichar* aString,uint32_t aLength,const char* aSet){ +StripChars2(char16_t* aString,uint32_t aLength,const char* aSet){ // XXX(darin): this code should defer writing until necessary. - PRUnichar* to = aString; - PRUnichar* from = aString-1; - PRUnichar* end = to + aLength; + char16_t* to = aString; + char16_t* from = aString-1; + char16_t* end = to + aLength; if(aSet && aString && (0 < aLength)){ uint32_t aSetLen=strlen(aSet); while (++from < end) { - PRUnichar theChar = *from; + char16_t theChar = *from; //Note the test for ascii range below. If you have a real unicode char, //and you're searching for chars in the (given) ascii string, there's no //point in doing the real search since it's out of the ascii range. @@ -535,7 +535,7 @@ StripChars2(PRUnichar* aString,uint32_t aLength,const char* aSet){ } *to = 0; } - return to - (PRUnichar*)aString; + return to - (char16_t*)aString; } /* ***** END RICKG BLOCK ***** */ @@ -571,19 +571,19 @@ struct nsBufferRoutines } static - int32_t compare( const char* a, const PRUnichar* b, uint32_t max, bool ic ) + int32_t compare( const char* a, const char16_t* b, uint32_t max, bool ic ) { return Compare1To2(a, b, max, ic); } static - int32_t find_char( const char* s, uint32_t max, int32_t offset, const PRUnichar c, int32_t count ) + int32_t find_char( const char* s, uint32_t max, int32_t offset, const char16_t c, int32_t count ) { return FindChar1(s, max, offset, c, count); } static - int32_t rfind_char( const char* s, uint32_t max, int32_t offset, const PRUnichar c, int32_t count ) + int32_t rfind_char( const char* s, uint32_t max, int32_t offset, const char16_t c, int32_t count ) { return RFindChar1(s, max, offset, c, count); } @@ -608,53 +608,53 @@ struct nsBufferRoutines }; template <> -struct nsBufferRoutines +struct nsBufferRoutines { static - int32_t compare( const PRUnichar* a, const PRUnichar* b, uint32_t max, bool ic ) + int32_t compare( const char16_t* a, const char16_t* b, uint32_t max, bool ic ) { NS_ASSERTION(!ic, "no case-insensitive compare here"); return Compare2To2(a, b, max); } static - int32_t compare( const PRUnichar* a, const char* b, uint32_t max, bool ic ) + int32_t compare( const char16_t* a, const char* b, uint32_t max, bool ic ) { return Compare2To1(a, b, max, ic); } static - int32_t find_char( const PRUnichar* s, uint32_t max, int32_t offset, const PRUnichar c, int32_t count ) + int32_t find_char( const char16_t* s, uint32_t max, int32_t offset, const char16_t c, int32_t count ) { return FindChar2(s, max, offset, c, count); } static - int32_t rfind_char( const PRUnichar* s, uint32_t max, int32_t offset, const PRUnichar c, int32_t count ) + int32_t rfind_char( const char16_t* s, uint32_t max, int32_t offset, const char16_t c, int32_t count ) { return RFindChar2(s, max, offset, c, count); } static - PRUnichar get_find_in_set_filter( const PRUnichar* set ) + char16_t get_find_in_set_filter( const char16_t* set ) { return GetFindInSetFilter(set); } static - PRUnichar get_find_in_set_filter( const char* set ) + char16_t get_find_in_set_filter( const char* set ) { - return (~PRUnichar(0)^~char(0)) | GetFindInSetFilter(set); + return (~char16_t(0)^~char(0)) | GetFindInSetFilter(set); } static - int32_t strip_chars( PRUnichar* s, uint32_t max, const char* set ) + int32_t strip_chars( char16_t* s, uint32_t max, const char* set ) { return StripChars2(s, max, set); } static - int32_t compress_chars( PRUnichar* s, uint32_t len, const char* set ) + int32_t compress_chars( char16_t* s, uint32_t len, const char* set ) { return CompressChars2(s, len, set); } @@ -878,7 +878,7 @@ nsString::Find( const nsAFlatString& aString, int32_t aOffset, int32_t aCount ) } int32_t -nsString::Find( const PRUnichar* aString, int32_t aOffset, int32_t aCount ) const +nsString::Find( const char16_t* aString, int32_t aOffset, int32_t aCount ) const { return Find(nsDependentString(aString), aOffset, aCount); } @@ -896,13 +896,13 @@ nsString::RFind( const nsAFlatString& aString, int32_t aOffset, int32_t aCount ) } int32_t -nsString::RFind( const PRUnichar* aString, int32_t aOffset, int32_t aCount ) const +nsString::RFind( const char16_t* aString, int32_t aOffset, int32_t aCount ) const { return RFind(nsDependentString(aString), aOffset, aCount); } int32_t -nsString::FindCharInSet( const PRUnichar* aSet, int32_t aOffset ) const +nsString::FindCharInSet( const char16_t* aSet, int32_t aOffset ) const { if (aOffset < 0) aOffset = 0; @@ -963,7 +963,7 @@ nsString::EqualsIgnoreCase( const char* aString, int32_t aCount ) const compareCount = aCount; int32_t result = - nsBufferRoutines::compare(mData, aString, compareCount, true); + nsBufferRoutines::compare(mData, aString, compareCount, true); if (result == 0 && (aCount < 0 || strLen < uint32_t(aCount) || mLength < uint32_t(aCount))) diff --git a/xpcom/string/src/nsSubstring.cpp b/xpcom/string/src/nsSubstring.cpp index 115efbef25a5..11bdb4df3492 100644 --- a/xpcom/string/src/nsSubstring.cpp +++ b/xpcom/string/src/nsSubstring.cpp @@ -40,10 +40,10 @@ using mozilla::Atomic; // --------------------------------------------------------------------------- -static PRUnichar gNullChar = 0; +static char16_t gNullChar = 0; char* nsCharTraits ::sEmptyBuffer = (char*) &gNullChar; -PRUnichar* nsCharTraits::sEmptyBuffer = &gNullChar; +char16_t* nsCharTraits::sEmptyBuffer = &gNullChar; // --------------------------------------------------------------------------- @@ -259,10 +259,10 @@ void nsStringBuffer::ToString(uint32_t len, nsAString &str, bool aMoveOwnership) { - PRUnichar* data = static_cast(Data()); + char16_t* data = static_cast(Data()); nsAStringAccessor* accessor = static_cast(&str); - NS_ASSERTION(data[len] == PRUnichar(0), "data should be null terminated"); + NS_ASSERTION(data[len] == char16_t(0), "data should be null terminated"); // preserve class flags uint32_t flags = accessor->flags(); diff --git a/xpcom/string/src/nsTStringObsolete.cpp b/xpcom/string/src/nsTStringObsolete.cpp index f610bd0988ff..4c1094d373a9 100644 --- a/xpcom/string/src/nsTStringObsolete.cpp +++ b/xpcom/string/src/nsTStringObsolete.cpp @@ -63,7 +63,7 @@ nsTString_CharT::RFind( const char* aString, bool aIgnoreCase, int32_t aOffset, */ int32_t -nsTString_CharT::RFindChar( PRUnichar aChar, int32_t aOffset, int32_t aCount) const +nsTString_CharT::RFindChar( char16_t aChar, int32_t aOffset, int32_t aCount) const { return nsBufferRoutines::rfind_char(mData, mLength, aOffset, aChar, aCount); } @@ -380,7 +380,7 @@ nsTString_CharT::Mid( self_type& aResult, index_type aStartPos, size_type aLengt */ bool -nsTString_CharT::SetCharAt( PRUnichar aChar, uint32_t aIndex ) +nsTString_CharT::SetCharAt( char16_t aChar, uint32_t aIndex ) { if (aIndex >= mLength) return false; diff --git a/xpcom/string/src/nsUTF8UtilsSSE2.cpp b/xpcom/string/src/nsUTF8UtilsSSE2.cpp index 9f698102d1bf..e0b7313189e4 100644 --- a/xpcom/string/src/nsUTF8UtilsSSE2.cpp +++ b/xpcom/string/src/nsUTF8UtilsSSE2.cpp @@ -8,7 +8,7 @@ #include void -LossyConvertEncoding16to8::write_sse2(const PRUnichar* aSource, +LossyConvertEncoding16to8::write_sse2(const char16_t* aSource, uint32_t aSourceLength) { char* dest = mDestination; @@ -16,7 +16,7 @@ LossyConvertEncoding16to8::write_sse2(const PRUnichar* aSource, // Align source to a 16-byte boundary. uint32_t i = 0; uint32_t alignLen = - XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(PRUnichar)); + XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t)); for (; i < alignLen; i++) { dest[i] = static_cast(aSource[i]); } @@ -62,7 +62,7 @@ void LossyConvertEncoding8to16::write_sse2(const char* aSource, uint32_t aSourceLength) { - PRUnichar *dest = mDestination; + char16_t *dest = mDestination; // Align source to a 16-byte boundary. We choose to align source rather than // dest because we'd rather have our loads than our stores be fast. You have diff --git a/xpcom/tests/CvtURL.cpp b/xpcom/tests/CvtURL.cpp index 5a876d98ef25..1a9b2b3166dc 100644 --- a/xpcom/tests/CvtURL.cpp +++ b/xpcom/tests/CvtURL.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) PRTime start = PR_Now(); int32_t count = 0; for (;;) { - PRUnichar buf[1000]; + char16_t buf[1000]; uint32_t nb; ec = uin->Read(buf, 0, 1000, &nb); if (NS_FAILED(ec)) { diff --git a/xpcom/tests/TestCRT.cpp b/xpcom/tests/TestCRT.cpp index fa41597174b3..ea5bf7b2665a 100644 --- a/xpcom/tests/TestCRT.cpp +++ b/xpcom/tests/TestCRT.cpp @@ -42,8 +42,8 @@ static void Check(const char* s1, const char* s2, int n) nsAutoString t1,t2; t1.AssignWithConversion(s1); t2.AssignWithConversion(s2); - const PRUnichar* us1 = t1.get(); - const PRUnichar* us2 = t2.get(); + const char16_t* us1 = t1.get(); + const char16_t* us2 = t2.get(); #ifdef DEBUG int u2 = diff --git a/xpcom/tests/TestEncoding.cpp b/xpcom/tests/TestEncoding.cpp index d792299d321e..4fef0dfdab9d 100644 --- a/xpcom/tests/TestEncoding.cpp +++ b/xpcom/tests/TestEncoding.cpp @@ -9,7 +9,7 @@ nsresult TestGoodSurrogatePair() { // When this string is decoded, the surrogate pair is U+10302 and the rest of // the string is specified by indexes 2 onward. - const PRUnichar goodPairData[] = { 0xD800, 0xDF02, 0x65, 0x78, 0x0 }; + const char16_t goodPairData[] = { 0xD800, 0xDF02, 0x65, 0x78, 0x0 }; nsDependentString goodPair16(goodPairData); uint32_t byteCount = 0; @@ -53,7 +53,7 @@ nsresult TestBackwardsSurrogatePair() { // When this string is decoded, the two surrogates are wrongly ordered and // must each be interpreted as U+FFFD. - const PRUnichar backwardsPairData[] = { 0xDDDD, 0xD863, 0x65, 0x78, 0x0 }; + const char16_t backwardsPairData[] = { 0xDDDD, 0xD863, 0x65, 0x78, 0x0 }; nsDependentString backwardsPair16(backwardsPairData); uint32_t byteCount = 0; @@ -97,7 +97,7 @@ nsresult TestMalformedUTF16OrphanHighSurrogate() { // When this string is decoded, the high surrogate should be replaced and the // rest of the string is specified by indexes 1 onward. - const PRUnichar highSurrogateData[] = { 0xD863, 0x74, 0x65, 0x78, 0x74, 0x0 }; + const char16_t highSurrogateData[] = { 0xD863, 0x74, 0x65, 0x78, 0x74, 0x0 }; nsDependentString highSurrogate16(highSurrogateData); uint32_t byteCount = 0; @@ -141,7 +141,7 @@ nsresult TestMalformedUTF16OrphanLowSurrogate() { // When this string is decoded, the low surrogate should be replaced and the // rest of the string is specified by indexes 1 onward. - const PRUnichar lowSurrogateData[] = { 0xDDDD, 0x74, 0x65, 0x78, 0x74, 0x0 }; + const char16_t lowSurrogateData[] = { 0xDDDD, 0x74, 0x65, 0x78, 0x74, 0x0 }; nsDependentString lowSurrogate16(lowSurrogateData); uint32_t byteCount = 0; diff --git a/xpcom/tests/TestObserverService.cpp b/xpcom/tests/TestObserverService.cpp index 8fb90d7cc212..8a5a9b0d52e6 100644 --- a/xpcom/tests/TestObserverService.cpp +++ b/xpcom/tests/TestObserverService.cpp @@ -51,7 +51,7 @@ NS_IMPL_ISUPPORTS2( TestObserver, nsIObserver, nsISupportsWeakReference ) NS_IMETHODIMP TestObserver::Observe( nsISupports *aSubject, const char *aTopic, - const PRUnichar *someData ) { + const char16_t *someData ) { nsCString topic( aTopic ); nsString data( someData ); /* diff --git a/xpcom/tests/TestStringAPI.cpp b/xpcom/tests/TestStringAPI.cpp index 1009511314e6..1206865943da 100644 --- a/xpcom/tests/TestStringAPI.cpp +++ b/xpcom/tests/TestStringAPI.cpp @@ -25,14 +25,14 @@ int testAccess() { s.Assign(NS_LITERAL_STRING("hello")); int res = CHECK(5 == s.Length()) + CHECK(s.EqualsLiteral("hello")); - const PRUnichar *it, *end; + const char16_t *it, *end; int len = s.BeginReading(&it, &end); res += CHECK(5 == len); - res += CHECK(PRUnichar('h') == it[0]) + - CHECK(PRUnichar('e') == it[1]) + - CHECK(PRUnichar('l') == it[2]) + - CHECK(PRUnichar('l') == it[3]) + - CHECK(PRUnichar('o') == it[4]) + + res += CHECK(char16_t('h') == it[0]) + + CHECK(char16_t('e') == it[1]) + + CHECK(char16_t('l') == it[2]) + + CHECK(char16_t('l') == it[3]) + + CHECK(char16_t('o') == it[4]) + CHECK(it + len == end); res += CHECK(s[0] == s.First()); for (int i = 0; i < len; ++i) { @@ -46,7 +46,7 @@ int testAccess() { int testWrite() { nsString s(NS_LITERAL_STRING("xyzz")); - PRUnichar *begin, *end; + char16_t *begin, *end; int res = CHECK(4 == s.Length()); uint32_t len = s.BeginWriting(&begin, &end, 5); res += CHECK(5 == s.Length()) + @@ -54,7 +54,7 @@ int testWrite() { CHECK(end == begin + 5) + CHECK(begin == s.BeginWriting()) + CHECK(end == s.EndWriting()); - begin[4] = PRUnichar('y'); + begin[4] = char16_t('y'); res += CHECK(s.Equals(NS_LITERAL_STRING("xyzzy"))); s.SetLength(4); res += CHECK(4 == s.Length()) + @@ -64,12 +64,12 @@ int testWrite() { s.Truncate(); res += CHECK(0 == s.Length()) + CHECK(s.IsEmpty()); - const PRUnichar sample[] = { 's', 'a', 'm', 'p', 'l', 'e', '\0' }; + const char16_t sample[] = { 's', 'a', 'm', 'p', 'l', 'e', '\0' }; s.Assign(sample); res += CHECK(s.EqualsLiteral("sample")); s.Assign(sample, 4); res += CHECK(s.EqualsLiteral("samp")); - s.Assign(PRUnichar('q')); + s.Assign(char16_t('q')); res += CHECK(s.EqualsLiteral("q")); return res; } diff --git a/xpcom/tests/TestStrings.cpp b/xpcom/tests/TestStrings.cpp index 6b9b21130b40..bf9325f89e75 100644 --- a/xpcom/tests/TestStrings.cpp +++ b/xpcom/tests/TestStrings.cpp @@ -1007,7 +1007,7 @@ static bool test_parse_string() test_parse_string_helper1(" foo", ' ', "foo"); } -static bool test_strip_chars_helper(const PRUnichar* str, const PRUnichar* strip, const nsAString& result, uint32_t offset=0) +static bool test_strip_chars_helper(const char16_t* str, const char16_t* strip, const nsAString& result, uint32_t offset=0) { nsAutoString tmp(str); nsAString& data = tmp; diff --git a/xpcom/tests/TestTextFormatter.cpp b/xpcom/tests/TestTextFormatter.cpp index d156f3ea44f5..117cef60840e 100644 --- a/xpcom/tests/TestTextFormatter.cpp +++ b/xpcom/tests/TestTextFormatter.cpp @@ -13,17 +13,17 @@ int main() nsAutoString fmt(NS_LITERAL_STRING("%3$s %4$S %1$d %2$d %2$d %3$s")); char utf8[] = "Hello"; - PRUnichar ucs2[]={'W', 'o', 'r', 'l', 'd', 0x4e00, 0xAc00, 0xFF45, 0x0103, 0x00}; + char16_t ucs2[]={'W', 'o', 'r', 'l', 'd', 0x4e00, 0xAc00, 0xFF45, 0x0103, 0x00}; int d=3; - PRUnichar buf[256]; + char16_t buf[256]; nsTextFormatter::snprintf(buf, 256, fmt.get(), d, 333, utf8, ucs2); nsAutoString out(buf); if(strcmp("Hello World", NS_LossyConvertUTF16toASCII(out).get())) test_ok = false; - const PRUnichar *uout = out.get(); - const PRUnichar expected[] = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, + const char16_t *uout = out.get(); + const char16_t expected[] = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x4E00, 0xAC00, 0xFF45, 0x0103, 0x20, 0x33, 0x20, 0x33, 0x33, 0x33, 0x20, 0x33, diff --git a/xpcom/tests/TestXPIDLString.cpp b/xpcom/tests/TestXPIDLString.cpp index f2802e1f6c8e..d85cdd56fe6d 100644 --- a/xpcom/tests/TestXPIDLString.cpp +++ b/xpcom/tests/TestXPIDLString.cpp @@ -3,7 +3,7 @@ #include "nsXPIDLString.h" static void -nsXPIDLStringTest_Value(PRUnichar** aResult) +nsXPIDLStringTest_Value(char16_t** aResult) { *aResult = ToNewUnicode(NS_LITERAL_STRING("Hello, World")); } diff --git a/xpcom/tests/UTFStrings.h b/xpcom/tests/UTFStrings.h index 32b864e79455..91468f1b033f 100644 --- a/xpcom/tests/UTFStrings.h +++ b/xpcom/tests/UTFStrings.h @@ -7,7 +7,7 @@ struct UTFStringsStringPair { - PRUnichar m16[16]; + char16_t m16[16]; char m8[16]; }; diff --git a/xpcom/tests/external/TestMinStringAPI.cpp b/xpcom/tests/external/TestMinStringAPI.cpp index 226fca3a26d9..3efe8b655762 100644 --- a/xpcom/tests/external/TestMinStringAPI.cpp +++ b/xpcom/tests/external/TestMinStringAPI.cpp @@ -11,7 +11,7 @@ static const char kAsciiData[] = "Hello World"; -static const PRUnichar kUnicodeData[] = +static const char16_t kUnicodeData[] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'}; static bool test_basic_1() @@ -78,9 +78,9 @@ static bool test_basic_2() nsStringContainer s; NS_StringContainerInit(s); - const PRUnichar *ptr; + const char16_t *ptr; uint32_t len; - PRUnichar *clone; + char16_t *clone; NS_StringGetData(s, &ptr); if (ptr == nullptr || *ptr != '\0') diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index 75e0c1699932..4bc8da9dfaa5 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -542,7 +542,7 @@ LazyIdleThread::AfterProcessNextEvent(nsIThreadInternal* /* aThread */, NS_IMETHODIMP LazyIdleThread::Observe(nsISupports* /* aSubject */, const char* aTopic, - const PRUnichar* /* aData */) + const char16_t* /* aData */) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); MOZ_ASSERT(mShutdownMethod == AutomaticShutdown, diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index 69ed7c63098b..e0934423a77b 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -423,7 +423,7 @@ void TimerThread::DoAfterSleep() /* void observe (in nsISupports aSubject, in string aTopic, in wstring aData); */ NS_IMETHODIMP -TimerThread::Observe(nsISupports* /* aSubject */, const char *aTopic, const PRUnichar* /* aData */) +TimerThread::Observe(nsISupports* /* aSubject */, const char *aTopic, const char16_t* /* aData */) { if (strcmp(aTopic, "sleep_notification") == 0 || strcmp(aTopic, "suspend_process_notification") == 0) diff --git a/xpcom/threads/nsProcess.h b/xpcom/threads/nsProcess.h index e25bf17f20df..63abf52dc98c 100644 --- a/xpcom/threads/nsProcess.h +++ b/xpcom/threads/nsProcess.h @@ -49,7 +49,7 @@ private: nsresult CopyArgsAndRunProcess(bool blocking, const char** args, uint32_t count, nsIObserver* observer, bool holdWeak); - nsresult CopyArgsAndRunProcessw(bool blocking, const PRUnichar** args, + nsresult CopyArgsAndRunProcessw(bool blocking, const char16_t** args, uint32_t count, nsIObserver* observer, bool holdWeak); // The 'args' array is null-terminated. diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 66d073875e14..dc67d29c59a8 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -363,21 +363,21 @@ nsProcess::CopyArgsAndRunProcess(bool blocking, const char** args, // XXXldb |args| has the wrong const-ness NS_IMETHODIMP -nsProcess::Runw(bool blocking, const PRUnichar **args, uint32_t count) +nsProcess::Runw(bool blocking, const char16_t **args, uint32_t count) { return CopyArgsAndRunProcessw(blocking, args, count, nullptr, false); } // XXXldb |args| has the wrong const-ness NS_IMETHODIMP -nsProcess::RunwAsync(const PRUnichar **args, uint32_t count, +nsProcess::RunwAsync(const char16_t **args, uint32_t count, nsIObserver* observer, bool holdWeak) { return CopyArgsAndRunProcessw(false, args, count, observer, holdWeak); } nsresult -nsProcess::CopyArgsAndRunProcessw(bool blocking, const PRUnichar** args, +nsProcess::CopyArgsAndRunProcessw(bool blocking, const char16_t** args, uint32_t count, nsIObserver* observer, bool holdWeak) { @@ -597,7 +597,7 @@ nsProcess::GetExitValue(int32_t *aExitValue) } NS_IMETHODIMP -nsProcess::Observe(nsISupports* subject, const char* topic, const PRUnichar* data) +nsProcess::Observe(nsISupports* subject, const char* topic, const char16_t* data) { // Shutting down, drop all references if (mThread) { diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index afa1b78b0f9d..286bbad8087f 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -230,7 +230,7 @@ NS_IMPL_ADDREF(WebBrowserChrome2Stub) NS_IMPL_RELEASE(WebBrowserChrome2Stub) NS_IMETHODIMP -WebBrowserChrome2Stub::SetStatus(uint32_t aStatusType, const PRUnichar* aStatus) +WebBrowserChrome2Stub::SetStatus(uint32_t aStatusType, const char16_t* aStatus) { return NS_OK; } @@ -845,7 +845,7 @@ nsAppShellService::UnregisterTopLevelWindow(nsIXULWindow* aWindow) NS_IMETHODIMP nsAppShellService::Observe(nsISupports* aSubject, const char *aTopic, - const PRUnichar *aData) + const char16_t *aData) { if (!strcmp(aTopic, "xpcom-will-shutdown")) { mXPCOMWillShutDown = true; diff --git a/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp b/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp index a1d14e8b52a5..4361565c99b4 100644 --- a/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp +++ b/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp @@ -151,7 +151,7 @@ void nsWindowInfo::ReferenceSelf(bool inAge, bool inZ) NS_IMPL_ISUPPORTS1(nsAppShellWindowEnumerator, nsISimpleEnumerator) nsAppShellWindowEnumerator::nsAppShellWindowEnumerator( - const PRUnichar* aTypeString, + const char16_t* aTypeString, nsWindowMediator& aMediator) : mWindowMediator(&aMediator), mType(aTypeString), mCurrentPosition(nullptr) { @@ -194,7 +194,7 @@ void nsAppShellWindowEnumerator::WindowRemoved(nsWindowInfo *inInfo) // nsASDOMWindowEnumerator::nsASDOMWindowEnumerator( - const PRUnichar* aTypeString, + const char16_t* aTypeString, nsWindowMediator& aMediator) : nsAppShellWindowEnumerator(aTypeString, aMediator) { @@ -225,7 +225,7 @@ NS_IMETHODIMP nsASDOMWindowEnumerator::GetNext(nsISupports **retval) // nsASXULWindowEnumerator::nsASXULWindowEnumerator( - const PRUnichar* aTypeString, + const char16_t* aTypeString, nsWindowMediator& aMediator) : nsAppShellWindowEnumerator(aTypeString, aMediator) { @@ -253,7 +253,7 @@ NS_IMETHODIMP nsASXULWindowEnumerator::GetNext(nsISupports **retval) // nsASDOMWindowEarlyToLateEnumerator::nsASDOMWindowEarlyToLateEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASDOMWindowEnumerator(aTypeString, aMediator) { @@ -292,7 +292,7 @@ nsWindowInfo *nsASDOMWindowEarlyToLateEnumerator::FindNext() // nsASXULWindowEarlyToLateEnumerator::nsASXULWindowEarlyToLateEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASXULWindowEnumerator(aTypeString, aMediator) { @@ -337,7 +337,7 @@ nsWindowInfo *nsASXULWindowEarlyToLateEnumerator::FindNext() // nsASDOMWindowFrontToBackEnumerator::nsASDOMWindowFrontToBackEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASDOMWindowEnumerator(aTypeString, aMediator) { @@ -376,7 +376,7 @@ nsWindowInfo *nsASDOMWindowFrontToBackEnumerator::FindNext() // nsASXULWindowFrontToBackEnumerator::nsASXULWindowFrontToBackEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASXULWindowEnumerator(aTypeString, aMediator) { @@ -415,7 +415,7 @@ nsWindowInfo *nsASXULWindowFrontToBackEnumerator::FindNext() // nsASDOMWindowBackToFrontEnumerator::nsASDOMWindowBackToFrontEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASDOMWindowEnumerator(aTypeString, aMediator) { @@ -457,7 +457,7 @@ nsWindowInfo *nsASDOMWindowBackToFrontEnumerator::FindNext() // nsASXULWindowBackToFrontEnumerator::nsASXULWindowBackToFrontEnumerator( - const PRUnichar *aTypeString, + const char16_t *aTypeString, nsWindowMediator &aMediator) : nsASXULWindowEnumerator(aTypeString, aMediator) { diff --git a/xpfe/appshell/src/nsAppShellWindowEnumerator.h b/xpfe/appshell/src/nsAppShellWindowEnumerator.h index 111e604d5d50..b69bc0fe773d 100644 --- a/xpfe/appshell/src/nsAppShellWindowEnumerator.h +++ b/xpfe/appshell/src/nsAppShellWindowEnumerator.h @@ -48,7 +48,7 @@ class nsAppShellWindowEnumerator : public nsISimpleEnumerator { friend class nsWindowMediator; public: - nsAppShellWindowEnumerator(const PRUnichar* aTypeString, + nsAppShellWindowEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsAppShellWindowEnumerator(); NS_IMETHOD GetNext(nsISupports **retval) = 0; @@ -71,7 +71,7 @@ protected: class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator { public: - nsASDOMWindowEnumerator(const PRUnichar* aTypeString, + nsASDOMWindowEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASDOMWindowEnumerator(); NS_IMETHOD GetNext(nsISupports **retval); @@ -80,7 +80,7 @@ public: class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator { public: - nsASXULWindowEnumerator(const PRUnichar* aTypeString, + nsASXULWindowEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASXULWindowEnumerator(); NS_IMETHOD GetNext(nsISupports **retval); @@ -93,7 +93,7 @@ public: class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator { public: - nsASDOMWindowEarlyToLateEnumerator(const PRUnichar* aTypeString, + nsASDOMWindowEarlyToLateEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASDOMWindowEarlyToLateEnumerator(); @@ -105,7 +105,7 @@ protected: class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator { public: - nsASXULWindowEarlyToLateEnumerator(const PRUnichar* aTypeString, + nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASXULWindowEarlyToLateEnumerator(); @@ -117,7 +117,7 @@ protected: class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator { public: - nsASDOMWindowFrontToBackEnumerator(const PRUnichar* aTypeString, + nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASDOMWindowFrontToBackEnumerator(); @@ -129,7 +129,7 @@ protected: class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator { public: - nsASXULWindowFrontToBackEnumerator(const PRUnichar* aTypeString, + nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASXULWindowFrontToBackEnumerator(); @@ -141,7 +141,7 @@ protected: class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator { public: - nsASDOMWindowBackToFrontEnumerator(const PRUnichar* aTypeString, + nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASDOMWindowBackToFrontEnumerator(); @@ -153,7 +153,7 @@ protected: class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator { public: - nsASXULWindowBackToFrontEnumerator(const PRUnichar* aTypeString, + nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString, nsWindowMediator& inMediator); virtual ~nsASXULWindowBackToFrontEnumerator(); diff --git a/xpfe/appshell/src/nsChromeTreeOwner.cpp b/xpfe/appshell/src/nsChromeTreeOwner.cpp index b677fa6cf4ed..8f8366b2561b 100644 --- a/xpfe/appshell/src/nsChromeTreeOwner.cpp +++ b/xpfe/appshell/src/nsChromeTreeOwner.cpp @@ -139,7 +139,7 @@ NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink) // nsChromeTreeOwner::nsIDocShellTreeOwner //***************************************************************************** -NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName, +NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** aFoundItem) { @@ -495,13 +495,13 @@ NS_IMETHODIMP nsChromeTreeOwner::SetFocus() return mXULWindow->SetFocus(); } -NS_IMETHODIMP nsChromeTreeOwner::GetTitle(PRUnichar** aTitle) +NS_IMETHODIMP nsChromeTreeOwner::GetTitle(char16_t** aTitle) { NS_ENSURE_STATE(mXULWindow); return mXULWindow->GetTitle(aTitle); } -NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const PRUnichar* aTitle) +NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const char16_t* aTitle) { NS_ENSURE_STATE(mXULWindow); return mXULWindow->SetTitle(aTitle); @@ -563,7 +563,7 @@ NS_IMETHODIMP nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { return NS_OK; } diff --git a/xpfe/appshell/src/nsContentTreeOwner.cpp b/xpfe/appshell/src/nsContentTreeOwner.cpp index c08eb826f8fe..00429582d403 100644 --- a/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -160,7 +160,7 @@ NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID, void** aSink) // nsContentTreeOwner::nsIDocShellTreeOwner //***************************************************************************** -NS_IMETHODIMP nsContentTreeOwner::FindItemWithName(const PRUnichar* aName, +NS_IMETHODIMP nsContentTreeOwner::FindItemWithName(const char16_t* aName, nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor, nsIDocShellTreeItem** aFoundItem) { @@ -484,7 +484,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatusWithContext(uint32_t aStatusType, //***************************************************************************** NS_IMETHODIMP nsContentTreeOwner::SetStatus(uint32_t aStatusType, - const PRUnichar* aStatus) + const char16_t* aStatus) { return SetStatusWithContext(aStatusType, aStatus ? static_cast(nsDependentString(aStatus)) @@ -696,7 +696,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetFocus() return mXULWindow->SetFocus(); } -NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle) +NS_IMETHODIMP nsContentTreeOwner::GetTitle(char16_t** aTitle) { NS_ENSURE_ARG_POINTER(aTitle); NS_ENSURE_STATE(mXULWindow); @@ -704,7 +704,7 @@ NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle) return mXULWindow->GetTitle(aTitle); } -NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle) +NS_IMETHODIMP nsContentTreeOwner::SetTitle(const char16_t* aTitle) { // We only allow the title to be set from the primary content shell if(!mPrimary || !mContentTitleSetting) @@ -1159,13 +1159,13 @@ nsSiteWindow::SetVisibility(bool aVisibility) } NS_IMETHODIMP -nsSiteWindow::GetTitle(PRUnichar * *aTitle) +nsSiteWindow::GetTitle(char16_t * *aTitle) { return mAggregator->GetTitle(aTitle); } NS_IMETHODIMP -nsSiteWindow::SetTitle(const PRUnichar * aTitle) +nsSiteWindow::SetTitle(const char16_t * aTitle) { return mAggregator->SetTitle(aTitle); } diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 8d2fb873ee55..47e1c5bbcad8 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -580,7 +580,7 @@ NS_IMETHODIMP nsWebShellWindow::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) + const char16_t* aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; diff --git a/xpfe/appshell/src/nsWindowMediator.cpp b/xpfe/appshell/src/nsWindowMediator.cpp index 4752a1b3a811..0729c4cebfb6 100644 --- a/xpfe/appshell/src/nsWindowMediator.cpp +++ b/xpfe/appshell/src/nsWindowMediator.cpp @@ -34,7 +34,7 @@ static bool notifyWindowTitleChange(nsIWindowMediatorListener *aElement, void* a // for notifyWindowTitleChange struct WindowTitleData { nsIXULWindow* mWindow; - const PRUnichar *mTitle; + const char16_t *mTitle; }; nsresult @@ -187,7 +187,7 @@ nsWindowMediator::GetInfoFor(nsIWidget *aWindow) } NS_IMETHODIMP -nsWindowMediator::GetEnumerator(const PRUnichar* inType, nsISimpleEnumerator** outEnumerator) +nsWindowMediator::GetEnumerator(const char16_t* inType, nsISimpleEnumerator** outEnumerator) { NS_ENSURE_ARG_POINTER(outEnumerator); NS_ENSURE_STATE(mReady); @@ -200,7 +200,7 @@ nsWindowMediator::GetEnumerator(const PRUnichar* inType, nsISimpleEnumerator** o } NS_IMETHODIMP -nsWindowMediator::GetXULWindowEnumerator(const PRUnichar* inType, nsISimpleEnumerator** outEnumerator) +nsWindowMediator::GetXULWindowEnumerator(const char16_t* inType, nsISimpleEnumerator** outEnumerator) { NS_ENSURE_ARG_POINTER(outEnumerator); NS_ENSURE_STATE(mReady); @@ -214,7 +214,7 @@ nsWindowMediator::GetXULWindowEnumerator(const PRUnichar* inType, nsISimpleEnume NS_IMETHODIMP nsWindowMediator::GetZOrderDOMWindowEnumerator( - const PRUnichar *aWindowType, bool aFrontToBack, + const char16_t *aWindowType, bool aFrontToBack, nsISimpleEnumerator **_retval) { NS_ENSURE_ARG_POINTER(_retval); @@ -233,7 +233,7 @@ nsWindowMediator::GetZOrderDOMWindowEnumerator( NS_IMETHODIMP nsWindowMediator::GetZOrderXULWindowEnumerator( - const PRUnichar *aWindowType, bool aFrontToBack, + const char16_t *aWindowType, bool aFrontToBack, nsISimpleEnumerator **_retval) { NS_ENSURE_ARG_POINTER(_retval); @@ -265,7 +265,7 @@ nsWindowMediator::RemoveEnumerator(nsAppShellWindowEnumerator * inEnumerator) // Returns the window of type inType ( if null return any window type ) which has the most recent // time stamp NS_IMETHODIMP -nsWindowMediator::GetMostRecentWindow(const PRUnichar* inType, nsIDOMWindow** outWindow) +nsWindowMediator::GetMostRecentWindow(const char16_t* inType, nsIDOMWindow** outWindow) { NS_ENSURE_ARG_POINTER(outWindow); *outWindow = nullptr; @@ -292,7 +292,7 @@ nsWindowMediator::GetMostRecentWindow(const PRUnichar* inType, nsIDOMWindow** ou } nsWindowInfo* -nsWindowMediator::MostRecentWindowInfo(const PRUnichar* inType) +nsWindowMediator::MostRecentWindowInfo(const char16_t* inType) { int32_t lastTimeStamp = -1; nsAutoString typeString(inType); @@ -366,7 +366,7 @@ nsWindowMediator::UpdateWindowTimeStamp(nsIXULWindow* inWindow) NS_IMETHODIMP nsWindowMediator::UpdateWindowTitle(nsIXULWindow* inWindow, - const PRUnichar* inTitle) + const char16_t* inTitle) { NS_ENSURE_STATE(mReady); MutexAutoLock lock(mListLock); @@ -771,7 +771,7 @@ nsWindowMediator::RemoveListener(nsIWindowMediatorListener* aListener) NS_IMETHODIMP nsWindowMediator::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) + const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown") && mReady) { // Unregistering a window may cause its destructor to run, causing it to diff --git a/xpfe/appshell/src/nsWindowMediator.h b/xpfe/appshell/src/nsWindowMediator.h index ac2eb3dfd839..7dfc68942f20 100644 --- a/xpfe/appshell/src/nsWindowMediator.h +++ b/xpfe/appshell/src/nsWindowMediator.h @@ -56,7 +56,7 @@ public: private: int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator); int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator); - nsWindowInfo *MostRecentWindowInfo(const PRUnichar* inType); + nsWindowInfo *MostRecentWindowInfo(const char16_t* inType); nsresult UnregisterWindow(nsWindowInfo *inInfo); nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow); diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 512a3c58166b..736e3f5145be 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -317,7 +317,7 @@ NS_IMETHODIMP nsXULWindow::GetPrimaryContentShell(nsIDocShellTreeItem** return NS_OK; } -NS_IMETHODIMP nsXULWindow::GetContentShellById(const PRUnichar* aID, +NS_IMETHODIMP nsXULWindow::GetContentShellById(const char16_t* aID, nsIDocShellTreeItem** aDocShellTreeItem) { NS_ENSURE_ARG_POINTER(aDocShellTreeItem); @@ -865,7 +865,7 @@ NS_IMETHODIMP nsXULWindow::SetFocus() return NS_OK; } -NS_IMETHODIMP nsXULWindow::GetTitle(PRUnichar** aTitle) +NS_IMETHODIMP nsXULWindow::GetTitle(char16_t** aTitle) { NS_ENSURE_ARG_POINTER(aTitle); @@ -875,7 +875,7 @@ NS_IMETHODIMP nsXULWindow::GetTitle(PRUnichar** aTitle) return NS_OK; } -NS_IMETHODIMP nsXULWindow::SetTitle(const PRUnichar* aTitle) +NS_IMETHODIMP nsXULWindow::SetTitle(const char16_t* aTitle) { NS_ENSURE_STATE(mWindow); mTitle.Assign(aTitle); diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index c82d82c14a05..4c79aa54b781 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -708,7 +708,7 @@ void nsHTTPIndex::GetDestination(nsIRDFResource* r, nsXPIDLCString& dest) { r->GetValueConst(&temp); dest.Adopt(temp ? strdup(temp) : 0); } else { - const PRUnichar* uri; + const char16_t* uri; url->GetValueConst(&uri); dest.Adopt(ToNewUTF8String(nsDependentString(uri))); } diff --git a/xpfe/components/windowds/nsWindowDataSource.cpp b/xpfe/components/windowds/nsWindowDataSource.cpp index 88d34b5656c2..dd62664b8647 100644 --- a/xpfe/components/windowds/nsWindowDataSource.cpp +++ b/xpfe/components/windowds/nsWindowDataSource.cpp @@ -85,7 +85,7 @@ nsWindowDataSource::~nsWindowDataSource() } NS_IMETHODIMP -nsWindowDataSource::Observe(nsISupports *aSubject, const char* aTopic, const PRUnichar *aData) +nsWindowDataSource::Observe(nsISupports *aSubject, const char* aTopic, const char16_t *aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { // release these objects so that they release their reference @@ -123,7 +123,7 @@ NS_INTERFACE_MAP_END /* void onWindowTitleChange (in nsIXULWindow window, in wstring newTitle); */ NS_IMETHODIMP nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window, - const PRUnichar *newTitle) + const char16_t *newTitle) { nsresult rv; diff --git a/xulrunner/app/nsXULRunnerApp.cpp b/xulrunner/app/nsXULRunnerApp.cpp index 20e9d65c1ef8..cd4f35ec4be3 100644 --- a/xulrunner/app/nsXULRunnerApp.cpp +++ b/xulrunner/app/nsXULRunnerApp.cpp @@ -50,7 +50,7 @@ static void Output(bool isError, 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); UINT flags = MB_OK; From 22ef961b401b95256123f9c032381241f31d8e59 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 4 Jan 2014 10:02:43 -0500 Subject: [PATCH 3/3] Bug 927728 - Part 2: Stop using PRUnichar in our code generators; r=roc,bzbarsky --- dom/bindings/Codegen.py | 4 ++-- xpcom/idl-parser/xpidl.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index c6c0d929bc30..1db50f332fce 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -2760,13 +2760,13 @@ def getHandleDefault(defaultValue): def handleDefaultStringValue(defaultValue, method): """ - Returns a string which ends up calling 'method' with a (PRUnichar*, length) + Returns a string which ends up calling 'method' with a (char16_t*, length) pair that sets this string default value. This string is suitable for passing as the second argument of handleDefault; in particular it does not end with a ';' """ assert defaultValue.type.isDOMString() - return ("static const PRUnichar data[] = { %s };\n" + return ("static const char16_t data[] = { %s };\n" "%s(data, ArrayLength(data) - 1)" % (", ".join(["'" + char + "'" for char in defaultValue.value] + ["0"]), diff --git a/xpcom/idl-parser/xpidl.py b/xpcom/idl-parser/xpidl.py index 7e1932aac011..a9fe7fba9bf7 100644 --- a/xpcom/idl-parser/xpidl.py +++ b/xpcom/idl-parser/xpidl.py @@ -131,8 +131,8 @@ builtinNames = [ Builtin('double', 'double', True, False), Builtin('char', 'char', True, False), Builtin('string', 'char *', False, False), - Builtin('wchar', 'PRUnichar', False, False), - Builtin('wstring', 'PRUnichar *', False, False), + Builtin('wchar', 'char16_t', False, False), + Builtin('wstring', 'char16_t *', False, False), ] builtinMap = {}