Update current version of litehtml. Fix a crash when document contains no fonts
[claws.git] / src / plugins / litehtml_viewer / litehtml / utf8_strings.h
index c932ed5074f1a4891136aef66a2797c703711c63..0120262766e6d1f96fa6684872b8c38b34f3eb60 100644 (file)
@@ -1,48 +1,51 @@
-#pragma once\r
-\r
-namespace litehtml\r
-{\r
-       class utf8_to_wchar\r
-       {\r
-               const byte* m_utf8;\r
-               std::wstring m_str;\r
-       public:\r
-               utf8_to_wchar(const char* val);\r
-               operator const wchar_t*() const\r
-               {\r
-                       return m_str.c_str();\r
-               }\r
-       private:\r
-               ucode_t getb()\r
-               {\r
-                       if (!(*m_utf8)) return 0;\r
-                       return *m_utf8++;\r
-               }\r
-               ucode_t get_next_utf8(ucode_t val)\r
-               {\r
-                       return (val & 0x3f);\r
-               }\r
-               ucode_t get_char();\r
-       };\r
-\r
-       class wchar_to_utf8\r
-       {\r
-               std::string m_str;\r
-       public:\r
-               wchar_to_utf8(const wchar_t* val);\r
-               operator const char*() const\r
-               {\r
-                       return m_str.c_str();\r
-               }\r
-       };\r
-\r
-#ifdef LITEHTML_UTF8\r
-#define litehtml_from_utf8(str)                str\r
-#define litehtml_to_utf8(str)          str\r
-#define litehtml_from_wchar(str)       wchar_to_utf8(str)\r
-#else\r
-#define litehtml_from_utf8(str)                utf8_to_wchar(str)\r
-#define litehtml_from_wchar(str)       str\r
-#define litehtml_to_utf8(str)          wchar_to_utf8(str)\r
-#endif\r
-}
\ No newline at end of file
+#ifndef LH_UTF8_STRINGS_H
+#define LH_UTF8_STRINGS_H
+
+namespace litehtml
+{
+       class utf8_to_wchar
+       {
+               const byte* m_utf8;
+               std::wstring m_str;
+       public:
+               utf8_to_wchar(const char* val);
+               operator const wchar_t*() const
+               {
+                       return m_str.c_str();
+               }
+       private:
+               ucode_t getb()
+               {
+                       if (!(*m_utf8)) return 0;
+                       return *m_utf8++;
+               }
+               ucode_t get_next_utf8(ucode_t val)
+               {
+                       return (val & 0x3f);
+               }
+               ucode_t get_char();
+       };
+
+       class wchar_to_utf8
+       {
+               std::string m_str;
+       public:
+               wchar_to_utf8(const wchar_t* val);
+               operator const char*() const
+               {
+                       return m_str.c_str();
+               }
+       };
+
+#ifdef LITEHTML_UTF8
+#define litehtml_from_utf8(str)                str
+#define litehtml_to_utf8(str)          str
+#define litehtml_from_wchar(str)       wchar_to_utf8(str)
+#else
+#define litehtml_from_utf8(str)                utf8_to_wchar(str)
+#define litehtml_from_wchar(str)       str
+#define litehtml_to_utf8(str)          wchar_to_utf8(str)
+#endif
+}
+
+#endif  // LH_UTF8_STRINGS_H