#endif
using Poco::UnicodeConverter;
-using Poco::UInt64;
+using boost::uint64_t;
namespace ucr
{
* @param [in] size Size of the buffer in bytes.
* @return true if invalid bytes found, false otherwise.
*/
-bool CheckForInvalidUtf8(const char *pBuffer, int size)
+bool CheckForInvalidUtf8(const char *pBuffer, size_t size)
{
unsigned char * pVal2 = (unsigned char *)pBuffer;
- for (int j = 0; j < size; ++j)
+ for (size_t j = 0; j < size; ++j)
{
if ((*pVal2 == 0xC0) || (*pVal2 == 0xC1) || (*pVal2 >= 0xF5))
return true;
}
pVal2 = (unsigned char *)pBuffer;
bool bUTF8 = false;
- for (int i = 0; i < (size - 3); ++i)
+ if (size < 3)
+ return false;
+ for (size_t i = 0; i < (size - 3); ++i)
{
if ((*pVal2 & 0x80) == 0x00)
;
* FF FE 00 00 UTF-32, little endian
* 00 00 FE FF UTF-32, big-endian
*/
-UNICODESET DetermineEncoding(const unsigned char *pBuffer, UInt64 size, bool * pBom)
+UNICODESET DetermineEncoding(const unsigned char *pBuffer, uint64_t size, bool * pBom)
{
UNICODESET unicoding = NONE;
*pBom = false;