From e50c30eaaa92b63ed655b9893a638b860932e09b Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari Date: Sat, 19 Jul 2014 22:10:50 +0530 Subject: [PATCH] not to write 0 bytes write have undefined( not mentioned behaviour when 0 bytes written) write xds data even if start_time is 0 --- src/cc_encoders_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cc_encoders_common.c b/src/cc_encoders_common.c index c612c208..7741be9b 100644 --- a/src/cc_encoders_common.c +++ b/src/cc_encoders_common.c @@ -328,18 +328,20 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) for(data = sub->data; sub->nb_data ; sub->nb_data--,data++) { - if(!data || !data->start_time) - break; new_sentence=1; if(data->format == SFORMAT_XDS) { xds_write_transcript_line_prefix (context->out, data->start_time, data->end_time,data->cur_xds_packet_class); - write (context->out->fh, data->xds_str,data->xds_len); + if(data->xds_len > 0) + write (context->out->fh, data->xds_str,data->xds_len); freep (&data->xds_str); xds_write_transcript_line_suffix (context->out); continue; } + + if(!data->start_time) + break; switch (ccx_options.write_format) { case CCX_OF_SRT: