-/* $OpenBSD: file.c,v 1.58 2016/05/01 20:34:26 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.59 2017/04/18 14:16:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
#include "magic.h"
#include "xmalloc.h"
-struct input_msg
-{
+struct input_msg {
int idx;
struct stat sb;
int link_target;
};
-struct input_ack
-{
+struct input_ack {
int idx;
};
-struct input_file
-{
+struct input_file {
struct magic *m;
struct input_msg *msg;
if (got == -1) {
if (errno == EINTR)
continue;
- return NULL;
+ return (NULL);
}
if (got == 0)
break;
left -= got;
}
*used = size - left;
- return buffer;
+ return (buffer);
}
static int
-/* $OpenBSD: magic-load.c,v 1.23 2016/05/01 14:57:15 nicm Exp $ */
+/* $OpenBSD: magic-load.c,v 1.24 2017/04/18 14:16:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
static int
magic_set_result(struct magic_line *ml, const char *s)
{
- const char *fmt;
- const char *endfmt;
- const char *cp;
+ const char *fmt, *endfmt, *cp;
regex_t *re = NULL;
regmatch_t pmatch;
size_t fmtlen;
-/* $OpenBSD: magic-test.c,v 1.24 2016/08/26 08:50:31 guenther Exp $ */
+/* $OpenBSD: magic-test.c,v 1.25 2017/04/18 14:16:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
if (*ms.out != '\0') {
if (flags & MAGIC_TEST_MIME) {
- if (ms.mimetype)
+ if (ms.mimetype != NULL)
return (xstrdup(ms.mimetype));
return (NULL);
}
-/* $OpenBSD: text.c,v 1.2 2015/04/24 16:45:32 nicm Exp $ */
+/* $OpenBSD: text.c,v 1.3 2017/04/18 14:16:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
size_t wordlen;
u_int i;
- end = (char *)base + size;
+ end = (const char *)base + size;
for (cp = base; cp != end; /* nothing */) {
while (cp != end && isspace((u_char)*cp))
cp++;