1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 23:46:14 +00:00

Pointer math correction (#171)

* Pointer math correction
* Change pointer diff size type to size_t
This commit is contained in:
Blake McBride 2021-01-04 21:08:58 -06:00 committed by GitHub
parent 96ab979e7a
commit dd4596099c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -354,7 +354,8 @@ extern DLword *Lisp_world; /* To access LispSysout area */
char *start; \
char *end; \
char *lf_cp; \
int len, ver_no; \
int ver_no; \
size_t len; \
char ver_buf[VERSIONLEN]; \
\
if ((start = strchr(pathname, '~')) != NULL) { \
@ -376,7 +377,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
* pathname ends in the form ".~###~". But we \
* check ### is a valid number or not. \
*/ \
len = (int)end - (int)start - 1; \
len = (end - start) - 1; \
strncpy(ver_buf, start + 1, len); \
ver_buf[len] = '\0'; \
NumericStringP(ver_buf, YES, NO); \

View File

@ -138,7 +138,7 @@ void separate_host(char *lfname, char *host)
#endif /* DOS */
{
register char *cp;
register int diff;
register size_t diff;
cp = lfname + 1; /* Skip the initial "{". */
@ -162,7 +162,7 @@ void separate_host(char *lfname, char *host)
*lfname = '<';
*(lfname + 1) = '\0';
} else {
diff = (int)cp - (int)lfname;
diff = cp - lfname;
if (*cp == '<' || *cp == DIRSEP
#ifdef DOS
|| *cp == UNIXDIRSEP
@ -2368,7 +2368,8 @@ LispPTR COM_getfreeblock(register LispPTR *args)
void separate_version(char *name, char *ver, int checkp)
{
register char *start, *end, *cp;
register int len, ver_no;
register int ver_no;
size_t len;
char ver_buf[VERSIONLEN];
if ((end = (char *)strchr(name, '~')) != (char *)NULL) {
@ -2387,7 +2388,7 @@ void separate_version(char *name, char *ver, int checkp)
* name ends in the form ".~###~". But we have to check
* ### are all numbers or not, if checkp is 1.
*/
len = (int)end - (int)start - 1;
len = (end - start) - 1;
strncpy(ver_buf, start + 1, len);
ver_buf[len] = '\0';
if (checkp) {