Commit 1f223e37 authored by Jean-Paul Saman's avatar Jean-Paul Saman

unify error, debug and warning messages

Libdvbpsi used printf and fprintf to return debug and error information to the caller.
This bypasses any logging mechanism the calling application uses and does not take
multi-threaded applications into account.
The unifying of messages (error, debug or warning) allows a calling application to
filter (message level: -1, 0, 1 or 2) and handle the messages in its own way.
parent d4a47c1f
...@@ -51,7 +51,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -51,7 +51,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor)
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x02) if(p_descriptor->i_tag != 0x02)
{ {
DVBPSI_ERROR_ARG("dr_02 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_02 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -61,11 +61,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -61,11 +61,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor)
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_vstream_dr_t*)malloc(sizeof(dvbpsi_vstream_dr_t)); p_decoded = (dvbpsi_vstream_dr_t*)malloc(sizeof(dvbpsi_vstream_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_02 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
p_decoded->b_mpeg2 = (p_descriptor->p_data[0] & 0x04) ? 1 : 0; p_decoded->b_mpeg2 = (p_descriptor->p_data[0] & 0x04) ? 1 : 0;
...@@ -73,7 +69,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -73,7 +69,7 @@ dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor)
if( (!p_decoded->b_mpeg2 && (p_descriptor->i_length != 1)) if( (!p_decoded->b_mpeg2 && (p_descriptor->i_length != 1))
|| (p_decoded->b_mpeg2 && (p_descriptor->i_length != 3))) || (p_decoded->b_mpeg2 && (p_descriptor->i_length != 3)))
{ {
DVBPSI_ERROR_ARG("dr_02 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_02 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
......
...@@ -51,7 +51,7 @@ dvbpsi_astream_dr_t * dvbpsi_DecodeAStreamDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -51,7 +51,7 @@ dvbpsi_astream_dr_t * dvbpsi_DecodeAStreamDr(dvbpsi_descriptor_t * p_descriptor)
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x03) if(p_descriptor->i_tag != 0x03)
{ {
DVBPSI_ERROR_ARG("dr_03 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_03 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -61,16 +61,12 @@ dvbpsi_astream_dr_t * dvbpsi_DecodeAStreamDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -61,16 +61,12 @@ dvbpsi_astream_dr_t * dvbpsi_DecodeAStreamDr(dvbpsi_descriptor_t * p_descriptor)
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_astream_dr_t*)malloc(sizeof(dvbpsi_astream_dr_t)); p_decoded = (dvbpsi_astream_dr_t*)malloc(sizeof(dvbpsi_astream_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_03 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 1) if(p_descriptor->i_length != 1)
{ {
DVBPSI_ERROR_ARG("dr_03 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_03 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_hierarchy_dr_t * dvbpsi_DecodeHierarchyDr( ...@@ -52,7 +52,7 @@ dvbpsi_hierarchy_dr_t * dvbpsi_DecodeHierarchyDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x04) if(p_descriptor->i_tag != 0x04)
{ {
DVBPSI_ERROR_ARG("dr_04 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_04 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -62,16 +62,12 @@ dvbpsi_hierarchy_dr_t * dvbpsi_DecodeHierarchyDr( ...@@ -62,16 +62,12 @@ dvbpsi_hierarchy_dr_t * dvbpsi_DecodeHierarchyDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_hierarchy_dr_t*)malloc(sizeof(dvbpsi_hierarchy_dr_t)); p_decoded = (dvbpsi_hierarchy_dr_t*)malloc(sizeof(dvbpsi_hierarchy_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_04 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 4) if(p_descriptor->i_length != 4)
{ {
DVBPSI_ERROR_ARG("dr_04 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_04 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_registration_dr_t * dvbpsi_DecodeRegistrationDr( ...@@ -52,7 +52,7 @@ dvbpsi_registration_dr_t * dvbpsi_DecodeRegistrationDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x05) if(p_descriptor->i_tag != 0x05)
{ {
DVBPSI_ERROR_ARG("dr_05 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_05 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_registration_dr_t * dvbpsi_DecodeRegistrationDr( ...@@ -63,16 +63,12 @@ dvbpsi_registration_dr_t * dvbpsi_DecodeRegistrationDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_registration_dr_t*) p_decoded = (dvbpsi_registration_dr_t*)
malloc(sizeof(dvbpsi_registration_dr_t)); malloc(sizeof(dvbpsi_registration_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_05 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length < 4) if(p_descriptor->i_length < 4)
{ {
DVBPSI_ERROR_ARG("dr_05 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_05 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_ds_alignment_dr_t * dvbpsi_DecodeDSAlignmentDr( ...@@ -52,7 +52,7 @@ dvbpsi_ds_alignment_dr_t * dvbpsi_DecodeDSAlignmentDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x06) if(p_descriptor->i_tag != 0x06)
{ {
DVBPSI_ERROR_ARG("dr_06 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_06 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_ds_alignment_dr_t * dvbpsi_DecodeDSAlignmentDr( ...@@ -63,16 +63,12 @@ dvbpsi_ds_alignment_dr_t * dvbpsi_DecodeDSAlignmentDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_ds_alignment_dr_t*) p_decoded = (dvbpsi_ds_alignment_dr_t*)
malloc(sizeof(dvbpsi_ds_alignment_dr_t)); malloc(sizeof(dvbpsi_ds_alignment_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_06 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 1) if(p_descriptor->i_length != 1)
{ {
DVBPSI_ERROR_ARG("dr_06 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_06 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_target_bg_grid_dr_t * dvbpsi_DecodeTargetBgGridDr( ...@@ -52,7 +52,7 @@ dvbpsi_target_bg_grid_dr_t * dvbpsi_DecodeTargetBgGridDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x07) if(p_descriptor->i_tag != 0x07)
{ {
DVBPSI_ERROR_ARG("dr_07 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_07 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_target_bg_grid_dr_t * dvbpsi_DecodeTargetBgGridDr( ...@@ -63,16 +63,12 @@ dvbpsi_target_bg_grid_dr_t * dvbpsi_DecodeTargetBgGridDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_target_bg_grid_dr_t*) p_decoded = (dvbpsi_target_bg_grid_dr_t*)
malloc(sizeof(dvbpsi_target_bg_grid_dr_t)); malloc(sizeof(dvbpsi_target_bg_grid_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_07 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 4) if(p_descriptor->i_length != 4)
{ {
DVBPSI_ERROR_ARG("dr_07 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_07 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -51,7 +51,7 @@ dvbpsi_vwindow_dr_t * dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -51,7 +51,7 @@ dvbpsi_vwindow_dr_t * dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor)
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x08) if(p_descriptor->i_tag != 0x08)
{ {
DVBPSI_ERROR_ARG("dr_08 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_08 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -61,16 +61,12 @@ dvbpsi_vwindow_dr_t * dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor) ...@@ -61,16 +61,12 @@ dvbpsi_vwindow_dr_t * dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor)
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_vwindow_dr_t*)malloc(sizeof(dvbpsi_vwindow_dr_t)); p_decoded = (dvbpsi_vwindow_dr_t*)malloc(sizeof(dvbpsi_vwindow_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_08 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 4) if(p_descriptor->i_length != 4)
{ {
DVBPSI_ERROR_ARG("dr_08 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_08 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -51,7 +51,7 @@ dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor) ...@@ -51,7 +51,7 @@ dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor)
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x09) if(p_descriptor->i_tag != 0x09)
{ {
DVBPSI_ERROR_ARG("dr_09 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_09 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -61,16 +61,12 @@ dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor) ...@@ -61,16 +61,12 @@ dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor)
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_ca_dr_t*)malloc(sizeof(dvbpsi_ca_dr_t)); p_decoded = (dvbpsi_ca_dr_t*)malloc(sizeof(dvbpsi_ca_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_09 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length < 4) if(p_descriptor->i_length < 4)
{ {
DVBPSI_ERROR_ARG("dr_09 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_09 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor) ...@@ -52,7 +52,7 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor)
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0a) if(p_descriptor->i_tag != 0x0a)
{ {
DVBPSI_ERROR_ARG("dr_0a decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0a decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -62,16 +62,12 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor) ...@@ -62,16 +62,12 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor)
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_iso639_dr_t*)malloc(sizeof(dvbpsi_iso639_dr_t)); p_decoded = (dvbpsi_iso639_dr_t*)malloc(sizeof(dvbpsi_iso639_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0a decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if((p_descriptor->i_length < 1) || (p_descriptor->i_length % 4 != 0)) if((p_descriptor->i_length < 1) || (p_descriptor->i_length % 4 != 0))
{ {
DVBPSI_ERROR_ARG("dr_0a decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0a decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_system_clock_dr_t * dvbpsi_DecodeSystemClockDr( ...@@ -52,7 +52,7 @@ dvbpsi_system_clock_dr_t * dvbpsi_DecodeSystemClockDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0b) if(p_descriptor->i_tag != 0x0b)
{ {
DVBPSI_ERROR_ARG("dr_0b decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0b decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_system_clock_dr_t * dvbpsi_DecodeSystemClockDr( ...@@ -63,16 +63,12 @@ dvbpsi_system_clock_dr_t * dvbpsi_DecodeSystemClockDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_system_clock_dr_t*)malloc(sizeof(dvbpsi_system_clock_dr_t)); (dvbpsi_system_clock_dr_t*)malloc(sizeof(dvbpsi_system_clock_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0b decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 2) if(p_descriptor->i_length != 2)
{ {
DVBPSI_ERROR_ARG("dr_0b decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0b decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_mx_buff_utilization_dr_t * dvbpsi_DecodeMxBuffUtilizationDr( ...@@ -52,7 +52,7 @@ dvbpsi_mx_buff_utilization_dr_t * dvbpsi_DecodeMxBuffUtilizationDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0c) if(p_descriptor->i_tag != 0x0c)
{ {
DVBPSI_ERROR_ARG("dr_0c decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0c decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_mx_buff_utilization_dr_t * dvbpsi_DecodeMxBuffUtilizationDr( ...@@ -63,16 +63,12 @@ dvbpsi_mx_buff_utilization_dr_t * dvbpsi_DecodeMxBuffUtilizationDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_mx_buff_utilization_dr_t*) p_decoded = (dvbpsi_mx_buff_utilization_dr_t*)
malloc(sizeof(dvbpsi_mx_buff_utilization_dr_t)); malloc(sizeof(dvbpsi_mx_buff_utilization_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0c decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 3) if(p_descriptor->i_length != 3)
{ {
DVBPSI_ERROR_ARG("dr_0c decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0c decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_copyright_dr_t * dvbpsi_DecodeCopyrightDr( ...@@ -52,7 +52,7 @@ dvbpsi_copyright_dr_t * dvbpsi_DecodeCopyrightDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0d) if(p_descriptor->i_tag != 0x0d)
{ {
DVBPSI_ERROR_ARG("dr_0d decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0d decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_copyright_dr_t * dvbpsi_DecodeCopyrightDr( ...@@ -63,16 +63,12 @@ dvbpsi_copyright_dr_t * dvbpsi_DecodeCopyrightDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_copyright_dr_t*) p_decoded = (dvbpsi_copyright_dr_t*)
malloc(sizeof(dvbpsi_copyright_dr_t)); malloc(sizeof(dvbpsi_copyright_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0d decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length < 4) if(p_descriptor->i_length < 4)
{ {
DVBPSI_ERROR_ARG("dr_0c decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0c decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_max_bitrate_dr_t * dvbpsi_DecodeMaxBitrateDr( ...@@ -52,7 +52,7 @@ dvbpsi_max_bitrate_dr_t * dvbpsi_DecodeMaxBitrateDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0e) if(p_descriptor->i_tag != 0x0e)
{ {
DVBPSI_ERROR_ARG("dr_0e decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0e decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -62,16 +62,12 @@ dvbpsi_max_bitrate_dr_t * dvbpsi_DecodeMaxBitrateDr( ...@@ -62,16 +62,12 @@ dvbpsi_max_bitrate_dr_t * dvbpsi_DecodeMaxBitrateDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = (dvbpsi_max_bitrate_dr_t*)malloc(sizeof(dvbpsi_max_bitrate_dr_t)); p_decoded = (dvbpsi_max_bitrate_dr_t*)malloc(sizeof(dvbpsi_max_bitrate_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0e decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 3) if(p_descriptor->i_length != 3)
{ {
DVBPSI_ERROR_ARG("dr_0e decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0e decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -52,7 +52,7 @@ dvbpsi_private_data_dr_t * dvbpsi_DecodePrivateDataDr( ...@@ -52,7 +52,7 @@ dvbpsi_private_data_dr_t * dvbpsi_DecodePrivateDataDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x0f) if(p_descriptor->i_tag != 0x0f)
{ {
DVBPSI_ERROR_ARG("dr_0f decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_0f decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,16 +63,12 @@ dvbpsi_private_data_dr_t * dvbpsi_DecodePrivateDataDr( ...@@ -63,16 +63,12 @@ dvbpsi_private_data_dr_t * dvbpsi_DecodePrivateDataDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_private_data_dr_t*)malloc(sizeof(dvbpsi_private_data_dr_t)); (dvbpsi_private_data_dr_t*)malloc(sizeof(dvbpsi_private_data_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_0f decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length != 4) if(p_descriptor->i_length != 4)
{ {
DVBPSI_ERROR_ARG("dr_0f decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_0f decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
free(p_decoded); free(p_decoded);
return NULL; return NULL;
......
...@@ -53,7 +53,7 @@ dvbpsi_stuffing_dr_t * dvbpsi_DecodeStuffingDr( ...@@ -53,7 +53,7 @@ dvbpsi_stuffing_dr_t * dvbpsi_DecodeStuffingDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x42) if(p_descriptor->i_tag != 0x42)
{ {
DVBPSI_ERROR_ARG("dr_42 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_42 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -64,11 +64,7 @@ dvbpsi_stuffing_dr_t * dvbpsi_DecodeStuffingDr( ...@@ -64,11 +64,7 @@ dvbpsi_stuffing_dr_t * dvbpsi_DecodeStuffingDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_stuffing_dr_t*)malloc(sizeof(dvbpsi_stuffing_dr_t)); (dvbpsi_stuffing_dr_t*)malloc(sizeof(dvbpsi_stuffing_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_42 decoder", "out of memory");
return NULL;
}
/* Decode data */ /* Decode data */
p_decoded->i_stuffing_length = p_descriptor->i_length; p_decoded->i_stuffing_length = p_descriptor->i_length;
......
...@@ -52,7 +52,7 @@ dvbpsi_sat_deliv_sys_dr_t * dvbpsi_DecodeSatDelivSysDr( ...@@ -52,7 +52,7 @@ dvbpsi_sat_deliv_sys_dr_t * dvbpsi_DecodeSatDelivSysDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x43) if(p_descriptor->i_tag != 0x43)
{ {
DVBPSI_ERROR_ARG("dr_43 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_43 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -63,11 +63,7 @@ dvbpsi_sat_deliv_sys_dr_t * dvbpsi_DecodeSatDelivSysDr( ...@@ -63,11 +63,7 @@ dvbpsi_sat_deliv_sys_dr_t * dvbpsi_DecodeSatDelivSysDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_sat_deliv_sys_dr_t*)malloc(sizeof(dvbpsi_sat_deliv_sys_dr_t)); (dvbpsi_sat_deliv_sys_dr_t*)malloc(sizeof(dvbpsi_sat_deliv_sys_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_43 decoder", "out of memory");
return NULL;
}
/* Decode data */ /* Decode data */
p_decoded->i_frequency = (uint32_t)(p_descriptor->p_data[0] << 24) p_decoded->i_frequency = (uint32_t)(p_descriptor->p_data[0] << 24)
......
...@@ -51,7 +51,7 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr( ...@@ -51,7 +51,7 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
/* Check the tag */ /* Check the tag */
if( p_descriptor->i_tag != 0x45 ) if( p_descriptor->i_tag != 0x45 )
{ {
DVBPSI_ERROR_ARG("dr_45 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_45 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -62,14 +62,14 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr( ...@@ -62,14 +62,14 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
/* Decode data and check the length */ /* Decode data and check the length */
if(p_descriptor->i_length < 3) if(p_descriptor->i_length < 3)
{ {
DVBPSI_ERROR_ARG("dr_45 decoder", "bad length (%d)", dvbpsi_error(h_dvbpsi, "dr_45 decoder", "bad length (%d)",
p_descriptor->i_length); p_descriptor->i_length);
return NULL; return NULL;
} }
if(p_descriptor->i_length % 2) if(p_descriptor->i_length % 2)
{ {
DVBPSI_ERROR_ARG("dr_45 decoder", "length not multiple of 3(%d)", dvbpsi_error(h_dvbpsi, "dr_45 decoder", "length not multiple of 3(%d)",
p_descriptor->i_length); p_descriptor->i_length);
return NULL; return NULL;
} }
...@@ -79,11 +79,7 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr( ...@@ -79,11 +79,7 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_vbi_dr_t*)malloc(sizeof(dvbpsi_vbi_dr_t)); (dvbpsi_vbi_dr_t*)malloc(sizeof(dvbpsi_vbi_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_45 decoder", "out of memory");
return NULL;
}
p_decoded->i_services_number = i_services_number; p_decoded->i_services_number = i_services_number;
......
...@@ -53,7 +53,7 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr( ...@@ -53,7 +53,7 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr(
/* Check the tag */ /* Check the tag */
if(p_descriptor->i_tag != 0x47) if(p_descriptor->i_tag != 0x47)
{ {
DVBPSI_ERROR_ARG("dr_47 decoder", "bad tag (0x%x)", p_descriptor->i_tag); dvbpsi_error(h_dvbpsi, "dr_47 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL; return NULL;
} }
...@@ -64,11 +64,7 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr( ...@@ -64,11 +64,7 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr(
/* Allocate memory */ /* Allocate memory */
p_decoded = p_decoded =
(dvbpsi_bouquet_name_dr_t*)malloc(sizeof(dvbpsi_bouquet_name_dr_t)); (dvbpsi_bouquet_name_dr_t*)malloc(sizeof(dvbpsi_bouquet_name_dr_t));
if(!p_decoded) if(!p_decoded) return NULL;
{
DVBPSI_ERROR("dr_47 decoder", "out of memory");
return NULL;
}