* this should cover the case where the buffer is one byte long but is _not_
a text file git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22893 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -218,6 +218,8 @@ file_ascmagic(const unsigned char *buf, size_t nbytes, BMimeType* mimeType,
|
|||||||
code = "ASCII";
|
code = "ASCII";
|
||||||
encoding = NULL; //"us-ascii";
|
encoding = NULL; //"us-ascii";
|
||||||
type = "text";
|
type = "text";
|
||||||
|
if (nbytes == 1)
|
||||||
|
rv = 1;
|
||||||
} else if (nbytes == 0 || looks_utf8(buf, nbytes, ubuf, &ulen)) {
|
} else if (nbytes == 0 || looks_utf8(buf, nbytes, ubuf, &ulen)) {
|
||||||
code = "UTF-8 Unicode";
|
code = "UTF-8 Unicode";
|
||||||
encoding = NULL; // "UTF-8";
|
encoding = NULL; // "UTF-8";
|
||||||
@@ -263,6 +265,8 @@ file_ascmagic(const unsigned char *buf, size_t nbytes, BMimeType* mimeType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes <= 1) {
|
if (nbytes <= 1) {
|
||||||
|
if (rv == -1)
|
||||||
|
rv = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user