mirror of
https://github.com/reactos/reactos.git
synced 2025-07-07 19:17:53 +00:00
- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests.
svn path=/trunk/; revision=26033
This commit is contained in:
parent
ad07a1e58f
commit
1e3d5d70e9
420 changed files with 78215 additions and 0 deletions
49
rosapps/sysutils/utils/sdkparse/binary2cstr.cpp
Normal file
49
rosapps/sysutils/utils/sdkparse/binary2cstr.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
// binary2cstr.cpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include "binary2cstr.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
string binary2cstr ( const string& src )
|
||||
{
|
||||
string dst;
|
||||
for ( int i = 0; i < src.size(); i++ )
|
||||
{
|
||||
char c = src[i];
|
||||
switch ( c )
|
||||
{
|
||||
case '\n':
|
||||
dst += "\\n";
|
||||
break;
|
||||
case '\r':
|
||||
dst += "\\r";
|
||||
break;
|
||||
case '\t':
|
||||
dst += "\\t";
|
||||
break;
|
||||
case '\v':
|
||||
dst += "\\v";
|
||||
break;
|
||||
case '\"':
|
||||
dst += "\x22";
|
||||
break;
|
||||
default:
|
||||
if ( isprint ( c ) )
|
||||
dst += c;
|
||||
else
|
||||
{
|
||||
dst += "\\x";
|
||||
char tmp[16];
|
||||
_snprintf ( tmp, sizeof(tmp)-1, "%02X", (unsigned)(unsigned char)c );
|
||||
tmp[sizeof(tmp)-1] = '\0';
|
||||
dst += tmp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue