/*lint -e961*/
VOS_VOID    NAS_COMM_nsprintf
(
    VOS_CHAR                                *pcBuff,
    VOS_UINT16                              usOffset,
    const VOS_CHAR                          *String,
    VOS_INT32                               *pilOutLen
)
{
    /* delay begin */
    PS_LOG_RETURN();
    /* delay end */

    /* 入参检查 */
    if ( VOS_NULL_PTR == pilOutLen )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf, pilOutLen is NULL pointer!");
        TLPS_PRINT2LAYER_ERROR(NAS_COMM_nsprintf_ENUM, LNAS_FUNCTION_LABEL1);
        return;
    }

    if ( VOS_NULL_PTR == pcBuff )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf, pcBuff is NULL pointer!");
        TLPS_PRINT2LAYER_ERROR(NAS_COMM_nsprintf_ENUM, LNAS_FUNCTION_LABEL2);
        *pilOutLen = 0;
        return;
    }

    if ( VOS_NULL_PTR == String )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf, String is NULL pointer!");
        TLPS_PRINT2LAYER_ERROR(NAS_COMM_nsprintf_ENUM, LNAS_FUNCTION_LABEL3);
        *pilOutLen = 0;
        return;
    }

    if ((NAS_COMM_PRINT_BUFF_LEN - 2) >= usOffset )
    {
        /* 需要预留一个字符作为结束符 */
        *pilOutLen = VOS_nsprintf(pcBuff + usOffset,
                                  (NAS_COMM_PRINT_BUFF_LEN - 1) - usOffset,
                                  String);
        if( (0 == *pilOutLen) || (PS_NEG_ONE == *pilOutLen) )
        {
            NAS_COMM_LOG1_WARN("NAS_COMM_nsprintf, *pilOutLen=", *pilOutLen);
            TLPS_PRINT2LAYER_WARNING1(NAS_COMM_nsprintf_ENUM, LNAS_FUNCTION_LABEL4,
                                *pilOutLen);
            *pilOutLen = 0;
            return;
        }
    }
    else
    {

        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf, Print too long!");
        TLPS_PRINT2LAYER_ERROR(NAS_COMM_nsprintf_ENUM, LNAS_FUNCTION_LABEL5);
        *pilOutLen = 0;
        return;
    }
}
示例#2
0
VOS_VOID    NAS_COMM_nsprintf_3(
                    VOS_CHAR                                *pcBuff,
                    VOS_UINT16                              usOffset,
                    const VOS_CHAR                          *String,
                    VOS_UINT32                               para1,
                    VOS_UINT32                               para2,
                    VOS_UINT32                               para3,
                    VOS_INT32                               *pilOutLen )
{
    /* delay begin */
    PS_LOG_RETURN();
    /* delay end */

    /* 入参检查 */
    if ( VOS_NULL_PTR == pilOutLen )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf_3, pilOutLen is NULL pointer!");
        return;
    }

    if ( VOS_NULL_PTR == pcBuff )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf_3, pcBuff is NULL pointer!");
        *pilOutLen = 0;
        return;
    }

    if ( VOS_NULL_PTR == String )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf_3, String is NULL pointer!");
        *pilOutLen = 0;
        return;
    }

    if ((NAS_COMM_PRINT_BUFF_LEN - 2)>= usOffset )
    {
        /* 需要预留一个字符作为结束符 */
        *pilOutLen = VOS_nsprintf(pcBuff + usOffset,
                                  (NAS_COMM_PRINT_BUFF_LEN - 1) - usOffset,
                                  String,
                                  para1,
                                  para2,
                                  para3);
        if( (0 == *pilOutLen) || (PS_NEG_ONE == *pilOutLen) )
        {
            NAS_COMM_LOG1_WARN("NAS_COMM_nsprintf_3,*pilOutLen=", *pilOutLen);
            *pilOutLen = 0;
            return;
        }
    }
    else
    {
        NAS_COMM_LOG_ERR("NAS_COMM_nsprintf_3, Print too long!");

        *pilOutLen = 0;
        return;
    }
}
示例#3
0
VOS_VOID    NAS_COMM_Print
(
    VOS_CHAR                                *pcBuff,
    VOS_UINT16                              usLen
)
{
    /* delay begin */
    PS_LOG_RETURN();
    /* delay end */

    /* 入参检查 */
    if ( VOS_NULL_PTR == pcBuff )
    {
        NAS_COMM_LOG_ERR("NAS_COMM_Print, Input param is NULL pointer!");
        return;
    }

    /* 需要预留一个字符作为结束符 */
    if ( usLen >= NAS_COMM_PRINT_BUFF_LEN )
    {
        NAS_COMM_LOG1_WARN("NAS_COMM_Print,usLen=", usLen);
        return;
    }
    else
    {
        pcBuff[usLen] = '\0';
        NAS_COMM_LOG_NORM(pcBuff);
        return;
    }

}