static bool isJobFileIndexValid()

in source/otaJobParser/ota_job_handler.c [81:105]


static bool isJobFileIndexValid( const char * jobDoc,
                                 const size_t jobDocLength,
                                 const uint8_t fileIndex )
{
    JSONStatus_t isFreeRTOSOta = JSONIllegalDocument;
    const char * fileValue;
    size_t fileValueLength = 0U;
    char file[ 17U ] = "afr_ota.files[i]";

    if( fileIndex <= 9U )
    {
        int32_t index = ( ( int32_t ) '0' + ( int32_t ) fileIndex );
        file[ 14U ] = ( char ) index;

        isFreeRTOSOta = JSON_SearchConst( jobDoc,
                                          jobDocLength,
                                          file,
                                          16U,
                                          &fileValue,
                                          &fileValueLength,
                                          NULL );
    }

    return( JSONSuccess == isFreeRTOSOta );
}