diff options
author | Christos Zoulas <christos@zoulas.com> | 2021-04-27 19:37:14 +0000 |
---|---|---|
committer | Christos Zoulas <christos@zoulas.com> | 2021-04-27 19:37:14 +0000 |
commit | c07e242e766242a44ff720c149b1bdd4924ec247 (patch) | |
tree | 720b90870328faabfda91dddcd3b60ab72d43b1e /src/encoding.c | |
parent | 905ca555b0e2bdcf9d2985bcc7c1c22e2229b088 (diff) | |
download | file-git-c07e242e766242a44ff720c149b1bdd4924ec247.tar.gz |
Revert the fix for PR/180. It lead to PR/261. Using character count heuristics
ends up with confusing behavior, the following should not be producing different
results:
echo -n xx | ./file -
echo -n xy | ./file -
Diffstat (limited to 'src/encoding.c')
-rw-r--r-- | src/encoding.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/encoding.c b/src/encoding.c index 31d4d125..3647a481 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: encoding.c,v 1.31 2021/04/19 18:38:04 christos Exp $") +FILE_RCSID("@(#)$File: encoding.c,v 1.32 2021/04/27 19:37:14 christos Exp $") #endif /* lint */ #include "magic.h" @@ -265,9 +265,7 @@ private int \ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \ size_t *ulen) \ { \ - size_t i, u; \ - unsigned char dist[256]; \ - memset(dist, 0, sizeof(dist)); \ + size_t i; \ \ *ulen = 0; \ \ @@ -278,16 +276,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \ return 0; \ \ ubuf[(*ulen)++] = buf[i]; \ - dist[buf[i]]++; \ } \ - u = 0; \ - for (i = 0; i < __arraycount(dist); i++) { \ - if (dist[i]) \ - u++; \ - } \ - if (u < MIN(nbytes, 3)) \ - return 0; \ -\ return 1; \ } |