Skip to content

Commit cc3bb98

Browse files
authored
Merge pull request #131 from gromit1811/fix-fposval-build-failure
2 parents 826d2d8 + 2b506a7 commit cc3bb98

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fposval.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,20 @@ main(int UNUSED(argc), char **argv)
114114
/*
115115
* Big Endian
116116
*/
117+
/*
118+
* Use casts to (HALF *) because SWAP_HALF_IN_B* might expand to
119+
* a simple assignment and SWAP_HALF_IN_FILEPOS might get a
120+
* (HALF *) and a (FILEPOS *) which are not assignment-compatible.
121+
*/
117122
if (fileposlen == 64) {
118123
printf("#define SWAP_HALF_IN_FILEPOS(dest, src) \\\n"
119-
"\tSWAP_HALF_IN_B64(dest, src)\n");
124+
"\tSWAP_HALF_IN_B64((HALF *)dest, (HALF *)src)\n");
120125
} else if (fileposlen == 32) {
121126
printf("#define SWAP_HALF_IN_FILEPOS(dest, src) \\\n"
122-
"\tSWAP_HALF_IN_B32(dest, src)\n");
127+
"\tSWAP_HALF_IN_B32((HALF *)dest, (HALF *)src)\n");
123128
} else if (fileposlen%BASEB == 0) {
124129
printf("#define SWAP_HALF_IN_FILEPOS(dest, src) \\\n"
125-
"\tswap_HALFs(dest, src, %d)\n",
130+
"\tswap_HALFs((HALF *)dest, (HALF *)src, %d)\n",
126131
fileposlen/BASEB);
127132
} else {
128133
fprintf(stderr, "%s: unexpected BIG_ENDIAN FILEPOS bit size: %d\n",

0 commit comments

Comments
 (0)