Bug fix for my last commit: all of a sudden, a text would need more than one
bad character to be accepted. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18708 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -367,7 +367,7 @@ identify_txt_header(uint8 *data, int32 bytesRead,
|
||||
} else if ((c & 0x80) != 0 && valid_utf8_char(data + i, length)) {
|
||||
int32 j = 1;
|
||||
for (; j < (int32)length && i + j < bytesRead; j++) {
|
||||
if ((data[j] & 0xc0) != 0x80) {
|
||||
if ((data[i + j] & 0xc0) != 0x80) {
|
||||
bad++;
|
||||
break;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ identify_txt_header(uint8 *data, int32 bytesRead,
|
||||
return B_NO_TRANSLATOR;
|
||||
#endif
|
||||
|
||||
capability *= (float)bad / bytesRead;
|
||||
capability *= (bytesRead - bad) / (float)bytesRead;
|
||||
|
||||
// return information about the data in the stream
|
||||
outInfo->type = B_TRANSLATOR_TEXT;
|
||||
|
||||
Reference in New Issue
Block a user