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/runtime/stream.c
static rsRetVal strmReadChar(strm_t* pThis, uchar* pC)
{
    int padBytes =
        0; /* in crypto mode, we may have some padding (non-data) bytes */
    DEFiRet;

    assert(pThis != NULL);
    assert(pC != NULL);

    /* DEV debug only: DBGOPRINT((obj_t*) pThis, "strmRead index %zd, max
    %zd\n", pThis->iBufPtr, pThis->iBufPtrMax); */
    if (pThis->iUngetC != -1)
    { /* do we have an "unread" char that we need to provide? */
        *pC = pThis->iUngetC;
        ++pThis->iCurrOffs; /* one more octet read */
        pThis->iUngetC = -1;
        ABORT_FINALIZE(RS_RET_OK);
    }

    /* do we need to obtain a new buffer? */
    if (pThis->iBufPtr >= pThis->iBufPtrMax)
    {
        CHKiRet(strmReadBuf(pThis, &padBytes));
    }
    pThis->iCurrOffs += padBytes;

    /* if we reach this point, we have data available in the buffer */

    *pC = pThis->pIOBuf[pThis->iBufPtr++];
    ++pThis->iCurrOffs; /* one more octet read */

finalize_it:
    RETiRet;
}
/* logically "read" a character from a file. What actually happens is that
 * data is taken from the buffer. Only if the buffer is full, data is read
 * directly from file. In that case, a read is performed blockwise.
 * rgerhards, 2008-01-07
 * NOTE: needs to be enhanced to support sticking with a strm entry (if not
 * deleted).
 */
logically "read" a character from a file. What actually happens is that
data is taken from the buffer. Only if the buffer is full, data is read
directly from file. In that case, a read is performed blockwise.
rgerhards, 2008-01-07
NOTE: needs to be enhanced to support sticking with a strm entry (if not
deleted).
logically " read " a character from a file . What actually happens is that data is taken from the buffer . Only if the buffer is full data is read directly from file . In that case a read is performed blockwise . rgerhards 2008 - 01 - 07 NOTE : needs to be enhanced to support sticking with a strm entry ( if not deleted ) .
static rsRetVal strmReadChar(strm_t* pThis, uchar* pC)
{
    int padBytes =
        0; 
    DEFiRet;
    assert(pThis != NULL);
    assert(pC != NULL);
    if (pThis->iUngetC != -1)
    { 
        *pC = pThis->iUngetC;
        ++pThis->iCurrOffs; 
        pThis->iUngetC = -1;
        ABORT_FINALIZE(RS_RET_OK);
    }
    if (pThis->iBufPtr >= pThis->iBufPtrMax)
    {
        CHKiRet(strmReadBuf(pThis, &padBytes));
    }
    pThis->iCurrOffs += padBytes;
    *pC = pThis->pIOBuf[pThis->iBufPtr++];
    ++pThis->iCurrOffs; 
finalize_it:
    RETiRet;
}
static rsRetVal strmReadChar ( strm_t * pThis , uchar * pC ) { int padBytes = 0 ; DEFiRet ; assert ( pThis != NULL ) ; assert ( pC != NULL ) ; if ( pThis -> iUngetC != -1 ) { * pC = pThis -> iUngetC ; ++ pThis -> iCurrOffs ; pThis -> iUngetC = -1 ; ABORT_FINALIZE ( RS_RET_OK ) ; } if ( pThis -> iBufPtr >= pThis -> iBufPtrMax ) { CHKiRet ( strmReadBuf ( pThis , & padBytes ) ) ; } pThis -> iCurrOffs += padBytes ; * pC = pThis -> pIOBuf [ pThis -> iBufPtr ++ ] ; ++ pThis -> iCurrOffs ; finalize_it : RETiRet ; }
logically "read" a character from a file.
logically " read " a character from a file .
/* in crypto mode, we may have some padding (non-data) bytes */ /* DEV debug only: DBGOPRINT((obj_t*) pThis, "strmRead index %zd, max
    %zd\n", pThis->iBufPtr, pThis->iBufPtrMax); */ /* do we have an "unread" char that we need to provide? */ /* one more octet read */ /* do we need to obtain a new buffer? */ /* if we reach this point, we have data available in the buffer */ /* one more octet read */