From 764bd0b8bff46b944cf8cc123527938ed2ceabad Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 17 Feb 2024 22:17:32 +0100 Subject: Use pre-C11/non-Windows sprintf and strcpy --- DefinitionEx/Parser_ss.cpp | 3 +-- DefinitionEx/Token.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'DefinitionEx') diff --git a/DefinitionEx/Parser_ss.cpp b/DefinitionEx/Parser_ss.cpp index 94f7856..246e4a5 100644 --- a/DefinitionEx/Parser_ss.cpp +++ b/DefinitionEx/Parser_ss.cpp @@ -28,8 +28,7 @@ static int dump_tokens = 0; Term* error(char* msg, const Token& token) { static char buf[1024]; - sprintf_s(buf, " near '%s' in line %d.", (const char*) token.symbol(), token.line()); - + snprintf(buf, 1024, " near '%s' in line %d", (const char*) token.symbol(), token.line()); return error(msg, buf); } diff --git a/DefinitionEx/Token.cpp b/DefinitionEx/Token.cpp index 2cc97b5..e61a1fb 100644 --- a/DefinitionEx/Token.cpp +++ b/DefinitionEx/Token.cpp @@ -40,7 +40,7 @@ Token::Token(const Token& rhs) { mLength = rhs.mLength; if (mLength < 8) { - strcpy_s(mSymbol, rhs.mSymbol); + strcpy(mSymbol, rhs.mSymbol); } else { mFullSymbol = new char[mLength + 1]; @@ -60,7 +60,7 @@ Token::Token(const char* s, int t, int k, int l, int c) { mLength = strlen(s); if (mLength < 8) { - strcpy_s(mSymbol, s); + strcpy(mSymbol, s); } else { mFullSymbol = new char[mLength + 1]; @@ -73,7 +73,7 @@ Token::Token(const Text& s, int t, int k, int l, int c) { mLength = s.length(); if (mLength < 8) { - strcpy_s(mSymbol, s.data()); + strcpy(mSymbol, s.data()); } else { mFullSymbol = new char[mLength + 1]; @@ -105,7 +105,7 @@ Token::operator = (const Token& rhs) mLength = rhs.mLength; if (mLength < 8) { - strcpy_s(mSymbol, rhs.mSymbol); + strcpy(mSymbol, rhs.mSymbol); } else { mFullSymbol = new char[mLength + 1]; -- cgit v1.1