Skip to content

Commit

Permalink
Small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-lischke committed Mar 10, 2021
1 parent ff629d5 commit 4431f1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions runtime/Cpp/runtime/src/ANTLRFileStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

using namespace antlr4;

ANTLRFileStream::ANTLRFileStream(): ANTLRInputStream() {
}

void ANTLRFileStream::loadFromFile(const std::string &fileName) {
_fileName = fileName;
if (_fileName.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cpp/runtime/src/ANTLRFileStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cpp/runtime/src/ANTLRInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4431f1f

Please sign in to comment.