Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make: fix lint warnings on ilp32 platforms
details: https://anonhg.NetBSD.org/src/rev/81e9dfe4cf33
branches: trunk
changeset: 1023117:81e9dfe4cf33
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Aug 25 22:14:38 2021 +0000
description:
make: fix lint warnings on ilp32 platforms
The warnings in arch.c were about conversions from int to long.
The warnings in var.c were about conversions from long long to
ptrdiff_t.
No functional change.
diffstat:
usr.bin/make/arch.c | 27 ++++++++++++++-------------
usr.bin/make/var.c | 12 +++++++-----
2 files changed, 21 insertions(+), 18 deletions(-)
diffs (130 lines):
diff -r 646352a69803 -r 81e9dfe4cf33 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c Wed Aug 25 22:04:51 2021 +0000
+++ b/usr.bin/make/arch.c Wed Aug 25 22:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.202 2021/08/14 14:43:30 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.203 2021/08/25 22:14:38 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.202 2021/08/14 14:43:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.203 2021/08/25 22:14:38 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -552,14 +552,14 @@
if (strncmp(memName, AR_EFMT1, sizeof AR_EFMT1 - 1) == 0 &&
ch_isdigit(memName[sizeof AR_EFMT1 - 1])) {
- int elen = atoi(memName + sizeof AR_EFMT1 - 1);
+ size_t elen = atoi(memName + sizeof AR_EFMT1 - 1);
- if ((unsigned int)elen > MAXPATHLEN)
+ if (elen > MAXPATHLEN)
goto badarch;
- if (fread(memName, (size_t)elen, 1, arch) != 1)
+ if (fread(memName, elen, 1, arch) != 1)
goto badarch;
memName[elen] = '\0';
- if (fseek(arch, -elen, SEEK_CUR) != 0)
+ if (fseek(arch, -(long)elen, SEEK_CUR) != 0)
goto badarch;
if (DEBUG(ARCH) || DEBUG(MAKE))
debug_printf(
@@ -791,14 +791,15 @@
if (strncmp(out_arh->ar_name, AR_EFMT1, sizeof AR_EFMT1 - 1) ==
0 &&
(ch_isdigit(out_arh->ar_name[sizeof AR_EFMT1 - 1]))) {
- int elen = atoi(&out_arh->ar_name[sizeof AR_EFMT1 - 1]);
+ size_t elen = atoi(
+ &out_arh->ar_name[sizeof AR_EFMT1 - 1]);
char ename[MAXPATHLEN + 1];
- if ((unsigned int)elen > MAXPATHLEN) {
+ if (elen > MAXPATHLEN) {
fclose(arch);
return NULL;
}
- if (fread(ename, (size_t)elen, 1, arch) != 1) {
+ if (fread(ename, elen, 1, arch) != 1) {
fclose(arch);
return NULL;
}
@@ -811,14 +812,14 @@
if (strncmp(ename, member, len) == 0) {
/* Found as extended name */
if (fseek(arch,
- -(long)sizeof(struct ar_hdr) - elen,
- SEEK_CUR) != 0) {
+ -(long)(sizeof(struct ar_hdr) - elen),
+ SEEK_CUR) != 0) {
fclose(arch);
return NULL;
}
return arch;
}
- if (fseek(arch, -elen, SEEK_CUR) != 0) {
+ if (fseek(arch, -(long)elen, SEEK_CUR) != 0) {
fclose(arch);
return NULL;
}
@@ -834,7 +835,7 @@
*/
out_arh->ar_size[sizeof out_arh->ar_size - 1] = '\0';
size = (int)strtol(out_arh->ar_size, NULL, 10);
- if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) {
+ if (fseek(arch, (size + 1) & ~1L, SEEK_CUR) != 0) {
fclose(arch);
return NULL;
}
diff -r 646352a69803 -r 81e9dfe4cf33 usr.bin/make/var.c
--- a/usr.bin/make/var.c Wed Aug 25 22:04:51 2021 +0000
+++ b/usr.bin/make/var.c Wed Aug 25 22:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.947 2021/08/14 13:11:33 rillig Exp $ */
+/* $NetBSD: var.c,v 1.948 2021/08/25 22:14:38 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.947 2021/08/14 13:11:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.948 2021/08/25 22:14:38 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1605,7 +1605,8 @@
if (*rp == '&') {
SepBuf_AddBytesBetween(buf,
- wp + m[0].rm_so, wp + m[0].rm_eo);
+ wp + (size_t)m[0].rm_so,
+ wp + (size_t)m[0].rm_eo);
continue;
}
@@ -1626,7 +1627,8 @@
}
} else {
SepBuf_AddBytesBetween(buf,
- wp + m[n].rm_so, wp + m[n].rm_eo);
+ wp + (size_t)m[n].rm_so,
+ wp + (size_t)m[n].rm_eo);
}
}
}
@@ -1673,7 +1675,7 @@
RegexReplace(args->replace, buf, wp, m, args->nsub);
- wp += m[0].rm_eo;
+ wp += (size_t)m[0].rm_eo;
if (args->pflags.subGlobal) {
flags |= REG_NOTBOL;
if (m[0].rm_so == 0 && m[0].rm_eo == 0) {
Home |
Main Index |
Thread Index |
Old Index