git: c821bafd9c8b - stable/13 - makefs: use size_t or ssize_t where appropriate
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Apr 2023 12:52:58 UTC
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c821bafd9c8bb03807823e4c0bdb062363f17869 commit c821bafd9c8bb03807823e4c0bdb062363f17869 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2023-03-30 02:04:16 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-04-14 12:10:38 +0000 makefs: use size_t or ssize_t where appropriate Obtained from: NetBSD af7bc97830ac (cherry picked from commit 1d1ffa2efd2a54c435b7977dc1cfd21dce248671) --- usr.sbin/makefs/cd9660.c | 11 ++++++----- usr.sbin/makefs/cd9660.h | 4 ++-- usr.sbin/makefs/cd9660/cd9660_strings.c | 4 ++-- usr.sbin/makefs/ffs/buf.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c index 54c1794d1500..661eefc832da 100644 --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.32 2011/08/23 17:09:11 christos Exp $ */ +/* $NetBSD: cd9660.c,v 1.56 2019/10/18 04:09:02 msaitoh Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-4-Clause @@ -115,7 +115,7 @@ __FBSDID("$FreeBSD$"); static void cd9660_finalize_PVD(iso9660_disk *); static cd9660node *cd9660_allocate_cd9660node(void); static void cd9660_set_defaults(iso9660_disk *); -static int cd9660_arguments_set_string(const char *, const char *, int, +static int cd9660_arguments_set_string(const char *, const char *, size_t, char, char *); static void cd9660_populate_iso_dir_record( struct _iso_directory_record_cd9660 *, u_char, u_char, u_char, @@ -324,10 +324,11 @@ cd9660_cleanup_opts(fsinfo_t *fsopts) } static int -cd9660_arguments_set_string(const char *val, const char *fieldtitle, int length, - char testmode, char * dest) +cd9660_arguments_set_string(const char *val, const char *fieldtitle, + size_t length, char testmode, char *dest) { - int len, test; + size_t len; + int test; if (val == NULL) warnx("error: '%s' requires a string argument", fieldtitle); diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h index c4baa590101a..fae2d2077c00 100644 --- a/usr.sbin/makefs/cd9660.h +++ b/usr.sbin/makefs/cd9660.h @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.h,v 1.17 2011/06/23 02:35:56 enami Exp $ */ +/* $NetBSD: cd9660.h,v 1.21 2015/12/24 15:52:37 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD @@ -284,7 +284,7 @@ typedef struct _iso9660_disk { /************ FUNCTIONS **************/ int cd9660_valid_a_chars(const char *); int cd9660_valid_d_chars(const char *); -void cd9660_uppercase_characters(char *, int); +void cd9660_uppercase_characters(char *, size_t); /* ISO Data Types */ void cd9660_721(uint16_t, unsigned char *); diff --git a/usr.sbin/makefs/cd9660/cd9660_strings.c b/usr.sbin/makefs/cd9660/cd9660_strings.c index 12d7566e463d..da47084961bb 100644 --- a/usr.sbin/makefs/cd9660/cd9660_strings.c +++ b/usr.sbin/makefs/cd9660/cd9660_strings.c @@ -46,9 +46,9 @@ __FBSDID("$FreeBSD$"); void -cd9660_uppercase_characters(char *str, int len) +cd9660_uppercase_characters(char *str, size_t len) { - int p; + size_t p; for (p = 0; p < len; p++) { if (islower((unsigned char)str[p]) ) diff --git a/usr.sbin/makefs/ffs/buf.c b/usr.sbin/makefs/ffs/buf.c index c5f437d3a2cd..bc91df0b3ed3 100644 --- a/usr.sbin/makefs/ffs/buf.c +++ b/usr.sbin/makefs/ffs/buf.c @@ -78,7 +78,7 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1) err(1, "%s: lseek %lld (%lld)", __func__, (long long)(*bpp)->b_blkno, (long long)offset); - rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (*bpp)->b_bcount); + rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (size_t)(*bpp)->b_bcount); if (debug & DEBUG_BUF_BREAD) printf("%s: read %ld (%lld) returned %d\n", __func__, (*bpp)->b_bcount, (long long)offset, (int)rv); @@ -206,8 +206,8 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int u1 __unused, } bp->b_bcount = size; if (bp->b_data == NULL || bp->b_bcount > bp->b_bufsize) { - n = erealloc(bp->b_data, size); - memset(n, 0, size); + n = erealloc(bp->b_data, (size_t)size); + memset(n, 0, (size_t)size); bp->b_data = n; bp->b_bufsize = size; }