fixed issue with malformed UTF-8 string;
ocl: Change static variable order in cl_context.cpp to avoid crashes during destruction ContextImpl::currentContext contains a reference to one of the DeviceInfoImpl objects from: static std::vector<DeviceInfoImpl> global_devices; ContextImpl::currentContext is destroyed in the destructor for the statically defined object __module, and relies on its DeviceInfoImpl reference to query some hardware features while being destroyed. This means that we need to ensure that the global_devices vector is destroyed affter __module, otherwise ContextImpl::currentContext's DeviceInfoImpl reference will no longer be valid when __module is destroyed. Since these variables are all confined to a single compilation unit, they will be destruct from bottom to top, so we need to make sure that __module is the bottom definition so it can be destroyed first. iOS: fix crash from overrelease in UIImageToMat viz: fixed memory leak, issue 3961 fix installation layout for debian packages: Install symlinks to shared libraries as a part of development package, not runtime package. It is default behavior for debian packages. Fix test name. TIFF loader: Allocate large enough buffer when (bpp * ncn) > 8. TIFF loader: Pass buffer size to read functions. replace not ascii and not cyrillic symbols with '?'; add test for putText; fix warning; minor fixes;
This commit is contained in:
@@ -2028,38 +2028,36 @@ inline void readCheck(int &c, int &i, const string &text, int fontFace)
|
||||
|
||||
if(c >= 0x80 && fontFace == FONT_HERSHEY_COMPLEX)
|
||||
{
|
||||
if(c >= 0xC0 && c <= 0xDF) //2 bytes utf
|
||||
if(c == 0xD0 && (uchar)text[i + 1] >= 0x90 && (uchar)text[i + 1] <= 0xBF)
|
||||
{
|
||||
if(c & 1)
|
||||
{
|
||||
c = (uchar)text[++i] + 47;
|
||||
leftBoundary = 175;
|
||||
rightBoundary = 191;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = (uchar)text[++i] - 17;
|
||||
leftBoundary = 127;
|
||||
rightBoundary = 175;
|
||||
}
|
||||
c = (uchar)text[++i] - 17;
|
||||
leftBoundary = 127;
|
||||
rightBoundary = 175;
|
||||
}
|
||||
else if(c == 0xD1 && (uchar)text[i + 1] >= 0x80 && (uchar)text[i + 1] <= 0x8F)
|
||||
{
|
||||
c = (uchar)text[++i] + 47;
|
||||
leftBoundary = 175;
|
||||
rightBoundary = 191;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(c >= 0xE0) //3 bytes utf
|
||||
if(c >= 0xC0 && text[i+1] != 0) //2 bytes utf
|
||||
i++;
|
||||
|
||||
if(c >= 0xF0) //4 bytes utf
|
||||
if(c >= 0xE0 && text[i+1] != 0) //3 bytes utf
|
||||
i++;
|
||||
|
||||
if(c >= 0xF8) //5 bytes utf
|
||||
if(c >= 0xF0 && text[i+1] != 0) //4 bytes utf
|
||||
i++;
|
||||
|
||||
if(c >= 0xFC) //6 bytes utf
|
||||
if(c >= 0xF8 && text[i+1] != 0) //5 bytes utf
|
||||
i++;
|
||||
|
||||
if(c >= 0xFC && text[i+1] != 0) //6 bytes utf
|
||||
i++;
|
||||
|
||||
i++;
|
||||
c = '?';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user