SHA256
1
0
forked from pool/file
file/file-5.40-1c677c04.patch

37 lines
998 B
Diff

From 1c677c04c0fa43ecfeccdb9705dbbd19fb356891 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sun, 4 Apr 2021 21:02:19 +0000
Subject: [PATCH] Don't count each byte encounter as 1, count the total number
of bytes found (Anatol Belski). This makes it behave like 5.39.
---
src/encoding.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git src/encoding.c src/encoding.c
index c8b40439..c66703bb 100644
--- src/encoding.c
+++ src/encoding.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: encoding.c,v 1.27 2021/02/05 21:33:49 christos Exp $")
+FILE_RCSID("@(#)$File: encoding.c,v 1.28 2021/04/04 21:02:19 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -282,8 +282,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
} \
u = 0; \
for (i = 0; i < __arraycount(dist); i++) { \
- if (dist[i]) \
- u++; \
+ u+= dist[i]; \
} \
if (u < 3) \
return 0; \
--
2.26.2