summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.cc')
-rw-r--r--decoder.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/decoder.cc b/decoder.cc
index 75d70d0..9f34680 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -3,7 +3,7 @@
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
+ the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -56,18 +56,18 @@ void Pretty_print::operator()( const char * const msg, FILE * const f ) const
*/
long readblock( const int fd, uint8_t * const buf, const long size )
{
- long pos = 0;
+ long sz = 0;
errno = 0;
- while( pos < size )
+ while( sz < size )
{
- const int sz = std::min( 65536L, size - pos );
- const int n = read( fd, buf + pos, sz );
- if( n > 0 ) pos += n;
+ const int psz = std::min( 65536L, size - sz );
+ const int n = read( fd, buf + sz, psz );
+ if( n > 0 ) sz += n;
else if( n == 0 ) break; // EOF
else if( errno != EINTR ) break;
errno = 0;
}
- return pos;
+ return sz;
}
@@ -76,16 +76,16 @@ long readblock( const int fd, uint8_t * const buf, const long size )
*/
int writeblock( const int fd, const uint8_t * const buf, const int size )
{
- int pos = 0;
+ int sz = 0;
errno = 0;
- while( pos < size )
+ while( sz < size )
{
- const int n = write( fd, buf + pos, size - pos );
- if( n > 0 ) pos += n;
+ const int n = write( fd, buf + sz, size - sz );
+ if( n > 0 ) sz += n;
else if( n < 0 && errno != EINTR ) break;
errno = 0;
}
- return pos;
+ return sz;
}