mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1662251 - stop assigning from NS_Convert* values, mostly; r=sg
This patch was generated by running: ``` perl -p -i \ -e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF8toUTF16\((.*)\);/\1CopyUTF8toUTF16(\3, \2);/;' \ -e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF16toUTF8\((.*)\);/\1CopyUTF16toUTF8(\3, \2);/;' \ $FILE ``` against every .cpp and .h in mozilla-central, and then fixing up the inevitable errors that happen as a result of matching C++ expressions with regexes. The errors fell into three categories: 1. Calling the convert functions with `std::string::c_str()`; these were changed to simply pass the string instead, relying on implicit conversion to `mozilla::Span`. 2. Calling the convert functions with raw pointers, which is not permitted with the copy functions; these were changed to invoke `MakeStringSpan` first. 3. Other miscellaneous errors resulting from over-eager regexes and/or the replacement not being type-aware. These changes were reverted. Differential Revision: https://phabricator.services.mozilla.com/D88903
This commit is contained in:
parent
af96e9a8f9
commit
cfb8fb313f
@ -64,7 +64,7 @@ class AccessibleWrap : public Accessible {
|
||||
|
||||
static const char* ReturnString(nsAString& aString) {
|
||||
static nsCString returnedString;
|
||||
returnedString = NS_ConvertUTF16toUTF8(aString);
|
||||
CopyUTF16toUTF8(aString, returnedString);
|
||||
return returnedString.get();
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ void BodyConsumer::BeginConsumeBodyMainThread(ThreadSafeWorkerRef* aWorkerRef) {
|
||||
rv = GetBodyLocalFile(getter_AddRefs(file));
|
||||
if (!NS_WARN_IF(NS_FAILED(rv)) && file) {
|
||||
ChromeFilePropertyBag bag;
|
||||
bag.mType = NS_ConvertUTF8toUTF16(mBodyMimeType);
|
||||
CopyUTF8toUTF16(mBodyMimeType, bag.mType);
|
||||
|
||||
ErrorResult error;
|
||||
RefPtr<Promise> promise =
|
||||
|
@ -287,7 +287,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable* aTransferable,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
newFileName.Append(".");
|
||||
newFileName.Append(primaryExtension);
|
||||
targetFilename = NS_ConvertUTF8toUTF16(newFileName);
|
||||
CopyUTF8toUTF16(newFileName, targetFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5904,7 +5904,7 @@ nsresult nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal,
|
||||
asciiOrigin.AssignLiteral("null");
|
||||
}
|
||||
|
||||
aOrigin = NS_ConvertUTF8toUTF16(asciiOrigin);
|
||||
CopyUTF8toUTF16(asciiOrigin, aOrigin);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -5930,7 +5930,7 @@ nsresult nsContentUtils::GetUTFOrigin(nsIURI* aURI, nsAString& aOrigin) {
|
||||
rv = GetASCIIOrigin(aURI, asciiOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aOrigin = NS_ConvertUTF8toUTF16(asciiOrigin);
|
||||
CopyUTF8toUTF16(asciiOrigin, aOrigin);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -8838,7 +8838,7 @@ void nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell,
|
||||
|
||||
nsAutoCString uriStr;
|
||||
uri->GetSpec(uriStr);
|
||||
aPresentationUrl = NS_ConvertUTF8toUTF16(uriStr);
|
||||
CopyUTF8toUTF16(uriStr, aPresentationUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6002,7 +6002,7 @@ bool nsGlobalWindowOuter::GatherPostMessageData(
|
||||
if (!callerPrin->IsSystemPrincipal()) {
|
||||
nsAutoCString asciiOrigin;
|
||||
callerPrin->GetAsciiOrigin(asciiOrigin);
|
||||
aOrigin = NS_ConvertUTF8toUTF16(asciiOrigin);
|
||||
CopyUTF8toUTF16(asciiOrigin, aOrigin);
|
||||
} else if (callerInnerWin) {
|
||||
if (!*aCallerURI) {
|
||||
return false;
|
||||
|
@ -5387,7 +5387,7 @@ void ClientWebGLContext::GetActiveUniformBlockName(const WebGLProgramJS& prog,
|
||||
}
|
||||
|
||||
const auto& block = list[index];
|
||||
retval = NS_ConvertUTF8toUTF16(block.name.c_str());
|
||||
CopyUTF8toUTF16(block.name, retval);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::GetActiveUniformBlockParameter(
|
||||
@ -5742,7 +5742,7 @@ void ClientWebGLContext::GetProgramInfoLog(const WebGLProgramJS& prog,
|
||||
if (!prog.ValidateUsable(*this, "program")) return;
|
||||
|
||||
const auto& res = GetLinkResult(prog);
|
||||
retval = NS_ConvertUTF8toUTF16(res.log);
|
||||
CopyUTF8toUTF16(res.log, retval);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::GetProgramParameter(
|
||||
@ -5826,7 +5826,7 @@ void ClientWebGLContext::GetShaderInfoLog(const WebGLShaderJS& shader,
|
||||
if (!shader.ValidateUsable(*this, "shader")) return;
|
||||
|
||||
const auto& result = GetCompileResult(shader);
|
||||
retval = NS_ConvertUTF8toUTF16(result.log);
|
||||
CopyUTF8toUTF16(result.log, retval);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::GetShaderParameter(
|
||||
@ -5864,7 +5864,7 @@ void ClientWebGLContext::GetShaderSource(const WebGLShaderJS& shader,
|
||||
if (IsContextLost()) return;
|
||||
if (!shader.ValidateUsable(*this, "shader")) return;
|
||||
|
||||
retval = NS_ConvertUTF8toUTF16(shader.mSource.c_str());
|
||||
CopyUTF8toUTF16(shader.mSource, retval);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::GetTranslatedShaderSource(const WebGLShaderJS& shader,
|
||||
@ -5875,7 +5875,7 @@ void ClientWebGLContext::GetTranslatedShaderSource(const WebGLShaderJS& shader,
|
||||
if (!shader.ValidateUsable(*this, "shader")) return;
|
||||
|
||||
const auto& result = GetCompileResult(shader);
|
||||
retval = NS_ConvertUTF8toUTF16(result.translatedSource);
|
||||
CopyUTF8toUTF16(result.translatedSource, retval);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::ShaderSource(WebGLShaderJS& shader,
|
||||
|
@ -70,7 +70,7 @@ class WebGLActiveInfoJS final : public RefCounted<WebGLActiveInfoJS> {
|
||||
GLenum Type() const { return mInfo.elemType; }
|
||||
|
||||
void GetName(nsString& retval) const {
|
||||
retval = NS_ConvertUTF8toUTF16(mInfo.name.c_str());
|
||||
CopyUTF8toUTF16(mInfo.name, retval);
|
||||
}
|
||||
|
||||
bool WrapObject(JSContext*, JS::Handle<JSObject*>,
|
||||
|
@ -749,7 +749,7 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
} else {
|
||||
Event::GetWidgetEventType(aEvent, eventTypeU16);
|
||||
}
|
||||
eventType = NS_ConvertUTF16toUTF8(eventTypeU16);
|
||||
CopyUTF16toUTF8(eventTypeU16, eventType);
|
||||
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aTarget);
|
||||
nsAutoString elementId;
|
||||
|
@ -624,7 +624,7 @@ const nsAutoCString& ParticularProcessPriorityManager::NameWithComma() {
|
||||
return mNameWithComma; // empty string
|
||||
}
|
||||
|
||||
mNameWithComma = NS_ConvertUTF16toUTF8(name);
|
||||
CopyUTF16toUTF8(name, mNameWithComma);
|
||||
mNameWithComma.AppendLiteral(", ");
|
||||
return mNameWithComma;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void DOMLocalization::GetAttributes(Element& aElement, L10nIdArgs& aResult,
|
||||
nsAutoString l10nArgs;
|
||||
|
||||
if (aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nid, l10nId)) {
|
||||
aResult.mId = NS_ConvertUTF16toUTF8(l10nId);
|
||||
CopyUTF16toUTF8(l10nId, aResult.mId);
|
||||
}
|
||||
|
||||
if (aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nargs, l10nArgs)) {
|
||||
|
@ -1339,12 +1339,12 @@ MediaDecoderOwner::NextFrameStatus MediaDecoder::NextFrameBufferedStatus() {
|
||||
}
|
||||
|
||||
void MediaDecoder::GetDebugInfo(dom::MediaDecoderDebugInfo& aInfo) {
|
||||
aInfo.mInstance = NS_ConvertUTF8toUTF16(nsPrintfCString("%p", this));
|
||||
CopyUTF8toUTF16(nsPrintfCString("%p", this), aInfo.mInstance);
|
||||
aInfo.mChannels = mInfo ? mInfo->mAudio.mChannels : 0;
|
||||
aInfo.mRate = mInfo ? mInfo->mAudio.mRate : 0;
|
||||
aInfo.mHasAudio = mInfo ? mInfo->HasAudio() : false;
|
||||
aInfo.mHasVideo = mInfo ? mInfo->HasVideo() : false;
|
||||
aInfo.mPlayState = NS_ConvertUTF8toUTF16(PlayStateStr());
|
||||
CopyUTF8toUTF16(MakeStringSpan(PlayStateStr()), aInfo.mPlayState);
|
||||
aInfo.mContainerType =
|
||||
NS_ConvertUTF8toUTF16(ContainerType().Type().AsString());
|
||||
mReader->GetDebugInfo(aInfo.mReader);
|
||||
|
@ -3925,8 +3925,8 @@ void MediaDecoderStateMachine::GetDebugInfo(
|
||||
aInfo.mPlayState = int32_t(mPlayState.Ref());
|
||||
aInfo.mSentFirstFrameLoadedEvent = mSentFirstFrameLoadedEvent;
|
||||
aInfo.mIsPlaying = IsPlaying();
|
||||
aInfo.mAudioRequestStatus = NS_ConvertUTF8toUTF16(AudioRequestStatus());
|
||||
aInfo.mVideoRequestStatus = NS_ConvertUTF8toUTF16(VideoRequestStatus());
|
||||
CopyUTF8toUTF16(MakeStringSpan(AudioRequestStatus()), aInfo.mAudioRequestStatus);
|
||||
CopyUTF8toUTF16(MakeStringSpan(VideoRequestStatus()), aInfo.mVideoRequestStatus);
|
||||
aInfo.mDecodedAudioEndTime = mDecodedAudioEndTime.ToMicroseconds();
|
||||
aInfo.mDecodedVideoEndTime = mDecodedVideoEndTime.ToMicroseconds();
|
||||
aInfo.mAudioCompleted = mAudioCompleted;
|
||||
|
@ -2975,8 +2975,8 @@ void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
aInfo.mAudioDecoderName = NS_ConvertUTF8toUTF16(audioDecoderName);
|
||||
aInfo.mAudioType = NS_ConvertUTF8toUTF16(audioType);
|
||||
CopyUTF8toUTF16(audioDecoderName, aInfo.mAudioDecoderName);
|
||||
CopyUTF8toUTF16(audioType, aInfo.mAudioType);
|
||||
aInfo.mAudioChannels = audioInfo.mChannels;
|
||||
aInfo.mAudioRate = audioInfo.mRate / 1000.0f;
|
||||
aInfo.mAudioFramesDecoded = mAudio.mNumSamplesOutputTotal;
|
||||
@ -3005,8 +3005,8 @@ void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
||||
aInfo.mAudioState.mLastStreamSourceID = mAudio.mLastStreamSourceID;
|
||||
}
|
||||
|
||||
aInfo.mVideoDecoderName = NS_ConvertUTF8toUTF16(videoDecoderName);
|
||||
aInfo.mVideoType = NS_ConvertUTF8toUTF16(videoType);
|
||||
CopyUTF8toUTF16(videoDecoderName, aInfo.mVideoDecoderName);
|
||||
CopyUTF8toUTF16(videoType, aInfo.mVideoType);
|
||||
aInfo.mVideoWidth =
|
||||
videoInfo.mDisplay.width < 0 ? 0 : videoInfo.mDisplay.width;
|
||||
aInfo.mVideoHeight =
|
||||
|
@ -3016,7 +3016,7 @@ nsresult MediaManager::AnonymizeId(nsAString& aId,
|
||||
return rv;
|
||||
}
|
||||
|
||||
aId = NS_ConvertUTF8toUTF16(mac);
|
||||
CopyUTF8toUTF16(mac, aId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ nsString SelectMimeType(bool aHasVideo, bool aHasAudio,
|
||||
if (constrainedType && constrainedType->ExtendedType().HaveCodecs()) {
|
||||
// The constrained mime type is fully defined (it has codecs!). No need to
|
||||
// select anything.
|
||||
result = NS_ConvertUTF8toUTF16(constrainedType->OriginalString());
|
||||
CopyUTF8toUTF16(constrainedType->OriginalString(), result);
|
||||
} else {
|
||||
// There is no constrained mime type, or there is and it is not fully
|
||||
// defined but still valid. Select what's missing, so that we have major
|
||||
|
@ -279,7 +279,7 @@ bool GMPChild::GetUTF8LibPath(nsACString& aOutLibPath) {
|
||||
|
||||
nsAutoString path;
|
||||
libFile->GetPath(path);
|
||||
aOutLibPath = NS_ConvertUTF16toUTF8(path);
|
||||
CopyUTF16toUTF8(path, aOutLibPath);
|
||||
|
||||
return true;
|
||||
#endif
|
||||
@ -396,7 +396,7 @@ static bool AppendHostPath(nsCOMPtr<nsIFile>& aFile,
|
||||
nsCOMPtr<nsIFile> sigFile;
|
||||
if (GetSigPath(2, binary, aFile, sigFile) &&
|
||||
NS_SUCCEEDED(sigFile->GetPath(str))) {
|
||||
sigFilePath = NS_ConvertUTF16toUTF8(str);
|
||||
CopyUTF16toUTF8(str, sigFilePath);
|
||||
} else {
|
||||
// Cannot successfully get the sig file path.
|
||||
// Assume it is located at the same place as plugin-container
|
||||
@ -431,7 +431,7 @@ GMPChild::MakeCDMHostVerificationPaths() {
|
||||
const std::string pluginContainer =
|
||||
WideToUTF8(CommandLine::ForCurrentProcess()->program());
|
||||
path = nullptr;
|
||||
str = NS_ConvertUTF8toUTF16(nsDependentCString(pluginContainer.c_str()));
|
||||
CopyUTF8toUTF16(nsDependentCString(pluginContainer.c_str()), str);
|
||||
if (NS_FAILED(NS_NewLocalFile(str, true, /* aFollowLinks */
|
||||
getter_AddRefs(path))) ||
|
||||
!AppendHostPath(path, paths)) {
|
||||
|
@ -698,9 +698,9 @@ RefPtr<GenericPromise> GMPParent::ParseChromiumManifest(
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
mDisplayName = NS_ConvertUTF16toUTF8(m.mName);
|
||||
mDescription = NS_ConvertUTF16toUTF8(m.mDescription);
|
||||
mVersion = NS_ConvertUTF16toUTF8(m.mVersion);
|
||||
CopyUTF16toUTF8(m.mName, mDisplayName);
|
||||
CopyUTF16toUTF8(m.mDescription, mDescription);
|
||||
CopyUTF16toUTF8(m.mVersion, mVersion);
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
if (!mozilla::SandboxInfo::Get().CanSandboxMedia()) {
|
||||
|
@ -29,7 +29,7 @@ bool GMPProcessChild::Init(int aArgc, char* aArgv[]) {
|
||||
// Keep in sync with dom/plugins/PluginModuleParent.
|
||||
std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
|
||||
MOZ_ASSERT(values.size() >= 2, "not enough args");
|
||||
pluginFilename = NS_ConvertUTF8toUTF16(nsDependentCString(values[1].c_str()));
|
||||
CopyUTF8toUTF16(nsDependentCString(values[1].c_str()), pluginFilename);
|
||||
#elif defined(OS_WIN)
|
||||
std::vector<std::wstring> values =
|
||||
CommandLine::ForCurrentProcess()->GetLooseValues();
|
||||
|
@ -175,7 +175,7 @@ static nsresult GMPPlatformString(nsAString& aOutPlatform) {
|
||||
platform.AppendLiteral("_");
|
||||
platform.Append(arch);
|
||||
|
||||
aOutPlatform = NS_ConvertUTF8toUTF16(platform);
|
||||
CopyUTF8toUTF16(platform, aOutPlatform);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ MediaEventSource<int64_t>& DecodedStreamData::OnOutput() {
|
||||
void DecodedStreamData::Forget() { mListener->Forget(); }
|
||||
|
||||
void DecodedStreamData::GetDebugInfo(dom::DecodedStreamDataDebugInfo& aInfo) {
|
||||
aInfo.mInstance = NS_ConvertUTF8toUTF16(nsPrintfCString("%p", this));
|
||||
CopyUTF8toUTF16(nsPrintfCString("%p", this), aInfo.mInstance);
|
||||
aInfo.mAudioFramesWritten = mAudioFramesWritten;
|
||||
aInfo.mStreamAudioWritten = mAudioTrackWritten;
|
||||
aInfo.mNextAudioTime = mNextAudioTime.ToMicroseconds();
|
||||
|
@ -2859,7 +2859,7 @@ void TrackBuffersManager::TrackData::AddSizeOfResources(
|
||||
|
||||
void TrackBuffersManager::GetDebugInfo(
|
||||
dom::TrackBuffersManagerDebugInfo& aInfo) {
|
||||
aInfo.mType = NS_ConvertUTF8toUTF16(mType.Type().AsString());
|
||||
CopyUTF8toUTF16(mType.Type().AsString(), aInfo.mType);
|
||||
|
||||
if (HasAudio()) {
|
||||
aInfo.mNextSampleTime = mAudioTracks.mNextSampleTime.ToSeconds();
|
||||
|
@ -272,7 +272,7 @@ nsresult TCPSocket::InitWithTransport(nsISocketTransport* aTransport) {
|
||||
|
||||
nsAutoCString host;
|
||||
mTransport->GetHost(host);
|
||||
mHost = NS_ConvertUTF8toUTF16(host);
|
||||
CopyUTF8toUTF16(host, mHost);
|
||||
int32_t port;
|
||||
mTransport->GetPort(&port);
|
||||
mPort = port;
|
||||
|
@ -62,7 +62,7 @@ already_AddRefed<UDPSocket> UDPSocket::Constructor(const GlobalObject& aGlobal,
|
||||
|
||||
nsCString remoteAddress;
|
||||
if (aOptions.mRemoteAddress.WasPassed()) {
|
||||
remoteAddress = NS_ConvertUTF16toUTF8(aOptions.mRemoteAddress.Value());
|
||||
CopyUTF16toUTF8(aOptions.mRemoteAddress.Value(), remoteAddress);
|
||||
} else {
|
||||
remoteAddress.SetIsVoid(true);
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool UDPSocket::Send(const StringOrBlobOrArrayBufferOrArrayBufferView& aData,
|
||||
// arguments, throw InvalidAccessError.
|
||||
nsCString remoteAddress;
|
||||
if (aRemoteAddress.WasPassed()) {
|
||||
remoteAddress = NS_ConvertUTF16toUTF8(aRemoteAddress.Value());
|
||||
CopyUTF16toUTF8(aRemoteAddress.Value(), remoteAddress);
|
||||
UDPSOCKET_LOG(("%s: Send to %s", __FUNCTION__, remoteAddress.get()));
|
||||
} else if (!mRemoteAddress.IsVoid()) {
|
||||
remoteAddress = mRemoteAddress;
|
||||
@ -433,7 +433,7 @@ nsresult UDPSocket::InitLocal(const nsAString& aLocalAddress,
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
mLocalAddress = NS_ConvertUTF8toUTF16(localAddress);
|
||||
CopyUTF8toUTF16(localAddress, mLocalAddress);
|
||||
|
||||
uint16_t localPort;
|
||||
rv = localAddr->GetPort(&localPort);
|
||||
@ -598,7 +598,7 @@ nsresult UDPSocket::DispatchReceivedData(const nsACString& aRemoteAddress,
|
||||
|
||||
// Create DOM event
|
||||
RootedDictionary<UDPMessageEventInit> init(cx);
|
||||
init.mRemoteAddress = NS_ConvertUTF8toUTF16(aRemoteAddress);
|
||||
CopyUTF8toUTF16(aRemoteAddress, init.mRemoteAddress);
|
||||
init.mRemotePort = aRemotePort;
|
||||
init.mData = jsData;
|
||||
|
||||
@ -685,7 +685,7 @@ UDPSocket::CallListenerOpened() {
|
||||
MOZ_ASSERT(mSocketChild);
|
||||
|
||||
// Get real local address and local port
|
||||
mLocalAddress = NS_ConvertUTF8toUTF16(mSocketChild->LocalAddress());
|
||||
CopyUTF8toUTF16(mSocketChild->LocalAddress(), mLocalAddress);
|
||||
|
||||
mLocalPort.SetValue(mSocketChild->LocalPort());
|
||||
|
||||
|
@ -66,7 +66,7 @@ class UDPSocket final : public DOMEventTargetHelper,
|
||||
return;
|
||||
}
|
||||
|
||||
aRetVal = NS_ConvertUTF8toUTF16(mRemoteAddress);
|
||||
CopyUTF8toUTF16(mRemoteAddress, aRetVal);
|
||||
}
|
||||
|
||||
Nullable<uint16_t> GetRemotePort() const { return mRemotePort; }
|
||||
|
@ -1598,7 +1598,7 @@ nsresult Notification::ResolveIconAndSoundURL(nsString& iconUrl,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString src;
|
||||
srcUri->GetSpec(src);
|
||||
iconUrl = NS_ConvertUTF8toUTF16(src);
|
||||
CopyUTF8toUTF16(src, iconUrl);
|
||||
}
|
||||
}
|
||||
if (mBehavior.mSoundFile.Length() > 0) {
|
||||
@ -1608,7 +1608,7 @@ nsresult Notification::ResolveIconAndSoundURL(nsString& iconUrl,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString src;
|
||||
srcUri->GetSpec(src);
|
||||
soundUrl = NS_ConvertUTF8toUTF16(src);
|
||||
CopyUTF8toUTF16(src, soundUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ void Performance::TimingNotification(PerformanceEntry* aEntry,
|
||||
init.mStartTime = aEntry->StartTime();
|
||||
init.mDuration = aEntry->Duration();
|
||||
init.mEpoch = aEpoch;
|
||||
init.mOrigin = NS_ConvertUTF8toUTF16(aOwner.BeginReading());
|
||||
CopyUTF8toUTF16(aOwner, init.mOrigin);
|
||||
|
||||
RefPtr<PerformanceEntryEvent> perfEntryEvent =
|
||||
PerformanceEntryEvent::Constructor(this, u"performanceentry"_ns, init);
|
||||
|
@ -34,7 +34,7 @@ void GetURLSpecFromChannel(nsITimedChannel* aChannel, nsAString& aSpec) {
|
||||
return;
|
||||
}
|
||||
|
||||
aSpec = NS_ConvertUTF8toUTF16(spec);
|
||||
CopyUTF8toUTF16(spec, aSpec);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -62,7 +62,7 @@ PerformanceTimingData* PerformanceTimingData::Create(
|
||||
|
||||
nsAutoCString name;
|
||||
originalURI->GetSpec(name);
|
||||
aEntryName = NS_ConvertUTF8toUTF16(name);
|
||||
CopyUTF8toUTF16(name, aEntryName);
|
||||
|
||||
// The nsITimedChannel argument will be used to gather all the timings.
|
||||
// The nsIHttpChannel argument will be used to check if any cross-origin
|
||||
@ -211,7 +211,7 @@ void PerformanceTimingData::SetPropertiesFromHttpChannel(
|
||||
|
||||
nsAutoCString protocol;
|
||||
Unused << aHttpChannel->GetProtocolVersion(protocol);
|
||||
mNextHopProtocol = NS_ConvertUTF8toUTF16(protocol);
|
||||
CopyUTF8toUTF16(protocol, mNextHopProtocol);
|
||||
|
||||
Unused << aHttpChannel->GetEncodedBodySize(&mEncodedBodySize);
|
||||
Unused << aHttpChannel->GetTransferSize(&mTransferSize);
|
||||
|
@ -58,7 +58,7 @@ static nsresult GetAbsoluteURL(const nsAString& aUrl, nsIURI* aBaseUri,
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
|
||||
aAbsoluteUrl = NS_ConvertUTF8toUTF16(spec);
|
||||
CopyUTF8toUTF16(spec, aAbsoluteUrl);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ bool CrashReport::Deliver(nsIPrincipal* aPrincipal, bool aIsOOM) {
|
||||
ReportDeliver::ReportData data;
|
||||
data.mType = u"crash"_ns;
|
||||
data.mGroupName = u"default"_ns;
|
||||
data.mURL = NS_ConvertUTF8toUTF16(safe_origin_spec);
|
||||
CopyUTF8toUTF16(safe_origin_spec, data.mURL);
|
||||
data.mCreationTime = TimeStamp::Now();
|
||||
|
||||
Navigator::GetUserAgent(nullptr, aPrincipal, false, data.mUserAgent);
|
||||
|
@ -656,7 +656,7 @@ void AutoEntryScript::DocshellEntryMonitor::Entry(
|
||||
rootedScript = JS_GetFunctionScript(aCx, rootedFunction);
|
||||
}
|
||||
if (rootedScript) {
|
||||
filename = NS_ConvertUTF8toUTF16(JS_GetScriptFilename(rootedScript));
|
||||
CopyUTF8toUTF16(MakeStringSpan(JS_GetScriptFilename(rootedScript)), filename);
|
||||
lineNumber = JS_GetScriptBaseLineNumber(aCx, rootedScript);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ nsCSPContext::AppendPolicy(const nsAString& aPolicyString, bool aReportOnly,
|
||||
if (mSelfURI) {
|
||||
mSelfURI->GetAsciiSpec(selfURIspec);
|
||||
}
|
||||
referrer = NS_ConvertUTF16toUTF8(mReferrer);
|
||||
CopyUTF16toUTF8(mReferrer, referrer);
|
||||
CSPCONTEXTLOG(
|
||||
("nsCSPContext::AppendPolicy added UPGRADE_IF_INSECURE_DIRECTIVE "
|
||||
"self-uri=%s referrer=%s",
|
||||
@ -997,7 +997,7 @@ nsresult nsCSPContext::GatherSecurityPolicyViolationEventData(
|
||||
// document-uri
|
||||
nsAutoCString reportDocumentURI;
|
||||
StripURIForReporting(mSelfURI, mSelfURI, reportDocumentURI);
|
||||
aViolationEventInit.mDocumentURI = NS_ConvertUTF8toUTF16(reportDocumentURI);
|
||||
CopyUTF8toUTF16(reportDocumentURI, aViolationEventInit.mDocumentURI);
|
||||
|
||||
// referrer
|
||||
aViolationEventInit.mReferrer = mReferrer;
|
||||
@ -1015,9 +1015,9 @@ nsresult nsCSPContext::GatherSecurityPolicyViolationEventData(
|
||||
}
|
||||
nsAutoCString reportBlockedURI;
|
||||
StripURIForReporting(uriToReport, mSelfURI, reportBlockedURI);
|
||||
aViolationEventInit.mBlockedURI = NS_ConvertUTF8toUTF16(reportBlockedURI);
|
||||
CopyUTF8toUTF16(reportBlockedURI, aViolationEventInit.mBlockedURI);
|
||||
} else {
|
||||
aViolationEventInit.mBlockedURI = NS_ConvertUTF8toUTF16(aBlockedString);
|
||||
CopyUTF8toUTF16(aBlockedString, aViolationEventInit.mBlockedURI);
|
||||
}
|
||||
|
||||
// effective-directive
|
||||
@ -1043,7 +1043,7 @@ nsresult nsCSPContext::GatherSecurityPolicyViolationEventData(
|
||||
if (sourceURI) {
|
||||
nsAutoCString spec;
|
||||
sourceURI->GetSpecIgnoringRef(spec);
|
||||
aSourceFile = NS_ConvertUTF8toUTF16(spec);
|
||||
CopyUTF8toUTF16(spec, aSourceFile);
|
||||
}
|
||||
aViolationEventInit.mSourceFile = aSourceFile;
|
||||
}
|
||||
|
@ -2112,7 +2112,7 @@ ServiceWorkerManager::GetScopeForUrl(nsIPrincipal* aPrincipal,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aScope = NS_ConvertUTF8toUTF16(r->Scope());
|
||||
CopyUTF8toUTF16(r->Scope(), aScope);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -998,7 +998,7 @@ class MessageEventOp final : public ExtendableEventOp {
|
||||
nsCString origin;
|
||||
mozUrl->Origin(origin);
|
||||
|
||||
init.mOrigin = NS_ConvertUTF8toUTF16(origin);
|
||||
CopyUTF8toUTF16(origin, init.mOrigin);
|
||||
|
||||
init.mSource.SetValue().SetAsClient() = new Client(
|
||||
sgo, mArgs.get_ServiceWorkerMessageEventOpArgs().clientInfoAndState());
|
||||
@ -1297,7 +1297,7 @@ void FetchEventOp::GetRequestURL(nsAString& aOutRequestURL) {
|
||||
mArgs.get_ServiceWorkerFetchEventOpArgs().internalRequest().urlList();
|
||||
MOZ_ASSERT(!urls.IsEmpty());
|
||||
|
||||
aOutRequestURL = NS_ConvertUTF8toUTF16(urls.LastElement());
|
||||
CopyUTF8toUTF16(urls.LastElement(), aOutRequestURL);
|
||||
}
|
||||
|
||||
void FetchEventOp::ResolvedCallback(JSContext* aCx,
|
||||
|
@ -47,7 +47,7 @@ class CreateURLRunnable : public WorkerMainThreadRunnable {
|
||||
return false;
|
||||
}
|
||||
|
||||
mURL = NS_ConvertUTF8toUTF16(url);
|
||||
CopyUTF8toUTF16(url, mURL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -379,7 +379,7 @@ uint32_t VRDisplay::DisplayId() const {
|
||||
|
||||
void VRDisplay::GetDisplayName(nsAString& aDisplayName) const {
|
||||
const gfx::VRDisplayInfo& info = mClient->GetDisplayInfo();
|
||||
aDisplayName = NS_ConvertUTF8toUTF16(info.GetDisplayName());
|
||||
CopyUTF8toUTF16(MakeStringSpan(info.GetDisplayName()), aDisplayName);
|
||||
}
|
||||
|
||||
void VRDisplay::UpdateFrameInfo() {
|
||||
|
@ -619,7 +619,7 @@ nsresult PersistNodeFixup::FixupURI(nsAString& aURI) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!replacement->IsEmpty()) {
|
||||
aURI = NS_ConvertUTF8toUTF16(*replacement);
|
||||
CopyUTF8toUTF16(*replacement, aURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ bool ContentSecurityPolicyAllows(JSContext* aCx, JS::HandleString aCode) {
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineNum, &columnNum) &&
|
||||
file.get()) {
|
||||
fileName = NS_ConvertUTF8toUTF16(file.get());
|
||||
CopyUTF8toUTF16(MakeStringSpan(file.get()), fileName);
|
||||
} else {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(aCx));
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class ReportGenericErrorRunnable final : public WorkerDebuggeeRunnable {
|
||||
} // namespace
|
||||
|
||||
void WorkerErrorBase::AssignErrorBase(JSErrorBase* aReport) {
|
||||
mFilename = NS_ConvertUTF8toUTF16(aReport->filename);
|
||||
CopyUTF8toUTF16(MakeStringSpan(aReport->filename), mFilename);
|
||||
mLineNumber = aReport->lineno;
|
||||
mColumnNumber = aReport->column;
|
||||
mErrorNumber = aReport->errorNumber;
|
||||
|
@ -354,7 +354,7 @@ void WorkerGlobalScope::ImportScripts(JSContext* aCx,
|
||||
if (profiler_can_accept_markers()) {
|
||||
const uint32_t urlCount = aScriptURLs.Length();
|
||||
if (urlCount) {
|
||||
urls = NS_ConvertUTF16toUTF8(aScriptURLs[0]);
|
||||
CopyUTF16toUTF8(aScriptURLs[0], urls);
|
||||
for (uint32_t index = 1; index < urlCount; index++) {
|
||||
urls.AppendLiteral(",");
|
||||
urls.Append(NS_ConvertUTF16toUTF8(aScriptURLs[index]));
|
||||
|
@ -2160,7 +2160,7 @@ XMLHttpRequestMainThread::OnStopRequest(nsIRequest* request, nsresult status) {
|
||||
}
|
||||
|
||||
ChromeFilePropertyBag bag;
|
||||
bag.mType = NS_ConvertUTF8toUTF16(contentType);
|
||||
CopyUTF8toUTF16(contentType, bag.mType);
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal();
|
||||
|
||||
|
@ -137,7 +137,7 @@ nsresult EvaluateAdminConfigScript(JS::HandleObject sandbox,
|
||||
nsString convertedScript;
|
||||
bool isUTF8 = IsUtf8(script);
|
||||
if (isUTF8) {
|
||||
convertedScript = NS_ConvertUTF8toUTF16(script);
|
||||
CopyUTF8toUTF16(script, convertedScript);
|
||||
} else {
|
||||
nsContentUtils::ReportToConsoleNonLocalized(
|
||||
nsLiteralString(
|
||||
|
@ -84,7 +84,7 @@ struct APZTestDataToJSConverter {
|
||||
}
|
||||
|
||||
static void ConvertString(const std::string& aFrom, nsString& aOutTo) {
|
||||
aOutTo = NS_ConvertUTF8toUTF16(aFrom.c_str(), aFrom.size());
|
||||
CopyUTF8toUTF16(aFrom, aOutTo);
|
||||
}
|
||||
|
||||
static void ConvertHitResult(const APZTestData::HitResult& aResult,
|
||||
|
@ -1814,7 +1814,7 @@ void RasterImage::ReportDecoderError() {
|
||||
if (!GetSpecTruncatedTo1k(uri)) {
|
||||
msg += u" URI in this note truncated due to length."_ns;
|
||||
}
|
||||
src = NS_ConvertUTF8toUTF16(uri);
|
||||
CopyUTF8toUTF16(uri, src);
|
||||
}
|
||||
if (NS_SUCCEEDED(errorObject->InitWithWindowID(msg, src, EmptyString(), 0,
|
||||
0, nsIScriptError::errorFlag,
|
||||
|
@ -38,7 +38,7 @@ void ICUUtils::LanguageTagIterForContent::GetNext(nsACString& aBCP47LangTag) {
|
||||
nsAutoString lang;
|
||||
mContent->GetLang(lang);
|
||||
if (!lang.IsEmpty()) {
|
||||
aBCP47LangTag = NS_ConvertUTF16toUTF8(lang);
|
||||
CopyUTF16toUTF8(lang, aBCP47LangTag);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -50,7 +50,7 @@ void ICUUtils::LanguageTagIterForContent::GetNext(nsACString& aBCP47LangTag) {
|
||||
nsAutoString lang;
|
||||
mContent->OwnerDoc()->GetContentLanguage(lang);
|
||||
if (!lang.IsEmpty()) {
|
||||
aBCP47LangTag = NS_ConvertUTF16toUTF8(lang);
|
||||
CopyUTF16toUTF8(lang, aBCP47LangTag);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ static bool GetCurrentWorkingDirectory(nsAString& workingDirectory) {
|
||||
// size back down to the actual string length
|
||||
cwd.SetLength(strlen(result) + 1);
|
||||
cwd.Replace(cwd.Length() - 1, 1, '/');
|
||||
workingDirectory = NS_ConvertUTF8toUTF16(cwd);
|
||||
CopyUTF8toUTF16(cwd, workingDirectory);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -1538,7 +1538,7 @@ already_AddRefed<nsIContent> nsCSSFrameConstructor::CreateGeneratedContent(
|
||||
} else {
|
||||
auto& counters = item.AsCounters();
|
||||
name = counters._0.AsAtom();
|
||||
separator = NS_ConvertUTF8toUTF16(counters._1.AsString());
|
||||
CopyUTF8toUTF16(counters._1.AsString(), separator);
|
||||
ptr = CounterStylePtr::FromStyle(counters._2);
|
||||
}
|
||||
|
||||
|
@ -2944,8 +2944,8 @@ static void GetDocTitleAndURL(const UniquePtr<nsPrintObject>& aPO,
|
||||
nsAutoString docTitleStr;
|
||||
nsAutoString docURLStr;
|
||||
GetDocumentTitleAndURL(aPO->mDocument, docTitleStr, docURLStr);
|
||||
aDocStr = NS_ConvertUTF16toUTF8(docTitleStr);
|
||||
aURLStr = NS_ConvertUTF16toUTF8(docURLStr);
|
||||
CopyUTF16toUTF8(docTitleStr, aDocStr);
|
||||
CopyUTF16toUTF8(docURLStr, aURLStr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
@ -85,7 +85,7 @@ void RTCDTMFSender::InsertDTMF(const nsAString& aTones, uint32_t aDuration,
|
||||
return;
|
||||
}
|
||||
|
||||
mToneBuffer = NS_ConvertUTF8toUTF16(utf8Tones.c_str());
|
||||
CopyUTF8toUTF16(utf8Tones, mToneBuffer);
|
||||
mDuration = std::clamp(aDuration, 40U, 6000U);
|
||||
mInterToneGap = std::clamp(aInterToneGap, 30U, 6000U);
|
||||
|
||||
|
@ -124,7 +124,7 @@ NS_IMETHODIMP
|
||||
nsCertTreeDispInfo::GetHostPort(nsAString& aHostPort) {
|
||||
nsAutoCString hostPort;
|
||||
nsCertOverrideService::GetHostWithPort(mAsciiHost, mPort, hostPort);
|
||||
aHostPort = NS_ConvertUTF8toUTF16(hostPort);
|
||||
CopyUTF8toUTF16(hostPort, aHostPort);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ nsCertTree::GetCellText(int32_t row, nsTreeColumn* col, nsAString& _retval) {
|
||||
nsAutoCString hostPort;
|
||||
nsCertOverrideService::GetHostWithPort(certdi->mAsciiHost, certdi->mPort,
|
||||
hostPort);
|
||||
_retval = NS_ConvertUTF8toUTF16(hostPort);
|
||||
CopyUTF8toUTF16(hostPort, _retval);
|
||||
} else {
|
||||
_retval = u"*"_ns;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ static nsresult GenerateType3Msg(const nsString& domain,
|
||||
}
|
||||
|
||||
if (unicode) {
|
||||
ucsHostBuf = NS_ConvertUTF8toUTF16(hostBuf);
|
||||
CopyUTF8toUTF16(hostBuf, ucsHostBuf);
|
||||
hostPtr = ucsHostBuf.get();
|
||||
hostLen = ucsHostBuf.Length() * 2;
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
|
@ -152,7 +152,7 @@ bool Vacuumer::execute() {
|
||||
nsAutoString databaseFilename;
|
||||
rv = databaseFile->GetLeafName(databaseFilename);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
mDBFilename = NS_ConvertUTF16toUTF8(databaseFilename);
|
||||
CopyUTF16toUTF8(databaseFilename, mDBFilename);
|
||||
MOZ_ASSERT(!mDBFilename.IsEmpty(), "Database filename cannot be empty");
|
||||
|
||||
// Check interval from last vacuum.
|
||||
|
@ -323,15 +323,15 @@ void MatchPattern::Init(JSContext* aCx, const nsAString& aPattern,
|
||||
if (host.EqualsLiteral("*")) {
|
||||
mMatchSubdomain = true;
|
||||
} else if (StringHead(host, 2).EqualsLiteral("*.")) {
|
||||
mDomain = NS_ConvertUTF16toUTF8(Substring(host, 2));
|
||||
CopyUTF16toUTF8(Substring(host, 2), mDomain);
|
||||
mMatchSubdomain = true;
|
||||
} else if (host.Length() > 1 && host[0] == '[' &&
|
||||
host[host.Length() - 1] == ']') {
|
||||
// This is an IPv6 literal, we drop the enclosing `[]` to be
|
||||
// consistent with nsIURI.
|
||||
mDomain = NS_ConvertUTF16toUTF8(Substring(host, 1, host.Length() - 2));
|
||||
CopyUTF16toUTF8(Substring(host, 1, host.Length() - 2), mDomain);
|
||||
} else {
|
||||
mDomain = NS_ConvertUTF16toUTF8(host);
|
||||
CopyUTF16toUTF8(host, mDomain);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2024,7 +2024,7 @@ History::UpdatePlaces(JS::Handle<JS::Value> aPlaceInfos,
|
||||
if (fatGUID.IsVoid()) {
|
||||
guid.SetIsVoid(true);
|
||||
} else {
|
||||
guid = NS_ConvertUTF16toUTF8(fatGUID);
|
||||
CopyUTF16toUTF8(fatGUID, guid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1870,7 +1870,7 @@ void nsNavBookmarks::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
||||
|
||||
ItemVisitData visitData;
|
||||
visitData.visitId = visit->mVisitId;
|
||||
visitData.bookmark.url = NS_ConvertUTF16toUTF8(visit->mUrl);
|
||||
CopyUTF16toUTF8(visit->mUrl, visitData.bookmark.url);
|
||||
visitData.time = visit->mVisitTime * 1000;
|
||||
visitData.transitionType = visit->mTransitionType;
|
||||
RefPtr<AsyncGetBookmarksForURI<ItemVisitMethod, ItemVisitData>> notifier =
|
||||
@ -1923,7 +1923,7 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, uint32_t aChangedAttribute,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
changeData.property = "favicon"_ns;
|
||||
changeData.isAnnotation = false;
|
||||
changeData.newValue = NS_ConvertUTF16toUTF8(aNewValue);
|
||||
CopyUTF16toUTF8(aNewValue, changeData.newValue);
|
||||
changeData.bookmark.lastModified = 0;
|
||||
changeData.bookmark.type = TYPE_BOOKMARK;
|
||||
|
||||
|
@ -3100,7 +3100,7 @@ nsresult internal_ParseHistogramData(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aOutName = NS_ConvertUTF16toUTF8(histogramName);
|
||||
CopyUTF16toUTF8(histogramName, aOutName);
|
||||
|
||||
// Get the data for this histogram.
|
||||
JS::RootedValue histogramData(aCx);
|
||||
|
@ -284,7 +284,7 @@ nsresult nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert,
|
||||
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName("brandShortName", appName);
|
||||
appShortName = NS_ConvertUTF16toUTF8(appName);
|
||||
CopyUTF16toUTF8(appName, appShortName);
|
||||
} else {
|
||||
NS_WARNING(
|
||||
"brand.properties not present, using default application name");
|
||||
@ -329,13 +329,13 @@ nsresult nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert,
|
||||
if (title.IsEmpty()) {
|
||||
mAlertTitle = " "_ns;
|
||||
} else {
|
||||
mAlertTitle = NS_ConvertUTF16toUTF8(title);
|
||||
CopyUTF16toUTF8(title, mAlertTitle);
|
||||
}
|
||||
|
||||
nsAutoString text;
|
||||
rv = aAlert->GetText(text);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mAlertText = NS_ConvertUTF16toUTF8(text);
|
||||
CopyUTF16toUTF8(text, mAlertText);
|
||||
|
||||
mAlertListener = aAlertListener;
|
||||
|
||||
|
@ -4034,7 +4034,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
||||
nsString leafName;
|
||||
rv = mProfD->GetLeafName(leafName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
profileName = NS_ConvertUTF16toUTF8(leafName);
|
||||
CopyUTF16toUTF8(leafName, profileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ static nsresult GetInstallDirPath(nsIFile* appDir, nsACString& installDirPath) {
|
||||
nsAutoString installDirPathW;
|
||||
rv = appDir->GetPath(installDirPathW);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
installDirPath = NS_ConvertUTF16toUTF8(installDirPathW);
|
||||
CopyUTF16toUTF8(installDirPathW, installDirPath);
|
||||
#else
|
||||
rv = appDir->GetNativePath(installDirPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -336,7 +336,7 @@ static void ApplyUpdate(nsIFile* greDir, nsIFile* updateDir, nsIFile* appDir,
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
updaterPath = NS_ConvertUTF16toUTF8(updaterPathW);
|
||||
CopyUTF16toUTF8(updaterPathW, updaterPath);
|
||||
|
||||
// Get the path to the update dir.
|
||||
nsAutoString updateDirPathW;
|
||||
@ -344,7 +344,7 @@ static void ApplyUpdate(nsIFile* greDir, nsIFile* updateDir, nsIFile* appDir,
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
updateDirPath = NS_ConvertUTF16toUTF8(updateDirPathW);
|
||||
CopyUTF16toUTF8(updateDirPathW, updateDirPath);
|
||||
#elif defined(XP_MACOSX)
|
||||
// Get an nsIFile reference for the updater in the installation dir.
|
||||
if (!GetFile(appDir, nsLiteralCString(UPDATER_APP), updater)) {
|
||||
@ -418,7 +418,7 @@ static void ApplyUpdate(nsIFile* greDir, nsIFile* updateDir, nsIFile* appDir,
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
appFilePath = NS_ConvertUTF16toUTF8(appFilePathW);
|
||||
CopyUTF16toUTF8(appFilePathW, appFilePath);
|
||||
#else
|
||||
rv = appFile->GetNativePath(appFilePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -454,7 +454,7 @@ static void ApplyUpdate(nsIFile* greDir, nsIFile* updateDir, nsIFile* appDir,
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
applyToDirPath = NS_ConvertUTF16toUTF8(applyToDirPathW);
|
||||
CopyUTF16toUTF8(applyToDirPathW, applyToDirPath);
|
||||
#else
|
||||
rv = updatedDir->GetNativePath(applyToDirPath);
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI* aURI) {
|
||||
if (mType.Equals(uriScheme) || mType.Equals(uriSpec)) {
|
||||
mimeType = EmptyString();
|
||||
} else {
|
||||
mimeType = NS_ConvertUTF8toUTF16(mType);
|
||||
CopyUTF8toUTF16(mType, mimeType);
|
||||
}
|
||||
|
||||
if (java::GeckoAppShell::OpenUriExternal(
|
||||
|
@ -213,7 +213,7 @@ Command GetInternalCommand(const char* aCommandName,
|
||||
if (NS_FAILED(rv)) {
|
||||
return Command::FormatJustifyNone;
|
||||
}
|
||||
cValue = NS_ConvertUTF16toUTF8(value);
|
||||
CopyUTF16toUTF8(value, cValue);
|
||||
}
|
||||
if (cValue.LowerCaseEqualsASCII("left")) {
|
||||
return Command::FormatJustifyLeft;
|
||||
|
@ -424,7 +424,7 @@ nsPrintSettingsGTK::GetPrinterName(nsAString& aPrinter) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
aPrinter = NS_ConvertUTF8toUTF16(gtkPrintName);
|
||||
CopyUTF8toUTF16(MakeStringSpan(gtkPrintName), aPrinter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -479,7 +479,7 @@ NS_IMETHODIMP
|
||||
nsPrintSettingsGTK::GetPaperName(nsAString& aPaperName) {
|
||||
const gchar* name =
|
||||
gtk_paper_size_get_name(gtk_page_setup_get_paper_size(mPageSetup));
|
||||
aPaperName = NS_ConvertUTF8toUTF16(name);
|
||||
CopyUTF8toUTF16(MakeStringSpan(name), aPaperName);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
|
@ -65,7 +65,7 @@ class NSPRIOAutoObservation : public mozilla::IOInterposeObserver::Observation {
|
||||
if (mShouldReport && aFd &&
|
||||
GetPathFromFd(PR_FileDesc2NativeHandle(aFd), filename,
|
||||
sizeof(filename)) != -1) {
|
||||
mFilename = NS_ConvertUTF8toUTF16(filename);
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(filename), mFilename);
|
||||
} else {
|
||||
mFilename.Truncate();
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void MacIOAutoObservation::Filename(nsAString& aFilename) {
|
||||
|
||||
char filename[MAXPATHLEN];
|
||||
if (fcntl(mFd, F_GETPATH, filename) != -1) {
|
||||
mFilename = NS_ConvertUTF8toUTF16(filename);
|
||||
CopyUTF8toUTF16(filename, mFilename);
|
||||
} else {
|
||||
mFilename.Truncate();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user