• R/O
  • HTTP
  • SSH
  • HTTPS

lha: Commit


Commit MetaInfo

Revisionbb574c0a72ae6108d95c86e2e68405df467ad7f9 (tree)
Time2016-10-05 23:27:35
AuthorKoji Arai <jca02266@gmai...>
CommiterKoji Arai

Log Message

Prefer to use the iconv on MacOS X

Thanks to hirotosakai

Change Summary

Incremental Difference

--- a/src/header.c
+++ b/src/header.c
@@ -1907,7 +1907,7 @@ write_header(fp, hdr)
19071907
19081908 #if MULTIBYTE_FILENAME
19091909
1910-#if defined(__APPLE__) /* Added by Hiroto Sakai */
1910+#if defined(__APPLE__) && !defined(HAVE_ICONV) /* Added by Hiroto Sakai */
19111911
19121912 #include <CoreFoundation/CFString.h>
19131913 #include <CoreFoundation/CFStringEncodingExt.h>
@@ -2045,11 +2045,16 @@ char *
20452045 sjis_to_utf8(char *dst, const char *src, size_t dstsize)
20462046 {
20472047 #if defined(__APPLE__)
2048+#if !defined(HAVE_ICONV)
20482049 dst[0] = '\0';
20492050 if (ConvertEncodingToUTF8(src, dst, dstsize,
20502051 kCFStringEncodingDOSJapanese,
20512052 kCFStringEncodingUseHFSPlusCanonical) == 0)
20522053 return dst;
2054+#else
2055+ if (ConvertEncodingByIconv(src, dst, dstsize, "SJIS", "UTF-8-MAC") != -1)
2056+ return dst;
2057+#endif
20532058 #elif HAVE_ICONV
20542059 if (ConvertEncodingByIconv(src, dst, dstsize, "SJIS", "UTF-8") != -1)
20552060 return dst;
@@ -2066,6 +2071,7 @@ char *
20662071 utf8_to_sjis(char *dst, const char *src, size_t dstsize)
20672072 {
20682073 #if defined(__APPLE__)
2074+#if !defined(HAVE_ICONV)
20692075 int srclen;
20702076
20712077 dst[0] = '\0';
@@ -2074,6 +2080,10 @@ utf8_to_sjis(char *dst, const char *src, size_t dstsize)
20742080 kCFStringEncodingDOSJapanese,
20752081 kCFStringEncodingUseHFSPlusCanonical) == 0)
20762082 return dst;
2083+#else
2084+ if (ConvertEncodingByIconv(src, dst, dstsize, "UTF-8-MAC", "SJIS") != -1)
2085+ return dst;
2086+#endif
20772087 #elif HAVE_ICONV
20782088 if (ConvertEncodingByIconv(src, dst, dstsize, "UTF-8", "SJIS") != -1)
20792089 return dst;
Show on old repository browser