]> git.lyx.org Git - lyx.git/blobdiff - src/support/docstream.C
MacOSX compile fix.
[lyx.git] / src / support / docstream.C
index 24c08ee18c034a5db7c203cbf97cc9804446bc1e..f67865263ca6d29183d9d96d3fa61199bf8a3bcd 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #include "docstream.h"
+#include "unicode.h"
 
 #include <cerrno>
 #include <cstdio>
 
 namespace {
 
-#ifdef WORDS_BIGENDIAN
-char const * ucs4_codeset = "UCS-4BE";
-#else
-char const * ucs4_codeset = "UCS-4LE";
-#endif
 char const * utf8_codeset = "UTF-8";
 
 // We use C IO throughout this file, because the facets might be used with
@@ -231,3 +227,27 @@ odocfstream::odocfstream(const char* s, std::ios_base::openmode mode)
 }
 
 }
+
+#if (!defined(HAVE_WCHAR_T) || SIZEOF_WCHAR_T != 4) && defined(__GNUC__)
+// We get undefined references to these virtual methods. This looks like
+// a bug in gcc. The implementation here does not do anything useful, since
+// it is overriden in utf8_codecvt_facet.
+namespace std {
+template<> codecvt<lyx::char_type, char, mbstate_t>::result
+codecvt<lyx::char_type, char, mbstate_t>::do_out(mbstate_t &, const lyx::char_type *, const lyx::char_type *, const lyx::char_type *&,
+               char *, char *, char *&) const { return error; }
+template<> codecvt<lyx::char_type, char, mbstate_t>::result
+codecvt<lyx::char_type, char, mbstate_t>::do_unshift(mbstate_t &, char *, char *, char *&) const { return error; }
+template<> codecvt<lyx::char_type, char, mbstate_t>::result
+codecvt<lyx::char_type, char, mbstate_t>::do_in(mbstate_t &, const char *, const char *, const char *&,
+               lyx::char_type *, lyx::char_type *, lyx::char_type *&) const { return error; }
+template<> int codecvt<lyx::char_type, char, mbstate_t>::do_encoding() const throw() { return 0; }
+template<> bool codecvt<lyx::char_type, char, mbstate_t>::do_always_noconv() const throw() { return true; }
+#if __GNUC__ == 3 && __GNUC_MINOR__ < 4
+template<> int codecvt<lyx::char_type, char, mbstate_t>::do_length(mbstate_t const &, const char *, const char *, size_t) const { return 1; }
+#else
+template<> int codecvt<lyx::char_type, char, mbstate_t>::do_length(mbstate_t &, const char *, const char *, size_t) const { return 1; }
+#endif
+template<> int codecvt<lyx::char_type, char, mbstate_t>::do_max_length() const throw() { return 4; }
+}
+#endif