mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Checkpoint on calc version 2.12.8.0
Fixed a mistake in "help intro" where some inserted text changed the value of "." and thus made the next result incorrect. Clarified in "help factor" that 1 is returned if no factor below the limit was found. Removed Makefile variable ${MAKEFILE_REV}. The missing cscript/square.calc file has been restored. Fixed compiler errors and warnings related to GCC. In particular, gcc/9.3.1 and gcc/10.2.1 now compile calc without any compiler errors or warnings, even with -Werror -Wextra -pedantic. To print out information about the calc compliation environment, we added the following make rule: make calcinfo Improved how 'make debug' operates. Moved help/contrib to CONTRIB-CODE. The help/contrib file is now build from a copy of CONTRIB-CODE. Created a new calc bug report Email address. Created a new calc question Email address. Created a new calc contribution Email address. See the BUGS file for details. Added "help questions" to print the QUESIONS help file. If the environment variable $CALCHELP is defined and is non-empty, then calc help files will be in the direcgory by the $CALCHISTFILE environment variable. If the environment variable $CALCCUSTOMHELP is defined and is non-empty, then custom calc help files will be in the direcgory by the $CALCCUSTOMHELP environment variable. The calc-tester mailing list has been retired. See: * How to submit a calc bug report: http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html * How to contribute code to calc: http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html * How to submit a question about calc: http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
This commit is contained in:
18
file.c
18
file.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* file - file I/O routines callable by users
|
||||
*
|
||||
* Copyright (C) 1999-2007,2018 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2018,2021 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -1416,21 +1416,22 @@ z2filepos(ZVALUE zpos)
|
||||
#if FILEPOS_BITS == FULL_BITS
|
||||
/* ztofull puts the value into native byte order */
|
||||
pos = ztofull(zpos);
|
||||
memset(&ret, 0, sizeof(ret)); /* on some hosts, FILEPOS is not a scalar */
|
||||
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||
memcpy((void *)&ret, (void *)&pos, MIN(sizeof(ret), sizeof(pos)));
|
||||
return ret;
|
||||
#elif FILEPOS_BITS < FULL_BITS
|
||||
/* ztofull puts the value into native byte order */
|
||||
pos = ztolong(zpos);
|
||||
memset(&ret, 0, sizeof(ret)); /* on some hosts, FILEPOS is not a scalar */
|
||||
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||
memcpy((void *)&ret, (void *)&pos, MIN(sizeof(ret), sizeof(pos)));
|
||||
return ret;
|
||||
#else /* FILEPOS_BITS > FULL_BITS */
|
||||
if (!zgtmaxfull(zpos)) {
|
||||
/* ztofull puts the value into native byte order */
|
||||
pos = ztofull(zpos);
|
||||
memset(&ret, 0, sizeof(ret)); /* on some hosts, FILEPOS is not a scalar */
|
||||
memcpy((void *)&ret, (void *)&pos, MIN(sizeof(ret), sizeof(pos)));
|
||||
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||
memcpy((void *)&ret, (void *)&pos,
|
||||
MIN(sizeof(ret), sizeof(pos)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1439,12 +1440,13 @@ z2filepos(ZVALUE zpos)
|
||||
*/
|
||||
if (zpos.len >= FILEPOS_BITS/BASEB) {
|
||||
/* copy the lower FILEPOS_BITS of the ZVALUE */
|
||||
memset(&tmp, 0, sizeof(tmp)); /* on some hosts, FILEPOS is not a scalar */
|
||||
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */
|
||||
memcpy(&tmp, zpos.v, MIN(sizeof(tmp), FILEPOS_LEN);
|
||||
} else {
|
||||
/* copy what bits we can into the temp value */
|
||||
memset(&tmp, 0, sizeof(tmp)); /* on some hosts, FILEPOS is not a scalar */
|
||||
memcpy(&tmp, zpos.v, MIN(sizeof(tmp), MIN(zpos.len*BASEB/8, FILEPOS_LEN)));
|
||||
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */
|
||||
memcpy(&tmp, zpos.v, MIN(sizeof(tmp),
|
||||
MIN(zpos.len*BASEB/8, FILEPOS_LEN)));
|
||||
}
|
||||
/* swap into native byte order */
|
||||
SWAP_HALF_IN_FILEPOS(&ret, &tmp);
|
||||
|
Reference in New Issue
Block a user