Skip to content

Commit 73e0c0f

Browse files
committed
Use C++ streams instead of C-style snprintf
1 parent d351a5d commit 73e0c0f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/ansi-c/expr2c.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ Author: Daniel Kroening, [email protected]
1010

1111
#include <algorithm>
1212
#include <cassert>
13-
#include <cctype>
14-
#include <cstdio>
15-
16-
#ifdef _WIN32
17-
#ifndef __MINGW32__
18-
#define snprintf sprintf_s
19-
#endif
20-
#endif
13+
#include <sstream>
2114

2215
#include <map>
2316
#include <set>
@@ -2258,9 +2251,9 @@ std::string expr2ct::convert_array(
22582251
dest+=static_cast<char>(ch);
22592252
else
22602253
{
2261-
char hexbuf[10];
2262-
snprintf(hexbuf, sizeof(hexbuf), "\\x%x", ch);
2263-
dest+=hexbuf;
2254+
std::ostringstream oss;
2255+
oss << "\\x" << std::hex << ch;
2256+
dest += oss.str();
22642257
last_was_hex=true;
22652258
}
22662259
}

0 commit comments

Comments
 (0)