From 4431f1ff69f24c92ed45f9a00f0946a8830dd99d Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Wed, 10 Mar 2021 13:21:54 +0100 Subject: [PATCH] Small improvement --- runtime/Cpp/runtime/src/ANTLRFileStream.cpp | 3 --- runtime/Cpp/runtime/src/ANTLRFileStream.h | 2 +- runtime/Cpp/runtime/src/ANTLRInputStream.cpp | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/runtime/Cpp/runtime/src/ANTLRFileStream.cpp b/runtime/Cpp/runtime/src/ANTLRFileStream.cpp index 005149044..62061bb83 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 1a1a91bde..6c7d619a0 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 1ef8fd4d1..2dded4091 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);