mhulden / foma

Automatically exported from code.google.com/p/foma
117 stars 90 forks source link

Fix BOM_codes initializer #151

Closed fweimer-rh closed 7 months ago

fweimer-rh commented 9 months ago

Future compilers will reject the current initializer:

io.c:1002:7: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast
 1002 |     { NULL, 0, NULL },
      |       ^~~~
io.c:1002:16: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast
 1002 |     { NULL, 0, NULL },
      |                ^~~~
io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
  996 | static BOM BOM_codes[] = {
      |                          ^
io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]

The reason is that NULL is usually a pointer constant, which is not a valid expression for a character.

Related to:

ttti07 commented 7 months ago

I also suffer from the same compilation errors, with clang compiler in Apple M1 CPU... And I agree that this is the right solution.