jgarff / rpi_ws281x

Userspace Raspberry Pi PWM library for WS281X LEDs
BSD 2-Clause "Simplified" License
1.76k stars 616 forks source link

ws2811.c: fix build with gcc 4.8 #452

Closed ffontaine closed 3 years ago

ffontaine commented 3 years ago

Fix the following build failure with gcc 4.8 (which has been added by commit 391f6e856d28510bd9ae4efd3a166da7f73613ab):

lib/ws2811.c: In function 'ws2811_set_custom_gamma_factor':
lib/ws2811.c:1289:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int chan = 0; chan < RPI_PWM_CHANNELS; chan++)
     ^
lib/ws2811.c:1289:5: note: use option -std=c99 or -std=gnu99 to compile your code
lib/ws2811.c:1295:11: error: 'for' loop initial declarations are only allowed in C99 mode
           for(int counter = 0; counter < 256; counter++)
           ^

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

Gadgetoid commented 3 years ago

I guess this is technically a regression since there's no need for that commit to break back compat... but... GCC 4.8. I won't ask.

Thank you!

(This repository could use some continuous integration)