mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
trunk/branch integration: optimalization
This commit is contained in:
@@ -41,7 +41,8 @@
|
||||
namespace Poco {
|
||||
|
||||
|
||||
HexBinaryDecoderBuf::HexBinaryDecoderBuf(std::istream& istr): _istr(istr)
|
||||
HexBinaryDecoderBuf::HexBinaryDecoderBuf(std::istream& istr):
|
||||
_buf(*istr.rdbuf())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -61,13 +62,13 @@ int HexBinaryDecoderBuf::readFromDevice()
|
||||
else if (n >= 'A' && n <= 'F')
|
||||
c = n - 'A' + 10;
|
||||
else if (n >= 'a' && n <= 'f')
|
||||
c = n - 'a' + 10;
|
||||
else throw DataFormatException();
|
||||
c <<= 4;
|
||||
if ((n = readOne()) == -1) return -1;
|
||||
if (n >= '0' && n <= '9')
|
||||
c |= n - '0';
|
||||
else if (n >= 'A' && n <= 'F')
|
||||
c = n - 'a' + 10;
|
||||
else throw DataFormatException();
|
||||
c <<= 4;
|
||||
if ((n = readOne()) == -1) throw DataFormatException();
|
||||
if (n >= '0' && n <= '9')
|
||||
c |= n - '0';
|
||||
else if (n >= 'A' && n <= 'F')
|
||||
c |= n - 'A' + 10;
|
||||
else if (n >= 'a' && n <= 'f')
|
||||
c |= n - 'a' + 10;
|
||||
@@ -78,10 +79,10 @@ int HexBinaryDecoderBuf::readFromDevice()
|
||||
|
||||
int HexBinaryDecoderBuf::readOne()
|
||||
{
|
||||
int ch = _istr.get();
|
||||
while (ch == ' ' || ch == '\r' || ch == '\t' || ch == '\n')
|
||||
ch = _istr.get();
|
||||
return ch;
|
||||
int ch = _buf.sbumpc();
|
||||
while (ch == ' ' || ch == '\r' || ch == '\t' || ch == '\n')
|
||||
ch = _buf.sbumpc();
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user