Bug 871462 - Clean up string API usages on Gonk. r=dbaron

This commit is contained in:
Makoto Kato 2013-06-03 17:41:27 +09:00
parent d49b8699e3
commit bad23f34f8
4 changed files with 8 additions and 10 deletions

View File

@ -193,11 +193,11 @@ AudioManager::Observe(nsISupports* aSubject,
String8 cmd;
cmd.appendFormat("bt_samplerate=%d", kBtSampleRate);
AudioSystem::setParameters(0, cmd);
const char* address = NS_ConvertUTF16toUTF8(nsDependentString(aData)).get();
NS_ConvertUTF16toUTF8 address(aData);
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET,
AUDIO_POLICY_DEVICE_STATE_AVAILABLE, address);
AUDIO_POLICY_DEVICE_STATE_AVAILABLE, address.get());
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
AUDIO_POLICY_DEVICE_STATE_AVAILABLE, address);
AUDIO_POLICY_DEVICE_STATE_AVAILABLE, address.get());
SetForceForUse(nsIAudioManager::USE_COMMUNICATION, nsIAudioManager::FORCE_BT_SCO);
} else {
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET,

View File

@ -132,7 +132,7 @@ nsresult TimeZoneSettingObserver::SetTimeZone(const JS::Value &aValue, JSContext
ERR("Failed to convert JS value to nsCString");
return NS_ERROR_FAILURE;
}
nsCString newTimezone = NS_ConvertUTF16toUTF8(valueStr);
NS_ConvertUTF16toUTF8 newTimezone(valueStr);
// Set the timezone only when the system timezone is not identical.
nsCString curTimezone = hal::GetTimezone();

View File

@ -187,7 +187,7 @@ NS_IMETHODIMP nsVolumeService::GetVolumeByName(const nsAString& aVolName, nsIVol
NS_IMETHODIMP
nsVolumeService::GetVolumeByPath(const nsAString& aPath, nsIVolume **aResult)
{
nsCString utf8Path = NS_ConvertUTF16toUTF8(aPath);
NS_ConvertUTF16toUTF8 utf8Path(aPath);
char realPathBuf[PATH_MAX];
while (realpath(utf8Path.get(), realPathBuf) < 0) {
@ -204,7 +204,7 @@ nsVolumeService::GetVolumeByPath(const nsAString& aPath, nsIVolume **aResult)
ERR("GetVolumeByPath: realpath on '%s' failed.", utf8Path.get());
return NSRESULT_FOR_ERRNO();
}
utf8Path = Substring(utf8Path, 0, slashIndex);
utf8Path.Assign(Substring(utf8Path, 0, slashIndex));
}
// The volume mount point is always a directory. Something like /mnt/sdcard
@ -223,7 +223,7 @@ nsVolumeService::GetVolumeByPath(const nsAString& aPath, nsIVolume **aResult)
nsVolume::Array::index_type volIndex;
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
nsRefPtr<nsVolume> vol = mVolumeArray[volIndex];
nsAutoCString volMountPointSlash = NS_ConvertUTF16toUTF8(vol->MountPoint());
NS_ConvertUTF16toUTF8 volMountPointSlash(vol->MountPoint());
volMountPointSlash.Append(NS_LITERAL_CSTRING("/"));
nsDependentCSubstring testStr(realPathBuf, volMountPointSlash.Length());
if (volMountPointSlash.Equals(testStr)) {

View File

@ -12,9 +12,7 @@ NS_IMPL_ISUPPORTS1(nsVolumeStat, nsIVolumeStat)
nsVolumeStat::nsVolumeStat(const nsAString& aPath)
{
nsCString utf8Path = NS_ConvertUTF16toUTF8(aPath);
if (statfs(utf8Path.get(), &mStat) != 0) {
if (statfs(NS_ConvertUTF16toUTF8(aPath).get(), &mStat) != 0) {
memset(&mStat, 0, sizeof(mStat));
}
}