along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
/* Specification. */
#include "striconv.h"
else
return -1;
}
-# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
- /* Irix iconv() inserts a NUL byte if it cannot convert. */
+# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+ /* Irix iconv() inserts a NUL byte if it cannot convert.
+ NetBSD iconv() inserts a question mark if it cannot convert.
+ Only GNU libiconv and GNU libc are known to prefer to fail rather
+ than doing a lossy conversion. */
else if (res > 0)
{
errno = EILSEQ;
*lengthp = 0;
return 0;
}
- result = (*resultp != NULL ? realloc (*resultp, length) : malloc (length));
+ result =
+ (char *) (*resultp != NULL ? realloc (*resultp, length) : malloc (length));
if (result == NULL)
{
errno = ENOMEM;
else
return -1;
}
-# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
- /* Irix iconv() inserts a NUL byte if it cannot convert. */
+# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+ /* Irix iconv() inserts a NUL byte if it cannot convert.
+ NetBSD iconv() inserts a question mark if it cannot convert.
+ Only GNU libiconv and GNU libc are known to prefer to fail rather
+ than doing a lossy conversion. */
else if (res > 0)
{
errno = EILSEQ;
else
goto failed;
}
-# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
- /* Irix iconv() inserts a NUL byte if it cannot convert. */
+# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+ /* Irix iconv() inserts a NUL byte if it cannot convert.
+ NetBSD iconv() inserts a question mark if it cannot convert.
+ Only GNU libiconv and GNU libc are known to prefer to fail rather
+ than doing a lossy conversion. */
else if (res > 0)
{
errno = EILSEQ;