Another fix for Clang.

This commit is contained in:
Alek Mosingiewicz 2018-05-25 12:07:50 +02:00
parent fb635033a9
commit 0f67b2f430

View File

@ -206,14 +206,14 @@ namespace chaiscript
/// Skip BOM at the beginning of file /// Skip BOM at the beginning of file
static bool skip_bom(std::ifstream &infile) { static bool skip_bom(std::ifstream &infile) {
std::streamsize bytes_needed = 3; size_t bytes_needed = 3;
std::streamsize bytes_read = 0; char buffer[3];
char buffer[4];
bytes_read = infile.readsome(buffer, bytes_needed); memset(buffer, '\0', bytes_needed);
if (!bytes_needed < bytes_read infile.read(buffer, bytes_needed);
&& (buffer[0] == '\xef')
if ((buffer[0] == '\xef')
&& (buffer[1] == '\xbb') && (buffer[1] == '\xbb')
&& (buffer[2] == '\xbf')) { && (buffer[2] == '\xbf')) {