openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/tools/omfwd.c
static rsRetVal doZipFinish(wrkrInstanceData_t* pWrkrData)
{
    int zRet; /* zlib return state */
    DEFiRet;
    unsigned outavail;
    uchar zipBuf[32 * 1024];

    if (!pWrkrData->bzInitDone)
        goto done;

    // TODO: can we get this into a single common function?
    pWrkrData->zstrm.avail_in = 0;
    /* run deflate() on buffer until everything has been compressed */
    do
    {
        DBGPRINTF("in deflate() loop, avail_in %d, total_in %ld\n",
                  pWrkrData->zstrm.avail_in, pWrkrData->zstrm.total_in);
        pWrkrData->zstrm.avail_out = sizeof(zipBuf);
        pWrkrData->zstrm.next_out = zipBuf;
        zRet = deflate(&pWrkrData->zstrm, Z_FINISH); /* no bad return value */
        DBGPRINTF("after deflate, ret %d, avail_out %d\n", zRet,
                  pWrkrData->zstrm.avail_out);
        outavail = sizeof(zipBuf) - pWrkrData->zstrm.avail_out;
        if (outavail != 0)
        {
            CHKiRet(TCPSendBufUncompressed(pWrkrData, zipBuf, outavail));
        }
    } while (pWrkrData->zstrm.avail_out == 0);

finalize_it:
    zRet = deflateEnd(&pWrkrData->zstrm);
    if (zRet != Z_OK)
    {
        DBGPRINTF("error %d returned from zlib/deflateEnd()\n", zRet);
    }

    pWrkrData->bzInitDone = 0;
done:
    RETiRet;
}
/* finish zlib buffer, to be called before closing the ZIP file (if
 * running in stream mode).
 */
finish zlib buffer, to be called before closing the ZIP file (if
running in stream mode).
finish zlib buffer to be called before closing the ZIP file ( if running in stream mode ) .
static rsRetVal doZipFinish(wrkrInstanceData_t* pWrkrData)
{
    int zRet; 
    DEFiRet;
    unsigned outavail;
    uchar zipBuf[32 * 1024];
    if (!pWrkrData->bzInitDone)
        goto done;
    pWrkrData->zstrm.avail_in = 0;
    do
    {
        DBGPRINTF("in deflate() loop, avail_in %d, total_in %ld\n",
                  pWrkrData->zstrm.avail_in, pWrkrData->zstrm.total_in);
        pWrkrData->zstrm.avail_out = sizeof(zipBuf);
        pWrkrData->zstrm.next_out = zipBuf;
        zRet = deflate(&pWrkrData->zstrm, Z_FINISH); 
        DBGPRINTF("after deflate, ret %d, avail_out %d\n", zRet,
                  pWrkrData->zstrm.avail_out);
        outavail = sizeof(zipBuf) - pWrkrData->zstrm.avail_out;
        if (outavail != 0)
        {
            CHKiRet(TCPSendBufUncompressed(pWrkrData, zipBuf, outavail));
        }
    } while (pWrkrData->zstrm.avail_out == 0);
finalize_it:
    zRet = deflateEnd(&pWrkrData->zstrm);
    if (zRet != Z_OK)
    {
        DBGPRINTF("error %d returned from zlib/deflateEnd()\n", zRet);
    }
    pWrkrData->bzInitDone = 0;
done:
    RETiRet;
}
static rsRetVal doZipFinish ( wrkrInstanceData_t * pWrkrData ) { int zRet ; DEFiRet ; unsigned outavail ; uchar zipBuf [ 32 * 1024 ] ; if ( ! pWrkrData -> bzInitDone ) goto done ; pWrkrData -> zstrm . avail_in = 0 ; do { DBGPRINTF ( " \n " , pWrkrData -> zstrm . avail_in , pWrkrData -> zstrm . total_in ) ; pWrkrData -> zstrm . avail_out = sizeof ( zipBuf ) ; pWrkrData -> zstrm . next_out = zipBuf ; zRet = deflate ( & pWrkrData -> zstrm , Z_FINISH ) ; DBGPRINTF ( " \n " , zRet , pWrkrData -> zstrm . avail_out ) ; outavail = sizeof ( zipBuf ) - pWrkrData -> zstrm . avail_out ; if ( outavail != 0 ) { CHKiRet ( TCPSendBufUncompressed ( pWrkrData , zipBuf , outavail ) ) ; } } while ( pWrkrData -> zstrm . avail_out == 0 ) ; finalize_it : zRet = deflateEnd ( & pWrkrData -> zstrm ) ; if ( zRet != Z_OK ) { DBGPRINTF ( " \n " , zRet ) ; } pWrkrData -> bzInitDone = 0 ; done : RETiRet ; }
finish zlib buffer, to be called before closing the ZIP file (if
 running in stream mode).
finish zlib buffer to be called before closing the ZIP file ( if running in stream mode ) .
/* zlib return state */ // TODO: can we get this into a single common function? /* run deflate() on buffer until everything has been compressed */ /* no bad return value */