Fixed FILEPOS_LEN symbol and macro problems

This commit is contained in:
Landon Curt Noll
2022-11-27 17:05:49 -08:00
parent 25dcd8cb80
commit 827988c553
4 changed files with 8 additions and 6 deletions

View File

@@ -103,6 +103,8 @@ The following are the changes from calc version 2.14.1.0 to date:
file failed to compile incorrectly, producing a potentially incorrect
have_uid_t.h file for such systems.
Renamed #define FPOS_POS_LEN symbol to FPOSPOS_LEN.
The following are the changes from calc version 2.14.0.15 to 2.14.0.15:

2
file.c
View File

@@ -1459,7 +1459,7 @@ z2filepos(ZVALUE zpos)
if (zpos.len >= FILEPOS_BITS/BASEB) {
/* copy the lower FILEPOS_BITS of the ZVALUE */
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */
memcpy(&tmp, zpos.v, MIN(sizeof(tmp), FILEPOS_LEN);
memcpy(&tmp, zpos.v, MIN(sizeof(tmp), FILEPOS_LEN));
} else {
/* copy what bits we can into the temp value */
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */

View File

@@ -138,7 +138,7 @@ main(int UNUSED(argc), char **argv)
*/
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
"\\\n\tmemcpy((void *)(dest), (void *)(src), "
"sizeof(FPOS_POS_LEN))");
"sizeof(FPOSPOS_LEN))");
#endif /* HAVE_FILEPOS_SCALAR */
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
putchar('\n');

View File

@@ -51,20 +51,20 @@ main(void)
/* determine __pos element size */
printf("#undef FPOS_POS_BITS\n");
printf("#undef FPOS_POS_LEN\n");
printf("#undef FPOSPOS_LEN\n");
# if defined(FPOS_POS_BITS)
printf("#define FPOS_POS_BITS %d\n", FPOS_POS_BITS);
printf("#define FPOS_POS_LEN %d\n", int(FPOS_POS_BITS/8));
printf("#define FPOSPOS_LEN %d\n", int(FPOS_POS_BITS/8));
# else
printf("#define FPOS_POS_BITS %lu\n", sizeof(pos.__pos)*8);
printf("#define FPOS_POS_LEN %lu\n", sizeof(pos.__pos));
printf("#define FPOSPOS_LEN %lu\n", sizeof(pos.__pos));
# endif
#else
/* we have no __pos element */
printf("#undef HAVE_FPOS_POS\t/* no */\n");
printf("#undef FPOS_POS_BITS\n");
printf("#undef FPOS_POS_LEN\n");
printf("#undef FPOSPOS_LEN\n");
#endif
/* exit(0); */
return 0;