fix[mpp]: Fix c89 build error

Change-Id: I648e78e4b271e914225f848309290e749fdd5176
Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
This commit is contained in:
Yanjun Liao 2025-10-29 10:12:02 +08:00
parent 33f65bd809
commit 3d047de1d4
6 changed files with 20 additions and 9 deletions

View file

@ -805,6 +805,7 @@ static void clear_slots_impl(MppBufSlotsImpl *impl)
MPP_RET mpp_buf_slot_init(MppBufSlots *slots)
{
MppBufSlotsImpl *impl;
RK_U32 i;
if (!slots) {
mpp_err_f("found NULL input\n");
@ -829,7 +830,7 @@ MPP_RET mpp_buf_slot_init(MppBufSlots *slots)
mpp_mutex_init(&impl->lock);
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(impl->queue); i++) {
for (i = 0; i < MPP_ARRAY_ELEMS(impl->queue); i++) {
INIT_LIST_HEAD(&impl->queue[i]);
}

View file

@ -480,6 +480,7 @@ MPP_RET mpp_task_queue_setup(MppTaskQueue queue, RK_S32 task_count)
MPP_RET mpp_task_queue_deinit(MppTaskQueue queue)
{
MppTaskQueueImpl *p = (MppTaskQueueImpl *)queue;
RK_S32 i;
if (!p) {
mpp_err_f("found NULL input queue\n");
@ -493,7 +494,7 @@ MPP_RET mpp_task_queue_deinit(MppTaskQueue queue)
mpp_cond_signal(&p->info[MPP_OUTPUT_PORT].cond);
if (p->tasks) {
for (RK_S32 i = 0; i < p->task_count; i++) {
for (i = 0; i < p->task_count; i++) {
MppMeta meta = p->tasks[i].meta;
/* we must ensure that all task return to init status */

View file

@ -27,6 +27,7 @@ MPP_RET mpp_dec_decode(MppDec ctx, MppPacket packet)
MppPacket input = dec->mpp_pkt_in;
size_t stream_size = 0;
RK_S32 output = 0;
RK_U32 i;
mpp_mutex_cond_lock(cmd_lock);
@ -322,7 +323,7 @@ MPP_RET mpp_dec_decode(MppDec ctx, MppPacket packet)
if (task_dec->output >= 0)
mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT);
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
for (i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
RK_S32 index = task_dec->refer[i];
if (index >= 0)
mpp_buf_slot_clr_flag(frame_slots, index, SLOT_HAL_INPUT);
@ -351,6 +352,7 @@ MPP_RET mpp_dec_reset_no_thread(MppDecImpl *dec)
MppMutexCond *cmd_lock = &dec->cmd_lock;
HalDecTask *task_dec = &task->info.dec;
RK_S32 index;
RK_U32 i;
mpp_mutex_cond_lock(cmd_lock);
@ -374,7 +376,7 @@ MPP_RET mpp_dec_reset_no_thread(MppDecImpl *dec)
if (task->status.task_parsed_rdy) {
mpp_log("task no send to hal que must clr current frame hal status\n");
mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT);
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
for (i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
index = task_dec->refer[i];
if (index >= 0)
mpp_buf_slot_clr_flag(frame_slots, index, SLOT_HAL_INPUT);

View file

@ -156,6 +156,8 @@ static RK_U32 reset_parser_thread(Mpp *mpp, DecTask *task)
// do parser reset process
{
RK_S32 index;
RK_U32 i;
task->status.curr_task_rdy = 0;
task->status.prev_task_rdy = 1;
task_dec->valid = 0;
@ -172,7 +174,7 @@ static RK_U32 reset_parser_thread(Mpp *mpp, DecTask *task)
if (task_dec->output >= 0)
mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT);
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
for (i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
index = task_dec->refer[i];
if (index >= 0)
mpp_buf_slot_clr_flag(frame_slots, index, SLOT_HAL_INPUT);
@ -776,6 +778,7 @@ void *mpp_dec_hal_thread(void *data)
HalTaskHnd task = NULL;
HalTaskInfo task_info;
HalDecTask *task_dec = &task_info.dec;
RK_U32 i;
mpp_clock_start(dec->clocks[DEC_HAL_TOTAL]);
@ -884,7 +887,7 @@ void *mpp_dec_hal_thread(void *data)
if (task_dec->output >= 0)
mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT);
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
for (i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
RK_S32 index = task_dec->refer[i];
if (index >= 0)
mpp_buf_slot_clr_flag(frame_slots, index, SLOT_HAL_INPUT);

View file

@ -1030,6 +1030,7 @@ static const MppSocInfo mpp_soc_default = {
static void read_soc_name(char *name, rk_s32 size)
{
const char *path = "/proc/device-tree/compatible";
char *ptr = NULL;
rk_s32 fd = open(path, O_RDONLY);
if (fd < 0) {
@ -1042,7 +1043,7 @@ static void read_soc_name(char *name, rk_s32 size)
if (soc_name_len > 0) {
name[soc_name_len] = '\0';
/* replacing the termination character to space */
for (char *ptr = name;; ptr = name) {
for (ptr = name;; ptr = name) {
ptr += strnlen(name, size);
if (ptr >= name + soc_name_len - 1)
break;

View file

@ -22,6 +22,7 @@ static rk_u32 thread_debug = 0;
MppThread *mpp_thread_create(MppThreadFunc func, void *ctx, const char *name)
{
MppThread *thread = mpp_malloc(MppThread, 1);
int i;
if (thread) {
thread->func = func;
@ -38,7 +39,7 @@ MppThread *mpp_thread_create(MppThreadFunc func, void *ctx, const char *name)
} else {
snprintf(thread->name, THREAD_NAME_LEN, "MppThread");
}
for (int i = 0; i < THREAD_SIGNAL_BUTT; i++) {
for (i = 0; i < THREAD_SIGNAL_BUTT; i++) {
mpp_mutex_cond_init(&thread->mutex_cond[i]);
}
}
@ -243,11 +244,13 @@ void mpp_thread_init(MppThread *thread, MppThreadFunc func, void *ctx, const cha
{
thread->func = func;
thread->ctx = ctx;
int i;
if (name) {
strncpy(thread->name, name, THREAD_NAME_LEN - 1);
thread->name[THREAD_NAME_LEN - 1] = '\0';
}
for (int i = 0; i < THREAD_SIGNAL_BUTT; i++) {
for (i = 0; i < THREAD_SIGNAL_BUTT; i++) {
mpp_mutex_cond_init(&thread->mutex_cond[i]);
thread->thd_status[i] = MPP_THREAD_UNINITED;
}