From dd60005824b5cf77c8b79fd5739d8b56a72bc693 Mon Sep 17 00:00:00 2001 From: drepper Date: Wed, 20 Nov 2002 23:40:45 +0000 Subject: [PATCH] (PREPARE_LOOP): Return __GCONV_EMPTY_INPUT only if input is really empty. Otherwise __GCONV_INCOMPLETE_INPUT. --- iconvdata/unicode.c | 3 ++- iconvdata/utf-16.c | 3 ++- iconvdata/utf-32.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c index c88f75dd85..df452d2a1d 100644 --- a/iconvdata/unicode.c +++ b/iconvdata/unicode.c @@ -49,7 +49,8 @@ { \ /* We have to find out which byte order the file is encoded in. */ \ if (inptr + 2 > inend) \ - return __GCONV_EMPTY_INPUT; \ + return (inptr == inend \ + ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ if (get16u (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c index 642340611d..b8165088e1 100644 --- a/iconvdata/utf-16.c +++ b/iconvdata/utf-16.c @@ -51,7 +51,8 @@ { \ /* We have to find out which byte order the file is encoded in. */ \ if (inptr + 2 > inend) \ - return __GCONV_EMPTY_INPUT; \ + return (inptr == inend \ + ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ if (get16u (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c index 01f4b881dc..cc02651374 100644 --- a/iconvdata/utf-32.c +++ b/iconvdata/utf-32.c @@ -49,7 +49,8 @@ { \ /* We have to find out which byte order the file is encoded in. */ \ if (inptr + 4 > inend) \ - return __GCONV_EMPTY_INPUT; \ + return (inptr == inend \ + ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ if (get32u (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ -- 2.11.0