summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-05-28 00:44:22 +0000
committerChristos Zoulas <christos@zoulas.com>2022-05-28 00:44:22 +0000
commit850e148d088922878f1e5f6b2e3a9c01f75d21f3 (patch)
tree00807aac1d4f7caf8774e8b0d6394717a5385b4d
parent33bd13769d99f289068aa0abf01ec74d30a0b277 (diff)
downloadfile-git-850e148d088922878f1e5f6b2e3a9c01f75d21f3.tar.gz
add missing cast in test code
-rw-r--r--src/is_csv.c4
-rw-r--r--src/is_json.c4
-rw-r--r--src/softmagic.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/is_csv.c b/src/is_csv.c
index 937ab5f4..841317c6 100644
--- a/src/is_csv.c
+++ b/src/is_csv.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: is_csv.c,v 1.6 2020/08/09 16:43:36 christos Exp $")
+FILE_RCSID("@(#)$File: is_csv.c,v 1.7 2022/05/28 00:44:22 christos Exp $")
#endif
#include <string.h>
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
if (fstat(fd, &st) == -1)
err(EXIT_FAILURE, "Can't stat `%s'", argv[1]);
- if ((p = malloc(st.st_size)) == NULL)
+ if ((p = CAST(char *, malloc(st.st_size))) == NULL)
err(EXIT_FAILURE, "Can't allocate %jd bytes",
(intmax_t)st.st_size);
if (read(fd, p, st.st_size) != st.st_size)
diff --git a/src/is_json.c b/src/is_json.c
index be53f80a..c276b7be 100644
--- a/src/is_json.c
+++ b/src/is_json.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: is_json.c,v 1.19 2022/04/04 17:47:45 christos Exp $")
+FILE_RCSID("@(#)$File: is_json.c,v 1.20 2022/05/28 00:44:22 christos Exp $")
#endif
#include "magic.h"
@@ -466,7 +466,7 @@ main(int argc, char *argv[])
if (fstat(fd, &st) == -1)
err(EXIT_FAILURE, "Can't stat `%s'", argv[1]);
- if ((p = malloc(st.st_size)) == NULL)
+ if ((p = CAST(char *, malloc(st.st_size))) == NULL)
err(EXIT_FAILURE, "Can't allocate %jd bytes",
(intmax_t)st.st_size);
if (read(fd, p, st.st_size) != st.st_size)
diff --git a/src/softmagic.c b/src/softmagic.c
index 064196d7..5e49afb7 100644
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.322 2022/04/18 21:50:49 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.323 2022/05/28 00:44:22 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -502,7 +502,7 @@ strndup(const char *str, size_t n)
for (len = 0; len < n && str[len]; len++)
continue;
- if ((copy = malloc(len + 1)) == NULL)
+ if ((copy = CAST(char *, malloc(len + 1))) == NULL)
return NULL;
(void)memcpy(copy, str, len);
copy[len] = '\0';