summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-04-11 18:14:41 +0000
committerChristos Zoulas <christos@zoulas.com>2022-04-11 18:14:41 +0000
commit961e193e4519d40983322ed853cea6511d4b6494 (patch)
treea8f34f7f43ada4a75033446ef0cb7a1ba95557a3
parent00dc93170dcc569166ae7eb7aa501fab439b5daa (diff)
downloadfile-git-961e193e4519d40983322ed853cea6511d4b6494.tar.gz
Casts to compile cleanly with g++
-rw-r--r--src/apprentice.c4
-rw-r--r--src/compress.c6
-rw-r--r--src/file.c6
-rw-r--r--src/fsmagic.c4
4 files changed, 10 insertions, 10 deletions
diff --git a/src/apprentice.c b/src/apprentice.c
index b3dec7d4..804c0e33 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.320 2022/03/24 15:48:21 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.321 2022/04/11 18:14:41 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -763,7 +763,7 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
fn = mfn;
while (fn) {
- p = strchr(fn, PATHSEP);
+ p = CCAST(char *, strchr(fn, PATHSEP));
if (p)
*p++ = '\0';
if (*fn == '\0')
diff --git a/src/compress.c b/src/compress.c
index 17c8e1ea..113077ae 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.134 2021/12/06 15:33:00 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.135 2022/04/11 18:14:41 christos Exp $")
#endif
#include "magic.h"
@@ -741,7 +741,7 @@ 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 = v;
+ 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
@@ -757,7 +757,7 @@ static void
closedesc(void *v, int fd)
{
#ifdef HAVE_POSIX_SPAWNP
- posix_spawn_file_actions_t *fa = v;
+ posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
posix_spawn_file_actions_addclose(fa, fd);
#else
close(v ? fd : fd);
diff --git a/src/file.c b/src/file.c
index b09ba206..7d6ed33f 100644
--- a/src/file.c
+++ b/src/file.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.191 2022/03/19 14:11:47 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.192 2022/04/11 18:14:41 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -456,7 +456,7 @@ setparam(const char *p)
size_t i;
char *s;
- if ((s = strchr(p, '=')) == NULL)
+ if ((s = CCAST(char *, strchr(p, '='))) == NULL)
goto badparm;
for (i = 0; i < __arraycount(pm); i++) {
@@ -629,7 +629,7 @@ docprint(const char *opts, int def)
int comma, pad;
char *sp, *p;
- p = strchr(opts, '%');
+ p = CCAST(char *, strchr(opts, '%'));
if (p == NULL) {
fprintf(stdout, "%s", opts);
defprint(def);
diff --git a/src/fsmagic.c b/src/fsmagic.c
index 5204f20d..f01d374f 100644
--- a/src/fsmagic.c
+++ b/src/fsmagic.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: fsmagic.c,v 1.81 2019/07/16 13:30:32 christos Exp $")
+FILE_RCSID("@(#)$File: fsmagic.c,v 1.82 2022/04/11 18:14:41 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -327,7 +327,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
char *tmp;
char buf2[BUFSIZ+BUFSIZ+4];
- if ((tmp = strrchr(fn, '/')) == NULL) {
+ if ((tmp = CCAST(char *, strrchr(fn, '/'))) == NULL) {
tmp = buf; /* in current directory anyway */
} else {
if (tmp - fn + 1 > BUFSIZ) {