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/obj.c
rsRetVal objDeserializeProperty(var_t* pProp, strm_t* pStrm)
{
    DEFiRet;
    number_t i;
    number_t iLen;
    uchar c;
    int step = 0; /* which step was successful? */
    int64 offs;

    assert(pProp != NULL);

    /* check cookie */
    NEXTC;
    if (c != COOKIE_PROPLINE)
    {
        /* oops, we've read one char that does not belong to use - unget it
         * first */
        CHKiRet(strm.UnreadChar(pStrm, c));
        ABORT_FINALIZE(RS_RET_NO_PROPLINE);
    }

    /* get the property name first */
    CHKiRet(cstrConstruct(&pProp->pcsName));

    NEXTC;
    while (c != ':')
    {
        CHKiRet(cstrAppendChar(pProp->pcsName, c));
        NEXTC;
    }
    cstrFinalize(pProp->pcsName);
    step = 1;

    /* property type */
    CHKiRet(objDeserializeNumber(&i, pStrm));
    pProp->varType = i;
    step = 2;

    /* size (needed for strings) */
    CHKiRet(objDeserializeNumber(&iLen, pStrm));
    step = 3;

    /* we now need to deserialize the value */
    switch (pProp->varType)
    {
        case VARTYPE_STR:
            CHKiRet(objDeserializeStr(&pProp->val.pStr, iLen, pStrm));
            break;
        case VARTYPE_NUMBER:
            CHKiRet(objDeserializeNumber(&pProp->val.num, pStrm));
            break;
        case VARTYPE_SYSLOGTIME:
            CHKiRet(objDeserializeSyslogTime(&pProp->val.vSyslogTime, pStrm));
            break;
        case VARTYPE_NONE:
        default:
            dbgprintf("invalid VARTYPE %d\n", pProp->varType);
            break;
    }
    step = 4;

    /* we should now be at the end of the line. So the next char must be \n */
    NEXTC;
    if (c != '\n')
        ABORT_FINALIZE(RS_RET_INVALID_PROPFRAME);

finalize_it:
    /* ensure the type of var is reset back to VARTYPE_NONE since
     * the deconstruct method of var might free unallocated memory
     */
    if (iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE)
    {
        if (step <= 2)
        {
            pProp->varType = VARTYPE_NONE;
        }
    }
    if (Debug && iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE)
    {
        strm.GetCurrOffset(pStrm, &offs);
        dbgprintf(
            "error %d deserializing property name, offset %lld, step %d\n",
            iRet, offs, step);
        strmDebugOutBuf(pStrm);
        if (step >= 1)
        {
            dbgprintf("error property name: '%s'\n",
                      rsCStrGetSzStrNoNULL(pProp->pcsName));
        }
        if (step >= 2)
        {
            dbgprintf("error var type: '%d'\n", pProp->varType);
        }
        if (step >= 3)
        {
            dbgprintf("error len: '%d'\n", (int)iLen);
        }
        if (step >= 4)
        {
            switch (pProp->varType)
            {
                case VARTYPE_STR:
                    dbgprintf("error data string: '%s'\n",
                              rsCStrGetSzStrNoNULL(pProp->val.pStr));
                    break;
                case VARTYPE_NUMBER:
                    dbgprintf("error number: %d\n", (int)pProp->val.num);
                    break;
                case VARTYPE_SYSLOGTIME:
                    dbgprintf("syslog time was successfully parsed (but "
                              "is not displayed\n");
                    break;
                case VARTYPE_NONE:
                default:
                    break;
            }
        }
    }
    RETiRet;
}
/* Deserialize a single property. Pointer must be positioned at begin of line.
 * Whole line up until the \n is read.
 */
Deserialize a single property. Pointer must be positioned at begin of line.
Whole line up until the \n is read.
Deserialize a single property . Pointer must be positioned at begin of line . Whole line up until the \ n is read .
rsRetVal objDeserializeProperty(var_t* pProp, strm_t* pStrm)
{
    DEFiRet;
    number_t i;
    number_t iLen;
    uchar c;
    int step = 0; 
    int64 offs;
    assert(pProp != NULL);
    NEXTC;
    if (c != COOKIE_PROPLINE)
    {
        CHKiRet(strm.UnreadChar(pStrm, c));
        ABORT_FINALIZE(RS_RET_NO_PROPLINE);
    }
    CHKiRet(cstrConstruct(&pProp->pcsName));
    NEXTC;
    while (c != ':')
    {
        CHKiRet(cstrAppendChar(pProp->pcsName, c));
        NEXTC;
    }
    cstrFinalize(pProp->pcsName);
    step = 1;
    CHKiRet(objDeserializeNumber(&i, pStrm));
    pProp->varType = i;
    step = 2;
    CHKiRet(objDeserializeNumber(&iLen, pStrm));
    step = 3;
    switch (pProp->varType)
    {
        case VARTYPE_STR:
            CHKiRet(objDeserializeStr(&pProp->val.pStr, iLen, pStrm));
            break;
        case VARTYPE_NUMBER:
            CHKiRet(objDeserializeNumber(&pProp->val.num, pStrm));
            break;
        case VARTYPE_SYSLOGTIME:
            CHKiRet(objDeserializeSyslogTime(&pProp->val.vSyslogTime, pStrm));
            break;
        case VARTYPE_NONE:
        default:
            dbgprintf("invalid VARTYPE %d\n", pProp->varType);
            break;
    }
    step = 4;
    NEXTC;
    if (c != '\n')
        ABORT_FINALIZE(RS_RET_INVALID_PROPFRAME);
finalize_it:
    if (iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE)
    {
        if (step <= 2)
        {
            pProp->varType = VARTYPE_NONE;
        }
    }
    if (Debug && iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE)
    {
        strm.GetCurrOffset(pStrm, &offs);
        dbgprintf(
            "error %d deserializing property name, offset %lld, step %d\n",
            iRet, offs, step);
        strmDebugOutBuf(pStrm);
        if (step >= 1)
        {
            dbgprintf("error property name: '%s'\n",
                      rsCStrGetSzStrNoNULL(pProp->pcsName));
        }
        if (step >= 2)
        {
            dbgprintf("error var type: '%d'\n", pProp->varType);
        }
        if (step >= 3)
        {
            dbgprintf("error len: '%d'\n", (int)iLen);
        }
        if (step >= 4)
        {
            switch (pProp->varType)
            {
                case VARTYPE_STR:
                    dbgprintf("error data string: '%s'\n",
                              rsCStrGetSzStrNoNULL(pProp->val.pStr));
                    break;
                case VARTYPE_NUMBER:
                    dbgprintf("error number: %d\n", (int)pProp->val.num);
                    break;
                case VARTYPE_SYSLOGTIME:
                    dbgprintf("syslog time was successfully parsed (but "
                              "is not displayed\n");
                    break;
                case VARTYPE_NONE:
                default:
                    break;
            }
        }
    }
    RETiRet;
}
rsRetVal objDeserializeProperty ( var_t * pProp , strm_t * pStrm ) { DEFiRet ; number_t i ; number_t iLen ; uchar c ; int step = 0 ; int64 offs ; assert ( pProp != NULL ) ; NEXTC ; if ( c != COOKIE_PROPLINE ) { CHKiRet ( strm . UnreadChar ( pStrm , c ) ) ; ABORT_FINALIZE ( RS_RET_NO_PROPLINE ) ; } CHKiRet ( cstrConstruct ( & pProp -> pcsName ) ) ; NEXTC ; while ( c != ' ' ) { CHKiRet ( cstrAppendChar ( pProp -> pcsName , c ) ) ; NEXTC ; } cstrFinalize ( pProp -> pcsName ) ; step = 1 ; CHKiRet ( objDeserializeNumber ( & i , pStrm ) ) ; pProp -> varType = i ; step = 2 ; CHKiRet ( objDeserializeNumber ( & iLen , pStrm ) ) ; step = 3 ; switch ( pProp -> varType ) { case VARTYPE_STR : CHKiRet ( objDeserializeStr ( & pProp -> val . pStr , iLen , pStrm ) ) ; break ; case VARTYPE_NUMBER : CHKiRet ( objDeserializeNumber ( & pProp -> val . num , pStrm ) ) ; break ; case VARTYPE_SYSLOGTIME : CHKiRet ( objDeserializeSyslogTime ( & pProp -> val . vSyslogTime , pStrm ) ) ; break ; case VARTYPE_NONE : default : dbgprintf ( " \n " , pProp -> varType ) ; break ; } step = 4 ; NEXTC ; if ( c != ' \n ' ) ABORT_FINALIZE ( RS_RET_INVALID_PROPFRAME ) ; finalize_it : if ( iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE ) { if ( step <= 2 ) { pProp -> varType = VARTYPE_NONE ; } } if ( Debug && iRet != RS_RET_OK && iRet != RS_RET_NO_PROPLINE ) { strm . GetCurrOffset ( pStrm , & offs ) ; dbgprintf ( " \n " , iRet , offs , step ) ; strmDebugOutBuf ( pStrm ) ; if ( step >= 1 ) { dbgprintf ( " \n " , rsCStrGetSzStrNoNULL ( pProp -> pcsName ) ) ; } if ( step >= 2 ) { dbgprintf ( " \n " , pProp -> varType ) ; } if ( step >= 3 ) { dbgprintf ( " \n " , ( int ) iLen ) ; } if ( step >= 4 ) { switch ( pProp -> varType ) { case VARTYPE_STR : dbgprintf ( " \n " , rsCStrGetSzStrNoNULL ( pProp -> val . pStr ) ) ; break ; case VARTYPE_NUMBER : dbgprintf ( " \n " , ( int ) pProp -> val . num ) ; break ; case VARTYPE_SYSLOGTIME : dbgprintf ( " " " \n " ) ; break ; case VARTYPE_NONE : default : break ; } } } RETiRet ; }
Deserialize a single property.
Deserialize a single property .
/* which step was successful? */ /* check cookie */ /* oops, we've read one char that does not belong to use - unget it
         * first */ /* get the property name first */ /* property type */ /* size (needed for strings) */ /* we now need to deserialize the value */ /* we should now be at the end of the line. So the next char must be \n */ /* ensure the type of var is reset back to VARTYPE_NONE since
     * the deconstruct method of var might free unallocated memory
     */