summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:47:57 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:47:57 +0000
commit6867e4e2ba8cd163e64105e0492726322f8704d2 (patch)
tree4a22cc7f0e52f52859de2236c625a7ce11d3c2aa /decoder.cc
parentAdding debian version 1.16~pre2-1. (diff)
downloadlziprecover-6867e4e2ba8cd163e64105e0492726322f8704d2.tar.xz
lziprecover-6867e4e2ba8cd163e64105e0492726322f8704d2.zip
Merging upstream version 1.16~rc1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-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;
}