- [SF 2513643] Seg fault in Poco::UTF8::toLower on 64-bit Linux

- removed support for 5- and 6-byte sequences
- fixed error counting in StreamConverterBuf::readFromDevice()
- added std::dec to poco_stdout_dbg and poco_stderr_dbg macros
This commit is contained in:
Aleksandar Fabijanic
2009-04-01 02:33:51 +00:00
parent 7007646ea2
commit d77ef57588
6 changed files with 78 additions and 65 deletions

View File

@@ -59,6 +59,16 @@ public:
int convert(const unsigned char* bytes) const;
int convert(int ch, unsigned char* bytes, int length) const;
static bool isLegal(const unsigned char *bytes, int length);
/// Utility routine to tell whether a sequence of bytes is legal UTF-8.
/// This must be called with the length pre-determined by the first byte.
/// The sequence is illegal right away if there aren't enough bytes
/// available. If presented with a length > 4, this function returns false.
/// The Unicode definition of UTF-8 goes up to 4-byte sequences.
///
/// Adapted from ftp://ftp.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c
/// Copyright 2001-2004 Unicode, Inc.
private:
static const char* _names[];
static const CharacterMap _charMap;