From cbb7ef057ce2f843d97146da9390452ae1c37d72 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 7 Nov 2010 18:13:22 +0000 Subject: sub_cc.c: minor cleanup Avoid unnecessary (). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32599 b3059339-0415-0410-9bf9-f77b7e298cf2 Use calloc instead of malloc+memset. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32600 b3059339-0415-0410-9bf9-f77b7e298cf2 --- sub_cc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sub_cc.c b/sub_cc.c index 437b1f6d1f..c447dd0bd3 100644 --- a/sub_cc.c +++ b/sub_cc.c @@ -100,7 +100,7 @@ static void scroll_buffer(subtitle* buf) { free(buf->text[0]); - for(i = 0; i < (buf->lines - 1); i++) buf->text[i] = buf->text[i+1]; + for(i = 0; i < buf->lines - 1; i++) buf->text[i] = buf->text[i+1]; buf->text[buf->lines-1] = NULL; buf->lines--; @@ -134,8 +134,7 @@ static void append_char(char c) if(!bb->lines) {bb->lines++; cursor_pos=0;} if(bb->text[bb->lines - 1]==NULL) { - bb->text[bb->lines - 1]=malloc(CC_MAX_LINE_LENGTH); - memset(bb->text[bb->lines - 1],0,CC_MAX_LINE_LENGTH); + bb->text[bb->lines - 1] = calloc(1, CC_MAX_LINE_LENGTH); cursor_pos=0; } @@ -286,7 +285,7 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength) while (curbytes < inputlength) { int skip = 2; - cc_code = *(current); + cc_code = current[0]; if (inputlength - curbytes < 2) { #ifdef LOG_DEBUG @@ -295,8 +294,8 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength) break; } - data1 = *(current+1); - data2 = *(current + 2); + data1 = current[1]; + data2 = current[2]; current++; curbytes++; switch (cc_code) { -- cgit v1.2.3