diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-12-09 00:51:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 00:51:19 +0100 |
commit | e58e3c5e0a527802bd5286c537dc3ed603317c1d (patch) | |
tree | dabb0caf55c65bfe141a91de2c64a4c22a3682c5 /src/jit | |
parent | bf4ed11eb5cee7123fd0c6fa5b60f09fe7adf23e (diff) | |
download | coreclr-e58e3c5e0a527802bd5286c537dc3ed603317c1d.tar.gz coreclr-e58e3c5e0a527802bd5286c537dc3ed603317c1d.tar.bz2 coreclr-e58e3c5e0a527802bd5286c537dc3ed603317c1d.zip |
Remove sscanf and sprintf usage (#8508)
* Remove sscanf
* Remove sprintf
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/codegenarm.cpp | 3 | ||||
-rw-r--r-- | src/jit/codegenarm64.cpp | 3 | ||||
-rw-r--r-- | src/jit/codegenxarch.cpp | 3 | ||||
-rw-r--r-- | src/jit/inlinepolicy.cpp | 12 | ||||
-rw-r--r-- | src/jit/utils.cpp | 2 |
5 files changed, 13 insertions, 10 deletions
diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp index 057521f1d6..076fb0fb67 100644 --- a/src/jit/codegenarm.cpp +++ b/src/jit/codegenarm.cpp @@ -737,7 +737,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "NYI: Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "NYI: Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); notYetImplemented(message, __FILE__, __LINE__); #else NYI("unimplemented node"); diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp index 5220ebcaa4..65477faca8 100644 --- a/src/jit/codegenarm64.cpp +++ b/src/jit/codegenarm64.cpp @@ -2896,7 +2896,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); #endif assert(!"Unknown node in codegen"); } diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index ab0bc3ac5b..1adefc12c9 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -2193,7 +2193,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); #endif assert(!"Unknown node in codegen"); } diff --git a/src/jit/inlinepolicy.cpp b/src/jit/inlinepolicy.cpp index c7b0e91cc6..61e70c3ed4 100644 --- a/src/jit/inlinepolicy.cpp +++ b/src/jit/inlinepolicy.cpp @@ -2463,7 +2463,7 @@ bool ReplayPolicy::FindMethod() // See if token matches unsigned token = 0; - int count = sscanf(buffer, " <Token>%u</Token> ", &token); + int count = sscanf_s(buffer, " <Token>%u</Token> ", &token); if ((count != 1) || (token != methodToken)) { continue; @@ -2477,7 +2477,7 @@ bool ReplayPolicy::FindMethod() // See if hash matches unsigned hash = 0; - count = sscanf(buffer, " <Hash>%u</Hash> ", &hash); + count = sscanf_s(buffer, " <Hash>%u</Hash> ", &hash); if ((count != 1) || (hash != methodHash)) { continue; @@ -2636,7 +2636,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match token unsigned inlineToken = 0; - int count = sscanf(buffer, " <Token>%u</Token> ", &inlineToken); + int count = sscanf_s(buffer, " <Token>%u</Token> ", &inlineToken); if ((count != 1) || (inlineToken != token)) { @@ -2651,7 +2651,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match hash unsigned inlineHash = 0; - count = sscanf(buffer, " <Hash>%u</Hash> ", &inlineHash); + count = sscanf_s(buffer, " <Hash>%u</Hash> ", &inlineHash); if ((count != 1) || (inlineHash != hash)) { @@ -2666,7 +2666,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match offset unsigned inlineOffset = 0; - count = sscanf(buffer, " <Offset>%u</Offset> ", &inlineOffset); + count = sscanf_s(buffer, " <Offset>%u</Offset> ", &inlineOffset); if ((count != 1) || (inlineOffset != offset)) { continue; @@ -2685,7 +2685,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) if (fgets(buffer, sizeof(buffer), s_ReplayFile) != nullptr) { unsigned collectData = 0; - count = sscanf(buffer, " <CollectData>%u</CollectData> ", &collectData); + count = sscanf_s(buffer, " <CollectData>%u</CollectData> ", &collectData); if (count == 1) { diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp index 6b62cb7fb7..3a45039aa7 100644 --- a/src/jit/utils.cpp +++ b/src/jit/utils.cpp @@ -657,7 +657,7 @@ void dumpILRange(const BYTE* const codeAddr, unsigned codeSize) // in bytes for (IL_OFFSET offs = 0; offs < codeSize;) { char prefix[100]; - sprintf(prefix, "IL_%04x ", offs); + sprintf_s(prefix, _countof(prefix), "IL_%04x ", offs); unsigned codeBytesDumped = dumpSingleInstr(codeAddr, offs, prefix); offs += codeBytesDumped; } |