[PATCH] [libcxx] std::codecvt - short wchar support

Oleg Ranevskyy llvm.mail.list at gmail.com
Tue Apr 7 14:30:04 PDT 2015


Hi EricWF, jroelofs, mclow.lists,

std::codecvt conversions internally use uint32_t in codecvt specializations for wchar_t, which breaks conversion logic if the '-fshort-wchar' was used during compilation.
This patch modifies std::codecvt_utf8 to use the same logic for short wchar_t as the one for WIN32 where wchar_t is 2 bytes long. 

std::codecvt_utf16 and std::codecvt_utf8_utf16 changed to work with both WIN32 and fshort-wchar.

It also improves code reuse by generalizing utf16_to_utf8 and utf8_to_utf16 functions, and fixes the libcxx tests dependent on std::codecvt, which use 4-byte test data or expect UCS-4 encoding.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8880

Files:
  src/locale.cpp
  test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
  test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
  test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
  test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
  test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
  test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
  test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8880.23368.patch
Type: text/x-patch
Size: 39752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150407/cb255bae/attachment.bin>


More information about the llvm-commits mailing list