Fix -Wpointer-sign warnings in makefs and mkimg

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D27175
This commit is contained in:
Alex Richardson 2021-01-06 17:05:29 +00:00 committed by Alex Richardson
parent 1f6612b444
commit fe41c64b57
7 changed files with 62 additions and 94 deletions

View File

@ -438,7 +438,7 @@ mkimg(void)
FILE *fp;
struct part *part;
lba_t block, blkoffset;
off_t bytesize, byteoffset;
uint64_t bytesize, byteoffset;
char *size, *offset;
bool abs_offset;
int error, fd;

View File

@ -221,7 +221,7 @@ typedef struct _path_table_entry
u_char extended_attribute_length[ISODCL (2, 2)];
u_char first_sector[ISODCL (3, 6)];
u_char parent_number[ISODCL (7, 8)];
u_char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
} path_table_entry;
typedef struct _volume_descriptor
@ -347,9 +347,9 @@ void debug_print_volume_descriptor_information(iso9660_disk *);
void debug_dump_to_xml_ptentry(path_table_entry *,int, int);
void debug_dump_to_xml_path_table(FILE *, off_t, int, int);
void debug_dump_to_xml(FILE *);
int debug_get_encoded_number(unsigned char *, int);
void debug_dump_integer(const char *, char *,int);
void debug_dump_string(const char *,unsigned char *,int);
int debug_get_encoded_number(const unsigned char *, int);
void debug_dump_integer(const char *, const unsigned char *, int);
void debug_dump_string(const char *, const unsigned char *, int);
void debug_dump_directory_record_9_1(unsigned char *);
void debug_dump_to_xml_volume_descriptor(unsigned char *,int);

View File

@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include "iso9660_rrip.h"
static void debug_print_susp_attrs(cd9660node *, int);
static void debug_dump_to_xml_padded_hex_output(const char *, unsigned char *,
static void debug_dump_to_xml_padded_hex_output(const char *, const char *,
int);
static inline void
@ -265,8 +265,8 @@ debug_dump_to_xml(FILE *fd)
}
static void
debug_dump_to_xml_padded_hex_output(const char *element, unsigned char *buf,
int len)
debug_dump_to_xml_padded_hex_output(const char *element, const char *buf,
int len)
{
int i;
int t;
@ -288,7 +288,7 @@ debug_dump_to_xml_padded_hex_output(const char *element, unsigned char *buf,
}
int
debug_get_encoded_number(unsigned char* buf, int mode)
debug_get_encoded_number(const unsigned char* buf, int mode)
{
#if !HAVE_NBTOOL_CONFIG_H
switch (mode) {
@ -298,7 +298,7 @@ debug_get_encoded_number(unsigned char* buf, int mode)
/* 712: Single signed byte */
case 712:
return isonum_712((signed char *)buf);
return isonum_712(buf);
/* 721: 16 bit LE */
case 721:
@ -329,14 +329,14 @@ debug_get_encoded_number(unsigned char* buf, int mode)
}
void
debug_dump_integer(const char *element, char* buf, int mode)
debug_dump_integer(const char *element, const unsigned char* buf, int mode)
{
printf("<%s>%i</%s>\n", element,
debug_get_encoded_number((unsigned char *)buf, mode), element);
printf("<%s>%i</%s>\n", element, debug_get_encoded_number(buf, mode),
element);
}
void
debug_dump_string(const char *element __unused, unsigned char *buf __unused, int len __unused)
debug_dump_string(const char *element __unused, const unsigned char *buf __unused, int len __unused)
{
}
@ -344,30 +344,20 @@ debug_dump_string(const char *element __unused, unsigned char *buf __unused, int
void
debug_dump_directory_record_9_1(unsigned char* buf)
{
struct iso_directory_record *rec = (struct iso_directory_record *)buf;
printf("<directoryrecord>\n");
debug_dump_integer("length",
((struct iso_directory_record*) buf)->length, 711);
debug_dump_integer("ext_attr_length",
((struct iso_directory_record*) buf)->ext_attr_length,711);
debug_dump_integer("extent",
(char *)((struct iso_directory_record*) buf)->extent, 733);
debug_dump_integer("size",
(char *)((struct iso_directory_record*) buf)->size, 733);
debug_dump_integer("flags",
((struct iso_directory_record*) buf)->flags, 711);
debug_dump_integer("file_unit_size",
((struct iso_directory_record*) buf)->file_unit_size,711);
debug_dump_integer("interleave",
((struct iso_directory_record*) buf)->interleave, 711);
debug_dump_integer("length", rec->length, 711);
debug_dump_integer("ext_attr_length", rec->ext_attr_length, 711);
debug_dump_integer("extent", rec->extent, 733);
debug_dump_integer("size", rec->size, 733);
debug_dump_integer("flags", rec->flags, 711);
debug_dump_integer("file_unit_size", rec->file_unit_size, 711);
debug_dump_integer("interleave", rec->interleave, 711);
debug_dump_integer("volume_sequence_number",
((struct iso_directory_record*) buf)->volume_sequence_number,
723);
debug_dump_integer("name_len",
((struct iso_directory_record*) buf)->name_len, 711);
debug_dump_to_xml_padded_hex_output("name",
(u_char *)((struct iso_directory_record*) buf)->name,
debug_get_encoded_number((u_char *)
((struct iso_directory_record*) buf)->length, 711));
rec->volume_sequence_number, 723);
debug_dump_integer("name_len", rec->name_len, 711);
debug_dump_to_xml_padded_hex_output("name", rec->name,
debug_get_encoded_number(rec->length, 711));
printf("</directoryrecord>\n");
}
@ -375,6 +365,9 @@ debug_dump_directory_record_9_1(unsigned char* buf)
void
debug_dump_to_xml_volume_descriptor(unsigned char* buf, int sector)
{
struct iso_primary_descriptor *desc =
(struct iso_primary_descriptor *)buf;
printf("<volumedescriptor sector=\"%i\">\n", sector);
printf("<vdtype>");
switch(buf[0]) {
@ -402,86 +395,60 @@ debug_dump_to_xml_volume_descriptor(unsigned char* buf, int sector)
printf("</vdtype>\n");
switch(buf[0]) {
case 1:
debug_dump_integer("type",
((struct iso_primary_descriptor*)buf)->type, 711);
debug_dump_to_xml_padded_hex_output("id",
(u_char *)((struct iso_primary_descriptor*) buf)->id,
ISODCL ( 2, 6));
debug_dump_integer("version",
((struct iso_primary_descriptor*)buf)->version,
711);
debug_dump_integer("type", desc->type, 711);
debug_dump_to_xml_padded_hex_output("id", desc->id,
ISODCL(2, 6));
debug_dump_integer("version", (u_char *)desc->version, 711);
debug_dump_to_xml_padded_hex_output("system_id",
(u_char *)((struct iso_primary_descriptor*)buf)->system_id,
ISODCL(9,40));
desc->system_id, ISODCL(9, 40));
debug_dump_to_xml_padded_hex_output("volume_id",
(u_char *)((struct iso_primary_descriptor*)buf)->volume_id,
ISODCL(41,72));
desc->volume_id, ISODCL(41, 72));
debug_dump_integer("volume_space_size",
((struct iso_primary_descriptor*)buf)->volume_space_size,
733);
(u_char *)desc->volume_space_size, 733);
debug_dump_integer("volume_set_size",
((struct iso_primary_descriptor*)buf)->volume_set_size,
733);
(u_char *)desc->volume_set_size, 733);
debug_dump_integer("volume_sequence_number",
((struct iso_primary_descriptor*)buf)->volume_sequence_number,
723);
(u_char *)desc->volume_sequence_number, 723);
debug_dump_integer("logical_block_size",
((struct iso_primary_descriptor*)buf)->logical_block_size,
723);
(u_char *)desc->logical_block_size, 723);
debug_dump_integer("path_table_size",
((struct iso_primary_descriptor*)buf)->path_table_size,
733);
(u_char *)desc->path_table_size, 733);
debug_dump_integer("type_l_path_table",
((struct iso_primary_descriptor*)buf)->type_l_path_table,
731);
(u_char *)desc->type_l_path_table, 731);
debug_dump_integer("opt_type_l_path_table",
((struct iso_primary_descriptor*)buf)->opt_type_l_path_table,
731);
(u_char *)desc->opt_type_l_path_table, 731);
debug_dump_integer("type_m_path_table",
((struct iso_primary_descriptor*)buf)->type_m_path_table,
732);
(u_char *)desc->type_m_path_table, 732);
debug_dump_integer("opt_type_m_path_table",
((struct iso_primary_descriptor*)buf)->opt_type_m_path_table,732);
(u_char *)desc->opt_type_m_path_table, 732);
debug_dump_directory_record_9_1(
(u_char *)((struct iso_primary_descriptor*)buf)->root_directory_record);
(u_char *)desc->root_directory_record);
debug_dump_to_xml_padded_hex_output("volume_set_id",
(u_char *)((struct iso_primary_descriptor*) buf)->volume_set_id,
ISODCL (191, 318));
desc->volume_set_id, ISODCL(191, 318));
debug_dump_to_xml_padded_hex_output("publisher_id",
(u_char *)((struct iso_primary_descriptor*) buf)->publisher_id,
ISODCL (319, 446));
desc->publisher_id, ISODCL(319, 446));
debug_dump_to_xml_padded_hex_output("preparer_id",
(u_char *)((struct iso_primary_descriptor*) buf)->preparer_id,
ISODCL (447, 574));
desc->preparer_id, ISODCL(447, 574));
debug_dump_to_xml_padded_hex_output("application_id",
(u_char *)((struct iso_primary_descriptor*) buf)->application_id,
ISODCL (575, 702));
desc->application_id, ISODCL(575, 702));
debug_dump_to_xml_padded_hex_output("copyright_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->copyright_file_id,
ISODCL (703, 739));
desc->copyright_file_id, ISODCL(703, 739));
debug_dump_to_xml_padded_hex_output("abstract_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->abstract_file_id,
ISODCL (740, 776));
desc->abstract_file_id, ISODCL(740, 776));
debug_dump_to_xml_padded_hex_output("bibliographic_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->bibliographic_file_id,
ISODCL (777, 813));
desc->bibliographic_file_id, ISODCL(777, 813));
debug_dump_to_xml_padded_hex_output("creation_date",
(u_char *)((struct iso_primary_descriptor*) buf)->creation_date,
ISODCL (814, 830));
desc->creation_date, ISODCL(814, 830));
debug_dump_to_xml_padded_hex_output("modification_date",
(u_char *)((struct iso_primary_descriptor*) buf)->modification_date,
ISODCL (831, 847));
desc->modification_date, ISODCL(831, 847));
debug_dump_to_xml_padded_hex_output("expiration_date",
(u_char *)((struct iso_primary_descriptor*) buf)->expiration_date,
ISODCL (848, 864));
desc->expiration_date, ISODCL(848, 864));
debug_dump_to_xml_padded_hex_output("effective_date",
(u_char *)((struct iso_primary_descriptor*) buf)->effective_date,
ISODCL (865, 881));
desc->effective_date, ISODCL(865, 881));
debug_dump_to_xml_padded_hex_output("file_structure_version",
(u_char *)((struct iso_primary_descriptor*) buf)->file_structure_version,
ISODCL(882,882));
desc->file_structure_version, ISODCL(882, 882));
break;
}
printf("</volumedescriptor>\n");

View File

@ -64,7 +64,7 @@ cd9660_write_image(iso9660_disk *diskStructure, const char* image)
{
FILE *fd;
int status;
char buf[CD9660_SECTOR_SIZE];
unsigned char buf[CD9660_SECTOR_SIZE];
if ((fd = fopen(image, "w+")) == NULL) {
err(EXIT_FAILURE, "%s: Can't open `%s' for writing", __func__,

View File

@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
* of some frags.
*/
void
ffs_fragacct_swap(struct fs *fs, int fragmap, int32_t fraglist[], int cnt, int needswap)
ffs_fragacct_swap(struct fs *fs, int fragmap, uint32_t fraglist[], int cnt, int needswap)
{
int inblk;
int field, subfield;

View File

@ -143,7 +143,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp)
bbsize = BBSIZE;
sbsize = SBLOCKSIZE;
strlcpy(sblock.fs_volname, ffs_opts->label, sizeof(sblock.fs_volname));
strlcpy((char *)sblock.fs_volname, ffs_opts->label,
sizeof(sblock.fs_volname));
if (Oflag == 0) {
sblock.fs_old_inodefmt = FS_42INODEFMT;

View File

@ -299,7 +299,7 @@ extern struct stat stampst;
((int32_t *)((uintptr_t)(cgp) + ufs_rw32((cgp)->cg_clustersumoff, ns)))
struct fs;
void ffs_fragacct_swap(struct fs *, int, int32_t [], int, int);
void ffs_fragacct_swap(struct fs *, int, uint32_t [], int, int);
fsinode *link_check(fsinode *);