зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1668492: Stop using locale based decimals when saving printing prefs. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D92099
This commit is contained in:
Родитель
a63466e44e
Коммит
922f287afd
|
@ -904,19 +904,26 @@ nsresult nsPrintSettingsService::ReadPrefDouble(const char* aPrefId,
|
||||||
|
|
||||||
nsAutoCString str;
|
nsAutoCString str;
|
||||||
nsresult rv = Preferences::GetCString(aPrefId, str);
|
nsresult rv = Preferences::GetCString(aPrefId, str);
|
||||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
if (NS_FAILED(rv) || str.IsEmpty()) {
|
||||||
aVal = atof(str.get());
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
return rv;
|
|
||||||
|
double value = str.ToDouble(&rv);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
aVal = value;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsPrintSettingsService::WritePrefDouble(const char* aPrefId,
|
nsresult nsPrintSettingsService::WritePrefDouble(const char* aPrefId,
|
||||||
double aVal) {
|
double aVal) {
|
||||||
NS_ENSURE_ARG_POINTER(aPrefId);
|
NS_ENSURE_ARG_POINTER(aPrefId);
|
||||||
|
|
||||||
nsPrintfCString str("%6.2f", aVal);
|
nsAutoCString str;
|
||||||
NS_ENSURE_TRUE(!str.IsEmpty(), NS_ERROR_FAILURE);
|
// We cast to a float so we only get up to 6 digits precision in the prefs.
|
||||||
|
str.AppendFloat((float)aVal);
|
||||||
return Preferences::SetCString(aPrefId, str);
|
return Preferences::SetCString(aPrefId, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче