зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125084 - Uninitialised value use in mozilla::hal_impl::SetScreenBrightness(double). r=dhylands.
This commit is contained in:
Родитель
3e23aa4c3d
Коммит
5db797db1b
|
@ -764,8 +764,11 @@ bool
|
|||
GetKeyLightEnabled()
|
||||
{
|
||||
LightConfiguration config;
|
||||
GetLight(eHalLightID_Buttons, &config);
|
||||
return (config.color != 0x00000000);
|
||||
bool ok = GetLight(eHalLightID_Buttons, &config);
|
||||
if (ok) {
|
||||
return (config.color != 0x00000000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -798,10 +801,15 @@ GetScreenBrightness()
|
|||
LightConfiguration config;
|
||||
LightType light = eHalLightID_Backlight;
|
||||
|
||||
GetLight(light, &config);
|
||||
// backlight is brightness only, so using one of the RGB elements as value.
|
||||
int brightness = config.color & 0xFF;
|
||||
return brightness / 255.0;
|
||||
bool ok = GetLight(light, &config);
|
||||
if (ok) {
|
||||
// backlight is brightness only, so using one of the RGB elements as value.
|
||||
int brightness = config.color & 0xFF;
|
||||
return brightness / 255.0;
|
||||
}
|
||||
// If GetLight fails, it's because the light doesn't exist. So return
|
||||
// a value corresponding to "off".
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче