1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Fix a few WARNS:

1) Include string.h for strcpy.
2) Don't make duplicate declaration of dump_file, we now include extern.h.
3) Help out with some constness.
4) Cast to slightly better types in some comparisons.
This commit is contained in:
David Malone 2004-02-15 22:01:23 +00:00
parent baa8d9176f
commit 10f106f5fd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125857

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <stab.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "extern.h"
@ -72,7 +73,6 @@ __FBSDID("$FreeBSD$");
#ifdef STANDALONE
static
#endif
void dump_file(const char *);
static void dump_rels(const char *, const struct relocation_info *,
unsigned long, const char *(*)(unsigned long), unsigned char *);
@ -182,7 +182,7 @@ dump_file(const char *fname)
file_base = (const char *) objbase; /* Makes address arithmetic easier */
if (IS_ELF(*(Elf32_Ehdr*) file_base)) {
if (IS_ELF(*(const Elf32_Ehdr*) file_base)) {
warnx("%s: this is an ELF program; use objdump to examine", fname);
++error_count;
munmap(objbase, sb.st_size);
@ -286,13 +286,13 @@ dump_file(const char *fname)
(const struct relocation_info *) (text_addr + sdt->sdt_rel);
rtrel_count = (sdt->sdt_hash - sdt->sdt_rel) / sizeof rtrel_base[0];
assert(rtrel_count * sizeof rtrel_base[0] ==
sdt->sdt_hash - sdt->sdt_rel);
(size_t)(sdt->sdt_hash - sdt->sdt_rel));
rtsym_base = (const struct nzlist *) (text_addr + sdt->sdt_nzlist);
rtsym_count = (sdt->sdt_strings - sdt->sdt_nzlist) /
sizeof rtsym_base[0];
assert(rtsym_count * sizeof rtsym_base[0] ==
sdt->sdt_strings - sdt->sdt_nzlist);
(size_t)(sdt->sdt_strings - sdt->sdt_nzlist));
if (rtsym_count != 0) {
rtsym_used = (unsigned char *) calloc(rtsym_count,
@ -338,8 +338,8 @@ dump_rels(const char *label, const struct relocation_info *base,
size = 1u << r->r_length;
if (origin <= r->r_address
&& r->r_address < origin + ex->a_text + ex->a_data
if (origin <= (unsigned long)r->r_address
&& (unsigned long)r->r_address < origin + ex->a_text + ex->a_data
&& 1 <= size && size <= 4) {
/*
* XXX - This can cause unaligned accesses. OK for the