1
0
Fork 0

Adding upstream version 1.6~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-23 19:20:22 +01:00
parent 2b4b126d96
commit 073a55afd4
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
18 changed files with 954 additions and 870 deletions

View file

@ -14,47 +14,6 @@
#include "lzip.h"
#include "LzmaDec.h"
CRC32 crc32;
/* Returns the number of bytes really read.
If (returned value < size) and (errno == 0), means EOF was reached.
*/
int readblock( const int fd, uint8_t * const buf, const int size )
{
int rest = size;
errno = 0;
while( rest > 0 )
{
const int n = read( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n;
else if( n == 0 ) break; /* EOF */
else if( errno != EINTR && errno != EAGAIN ) break;
errno = 0;
}
return size - rest;
}
/* Returns the number of bytes really written.
If (returned value < size), it is always an error.
*/
int writeblock( const int fd, const uint8_t * const buf, const int size )
{
int rest = size;
errno = 0;
while( rest > 0 )
{
const int n = write( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n;
else if( n < 0 && errno != EINTR && errno != EAGAIN ) break;
errno = 0;
}
return size - rest;
}
#define kNumTopBits 24
#define kTopValue ((uint32_t)1 << kNumTopBits)