Skip to content

Commit

Permalink
Attempt to remedy the problem occuring on Clang.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekMosingiewicz committed May 25, 2018
1 parent 51693aa commit 0e964da
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/chaiscript/language/chaiscript_engine.hpp
Expand Up @@ -206,14 +206,14 @@ namespace chaiscript

/// Skip BOM at the beginning of file
static bool skip_bom(std::ifstream &infile) {
std::streamsize bytes_needed = 3;
std::streamsize bytes_read = 0;
size_t bytes_needed = 3;
char buffer[3];

bytes_read = infile.readsome(buffer, bytes_needed);
memset(buffer, '\0', bytes_needed);

if (bytes_needed == bytes_read
&& (buffer[0] == '\xef')
infile.readsome(buffer, bytes_needed);

if ((buffer[0] == '\xef')
&& (buffer[1] == '\xbb')
&& (buffer[2] == '\xbf')) {

Expand Down

0 comments on commit 0e964da

Please sign in to comment.