BinaryToHex(string)

change BinaryToHex(p*) to void*
This commit is contained in:
Glenn Maynard
2007-01-26 04:34:04 +00:00
parent 0cdddc34ae
commit 9b4a488895
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -142,8 +142,9 @@ bool IsHexVal( const RString &s )
return true; return true;
} }
RString BinaryToHex( const unsigned char *string, int iNumBytes ) RString BinaryToHex( const void *pData_, int iNumBytes )
{ {
const unsigned char *string = (const unsigned char *) pData_;
RString s; RString s;
for( int i=0; i<iNumBytes; i++ ) for( int i=0; i<iNumBytes; i++ )
{ {
@@ -153,6 +154,11 @@ RString BinaryToHex( const unsigned char *string, int iNumBytes )
return s; return s;
} }
RString BinaryToHex( const RString &sString )
{
return BinaryToHex( sString.data(), sString.size() );
}
bool HexToBinary( const RString &s, unsigned char *stringOut ) bool HexToBinary( const RString &s, unsigned char *stringOut )
{ {
if( !IsHexVal(s) ) if( !IsHexVal(s) )
+2 -1
View File
@@ -333,7 +333,8 @@ float fmodfp( float x, float y );
int power_of_two( int input ); int power_of_two( int input );
bool IsAnInt( const RString &s ); bool IsAnInt( const RString &s );
bool IsHexVal( const RString &s ); bool IsHexVal( const RString &s );
RString BinaryToHex( const unsigned char *string, int iNumBytes ); RString BinaryToHex( const void *pData_, int iNumBytes );
RString BinaryToHex( const RString &sString );
bool HexToBinary( const RString &s, unsigned char *stringOut ); bool HexToBinary( const RString &s, unsigned char *stringOut );
float HHMMSSToSeconds( const RString &sHMS ); float HHMMSSToSeconds( const RString &sHMS );
RString SecondsToHHMMSS( float fSecs ); RString SecondsToHHMMSS( float fSecs );