Commit bd913184 authored by Jean-Paul Saman's avatar Jean-Paul Saman

--std=gnu99: declare for-loop variables inside for() where possible

Replace

  unsigned int i;
  for(i = 0; ...)

with

  for(unsigned int i=; ...)
parent 9be0fb84
...@@ -58,7 +58,6 @@ int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -58,7 +58,6 @@ int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder; dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_bat_decoder_t* p_bat_decoder; dvbpsi_bat_decoder_t* p_bat_decoder;
unsigned int i;
if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension)) if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
{ {
...@@ -100,7 +99,7 @@ int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -100,7 +99,7 @@ int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
p_bat_decoder->b_current_valid = 0; p_bat_decoder->b_current_valid = 0;
p_bat_decoder->p_building_bat = NULL; p_bat_decoder->p_building_bat = NULL;
for(i = 0; i < 256; i++) for(unsigned int i = 0; i < 256; i++)
p_bat_decoder->ap_sections[i] = NULL; p_bat_decoder->ap_sections[i] = NULL;
return 0; return 0;
...@@ -117,7 +116,6 @@ void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -117,7 +116,6 @@ void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_demux_subdec_t** pp_prev_subdec; dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_bat_decoder_t* p_bat_decoder; dvbpsi_bat_decoder_t* p_bat_decoder;
unsigned int i;
p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension); p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension);
if(p_subdec == NULL) if(p_subdec == NULL)
...@@ -132,7 +130,7 @@ void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -132,7 +130,7 @@ void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_cb_data; p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_cb_data;
free(p_bat_decoder->p_building_bat); free(p_bat_decoder->p_building_bat);
for(i = 0; i < 256; i++) for(unsigned int i = 0; i < 256; i++)
{ {
if(p_bat_decoder->ap_sections[i]) if(p_bat_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[i]); dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[i]);
...@@ -293,7 +291,6 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -293,7 +291,6 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
= (dvbpsi_bat_decoder_t*)p_private_decoder; = (dvbpsi_bat_decoder_t*)p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("BAT decoder", DVBPSI_DEBUG_ARG("BAT decoder",
"Table version %2d, " "i_table_id %2d, " "i_extension %5d, " "Table version %2d, " "i_table_id %2d, " "i_extension %5d, "
...@@ -386,7 +383,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -386,7 +383,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
p_bat_decoder->p_building_bat = NULL; p_bat_decoder->p_building_bat = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i < 256; i++) for(unsigned int i = 0; i < 256; i++)
{ {
if(p_bat_decoder->ap_sections[i] != NULL) if(p_bat_decoder->ap_sections[i] != NULL)
{ {
...@@ -424,7 +421,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -424,7 +421,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_bat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_bat_decoder->i_last_section_number; i++)
{ {
if(!p_bat_decoder->ap_sections[i]) if(!p_bat_decoder->ap_sections[i])
break; break;
...@@ -441,8 +438,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -441,8 +438,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_bat_decoder->i_last_section_number) if(p_bat_decoder->i_last_section_number)
{ {
int j; for(int j = 0; j <= p_bat_decoder->i_last_section_number - 1; j++)
for(j = 0; j <= p_bat_decoder->i_last_section_number - 1; j++)
p_bat_decoder->ap_sections[j]->p_next = p_bat_decoder->ap_sections[j]->p_next =
p_bat_decoder->ap_sections[j + 1]; p_bat_decoder->ap_sections[j + 1];
} }
...@@ -456,7 +452,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -456,7 +452,7 @@ void dvbpsi_GatherBATSections(dvbpsi_decoder_t * p_psi_decoder,
p_bat_decoder->p_building_bat); p_bat_decoder->p_building_bat);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_bat_decoder->p_building_bat = NULL; p_bat_decoder->p_building_bat = NULL;
for(i = 0; i <= p_bat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_bat_decoder->i_last_section_number; i++)
p_bat_decoder->ap_sections[i] = NULL; p_bat_decoder->ap_sections[i] = NULL;
} }
} }
......
...@@ -57,7 +57,6 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, ...@@ -57,7 +57,6 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback,
{ {
dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t)); dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t));
dvbpsi_cat_decoder_t* p_cat_decoder; dvbpsi_cat_decoder_t* p_cat_decoder;
unsigned int i;
if(h_dvbpsi == NULL) if(h_dvbpsi == NULL)
return NULL; return NULL;
...@@ -85,7 +84,7 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, ...@@ -85,7 +84,7 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback,
/* CAT decoder initial state */ /* CAT decoder initial state */
p_cat_decoder->b_current_valid = 0; p_cat_decoder->b_current_valid = 0;
p_cat_decoder->p_building_cat = NULL; p_cat_decoder->p_building_cat = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_cat_decoder->ap_sections[i] = NULL; p_cat_decoder->ap_sections[i] = NULL;
return h_dvbpsi; return h_dvbpsi;
...@@ -101,11 +100,10 @@ void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi) ...@@ -101,11 +100,10 @@ void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi)
{ {
dvbpsi_cat_decoder_t* p_cat_decoder dvbpsi_cat_decoder_t* p_cat_decoder
= (dvbpsi_cat_decoder_t*)h_dvbpsi->p_private_decoder; = (dvbpsi_cat_decoder_t*)h_dvbpsi->p_private_decoder;
unsigned int i;
free(p_cat_decoder->p_building_cat); free(p_cat_decoder->p_building_cat);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_cat_decoder->ap_sections[i]) if(p_cat_decoder->ap_sections[i])
free(p_cat_decoder->ap_sections[i]); free(p_cat_decoder->ap_sections[i]);
...@@ -188,7 +186,6 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -188,7 +186,6 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
= (dvbpsi_cat_decoder_t*)p_decoder->p_private_decoder; = (dvbpsi_cat_decoder_t*)p_decoder->p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("CAT decoder", DVBPSI_DEBUG_ARG("CAT decoder",
"Table version %2d, " "i_extension %5d, " "Table version %2d, " "i_extension %5d, "
...@@ -271,7 +268,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -271,7 +268,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
p_cat_decoder->p_building_cat = NULL; p_cat_decoder->p_building_cat = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_cat_decoder->ap_sections[i] != NULL) if(p_cat_decoder->ap_sections[i] != NULL)
{ {
...@@ -308,7 +305,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -308,7 +305,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_cat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_cat_decoder->i_last_section_number; i++)
{ {
if(!p_cat_decoder->ap_sections[i]) if(!p_cat_decoder->ap_sections[i])
break; break;
...@@ -325,7 +322,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -325,7 +322,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_cat_decoder->i_last_section_number) if(p_cat_decoder->i_last_section_number)
{ {
for(i = 0; (int)i <= p_cat_decoder->i_last_section_number - 1; i++) for(unsigned int i = 0; (int)i <= p_cat_decoder->i_last_section_number - 1; i++)
p_cat_decoder->ap_sections[i]->p_next = p_cat_decoder->ap_sections[i]->p_next =
p_cat_decoder->ap_sections[i + 1]; p_cat_decoder->ap_sections[i + 1];
} }
...@@ -339,7 +336,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -339,7 +336,7 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
p_cat_decoder->p_building_cat); p_cat_decoder->p_building_cat);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_cat_decoder->p_building_cat = NULL; p_cat_decoder->p_building_cat = NULL;
for(i = 0; i <= p_cat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_cat_decoder->i_last_section_number; i++)
p_cat_decoder->ap_sections[i] = NULL; p_cat_decoder->ap_sections[i] = NULL;
} }
} }
......
...@@ -59,7 +59,6 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -59,7 +59,6 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder; dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_eit_decoder_t* p_eit_decoder; dvbpsi_eit_decoder_t* p_eit_decoder;
unsigned int i;
if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension)) if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
{ {
...@@ -101,7 +100,7 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -101,7 +100,7 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
/* EIT decoder initial state */ /* EIT decoder initial state */
p_eit_decoder->b_current_valid = 0; p_eit_decoder->b_current_valid = 0;
p_eit_decoder->p_building_eit = NULL; p_eit_decoder->p_building_eit = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_eit_decoder->ap_sections[i] = NULL; p_eit_decoder->ap_sections[i] = NULL;
return 0; return 0;
...@@ -120,8 +119,6 @@ void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -120,8 +119,6 @@ void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
dvbpsi_demux_subdec_t** pp_prev_subdec; dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_eit_decoder_t* p_eit_decoder; dvbpsi_eit_decoder_t* p_eit_decoder;
unsigned int i;
p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension); p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension);
if(p_demux == NULL) if(p_demux == NULL)
...@@ -137,7 +134,7 @@ void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -137,7 +134,7 @@ void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
free(p_eit_decoder->p_building_eit); free(p_eit_decoder->p_building_eit);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_eit_decoder->ap_sections[i]) if(p_eit_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[i]); dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[i]);
...@@ -280,7 +277,6 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -280,7 +277,6 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
= (dvbpsi_eit_decoder_t*)p_private_decoder; = (dvbpsi_eit_decoder_t*)p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("EIT decoder", DVBPSI_DEBUG_ARG("EIT decoder",
"Table version %2d, " "i_table_id %2d, " "i_extension %5d, " "Table version %2d, " "i_table_id %2d, " "i_extension %5d, "
...@@ -365,7 +361,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -365,7 +361,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
p_eit_decoder->p_building_eit = NULL; p_eit_decoder->p_building_eit = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_eit_decoder->ap_sections[i] != NULL) if(p_eit_decoder->ap_sections[i] != NULL)
{ {
...@@ -427,7 +423,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -427,7 +423,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
(p_eit_decoder->i_first_received_section_number == 0 && (p_eit_decoder->i_first_received_section_number == 0 &&
p_section->i_number == p_eit_decoder->i_last_section_number)) p_section->i_number == p_eit_decoder->i_last_section_number))
{ {
for(i = 0; i <= p_eit_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_eit_decoder->i_last_section_number; i++)
{ {
if(!p_eit_decoder->ap_sections[i]) if(!p_eit_decoder->ap_sections[i])
break; break;
...@@ -467,7 +463,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -467,7 +463,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
dvbpsi_psi_section_t * p_prev_section; dvbpsi_psi_section_t * p_prev_section;
p_prev_section = p_eit_decoder->ap_sections[0]; p_prev_section = p_eit_decoder->ap_sections[0];
for(i = 1; i <= p_eit_decoder->i_last_section_number; i++) for(unsigned int i = 1; i <= p_eit_decoder->i_last_section_number; i++)
{ {
if(p_eit_decoder->ap_sections[i] != NULL) if(p_eit_decoder->ap_sections[i] != NULL)
{ {
...@@ -486,7 +482,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -486,7 +482,7 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t * p_psi_decoder,
p_eit_decoder->p_building_eit); p_eit_decoder->p_building_eit);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_eit_decoder->p_building_eit = NULL; p_eit_decoder->p_building_eit = NULL;
for(i = 0; i <= p_eit_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_eit_decoder->i_last_section_number; i++)
p_eit_decoder->ap_sections[i] = NULL; p_eit_decoder->ap_sections[i] = NULL;
} }
} }
......
...@@ -60,7 +60,6 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -60,7 +60,6 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder; dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_nit_decoder_t* p_nit_decoder; dvbpsi_nit_decoder_t* p_nit_decoder;
unsigned int i;
if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension)) if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
{ {
...@@ -103,7 +102,7 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -103,7 +102,7 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
/* NIT decoder initial state */ /* NIT decoder initial state */
p_nit_decoder->b_current_valid = 0; p_nit_decoder->b_current_valid = 0;
p_nit_decoder->p_building_nit = NULL; p_nit_decoder->p_building_nit = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_nit_decoder->ap_sections[i] = NULL; p_nit_decoder->ap_sections[i] = NULL;
return 0; return 0;
...@@ -122,8 +121,6 @@ void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -122,8 +121,6 @@ void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
dvbpsi_demux_subdec_t** pp_prev_subdec; dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_nit_decoder_t* p_nit_decoder; dvbpsi_nit_decoder_t* p_nit_decoder;
unsigned int i;
p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension); p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension);
if(p_demux == NULL) if(p_demux == NULL)
...@@ -139,7 +136,7 @@ void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -139,7 +136,7 @@ void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
free(p_nit_decoder->p_building_nit); free(p_nit_decoder->p_building_nit);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_nit_decoder->ap_sections[i]) if(p_nit_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[i]); dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[i]);
...@@ -305,7 +302,6 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder, ...@@ -305,7 +302,6 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
= (dvbpsi_nit_decoder_t*)p_private_decoder; = (dvbpsi_nit_decoder_t*)p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("NIT decoder", DVBPSI_DEBUG_ARG("NIT decoder",
"Table version %2d, " "i_extension %5d, " "Table version %2d, " "i_extension %5d, "
...@@ -398,7 +394,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder, ...@@ -398,7 +394,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
p_nit_decoder->p_building_nit = NULL; p_nit_decoder->p_building_nit = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_nit_decoder->ap_sections[i] != NULL) if(p_nit_decoder->ap_sections[i] != NULL)
{ {
...@@ -436,7 +432,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder, ...@@ -436,7 +432,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_nit_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_nit_decoder->i_last_section_number; i++)
{ {
if(!p_nit_decoder->ap_sections[i]) if(!p_nit_decoder->ap_sections[i])
break; break;
...@@ -453,7 +449,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder, ...@@ -453,7 +449,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_nit_decoder->i_last_section_number) if(p_nit_decoder->i_last_section_number)
{ {
for(i = 0; (int)i <= p_nit_decoder->i_last_section_number - 1; i++) for(unsigned int i = 0; (int)i <= p_nit_decoder->i_last_section_number - 1; i++)
p_nit_decoder->ap_sections[i]->p_next = p_nit_decoder->ap_sections[i]->p_next =
p_nit_decoder->ap_sections[i + 1]; p_nit_decoder->ap_sections[i + 1];
} }
...@@ -467,7 +463,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder, ...@@ -467,7 +463,7 @@ void dvbpsi_GatherNITSections(dvbpsi_decoder_t * p_decoder,
p_nit_decoder->p_building_nit); p_nit_decoder->p_building_nit);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_nit_decoder->p_building_nit = NULL; p_nit_decoder->p_building_nit = NULL;
for(i = 0; i <= p_nit_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_nit_decoder->i_last_section_number; i++)
p_nit_decoder->ap_sections[i] = NULL; p_nit_decoder->ap_sections[i] = NULL;
} }
} }
......
...@@ -53,7 +53,6 @@ dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, ...@@ -53,7 +53,6 @@ dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback,
{ {
dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t)); dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t));
dvbpsi_pat_decoder_t* p_pat_decoder; dvbpsi_pat_decoder_t* p_pat_decoder;
unsigned int i;
if(h_dvbpsi == NULL) if(h_dvbpsi == NULL)
return NULL; return NULL;
...@@ -81,7 +80,7 @@ dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, ...@@ -81,7 +80,7 @@ dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback,
/* PAT decoder initial state */ /* PAT decoder initial state */
p_pat_decoder->b_current_valid = 0; p_pat_decoder->b_current_valid = 0;
p_pat_decoder->p_building_pat = NULL; p_pat_decoder->p_building_pat = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_pat_decoder->ap_sections[i] = NULL; p_pat_decoder->ap_sections[i] = NULL;
return h_dvbpsi; return h_dvbpsi;
...@@ -97,11 +96,10 @@ void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi) ...@@ -97,11 +96,10 @@ void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi)
{ {
dvbpsi_pat_decoder_t* p_pat_decoder dvbpsi_pat_decoder_t* p_pat_decoder
= (dvbpsi_pat_decoder_t*)h_dvbpsi->p_private_decoder; = (dvbpsi_pat_decoder_t*)h_dvbpsi->p_private_decoder;
unsigned int i;
free(p_pat_decoder->p_building_pat); free(p_pat_decoder->p_building_pat);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_pat_decoder->ap_sections[i]) if(p_pat_decoder->ap_sections[i])
free(p_pat_decoder->ap_sections[i]); free(p_pat_decoder->ap_sections[i]);
...@@ -195,7 +193,6 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -195,7 +193,6 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
= (dvbpsi_pat_decoder_t*)p_decoder->p_private_decoder; = (dvbpsi_pat_decoder_t*)p_decoder->p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("PAT decoder", DVBPSI_DEBUG_ARG("PAT decoder",
"Table version %2d, " "i_extension %5d, " "Table version %2d, " "i_extension %5d, "
...@@ -288,7 +285,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -288,7 +285,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
p_pat_decoder->p_building_pat = NULL; p_pat_decoder->p_building_pat = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_pat_decoder->ap_sections[i] != NULL) if(p_pat_decoder->ap_sections[i] != NULL)
{ {
...@@ -326,7 +323,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -326,7 +323,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_pat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_pat_decoder->i_last_section_number; i++)
{ {
if(!p_pat_decoder->ap_sections[i]) if(!p_pat_decoder->ap_sections[i])
break; break;
...@@ -343,7 +340,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -343,7 +340,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_pat_decoder->i_last_section_number) if(p_pat_decoder->i_last_section_number)
{ {
for(i = 0; (int)i <= p_pat_decoder->i_last_section_number - 1; i++) for(unsigned int i = 0; (int)i <= p_pat_decoder->i_last_section_number - 1; i++)
p_pat_decoder->ap_sections[i]->p_next = p_pat_decoder->ap_sections[i]->p_next =
p_pat_decoder->ap_sections[i + 1]; p_pat_decoder->ap_sections[i + 1];
} }
...@@ -357,7 +354,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -357,7 +354,7 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
p_pat_decoder->p_building_pat); p_pat_decoder->p_building_pat);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_pat_decoder->p_building_pat = NULL; p_pat_decoder->p_building_pat = NULL;
for(i = 0; i <= p_pat_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_pat_decoder->i_last_section_number; i++)
p_pat_decoder->ap_sections[i] = NULL; p_pat_decoder->ap_sections[i] = NULL;
} }
} }
...@@ -376,11 +373,9 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -376,11 +373,9 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte;
while(p_section) while(p_section)
{ {
for(p_byte = p_section->p_payload_start; for(uint8_t *p_byte = p_section->p_payload_start;
p_byte < p_section->p_payload_end; p_byte < p_section->p_payload_end;
p_byte += 4) p_byte += 4)
{ {
......
...@@ -56,7 +56,6 @@ dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, ...@@ -56,7 +56,6 @@ dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number,
{ {
dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t)); dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t));
dvbpsi_pmt_decoder_t* p_pmt_decoder; dvbpsi_pmt_decoder_t* p_pmt_decoder;
unsigned int i;
if(h_dvbpsi == NULL) if(h_dvbpsi == NULL)
return NULL; return NULL;
...@@ -85,7 +84,7 @@ dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, ...@@ -85,7 +84,7 @@ dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number,
/* PMT decoder initial state */ /* PMT decoder initial state */
p_pmt_decoder->b_current_valid = 0; p_pmt_decoder->b_current_valid = 0;
p_pmt_decoder->p_building_pmt = NULL; p_pmt_decoder->p_building_pmt = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_pmt_decoder->ap_sections[i] = NULL; p_pmt_decoder->ap_sections[i] = NULL;
return h_dvbpsi; return h_dvbpsi;
...@@ -101,11 +100,10 @@ void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi) ...@@ -101,11 +100,10 @@ void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi)
{ {
dvbpsi_pmt_decoder_t* p_pmt_decoder dvbpsi_pmt_decoder_t* p_pmt_decoder
= (dvbpsi_pmt_decoder_t*)h_dvbpsi->p_private_decoder; = (dvbpsi_pmt_decoder_t*)h_dvbpsi->p_private_decoder;
unsigned int i;
free(p_pmt_decoder->p_building_pmt); free(p_pmt_decoder->p_building_pmt);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_pmt_decoder->ap_sections[i]) if(p_pmt_decoder->ap_sections[i])
free(p_pmt_decoder->ap_sections[i]); free(p_pmt_decoder->ap_sections[i]);
...@@ -267,7 +265,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -267,7 +265,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
= (dvbpsi_pmt_decoder_t*)p_decoder->p_private_decoder; = (dvbpsi_pmt_decoder_t*)p_decoder->p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("PMT decoder", DVBPSI_DEBUG_ARG("PMT decoder",
"Table version %2d, " "i_extension %5d, " "Table version %2d, " "i_extension %5d, "
...@@ -361,7 +358,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -361,7 +358,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
p_pmt_decoder->p_building_pmt = NULL; p_pmt_decoder->p_building_pmt = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_pmt_decoder->ap_sections[i] != NULL) if(p_pmt_decoder->ap_sections[i] != NULL)
{ {
...@@ -401,7 +398,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -401,7 +398,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_pmt_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_pmt_decoder->i_last_section_number; i++)
{ {
if(!p_pmt_decoder->ap_sections[i]) if(!p_pmt_decoder->ap_sections[i])
break; break;
...@@ -418,7 +415,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -418,7 +415,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_pmt_decoder->i_last_section_number) if(p_pmt_decoder->i_last_section_number)
{ {
for(i = 0; (int)i <= p_pmt_decoder->i_last_section_number - 1; i++) for(unsigned int i = 0; (int)i <= p_pmt_decoder->i_last_section_number - 1; i++)
p_pmt_decoder->ap_sections[i]->p_next = p_pmt_decoder->ap_sections[i]->p_next =
p_pmt_decoder->ap_sections[i + 1]; p_pmt_decoder->ap_sections[i + 1];
} }
...@@ -432,7 +429,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -432,7 +429,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
p_pmt_decoder->p_building_pmt); p_pmt_decoder->p_building_pmt);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_pmt_decoder->p_building_pmt = NULL; p_pmt_decoder->p_building_pmt = NULL;
for(i = 0; i <= p_pmt_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_pmt_decoder->i_last_section_number; i++)
p_pmt_decoder->ap_sections[i] = NULL; p_pmt_decoder->ap_sections[i] = NULL;
} }
} }
......
...@@ -58,7 +58,6 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -58,7 +58,6 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder; dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_psi_decoder->p_private_decoder;
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
dvbpsi_sdt_decoder_t* p_sdt_decoder; dvbpsi_sdt_decoder_t* p_sdt_decoder;
unsigned int i;
if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension)) if(dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
{ {
...@@ -100,7 +99,7 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -100,7 +99,7 @@ int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
/* SDT decoder initial state */ /* SDT decoder initial state */
p_sdt_decoder->b_current_valid = 0; p_sdt_decoder->b_current_valid = 0;
p_sdt_decoder->p_building_sdt = NULL; p_sdt_decoder->p_building_sdt = NULL;
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
p_sdt_decoder->ap_sections[i] = NULL; p_sdt_decoder->ap_sections[i] = NULL;
return 0; return 0;
...@@ -119,8 +118,6 @@ void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -119,8 +118,6 @@ void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
dvbpsi_demux_subdec_t** pp_prev_subdec; dvbpsi_demux_subdec_t** pp_prev_subdec;
dvbpsi_sdt_decoder_t* p_sdt_decoder; dvbpsi_sdt_decoder_t* p_sdt_decoder;
unsigned int i;
p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension); p_subdec = dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension);
if(p_demux == NULL) if(p_demux == NULL)
...@@ -136,7 +133,7 @@ void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, ...@@ -136,7 +133,7 @@ void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
free(p_sdt_decoder->p_building_sdt); free(p_sdt_decoder->p_building_sdt);
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_sdt_decoder->ap_sections[i]) if(p_sdt_decoder->ap_sections[i])
dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[i]); dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[i]);
...@@ -277,7 +274,6 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -277,7 +274,6 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
= (dvbpsi_sdt_decoder_t*)p_private_decoder; = (dvbpsi_sdt_decoder_t*)p_private_decoder;
int b_append = 1; int b_append = 1;
int b_reinit = 0; int b_reinit = 0;
unsigned int i;
DVBPSI_DEBUG_ARG("SDT decoder", DVBPSI_DEBUG_ARG("SDT decoder",
"Table version %2d, " "i_table_id %2d, " "i_extension %5d, " "Table version %2d, " "i_table_id %2d, " "i_extension %5d, "
...@@ -362,7 +358,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -362,7 +358,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
p_sdt_decoder->p_building_sdt = NULL; p_sdt_decoder->p_building_sdt = NULL;
} }
/* Clear the section array */ /* Clear the section array */
for(i = 0; i <= 255; i++) for(unsigned int i = 0; i <= 255; i++)
{ {
if(p_sdt_decoder->ap_sections[i] != NULL) if(p_sdt_decoder->ap_sections[i] != NULL)
{ {
...@@ -402,7 +398,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -402,7 +398,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
/* Check if we have all the sections */ /* Check if we have all the sections */
b_complete = 0; b_complete = 0;
for(i = 0; i <= p_sdt_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_sdt_decoder->i_last_section_number; i++)
{ {
if(!p_sdt_decoder->ap_sections[i]) if(!p_sdt_decoder->ap_sections[i])
break; break;
...@@ -419,7 +415,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -419,7 +415,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
/* Chain the sections */ /* Chain the sections */
if(p_sdt_decoder->i_last_section_number) if(p_sdt_decoder->i_last_section_number)
{ {
for(i = 0; (int)i <= p_sdt_decoder->i_last_section_number - 1; i++) for(unsigned int i = 0; (int)i <= p_sdt_decoder->i_last_section_number - 1; i++)
p_sdt_decoder->ap_sections[i]->p_next = p_sdt_decoder->ap_sections[i]->p_next =
p_sdt_decoder->ap_sections[i + 1]; p_sdt_decoder->ap_sections[i + 1];
} }
...@@ -433,7 +429,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder, ...@@ -433,7 +429,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t * p_psi_decoder,
p_sdt_decoder->p_building_sdt); p_sdt_decoder->p_building_sdt);
/* Reinitialize the structures */ /* Reinitialize the structures */
p_sdt_decoder->p_building_sdt = NULL; p_sdt_decoder->p_building_sdt = NULL;
for(i = 0; i <= p_sdt_decoder->i_last_section_number; i++) for(unsigned int i = 0; i <= p_sdt_decoder->i_last_section_number; i++)
p_sdt_decoder->ap_sections[i] = NULL; p_sdt_decoder->ap_sections[i] = NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment