don't use feof

This commit is contained in:
Lucinda May Phipps 2022-04-23 02:48:12 +00:00 committed by Jehan Pagès
parent 143b3fe513
commit 383bf118c9

View File

@ -51,9 +51,11 @@ void detect(FILE * fp)
{
uchardet_t handle = uchardet_new();
while (!feof(fp))
while (1)
{
size_t len = fread(buffer, 1, BUFFER_SIZE, fp);
if (len == 0)
break;
int retval = uchardet_handle_data(handle, buffer, len);
if (retval != 0)
{