diff options
-rw-r--r-- | Parser/Parser.cpp | 2 | ||||
-rw-r--r-- | Parser/Reader.cpp | 5 | ||||
-rw-r--r-- | Parser/Token.cpp | 10 |
3 files changed, 8 insertions, 9 deletions
diff --git a/Parser/Parser.cpp b/Parser/Parser.cpp index f8dea6f..ae1c157 100644 --- a/Parser/Parser.cpp +++ b/Parser/Parser.cpp @@ -30,7 +30,7 @@ static int dump_tokens = 0; Term* error(char* msg, const Token& token)
{
static char buf[1024];
- sprintf(buf, " near '%s' in line %d.", (const char*) token.symbol(), token.line());
+ sprintf_s(buf, " near '%s' in line %d.", (const char*) token.symbol(), token.line());
return error(msg, buf);
}
diff --git a/Parser/Reader.cpp b/Parser/Reader.cpp index 14b1126..2863d01 100644 --- a/Parser/Reader.cpp +++ b/Parser/Reader.cpp @@ -15,7 +15,7 @@ #include "MemDebug.h"
#include "reader.h"
#include <stdio.h>
-#include <fstream.h>
+#include <fstream>
#include <ctype.h>
@@ -60,8 +60,7 @@ FileReader::more() {
if (done) return Text();
- ifstream fin;
- fin.open(filename, ios::in | ios::nocreate);
+ std::fstream fin(filename, std::fstream::in);
if (!fin) {
Print("ERROR(Parse): Could not open file '%s'\n", filename);
diff --git a/Parser/Token.cpp b/Parser/Token.cpp index a7470ee..7ccabd8 100644 --- a/Parser/Token.cpp +++ b/Parser/Token.cpp @@ -42,7 +42,7 @@ Token::Token(const Token& rhs) {
mLength = rhs.mLength;
if (mLength < 8) {
- strcpy(mSymbol, rhs.mSymbol);
+ strcpy_s(mSymbol, rhs.mSymbol);
}
else {
mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1];
@@ -62,7 +62,7 @@ Token::Token(const char* s, int t, int k, int l, int c) {
mLength = strlen(s);
if (mLength < 8) {
- strcpy(mSymbol, s);
+ strcpy_s(mSymbol, s);
}
else {
mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1];
@@ -75,7 +75,7 @@ Token::Token(const Text& s, int t, int k, int l, int c) {
mLength = s.length();
if (mLength < 8) {
- strcpy(mSymbol, s.data());
+ strcpy_s(mSymbol, s.data());
}
else {
mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1];
@@ -107,7 +107,7 @@ Token::operator = (const Token& rhs) mLength = rhs.mLength;
if (mLength < 8) {
- strcpy(mSymbol, rhs.mSymbol);
+ strcpy_s(mSymbol, rhs.mSymbol);
}
else {
mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1];
@@ -181,7 +181,7 @@ bool Token::findKey(const Text& k, int& v)
{
if (keymap.contains(k)) {
- v = keymap.find(k);
+ v = keymap.find(k, 0);
return true;
}
else
|