]> git.lizzy.rs Git - minetest.git/blobdiff - src/irrlicht_changes/irrUString.h
Revert #10495 and simplify.
[minetest.git] / src / irrlicht_changes / irrUString.h
index 2472eda4decc7c745307848668364eb822a74d6b..b628c092c28b5a2371d65910ec81f126a498626a 100644 (file)
@@ -28,8 +28,7 @@
    john@suckerfreegames.com
 */
 
-#ifndef __IRR_USTRING_H_INCLUDED__
-#define __IRR_USTRING_H_INCLUDED__
+#pragma once
 
 #if (__cplusplus > 199711L) || (_MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__)
 #      define USTRING_CPP0X
@@ -49,7 +48,7 @@
 #define __BIG_ENDIAN 1
 #elif defined(__MACH__) && defined(__APPLE__)
 #include <machine/endian.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/endian.h>
 #else
 #include <endian.h>
@@ -2917,13 +2916,13 @@ class ustring16
                                ret[0] = unicode::BOM;
                        else if (endian == unicode::EUTFEE_LITTLE)
                        {
-                               uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
+                               uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
                                *ptr8++ = unicode::BOM_ENCODE_UTF16_LE[0];
                                *ptr8 = unicode::BOM_ENCODE_UTF16_LE[1];
                        }
                        else
                        {
-                               uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
+                               uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
                                *ptr8++ = unicode::BOM_ENCODE_UTF16_BE[0];
                                *ptr8 = unicode::BOM_ENCODE_UTF16_BE[1];
                        }
@@ -3890,5 +3889,3 @@ class hash : public std::unary_function<core::ustring, size_t>
 
 } // end namespace core
 } // end namespace irr
-
-#endif