don't use implicit wxString->char*/wchar_t* conversion, it will not be available in wxUSE_STL build in the future

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-10 17:42:41 +00:00
parent 52de37c78f
commit 8650108199
51 changed files with 330 additions and 304 deletions

View File

@@ -120,7 +120,7 @@ private:
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
);
@@ -130,7 +130,7 @@ private:
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
);
@@ -142,7 +142,7 @@ private:
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
);
// use wxTextOutputStream to exercise wxMBConv interface
@@ -152,7 +152,7 @@ private:
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
);
#endif
@@ -167,7 +167,7 @@ private:
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
const char* utf8Buffer, // the same character sequence as multiBuffer, encoded as UTF-8
size_t utf8Bytes, // the byte length of the UTF-8 encoded character sequence
wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // the number of bytes occupied by a terminating null in the converter's encoding
);
@@ -393,7 +393,7 @@ void MBConvTestCase::UTF7Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_iconv,
sizeof(welcome_utf7_iconv),
&wxConvUTF7,
wxConvUTF7,
1
);
TestDecoder
@@ -402,7 +402,7 @@ void MBConvTestCase::UTF7Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_wx,
sizeof(welcome_utf7_wx),
&wxConvUTF7,
wxConvUTF7,
1
);
#if 0
@@ -415,7 +415,7 @@ void MBConvTestCase::UTF7Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_iconv,
sizeof(welcome_utf7_iconv),
&wxConvUTF7,
wxConvUTF7,
1
);
#endif
@@ -425,7 +425,7 @@ void MBConvTestCase::UTF7Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_wx,
sizeof(welcome_utf7_wx),
&wxConvUTF7,
wxConvUTF7,
1
);
}
@@ -438,7 +438,7 @@ void MBConvTestCase::UTF8Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
&wxConvUTF8,
wxConvUTF8,
1
);
TestEncoder
@@ -447,7 +447,7 @@ void MBConvTestCase::UTF8Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
&wxConvUTF8,
wxConvUTF8,
1
);
}
@@ -461,7 +461,7 @@ void MBConvTestCase::UTF16LETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16le,
sizeof(welcome_utf16le),
&convUTF16LE,
convUTF16LE,
2
);
TestEncoder
@@ -470,7 +470,7 @@ void MBConvTestCase::UTF16LETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16le,
sizeof(welcome_utf16le),
&convUTF16LE,
convUTF16LE,
2
);
}
@@ -484,7 +484,7 @@ void MBConvTestCase::UTF16BETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16be,
sizeof(welcome_utf16be),
&convUTF16BE,
convUTF16BE,
2
);
TestEncoder
@@ -493,7 +493,7 @@ void MBConvTestCase::UTF16BETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16be,
sizeof(welcome_utf16be),
&convUTF16BE,
convUTF16BE,
2
);
}
@@ -507,7 +507,7 @@ void MBConvTestCase::UTF32LETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32le,
sizeof(welcome_utf32le),
&convUTF32LE,
convUTF32LE,
4
);
TestEncoder
@@ -516,7 +516,7 @@ void MBConvTestCase::UTF32LETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32le,
sizeof(welcome_utf32le),
&convUTF32LE,
convUTF32LE,
4
);
}
@@ -530,7 +530,7 @@ void MBConvTestCase::UTF32BETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32be,
sizeof(welcome_utf32be),
&convUTF32BE,
convUTF32BE,
4
);
TestEncoder
@@ -539,7 +539,7 @@ void MBConvTestCase::UTF32BETests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32be,
sizeof(welcome_utf32be),
&convUTF32BE,
convUTF32BE,
4
);
}
@@ -553,7 +553,7 @@ void MBConvTestCase::CP932Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_cp932,
sizeof(welcome_cp932),
&convCP932,
convCP932,
1
);
TestEncoder
@@ -562,7 +562,7 @@ void MBConvTestCase::CP932Tests()
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_cp932,
sizeof(welcome_cp932),
&convCP932,
convCP932,
1
);
}
@@ -743,7 +743,7 @@ void MBConvTestCase::TestCoder(
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
const char* utf8Buffer, // the same character sequence as multiBuffer, encoded as UTF-8
size_t utf8Bytes, // the byte length of the UTF-8 encoded character sequence
wxMBConv* converter, // the wxMBConv object thta can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object thta can decode multiBuffer into a wide character sequence
int sizeofNull // the number of bytes occupied by a terminating null in the converter's encoding
)
{
@@ -777,12 +777,12 @@ void MBConvTestCase::TestCoder(
}
WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name );
WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name );
void MBConvTestCase::FontmapTests()
{
#ifdef wxUSE_FONTMAP
wxMBConv* converter = new_wxMBConv_wxwin( _T("CP1252") );
wxMBConv* converter = new_wxMBConv_wxwin("CP1252");
if ( !converter )
{
return;
@@ -792,7 +792,7 @@ void MBConvTestCase::FontmapTests()
sizeof(CP1252),
(const char*)CP1252_utf8,
sizeof(CP1252_utf8),
converter,
*converter,
1
);
delete converter;
@@ -800,12 +800,12 @@ void MBConvTestCase::FontmapTests()
}
WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name );
WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const char* name );
void MBConvTestCase::IconvTests()
{
#ifdef HAVE_ICONV
wxMBConv* converter = new_wxMBConv_iconv( _T("CP932") );
wxMBConv* converter = new_wxMBConv_iconv("CP932");
if ( !converter )
{
return;
@@ -815,7 +815,7 @@ void MBConvTestCase::IconvTests()
sizeof(welcome_cp932),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
converter,
*converter,
1
);
delete converter;
@@ -830,7 +830,7 @@ void MBConvTestCase::CP1252Tests()
sizeof(CP1252),
(const char*)CP1252_utf8,
sizeof(CP1252_utf8),
&convCP1252,
convCP1252,
1
);
}
@@ -874,7 +874,7 @@ void MBConvTestCase::TestDecoder(
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
)
{
@@ -886,7 +886,7 @@ void MBConvTestCase::TestDecoder(
memset( &inputCopy.data()[multiBytes], 0, sizeofNull );
// calculate the output size
size_t outputWritten = converter->MB2WC
size_t outputWritten = converter.MB2WC
(
0,
(const char*)inputCopy.data(),
@@ -902,7 +902,7 @@ void MBConvTestCase::TestDecoder(
wxWCharBuffer outputBuffer(outputBufferChars);
memset( outputBuffer.data(), UNINITIALIZED, outputBufferChars*sizeof(wchar_t) );
outputWritten = converter->MB2WC
outputWritten = converter.MB2WC
(
outputBuffer.data(),
(const char*)inputCopy.data(),
@@ -934,7 +934,7 @@ void MBConvTestCase::TestEncoder(
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
)
{
@@ -946,7 +946,7 @@ void MBConvTestCase::TestEncoder(
inputCopy.data()[wideChars] = 0;
// calculate the output size
size_t outputWritten = converter->WC2MB
size_t outputWritten = converter.WC2MB
(
0,
(const wchar_t*)inputCopy.data(),
@@ -961,7 +961,7 @@ void MBConvTestCase::TestEncoder(
wxCharBuffer outputBuffer(outputBufferSize);
memset( outputBuffer.data(), UNINITIALIZED, outputBufferSize );
outputWritten = converter->WC2MB
outputWritten = converter.WC2MB
(
outputBuffer.data(),
(const wchar_t*)inputCopy.data(),
@@ -1001,14 +1001,14 @@ void MBConvTestCase::TestStreamDecoder(
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
)
{
// this isn't meant to test wxMemoryInputStream or wxTextInputStream
// it's meant to test the way wxTextInputStream uses wxMBConv
// (which has exposed some problems with wxMBConv)
wxMemoryInputStream memoryInputStream( multiBuffer, multiBytes );
wxTextInputStream textInputStream( memoryInputStream, wxT(""), *converter );
wxTextInputStream textInputStream( memoryInputStream, wxT(""), converter );
for ( size_t i = 0; i < wideChars; i++ )
{
wxChar wc = textInputStream.GetChar();
@@ -1027,7 +1027,7 @@ void MBConvTestCase::TestStreamEncoder(
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
)
{
// this isn't meant to test wxMemoryOutputStream or wxTextOutputStream
@@ -1035,7 +1035,7 @@ void MBConvTestCase::TestStreamEncoder(
// (which has exposed some problems with wxMBConv)
wxMemoryOutputStream memoryOutputStream;
// wxEOL_UNIX will pass \n \r unchanged
wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, *converter );
wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, converter );
for ( size_t i = 0; i < wideChars; i++ )
{
textOutputStream.PutChar( wideBuffer[i] );