Skip to content

Commit dc477f4

Browse files
committed
Fix win builds: Change sprintf to stringstream code.
1 parent fca8ceb commit dc477f4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/common/stringutils.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2525

2626

2727
#include "stringutils.h"
28-
#include <stdlib.h>
29-
#include <stdio.h>
28+
#include <iomanip>
29+
#include <sstream>
3030

3131
namespace StringUtils
3232
{
@@ -181,11 +181,10 @@ namespace StringUtils
181181
if ( leading0x )
182182
result= "0x";
183183

184-
char buf[3];
184+
std::stringstream buf;
185+
buf << std::hex() << (int)(c & 0xff);
185186

186-
sprintf( buf, "%02x", c & 0xff );
187-
188-
result.append( buf );
187+
result.append( buf.str() );
189188

190189
return result;
191190
}

0 commit comments

Comments
 (0)