1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WPrefs: make fall-back value look like a fall-back value in Texture Panel (Coverity #50031)

As pointed by Coverity, the return value of 'sscanf' is not checked, which
may not be a problem because the fall-back value for 'i' is provided before.

However, if sscanf fails there is no guarantee that all implementation would
leave 'i' untouched in case of parsing error, and for convenience it is more
logical to write the code is such a way that the value assignment looks like
the fall-back value it is.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-31 19:58:39 +02:00
committed by Carlos R. Mafra
parent db9f5c9658
commit c5744aaa8b

View File

@@ -824,8 +824,8 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
wfree(panel->imageFile); wfree(panel->imageFile);
panel->imageFile = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1))); panel->imageFile = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1)));
if (sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", &i) != 1)
i = 180; i = 180;
sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", &i);
WMSetSliderValue(panel->topaS, i); WMSetSliderValue(panel->topaS, i);
p = WMGetFromPLArray(texture, 3); p = WMGetFromPLArray(texture, 3);