change UTF8& operator+=( wchar_t ch ) to UTF8& operator+=( unsigned ch ), because swig does not like wchar_t.

(on Linux, wchar_t is a unsigned int, on Windows a unsigned short, so always using a unsigned int do not create issues)
This commit is contained in:
jean-pierre charras 2017-12-08 17:57:53 +01:00
parent b33bf2eafe
commit 4c4b11b45f
4 changed files with 11 additions and 10 deletions

View File

@ -45,8 +45,8 @@ std::pair<UTF8, std::vector<bool>> ProcessOverbars( const UTF8& aText )
}
// remember: *chIt is not necessary a ASCII7 char.
// it is an unsigned ( wchar_t ) giving a multibyte char in UTF8 strings
text += wchar_t( *chIt );
// it is an unsigned giving a multibyte char in UTF8 strings
text += *chIt;
flags.push_back( overbar );
}

View File

@ -218,15 +218,15 @@ UTF8::UTF8( const wchar_t* txt ) :
}
UTF8& UTF8::operator+=( wchar_t ch )
UTF8& UTF8::operator+=( unsigned w_ch )
{
if( ch <= 0x7F )
m_s.operator+=( char( ch ) );
if( w_ch <= 0x7F )
m_s.operator+=( char( w_ch ) );
else
{
wchar_t wide_chr[2]; // buffer to store wide chars (unicode) read from aText
wchar_t wide_chr[2]; // buffer to store wide chars (UTF16) read from aText
wide_chr[1] = 0;
wide_chr[0] = ch;
wide_chr[0] = w_ch;
UTF8 substr( wide_chr );
m_s += substr.m_s;
}

View File

@ -709,7 +709,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibPart,
void SCH_REFERENCE::Annotate()
{
if( m_NumRef < 0 )
m_Ref += wxChar( '?' );
m_Ref += '?';
else
{
// To avoid a risk of duplicate, for power components

View File

@ -146,8 +146,9 @@ public:
}
/// Append a wide (unicode) char to the UTF8 string.
/// if this char is not a ASCII7 char, it will be added as a UTF8 multibyte seqence
UTF8& operator+=( wchar_t ch );
/// if this wide char is not a ASCII7 char, it will be added as a UTF8 multibyte seqence
/// @param w_ch is a UTF-16 value (can be a UTF-32 on Linux)
UTF8& operator+=( unsigned w_ch );
// std::string::npos is not constexpr, so we can't use it in an
// initializer.