From ec05778d5718a7912e506764d443a78d6a6179e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Nov 2012 22:41:51 +0000 Subject: Converted tabs to spaces with tabconv. --- src/stable/hex.cpp | 70 +++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'src/stable/hex.cpp') diff --git a/src/stable/hex.cpp b/src/stable/hex.cpp index 3e6a22e..45679b5 100644 --- a/src/stable/hex.cpp +++ b/src/stable/hex.cpp @@ -8,11 +8,11 @@ #include "bu/hex.h" Bu::Hex::Hex( Bu::Stream &rNext, bool bUpperCase, int iChunk ) : - Bu::Filter( rNext ), - iChunk( iChunk ), - iPos( 0 ), - iIn( 0 ), - sChrs(bUpperCase?"0123456789ABCDEF":"0123456789abcdef") + Bu::Filter( rNext ), + iChunk( iChunk ), + iPos( 0 ), + iIn( 0 ), + sChrs(bUpperCase?"0123456789ABCDEF":"0123456789abcdef") { } @@ -22,48 +22,48 @@ Bu::Hex::~Hex() void Bu::Hex::start() { - iPos = iIn = 0; + iPos = iIn = 0; } Bu::size Bu::Hex::stop() { - return iPos; + return iPos; } Bu::size Bu::Hex::read( void *pBuf, Bu::size iBytes ) { - Bu::size j; - uint8_t *puBuf = (uint8_t *)pBuf; - for( j = 0; j < iBytes; j++ ) - { - for(; iIn < 2; iIn++ ) - { - if( rNext.read( &cIn[iIn], 1 ) == 0 ) - return j; - if( cIn[iIn] == ' ' || cIn[iIn] == '\t' || - cIn[iIn] == '\n' || cIn[iIn] == '\r' ) - iIn--; - } + Bu::size j; + uint8_t *puBuf = (uint8_t *)pBuf; + for( j = 0; j < iBytes; j++ ) + { + for(; iIn < 2; iIn++ ) + { + if( rNext.read( &cIn[iIn], 1 ) == 0 ) + return j; + if( cIn[iIn] == ' ' || cIn[iIn] == '\t' || + cIn[iIn] == '\n' || cIn[iIn] == '\r' ) + iIn--; + } #define chr2nibble( c ) ((c>='0'&&c<='9')?(c-'0'):((c|0x60)-'a'+10)) - puBuf[j] = ((chr2nibble(cIn[0])<<4)|chr2nibble(cIn[1])); - iIn = 0; - } - return j; + puBuf[j] = ((chr2nibble(cIn[0])<<4)|chr2nibble(cIn[1])); + iIn = 0; + } + return j; } Bu::size Bu::Hex::write( const void *pBuf, Bu::size iBytes ) { - char cOut[2]; - uint8_t *puBuf = (uint8_t *)pBuf; - for( Bu::size j = 0; j < iBytes; j++ ) - { - cOut[0] = sChrs[(puBuf[j]&0xf0)>>4]; - cOut[1] = sChrs[(puBuf[j]&0x0f)]; - if( iChunk > 0 && iPos%iChunk == 0 && iPos>0 ) - rNext.write(" ", 1 ); - rNext.write( cOut, 2 ); - iPos++; - } - return iBytes; + char cOut[2]; + uint8_t *puBuf = (uint8_t *)pBuf; + for( Bu::size j = 0; j < iBytes; j++ ) + { + cOut[0] = sChrs[(puBuf[j]&0xf0)>>4]; + cOut[1] = sChrs[(puBuf[j]&0x0f)]; + if( iChunk > 0 && iPos%iChunk == 0 && iPos>0 ) + rNext.write(" ", 1 ); + rNext.write( cOut, 2 ); + iPos++; + } + return iBytes; } -- cgit v1.2.3