]> git.saurik.com Git - wxWidgets.git/commit - tests/test_vc9_test.vcproj
Write correct number of bytes in wxFile::Write(wxString).
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 12 Sep 2009 22:40:42 +0000 (22:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 12 Sep 2009 22:40:42 +0000 (22:40 +0000)
commit227989f3e96d846023d36a797931875c57fbae6d
tree86fa1e0092e67149bde8047b83e78f8d80924f9e
parentcaa96da73962c44562fe5744a5850855a2658fa0
Write correct number of bytes in wxFile::Write(wxString).

This function was broken for conversions using more than one byte per
character (e.g. UTF-16 or UTF-32) and also even for UTF-8 for strings
containing NUL bytes as it used strlen() to determine the number of bytes to
write out instead of using the really needed number.

Fix this by using the wxCharBuffer::length() method which always returns the
correct value.

Also add a wxFile unit test verifying that it can correctly read back a string
written using any of UTF-8, UTF-16 or UTF-32.

Closes #11192.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
12 files changed:
src/common/file.cpp
tests/Makefile.in
tests/file/filetest.cpp [new file with mode: 0644]
tests/makefile.bcc
tests/makefile.gcc
tests/makefile.vc
tests/makefile.wat
tests/test.bkl
tests/test_test.dsp
tests/test_vc7_test.vcproj
tests/test_vc8_test.vcproj
tests/test_vc9_test.vcproj