Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Wextra compile option and adapt code to suppress warnings #214

Merged
merged 1 commit into from
Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def linux_flags(env):
-g
-O2
-Wall
-Wextra
-Werror
'''.split(),
}),
Expand Down
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void matrix_bottom(void)
{
int i;

for (i = 0; i < ARRAY_SIZE(dotspos); i++)
for (i = 0; i < (int)(ARRAY_SIZE(dotspos)); i++)
{
dotspos[i]++;
if (dotspos[i] > (width - 1))
Expand All @@ -190,6 +190,7 @@ void matrix_bottom(void)

static void ctrl_c_handler(int signum)
{
(void)(signum);
running = 0;
}

Expand Down
8 changes: 4 additions & 4 deletions ws2811.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ static int check_hwver_and_gpionum(ws2811_t *ws2811)
gpionum = ws2811->channel[0].gpionum;
if (hwver < 0x0004) // Model B Rev 1
{
for ( i = 0; i < (sizeof(gpionums_B1) / sizeof(gpionums_B1[0])); i++)
for ( i = 0; i < (int)(sizeof(gpionums_B1) / sizeof(gpionums_B1[0])); i++)
{
if (gpionums_B1[i] == gpionum) {
// Set driver mode (PWM, PCM, or SPI)
Expand All @@ -686,7 +686,7 @@ static int check_hwver_and_gpionum(ws2811_t *ws2811)
}
else if (hwver >= 0x000e && hwver <= 0x000f) // Models B Rev2, A
{
for ( i = 0; i < (sizeof(gpionums_B2) / sizeof(gpionums_B2[0])); i++)
for ( i = 0; i < (int)(sizeof(gpionums_B2) / sizeof(gpionums_B2[0])); i++)
{
if (gpionums_B2[i] == gpionum) {
// Set driver mode (PWM, PCM, or SPI)
Expand All @@ -710,7 +710,7 @@ static int check_hwver_and_gpionum(ws2811_t *ws2811)
return -1;
}
}
for ( i = 0; i < (sizeof(gpionums_40p) / sizeof(gpionums_40p[0])); i++)
for ( i = 0; i < (int)(sizeof(gpionums_40p) / sizeof(gpionums_40p[0])); i++)
{
if (gpionums_40p[i] == gpionum) {
// Set driver mode (PWM, PCM, or SPI)
Expand Down Expand Up @@ -1218,7 +1218,7 @@ const char * ws2811_get_return_t_str(const ws2811_return_t state)
const int index = -state;
static const char * const ret_state_str[] = { WS2811_RETURN_STATES(WS2811_RETURN_STATES_STRING) };

if (index < sizeof(ret_state_str) / sizeof(ret_state_str[0]))
if (index < (int)(sizeof(ret_state_str) / sizeof(ret_state_str[0])))
{
return ret_state_str[index];
}
Expand Down