Files
haikuports/sys-apps/file/patches/file-5.43.patchset
2022-09-25 17:48:12 +02:00

136 lines
4.2 KiB
Plaintext

From e2e9aae068f143aa7da969c6cedad9b1e85bece3 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 12 May 2016 19:46:43 +0000
Subject: Haiku patch
diff --git a/configure.ac b/configure.ac
index 6629300..cae8ed3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,14 +151,14 @@ else
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
fi], [
if test "$GCC" = yes; then
AC_MSG_RESULT(yes)
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
else
WARNINGS=
AC_MSG_RESULT(no)
diff --git a/src/compress.c b/src/compress.c
index b456626..6e74c86 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -741,9 +741,11 @@ movedesc(void *v, int i, int fd)
if (fd == i)
return; /* "no dup was necessary" */
#ifdef HAVE_POSIX_SPAWNP
+{
posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
posix_spawn_file_actions_adddup2(fa, fd, i);
posix_spawn_file_actions_addclose(fa, fd);
+}
#else
if (dup2(fd, i) == -1) {
DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
diff --git a/src/der.c b/src/der.c
index cb44b9e..73e0e49 100644
--- a/src/der.c
+++ b/src/der.c
@@ -265,6 +265,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
{
const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
+ uint32_t tlen;
if (gettag(b, &offs, len) == DER_BAD) {
DPRINTF(("%s: bad tag 1\n", __func__));
@@ -273,7 +274,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
offs, m->offset));
- uint32_t tlen = getlength(b, &offs, len);
+ tlen = getlength(b, &offs, len);
if (tlen == DER_BAD) {
DPRINTF(("%s: bad tag 2\n", __func__));
return -1;
@@ -307,6 +308,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
size_t offs = 0, len = ms->search.s_len;
uint32_t tag, tlen;
char buf[128];
+ size_t slen;
DPRINTF(("%s: compare %zu bytes\n", __func__, len));
@@ -329,7 +331,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
buf, s);
- size_t slen = strlen(buf);
+ slen = strlen(buf);
if (strncmp(buf, s, slen) != 0) {
DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
diff --git a/src/file.c b/src/file.c
index 1566a17..2620ef0 100644
--- a/src/file.c
+++ b/src/file.c
@@ -531,8 +531,9 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
if (line[len - 1] == '\n')
line[len - 1] = '\0';
if (fi >= fimax) {
+ char **nf;
fimax += 100;
- char **nf = CAST(char **,
+ nf = CAST(char **,
realloc(flist, fimax * sizeof(*flist)));
if (nf == NULL)
goto out;
diff --git a/src/funcs.c b/src/funcs.c
index 41c4106..0f9513f 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -668,6 +668,7 @@ file_regcomp(struct magic_set *ms file_locale_used, file_regex_t *rx,
strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
(void)setlocale(LC_CTYPE, "C");
#endif
+{
int rc;
rc = regcomp(rx, pat, flags);
@@ -685,6 +686,7 @@ file_regcomp(struct magic_set *ms file_locale_used, file_regex_t *rx,
}
return rc;
}
+}
/*ARGSUSED*/
protected int
@@ -699,6 +701,7 @@ file_regexec(struct magic_set *ms file_locale_used, file_regex_t *rx,
strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
(void)setlocale(LC_CTYPE, "C");
#endif
+{
int rc;
/* XXX: force initialization because glibc does not always do this */
if (nmatch != 0)
@@ -711,6 +714,7 @@ file_regexec(struct magic_set *ms file_locale_used, file_regex_t *rx,
#endif
return rc;
}
+}
protected void
file_regfree(file_regex_t *rx)
--
2.30.2