git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9691
d7cf8633-e32d-0410-b094-
e92efae38249
//fprintf(stderr, "skipping\n");
++i;
}
//fprintf(stderr, "skipping\n");
++i;
}
- if(i >= _maxlen)
- return false;
- //fprintf(stderr, "checking\n");
+ //fprintf(stderr, "checking\n");
// If we hit the end, well, we're out and invalid
// If we hit the end, well, we're out and invalid
+ if(i >= _maxlen || !s[i]) {
+ if (_start) *_start = i;
+ if (_len) *_len = 0;
- //fprintf(stderr, "checking ascii\n");
+ //fprintf(stderr, "checking ascii\n");
// ascii characters
if (s[i] < 0x80)
{
// ascii characters
if (s[i] < 0x80)
{
+ if(i + bits > _maxlen) {
+ if (_start) *_start = i;
+ if (_len) *_len = 0;
// turn bt into a mask and give ch a starting value
--bt;
ch = (s[i] & bt);
// turn bt into a mask and give ch a starting value
--bt;
ch = (s[i] & bt);
}
if (!u8_analyze(_s, &st, &ln, &ch, U8_ANALYZE_INFINITY))
}
if (!u8_analyze(_s, &st, &ln, &ch, U8_ANALYZE_INFINITY))
if (_end)
*_end = _s + st + ln;
return ch;
if (_end)
*_end = _s + st + ln;
return ch;
}
if (!u8_analyze(_s, &st, &ln, &ch, _maxlen))
}
if (!u8_analyze(_s, &st, &ln, &ch, _maxlen))
if (_end)
*_end = _s + st + ln;
return ch;
if (_end)
*_end = _s + st + ln;
return ch;