pzread.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1998-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include "pzlib.h"
/*
* read a buffer from a pz stream
* this code mirrors pzinflate()
*/
{
register int i;
register int j;
register int k;
register size_t m;
ssize_t n;
ssize_t w;
size_t r;
unsigned char* ob;
unsigned char* om;
unsigned char* x;
return -1;
else
n = z;
{
{
return -1;
}
return -1;
w = -1;
}
else
{
}
{
if (writef)
{
{
{
return -1;
}
return 0;
}
return -1;
if (z < n)
return -1;
w = (z / n) * n;
while ((w -= n) > 0)
{
{
{
return -1;
}
break;
}
return -1;
}
}
else
}
{
{
m = z;
return m;
}
}
for (;;)
{
{
return 0;
{
{
if ((m = sfgetu(pz->io)) && !sferror(pz->io) && !sfeof(pz->io) && (x = (unsigned char*)sfreserve(pz->io, m, 0)))
{
if (m > r)
{
return z;
}
ob += m;
}
}
else if (k != -1)
{
case 0:
goto done;
case 1:
continue;
default:
return -1;
}
}
{
{
return -1;
}
m = 0;
j = 0;
k = 0;
{
j++;
else
j = m;
m += n;
}
}
else if (m != 1)
{
return -1;
}
{
return -1;
}
{
return -1;
}
}
for (;;)
{
{
{
}
if (writef)
{
return -1;
if (w < 0)
w = (z / n) * (n - 1);
if ((w -= n) <= 0)
goto done;
}
goto done;
}
for (;;)
{
}
}
}
done:
}