makefs: use size_t or ssize_t where appropriate
Obtained from: NetBSD af7bc97830ac
This commit is contained in:
parent
7f8953991f
commit
1d1ffa2efd
@ -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
|
* 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 void cd9660_finalize_PVD(iso9660_disk *);
|
||||||
static cd9660node *cd9660_allocate_cd9660node(void);
|
static cd9660node *cd9660_allocate_cd9660node(void);
|
||||||
static void cd9660_set_defaults(iso9660_disk *);
|
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 *);
|
char, char *);
|
||||||
static void cd9660_populate_iso_dir_record(
|
static void cd9660_populate_iso_dir_record(
|
||||||
struct _iso_directory_record_cd9660 *, u_char, u_char, u_char,
|
struct _iso_directory_record_cd9660 *, u_char, u_char, u_char,
|
||||||
@ -324,10 +324,11 @@ cd9660_cleanup_opts(fsinfo_t *fsopts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cd9660_arguments_set_string(const char *val, const char *fieldtitle, int length,
|
cd9660_arguments_set_string(const char *val, const char *fieldtitle,
|
||||||
char testmode, char * dest)
|
size_t length, char testmode, char *dest)
|
||||||
{
|
{
|
||||||
int len, test;
|
size_t len;
|
||||||
|
int test;
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
warnx("error: '%s' requires a string argument", fieldtitle);
|
warnx("error: '%s' requires a string argument", fieldtitle);
|
||||||
|
@ -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
|
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||||
@ -284,7 +284,7 @@ typedef struct _iso9660_disk {
|
|||||||
/************ FUNCTIONS **************/
|
/************ FUNCTIONS **************/
|
||||||
int cd9660_valid_a_chars(const char *);
|
int cd9660_valid_a_chars(const char *);
|
||||||
int cd9660_valid_d_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 */
|
/* ISO Data Types */
|
||||||
void cd9660_721(uint16_t, unsigned char *);
|
void cd9660_721(uint16_t, unsigned char *);
|
||||||
|
@ -46,9 +46,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
|
|
||||||
void
|
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++) {
|
for (p = 0; p < len; p++) {
|
||||||
if (islower((unsigned char)str[p]) )
|
if (islower((unsigned char)str[p]) )
|
||||||
|
@ -78,7 +78,7 @@ bread(struct m_vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused,
|
|||||||
if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1)
|
if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1)
|
||||||
err(1, "%s: lseek %lld (%lld)", __func__,
|
err(1, "%s: lseek %lld (%lld)", __func__,
|
||||||
(long long)(*bpp)->b_blkno, (long long)offset);
|
(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)
|
if (debug & DEBUG_BUF_BREAD)
|
||||||
printf("%s: read %ld (%lld) returned %d\n", __func__,
|
printf("%s: read %ld (%lld) returned %d\n", __func__,
|
||||||
(*bpp)->b_bcount, (long long)offset, (int)rv);
|
(*bpp)->b_bcount, (long long)offset, (int)rv);
|
||||||
@ -206,8 +206,8 @@ getblk(struct m_vnode *vp, daddr_t blkno, int size, int u1 __unused,
|
|||||||
}
|
}
|
||||||
bp->b_bcount = size;
|
bp->b_bcount = size;
|
||||||
if (bp->b_data == NULL || bp->b_bcount > bp->b_bufsize) {
|
if (bp->b_data == NULL || bp->b_bcount > bp->b_bufsize) {
|
||||||
n = erealloc(bp->b_data, size);
|
n = erealloc(bp->b_data, (size_t)size);
|
||||||
memset(n, 0, size);
|
memset(n, 0, (size_t)size);
|
||||||
bp->b_data = n;
|
bp->b_data = n;
|
||||||
bp->b_bufsize = size;
|
bp->b_bufsize = size;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user