Skip to content

Commit

Permalink
remove ambiguity when trying to convert a int to cxxtools::Char
Browse files Browse the repository at this point in the history
  • Loading branch information
maekitalo committed Nov 3, 2013
1 parent c5ccd1c commit 645dedf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
19 changes: 2 additions & 17 deletions include/cxxtools/char.h
Expand Up @@ -72,23 +72,8 @@ namespace cxxtools
: _value(0)
{}

//! Constructs a character using the given char as base for the character value.
Char(char ch)
: _value(value_type(static_cast<unsigned char>(ch)))
{}

//! Constructs a character using the given char as base for the character value.
Char(unsigned char ch)
: _value( value_type(ch) )
{}

//! Constructs a character using the given char as base for the character value.
Char(wchar_t ch)
: _value( value_type(static_cast<uint16_t>(ch)) )
{}

//! Constructs a character using the given unsigned 32-bit as base for the character value.
explicit Char(value_type ch)
//! Constructs a character using the given value as base for the character value.
Char(value_type ch)
: _value(ch)
{}

Expand Down
2 changes: 1 addition & 1 deletion src/iso8859_15codec.cpp
Expand Up @@ -38,7 +38,7 @@ Iso8859_15Codec::result Iso8859_15Codec::do_in(MBState& s, const char* fromBegin
toNext = toBegin;
while (fromNext < fromEnd && toNext < toEnd)
{
*toNext = *fromNext == '\xa4' ? Char(0x20ac) : Char(*fromNext);
*toNext = *fromNext == '\xa4' ? Char(0x20ac) : Char(static_cast<unsigned char>(*fromNext));
++fromNext;
++toNext;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iso8859_1codec.cpp
Expand Up @@ -38,7 +38,7 @@ Iso8859_1Codec::result Iso8859_1Codec::do_in(MBState& s, const char* fromBegin,
toNext = toBegin;
while (fromNext < fromEnd && toNext < toEnd)
{
*toNext = Char(*fromNext);
*toNext = Char(static_cast<unsigned char>(*fromNext));
++fromNext;
++toNext;
}
Expand Down

0 comments on commit 645dedf

Please sign in to comment.