diff --git a/runtime/Cpp/runtime/src/ANTLRFileStream.cpp b/runtime/Cpp/runtime/src/ANTLRFileStream.cpp index 0051490449..62061bb83a 100755 --- a/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRFileStream.cpp @@ -9,9 +9,6 @@ using namespace antlr4; -ANTLRFileStream::ANTLRFileStream(): ANTLRInputStream() { -} - void ANTLRFileStream::loadFromFile(const std::string &fileName) { _fileName = fileName; if (_fileName.empty()) { diff --git a/runtime/Cpp/runtime/src/ANTLRFileStream.h b/runtime/Cpp/runtime/src/ANTLRFileStream.h index 1a1a91bdec..6c7d619a00 100755 --- a/runtime/Cpp/runtime/src/ANTLRFileStream.h +++ b/runtime/Cpp/runtime/src/ANTLRFileStream.h @@ -14,7 +14,7 @@ namespace antlr4 { // TODO: this class needs testing. class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream { public: - ANTLRFileStream(); + ANTLRFileStream() = default; ANTLRFileStream(const std::string &) = delete; ANTLRFileStream(const char *data, size_t length) = delete; ANTLRFileStream(std::istream &stream) = delete; diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp index 1ef8fd4d19..2dded40910 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp @@ -48,7 +48,7 @@ void ANTLRInputStream::load(const std::string &input) { void ANTLRInputStream::load(const char *data, size_t length) { // Remove the UTF-8 BOM if present. const char *bom = "\xef\xbb\xbf"; - if (length > 3 && strncmp(data, bom, 3) == 0) + if (length >= 3 && strncmp(data, bom, 3) == 0) _data = antlrcpp::utf8_to_utf32(data + 3, data + length); else _data = antlrcpp::utf8_to_utf32(data, data + length);