misc cleanups
This commit is contained in:
parent
320991dd0c
commit
97a2ff3736
7
dist/file/src/apprentice.c
vendored
7
dist/file/src/apprentice.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apprentice.c,v 1.18 2008/08/30 12:16:52 christos Exp $ */
|
||||
/* $NetBSD: apprentice.c,v 1.19 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
@ -55,7 +55,7 @@
|
||||
#if 0
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.140 2008/07/20 04:02:15 christos Exp $")
|
||||
#else
|
||||
__RCSID("$NetBSD: apprentice.c,v 1.18 2008/08/30 12:16:52 christos Exp $");
|
||||
__RCSID("$NetBSD: apprentice.c,v 1.19 2008/08/31 07:53:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -596,7 +596,8 @@ set_test_type(struct magic *mstart, struct magic *m)
|
||||
case FILE_REGEX:
|
||||
case FILE_SEARCH:
|
||||
/* binary test if pattern is not text */
|
||||
if (file_looks_utf8(m->value.us, m->vallen, NULL, NULL) <= 0)
|
||||
if (file_looks_utf8(m->value.us, (size_t)m->vallen, NULL,
|
||||
NULL) <= 0)
|
||||
mstart->flag |= BINTEST;
|
||||
break;
|
||||
case FILE_DEFAULT:
|
||||
|
8
dist/file/src/apptype.c
vendored
8
dist/file/src/apptype.c
vendored
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: apptype.c,v 1.2 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Adapted from: apptype.c, Written by Eberhard Mattes and put into the
|
||||
* public domain
|
||||
@ -24,16 +26,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#if 0
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: apptype.c,v 1.7 2007/01/12 17:38:27 christos Exp $")
|
||||
#endif /* lint */
|
||||
#else
|
||||
__RCSID("$NetBSD: apptype.c,v 1.2 2008/08/31 07:53:33 christos Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
#include <io.h>
|
||||
|
7
dist/file/src/ascmagic.c
vendored
7
dist/file/src/ascmagic.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ascmagic.c,v 1.7 2008/08/30 12:16:52 christos Exp $ */
|
||||
/* $NetBSD: ascmagic.c,v 1.8 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
@ -54,7 +54,7 @@
|
||||
#if 0
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.64 2008/07/16 18:00:57 christos Exp $")
|
||||
#else
|
||||
__RCSID("$NetBSD: ascmagic.c,v 1.7 2008/08/30 12:16:52 christos Exp $");
|
||||
__RCSID("$NetBSD: ascmagic.c,v 1.8 2008/08/31 07:53:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -185,7 +185,8 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
|
||||
}
|
||||
if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen)) == NULL)
|
||||
goto done;
|
||||
if (file_softmagic(ms, utf8_buf, utf8_end - utf8_buf, TEXTTEST) != 0) {
|
||||
if (file_softmagic(ms, utf8_buf, (size_t)(utf8_end - utf8_buf),
|
||||
TEXTTEST) != 0) {
|
||||
rv = 1;
|
||||
goto done;
|
||||
}
|
||||
|
23
dist/file/src/file.h
vendored
23
dist/file/src/file.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file.h,v 1.16 2008/08/30 12:16:52 christos Exp $ */
|
||||
/* $NetBSD: file.h,v 1.17 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
@ -411,22 +411,19 @@ int asprintf(char **ptr, const char *format_string, ...);
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __GNUC__
|
||||
#ifndef __NetBSD__
|
||||
#ifndef __RCSID
|
||||
# ifndef __cplusplus
|
||||
# ifdef __GNUC__
|
||||
static const char *rcsid(const char *) __attribute__((__used__));
|
||||
#endif
|
||||
#endif
|
||||
#define FILE_RCSID(id) \
|
||||
# endif
|
||||
# define FILE_RCSID(id) \
|
||||
static const char *rcsid(const char *p) { \
|
||||
return rcsid(p = id); \
|
||||
}
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
#endif
|
||||
|
||||
#ifndef __RCSID
|
||||
#define __RCSID FILE_RCSID
|
||||
# else
|
||||
# define FILE_RCSID(id)
|
||||
# endif
|
||||
# define __RCSID FILE_RCSID
|
||||
#endif
|
||||
|
||||
#endif /* __file_h__ */
|
||||
|
8
dist/file/src/magic.c
vendored
8
dist/file/src/magic.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: magic.c,v 1.19 2008/08/30 12:16:52 christos Exp $ */
|
||||
/* $NetBSD: magic.c,v 1.20 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2003.
|
||||
@ -66,9 +66,13 @@
|
||||
|
||||
#include "patchlevel.h"
|
||||
|
||||
#if 0
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: magic.c,v 1.54 2008/07/25 23:30:32 rrt Exp $")
|
||||
#endif /* lint */
|
||||
#else
|
||||
__RCSID("$NetBSD: magic.c,v 1.20 2008/08/31 07:53:33 christos Exp $");
|
||||
#endif
|
||||
|
||||
#ifndef PIPE_BUF
|
||||
/* Get the PIPE_BUF from pathconf */
|
||||
@ -76,7 +80,7 @@ FILE_RCSID("@(#)$File: magic.c,v 1.54 2008/07/25 23:30:32 rrt Exp $")
|
||||
#define PIPE_BUF pathconf(".", _PC_PIPE_BUF)
|
||||
#else
|
||||
<<<<<<< magic.c
|
||||
__RCSID("$NetBSD: magic.c,v 1.19 2008/08/30 12:16:52 christos Exp $");
|
||||
__RCSID("$NetBSD: magic.c,v 1.20 2008/08/31 07:53:33 christos Exp $");
|
||||
=======
|
||||
#define PIPE_BUF 512
|
||||
#endif
|
||||
|
6
dist/file/src/readelf.c
vendored
6
dist/file/src/readelf.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: readelf.c,v 1.15 2008/08/30 17:49:43 christos Exp $ */
|
||||
/* $NetBSD: readelf.c,v 1.16 2008/08/31 07:53:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2003.
|
||||
@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.76 2008/07/16 18:00:57 christos Exp $")
|
||||
#else
|
||||
__RCSID("$NetBSD: readelf.c,v 1.15 2008/08/30 17:49:43 christos Exp $");
|
||||
__RCSID("$NetBSD: readelf.c,v 1.16 2008/08/31 07:53:33 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -913,7 +913,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
|
||||
for (;;) {
|
||||
Elf32_Cap cap32;
|
||||
Elf64_Cap cap64;
|
||||
char cbuf[MAX(sizeof cap32, sizeof cap64)];
|
||||
char cbuf[/*CONSTCOND*/MAX(sizeof cap32, sizeof cap64)];
|
||||
if ((coff += xcap_sizeof) >= (size_t)xsh_size)
|
||||
break;
|
||||
if (read(fd, cbuf, (size_t)xcap_sizeof) !=
|
||||
|
Loading…
Reference in New Issue
Block a user