From 6867e4e2ba8cd163e64105e0492726322f8704d2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 12:47:57 +0100 Subject: Merging upstream version 1.16~rc1. Signed-off-by: Daniel Baumann --- decoder.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'decoder.cc') 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; } -- cgit v1.2.3