#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.99 2005/10/17 17:39:39 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.100 2005/10/17 18:41:44 christos Exp $")
#endif /* lint */
#endif
#ifdef LC_CTYPE
- setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */
+ /* makes islower etc work for other langs */
+ (void)setlocale(LC_CTYPE, "");
#endif
#ifdef __EMX__
flags |= MAGIC_DEVICES;
break;
case 'v':
- (void) fprintf(stdout, "%s-%d.%.2d\n", progname,
+ (void)fprintf(stdout, "%s-%d.%.2d\n", progname,
FILE_VERSION_MAJOR, patchlevel);
- (void) fprintf(stdout, "magic file from %s\n",
+ (void)fprintf(stdout, "magic file from %s\n",
magicfile);
return 1;
case 'z':
private void
+/*ARGSUSED*/
load(const char *m, int flags)
{
if (magic)
buf[len - 1] = '\0';
process(buf, wid);
if(nobuffer)
- (void) fflush(stdout);
+ (void)fflush(stdout);
}
- (void) fclose(f);
+ (void)fclose(f);
}
private void
int std_in = strcmp(inname, "-") == 0;
if (wid > 0 && !bflag)
- (void) printf("%s%s%*s ", std_in ? "/dev/stdin" : inname,
+ (void)printf("%s%s%*s ", std_in ? "/dev/stdin" : inname,
separator, (int) (nopad ? 0 : (wid - file_mbswidth(inname))), "");
type = magic_file(magic, std_in ? NULL : inname);
if (type == NULL)
- printf("ERROR: %s\n", magic_error(magic));
+ (void)printf("ERROR: %s\n", magic_error(magic));
else
- printf("%s\n", type);
+ (void)printf("%s\n", type);
}
private void
help(void)
{
- puts(
+ (void)puts(
"Usage: file [OPTION]... [FILE]...\n"
"Determine file type of FILEs.\n"
"\n"
#include <ctype.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: funcs.c,v 1.15 2005/07/12 20:05:38 christos Exp $")
+FILE_RCSID("@(#)$Id: funcs.c,v 1.16 2005/10/17 18:41:44 christos Exp $")
#endif /* lint */
#ifndef HAVE_VSNPRINTF
*np++ = *op;
} else {
*np++ = '\\';
- *np++ = ((*op >> 6) & 3) + '0';
- *np++ = ((*op >> 3) & 7) + '0';
- *np++ = ((*op >> 0) & 7) + '0';
+ *np++ = (((uint32_t)*op >> 6) & 3) + '0';
+ *np++ = (((uint32_t)*op >> 3) & 7) + '0';
+ *np++ = (((uint32_t)*op >> 0) & 7) + '0';
}
}
*np = '\0';
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: readelf.c,v 1.51 2005/10/16 07:37:13 christos Exp $")
+FILE_RCSID("@(#)$Id: readelf.c,v 1.52 2005/10/17 18:41:44 christos Exp $")
#endif
#ifdef ELFCORE
: sizeof sh64)
#define xsh_size (class == ELFCLASS32 \
? getu32(swap, sh32.sh_size) \
- : getu32(swap, sh64.sh_size))
+ : getu64(swap, sh64.sh_size))
#define xsh_offset (class == ELFCLASS32 \
? getu32(swap, sh32.sh_offset) \
- : getu32(swap, sh64.sh_offset))
+ : getu64(swap, sh64.sh_offset))
#define xsh_type (class == ELFCLASS32 \
? getu32(swap, sh32.sh_type) \
: getu32(swap, sh64.sh_type))
file_badread(ms);
return -1;
}
- if ((nbuf = malloc(xsh_size)) == NULL) {
+ if ((nbuf = malloc((size_t)xsh_size)) == NULL) {
file_error(ms, errno, "Cannot allocate memory"
" for note");
return -1;
}
- if ((noff = lseek(fd, xsh_offset, SEEK_SET)) ==
+ if ((noff = lseek(fd, (off_t)xsh_offset, SEEK_SET)) ==
(off_t)-1) {
file_badread(ms);
free(nbuf);
return -1;
}
- if (read(fd, nbuf, xsh_size) != xsh_size) {
+ if (read(fd, nbuf, (size_t)xsh_size) !=
+ (ssize_t)xsh_size) {
free(nbuf);
file_badread(ms);
return -1;
noff = 0;
for (;;) {
- if (noff >= xsh_size)
+ if (noff >= (size_t)xsh_size)
break;
- noff = donote(ms, nbuf, noff,
+ noff = donote(ms, nbuf, (size_t)noff,
(size_t)xsh_size, class, swap, 4,
&flags);
if (noff == 0)
#ifndef lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.74 2005/07/29 17:57:20 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.75 2005/10/17 18:41:44 christos Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
const unsigned char *, size_t);
private int mget(struct magic_set *, union VALUETYPE *, const unsigned char *,
- struct magic *, size_t, int);
+ struct magic *, size_t, unsigned int);
private int mcheck(struct magic_set *, union VALUETYPE *, struct magic *);
private int32_t mprint(struct magic_set *, union VALUETYPE *, struct magic *);
private void mdebug(uint32_t, const char *, size_t);
* might even cause problems
*/
if (nbytes < sizeof(*p))
- (void)memset(((char *)p) + nbytes, '\0', sizeof(*p) - nbytes);
+ (void)memset(((char *)(void *)p) + nbytes, '\0',
+ sizeof(*p) - nbytes);
return 0;
}
private int
mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s,
- struct magic *m, size_t nbytes, int cont_level)
+ struct magic *m, size_t nbytes, unsigned int cont_level)
{
uint32_t offset = m->offset;
int off = m->in_offset;
if (m->in_op & FILE_OPINDIRECT) {
const union VALUETYPE *q =
- ((const union VALUETYPE *)(s + offset + off));
+ ((const void *)(s + offset + off));
switch (m->in_type) {
case FILE_BYTE:
off = q->b;