projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i18n: Use UTF8 macro instead of "UTF8" literal string.
[pspp]
/
src
/
libpspp
/
i18n.c
diff --git
a/src/libpspp/i18n.c
b/src/libpspp/i18n.c
index d9b42cbcca844da31d46630c78295b8276591d99..c0deb119c0f3faa9c277ba0f3f931e856bd534e7 100644
(file)
--- a/
src/libpspp/i18n.c
+++ b/
src/libpspp/i18n.c
@@
-15,31
+15,29
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <xalloc.h>
+
+#include "libpspp/i18n.h"
+
#include <assert.h>
#include <assert.h>
+#include <errno.h>
+#include <iconv.h>
+#include <langinfo.h>
+#include <libintl.h>
#include <locale.h>
#include <locale.h>
-#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <string.h>
-#include <libintl.h>
-#include <iconv.h>
-#include <errno.h>
-#include <relocatable.h>
-#include "assertion.h"
-#include "hmapx.h"
-#include "hash-functions.h"
-#include "pool.h"
-#include "i18n.h"
+#include "libpspp/assertion.h"
+#include "libpspp/hmapx.h"
+#include "libpspp/hash-functions.h"
+#include "libpspp/pool.h"
+#include "libpspp/version.h"
-#include "version.h"
-
-#include <localcharset.h>
-#include "xstrndup.h"
-
-#if HAVE_NL_LANGINFO
-#include <langinfo.h>
-#endif
+#include "gl/localcharset.h"
+#include "gl/xalloc.h"
+#include "gl/relocatable.h"
+#include "gl/xstrndup.h"
struct converter
{
struct converter
{
@@
-118,11
+116,16
@@
try_recode (iconv_t conv,
&op, &outbytes) == -1)
switch (errno)
{
&op, &outbytes) == -1)
switch (errno)
{
- case EILSEQ:
case EINVAL:
case EINVAL:
- if (outbytes
== 0
)
+ if (outbytes
< 2
)
return false;
return false;
+ *op++ = fallbackchar;
+ *op++ = '\0';
+ return true;
+ case EILSEQ:
+ if (outbytes == 0)
+ return false;
*op++ = fallbackchar;
outbytes--;
ip++;
*op++ = fallbackchar;
outbytes--;
ip++;
@@
-297,7
+300,7
@@
i18n_done (void)
bool
valid_encoding (const char *enc)
{
bool
valid_encoding (const char *enc)
{
- iconv_t conv = iconv_open (
"UTF8"
, enc);
+ iconv_t conv = iconv_open (
UTF8
, enc);
if ( conv == (iconv_t) -1)
return false;
if ( conv == (iconv_t) -1)
return false;