Skip to content

Commit 4431f1f

Browse files
committed
Small improvement
1 parent ff629d5 commit 4431f1f

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

runtime/Cpp/runtime/src/ANTLRFileStream.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
using namespace antlr4;
1111

12-
ANTLRFileStream::ANTLRFileStream(): ANTLRInputStream() {
13-
}
14-
1512
void ANTLRFileStream::loadFromFile(const std::string &fileName) {
1613
_fileName = fileName;
1714
if (_fileName.empty()) {

runtime/Cpp/runtime/src/ANTLRFileStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace antlr4 {
1414
// TODO: this class needs testing.
1515
class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
1616
public:
17-
ANTLRFileStream();
17+
ANTLRFileStream() = default;
1818
ANTLRFileStream(const std::string &) = delete;
1919
ANTLRFileStream(const char *data, size_t length) = delete;
2020
ANTLRFileStream(std::istream &stream) = delete;

runtime/Cpp/runtime/src/ANTLRInputStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void ANTLRInputStream::load(const std::string &input) {
4848
void ANTLRInputStream::load(const char *data, size_t length) {
4949
// Remove the UTF-8 BOM if present.
5050
const char *bom = "\xef\xbb\xbf";
51-
if (length > 3 && strncmp(data, bom, 3) == 0)
51+
if (length >= 3 && strncmp(data, bom, 3) == 0)
5252
_data = antlrcpp::utf8_to_utf32(data + 3, data + length);
5353
else
5454
_data = antlrcpp::utf8_to_utf32(data, data + length);

0 commit comments

Comments
 (0)