* 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:
Stephan Aßmus 2007-11-11 10:29:07 +00:00
parent acdf38f663
commit a9cde6d274

View File

@ -218,6 +218,8 @@ file_ascmagic(const unsigned char *buf, size_t nbytes, BMimeType* mimeType,
code = "ASCII";
encoding = NULL; //"us-ascii";
type = "text";
if (nbytes == 1)
rv = 1;
} else if (nbytes == 0 || looks_utf8(buf, nbytes, ubuf, &ulen)) {
code = "UTF-8 Unicode";
encoding = NULL; // "UTF-8";
@ -263,6 +265,8 @@ file_ascmagic(const unsigned char *buf, size_t nbytes, BMimeType* mimeType,
}
if (nbytes <= 1) {
if (rv == -1)
rv = 0;
goto done;
}