mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
wcolorpanel.c Removed hsbInit warnings
This patch removes these warnings in the hsbInit function.
wcolorpanel.c: In function ‘hsbInit’:
wcolorpanel.c:3456:16: warning: ‘%u’ directive writing between 1 and 5 bytes into a region of size 4 [-Wformat-overflow=]
sprintf(tmp, "%d", value[0]);
^~
wcolorpanel.c:3456:15: note: directive argument in the range [0, 65535]
sprintf(tmp, "%d", value[0]);
^~~~
wcolorpanel.c:3456:2: note: ‘sprintf’ output between 2 and 6 bytes into a destination of size 4
sprintf(tmp, "%d", value[0]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
The problem is that the hue variable in the RHSVColor struct. This variable is not an integer, is a shor variable, so using the printf using the "%d" modifier spects an integer. Using a "%hu" prints a unsigned short value.
typedef struct RHSVColor {
unsigned short hue; /* 0-359 */
unsigned char saturation; /* 0-255 */
unsigned char value; /* 0-255 */
} RHSVColor;
This commit is contained in:
committed by
Carlos R. Mafra
parent
fb5f6c30c0
commit
1f80c82091
@@ -3453,7 +3453,7 @@ static void hsbInit(W_ColorPanel * panel)
|
||||
WMSetSliderValue(panel->hsbSaturationS, value[1]);
|
||||
WMSetSliderValue(panel->hsbBrightnessS, value[2]);
|
||||
|
||||
sprintf(tmp, "%d", value[0]);
|
||||
sprintf(tmp, "%hu", value[0]);
|
||||
WMSetTextFieldText(panel->hsbHueT, tmp);
|
||||
sprintf(tmp, "%d", value[1]);
|
||||
WMSetTextFieldText(panel->hsbSaturationT, tmp);
|
||||
|
||||
Reference in New Issue
Block a user