@@ -46,11 +46,11 @@ namespace textfile {
4646
4747
4848struct encoding {
49- static inline constexpr const std::array<std::byte, 4 > bom_utf32be = {std::byte{0x00 }, std::byte{0x00 }, std::byte{0xfe }, std::byte{0xff }};
50- static inline constexpr const std::array<std::byte, 4 > bom_utf32le = {std::byte{0xff }, std::byte{0xfe }, std::byte{0x00 }, std::byte{0x00 }};
51- static inline constexpr const std::array<std::byte, 2 > bom_utf16be = {std::byte{0xfe }, std::byte{0xff }};
52- static inline constexpr const std::array<std::byte, 2 > bom_utf16le = {std::byte{0xff }, std::byte{0xfe }};
53- static inline constexpr const std::array<std::byte, 3 > bom_utf8 = {std::byte{0xef }, std::byte{0xbb }, std::byte{0xbf }};
49+ static inline constexpr const std::array<std::byte, 4 > bom_utf32be = {std::byte{0x00 }, std::byte{0x00 }, std::byte{0xfe }, std::byte{0xff }};
50+ static inline constexpr const std::array<std::byte, 4 > bom_utf32le = {std::byte{0xff }, std::byte{0xfe }, std::byte{0x00 }, std::byte{0x00 }};
51+ static inline constexpr const std::array<std::byte, 2 > bom_utf16be = {std::byte{0xfe }, std::byte{0xff }};
52+ static inline constexpr const std::array<std::byte, 2 > bom_utf16le = {std::byte{0xff }, std::byte{0xfe }};
53+ static inline constexpr const std::array<std::byte, 3 > bom_utf8 = {std::byte{0xef }, std::byte{0xbb }, std::byte{0xbf }};
5454 enum class type {
5555 utf32be,
5656 utf32le,
@@ -258,52 +258,52 @@ inline std::vector<std::byte> encode(encoding encoding, const mpt::ustring & tex
258258 case encoding::type::utf32be:
259259 MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big ()) {
260260 std::u32string utf32text = mpt::transcode<std::u32string>(text);
261- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf32text.data ()), utf32text.size () * sizeof (char32_t )));
261+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf32text.data ()), utf32text.size () * sizeof (char32_t )));
262262 } else {
263263 std::u32string utf32text = mpt::transcode<std::u32string>(text);
264264 std::vector<mpt::uint32be> utf32betext;
265265 utf32betext.resize (utf32text.size ());
266266 std::copy (utf32text.begin (), utf32text.end (), utf32betext.begin ());
267- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf32betext.data ()), utf32betext.size () * sizeof (mpt::uint32be)));
267+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf32betext.data ()), utf32betext.size () * sizeof (mpt::uint32be)));
268268 }
269269 break ;
270270 case encoding::type::utf32le:
271271 MPT_MAYBE_CONSTANT_IF (mpt::endian_is_little ()) {
272272 std::u32string utf32text = mpt::transcode<std::u32string>(text);
273- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf32text.data ()), utf32text.size () * sizeof (char32_t )));
273+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf32text.data ()), utf32text.size () * sizeof (char32_t )));
274274 } else {
275275 std::u32string utf32text = mpt::transcode<std::u32string>(text);
276276 std::vector<mpt::uint32le> utf32letext;
277277 utf32letext.resize (utf32text.size ());
278278 std::copy (utf32text.begin (), utf32text.end (), utf32letext.begin ());
279- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf32letext.data ()), utf32letext.size () * sizeof (mpt::uint32le)));
279+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf32letext.data ()), utf32letext.size () * sizeof (mpt::uint32le)));
280280 }
281281 break ;
282282 case encoding::type::utf16be:
283283 MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big ()) {
284284 std::u16string utf16text = mpt::transcode<std::u16string>(text);
285- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf16text.data ()), utf16text.size () * sizeof (char16_t )));
285+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf16text.data ()), utf16text.size () * sizeof (char16_t )));
286286 } else {
287287 std::u16string utf16text = mpt::transcode<std::u16string>(text);
288288 std::vector<mpt::uint16be> utf16betext;
289289 utf16betext.resize (utf16text.size ());
290290 std::copy (utf16text.begin (), utf16text.end (), utf16betext.begin ());
291- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf16betext.data ()), utf16betext.size () * sizeof (mpt::uint16be)));
291+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf16betext.data ()), utf16betext.size () * sizeof (mpt::uint16be)));
292292 }
293293 break ;
294294 case encoding::type::utf16le:
295295 MPT_MAYBE_CONSTANT_IF (MPT_OS_WINDOWS) {
296296 std::wstring wtext = mpt::transcode<std::wstring>(text);
297- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(wtext.data ()), wtext.size () * sizeof (wchar_t )));
297+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(wtext.data ()), wtext.size () * sizeof (wchar_t )));
298298 } else MPT_MAYBE_CONSTANT_IF (mpt::endian_is_little ()) {
299299 std::u16string utf16text = mpt::transcode<std::u16string>(text);
300- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf16text.data ()), utf16text.size () * sizeof (char16_t )));
300+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf16text.data ()), utf16text.size () * sizeof (char16_t )));
301301 } else {
302302 std::u16string utf16text = mpt::transcode<std::u16string>(text);
303303 std::vector<mpt::uint16le> utf16letext;
304304 utf16letext.resize (utf16text.size ());
305305 std::copy (utf16text.begin (), utf16text.end (), utf16letext.begin ());
306- mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte*>(utf16letext.data ()), utf16letext.size () * sizeof (mpt::uint16le)));
306+ mpt::append (result, mpt::as_span (reinterpret_cast <const std::byte *>(utf16letext.data ()), utf16letext.size () * sizeof (mpt::uint16le)));
307307 }
308308 break ;
309309 case encoding::type::utf8:
0 commit comments