src/schedule.c: fix build with GCC 4.8

Fix the following build failure with GCC 4.8:

schedule.c:19:2:
error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < 4; ++i) {
  ^
schedule.c:19:2:
note: use option -std=c99 or -std=gnu99 to compile your code
schedule.c: In function 'pms2_read_block':
schedule.c:39:2:
error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < 4; ++i) {
  ^

Fixes:
 - http://autobuild.buildroot.org/results/079f1454121d38a83c49529c0f6cc8ed61fd5abb

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Add empty lines after variable declarations.
Reviewed-by: Heinrich Schuchardt
This commit is contained in:
Fabrice Fontaine 2020-10-29 13:36:00 +01:00 committed by Heinrich Schuchardt
parent a71f63413a
commit 1631002edc
1 changed files with 6 additions and 2 deletions

View File

@ -15,8 +15,10 @@
static unsigned char
*pms2_write_block(uint8_t action, uint32_t time, unsigned char *ptr)
{
int i;
*ptr++ = action;
for (int i = 0; i < 4; ++i) {
for (i = 0; i < 4; ++i) {
*ptr++ = (uint8_t)time;
time >>= 8;
}
@ -34,9 +36,11 @@ static unsigned char
static const unsigned char
*pms2_read_block(uint8_t *action, uint32_t *time, const unsigned char *ptr)
{
int i;
*action = *ptr++;
*time = 0;
for (int i = 0; i < 4; ++i) {
for (i = 0; i < 4; ++i) {
*time >>= 8;
*time += (uint32_t)*ptr++ << 24;
}