byte b = (string)[0]; \
int i; \
byte mask = 0x7F; \
- numBytes = 1; \
+ numBytes = b ? 1 : 0; \
ch = 0; \
- if(b & 0x80 && b & 0x40) \
+ if(b & 0x80) \
{ \
- mask >>= 2; \
- numBytes++; \
- if(b & 0x20) \
+ if(b & 0x40) \
{ \
+ mask >>= 2; \
numBytes++; \
- mask >>= 1; \
- if(b & 0x10) \
+ if(b & 0x20) \
{ \
numBytes++; \
mask >>= 1; \
+ if(b & 0x10) \
+ { \
+ if(b & 0x08) { numBytes = 0; } \
+ numBytes++; \
+ mask >>= 1; \
+ } \
} \
} \
+ else \
+ numBytes = 0; \
} \
for(i = 0; i<numBytes; i++) \
{ \
ch <<= 6; \
- ch |= (string)[i] & mask; \
+ ch |= (b = (string)[i]) & mask; \
mask = 0x3F; \
+ if(i > 1 && (!(b & 0x80) || (b & 0x40))) \
+ { \
+ numBytes = 0; \
+ ch = 0; \
+ } \
+ } \
+ if(i < numBytes || \
+ ch > 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF) || \
+ (ch < 0x80 && numBytes > 1) || \
+ (ch < 0x800 && numBytes > 2) || \
+ (ch < 0x10000 && numBytes > 3))\
+ { \
+ ch = 0; \
+ numBytes = 0; \
} \
ch; \
})
if(type.type == normalClass || type.type == noHeadClass)
{
for(c = 0; c<size; c++)
- type._vTbl[__ecereVMethodID_class_OnFree](type, array[c]);
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, array[c]);
}
// TODO: Call OnFree for structClass
delete ((ArrayImpl)this).array;
"virtual", "thisclass","unichar", "dbtable", "dbindex", "database_open", "dbfield",
// Types
- "uint", "uint32", "uint16", "uint64", "bool", "byte", "int64",
+ "uint", "uint32", "uint16", "uint64", "bool", "byte", "int64", "uintptr", "intptr", "intsize", "uintsize",
// Values
"this", "true", "false", "null", "value",
}
else if(wordLen == 1 && word[0] == '*')
{
- if(!c || word[-1] != '/')
+ if(c < 2 || word[-1] != '/')
lastWasStar = true;
}
else if(!inSingleLineComment && !inMultiLineComment && !inQuotes && wordLen == 1 && word[0] == '\"')
int c, position = 0;
unichar ch;
int nb;
- for(c = 0; c<this.line.count && c<this.x; c+= nb)
+ for(c = 0; c<this.line.count && c<this.x && (ch = UTF8_GET_CHAR(this.line.buffer + c, nb)); c+= nb)
{
- ch = UTF8_GET_CHAR(this.line.buffer + c, nb);
// TODO: MIGHT WANT TO RETHINK WHAT COLUMN SHOULD BE REGARDING TABS
if(ch == '\t')
position += this.tabSize - (position % this.tabSize);
for(c = start; c<line.count; c += numBytes)
{
unichar ch = UTF8_GET_CHAR(line.buffer + c, numBytes);
- if(!IS_ALUNDER(ch))
+ if(!ch || !IS_ALUNDER(ch))
break;
}
SelDirty();
int start = (line == this.line) ? this.x : 0;
int c;
int numBytes;
- for(c = start; c < line.count; c += numBytes)
+ unichar ch;
+ for(c = start; c < line.count && (ch = UTF8_GET_CHAR(line.buffer + c, numBytes)); c += numBytes)
{
- unichar ch = UTF8_GET_CHAR(line.buffer + c, numBytes);
if(IS_ALUNDER(ch))
{
foundAlpha = true;
int start = (line == this.line) ? this.x : 0;
int c;
int numBytes;
- for(c = start; c < line.count; c += numBytes)
+ unichar ch;
+ for(c = start; c < line.count && (ch = UTF8_GET_CHAR(line.buffer + c, numBytes)); c += numBytes)
{
- unichar ch = UTF8_GET_CHAR(line.buffer + c, numBytes);
if(!IS_ALUNDER(ch))
foundAlpha = true;
else if(foundAlpha)
ComputeColumn();
}
// Insert spaces
- start = this.x;
+ start = Min(this.x, this.selX);
for(c=start; ((c == start) || ((c) % this.tabSize)); c++)
{
addString[len++] = ' ';
}
if(addCharAction)
{
+ addCharAction.x -= addedTabs * (tabSize-1);
addCharAction.addedSpaces = addedSpaces;
addCharAction.addedTabs = addedTabs;
}
}
if(addCharAction)
{
+ addCharAction.x -= addedTabs * (tabSize-1);
addCharAction.addedSpaces = addedSpaces;
addCharAction.addedTabs = addedTabs;
}