summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-11-07 18:13:22 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-14 12:09:19 +0200
commitcbb7ef057ce2f843d97146da9390452ae1c37d72 (patch)
tree98fd73d965680c36aa27738300a3f587c49e7f1b
parentfdea095e349a2236f4d4a2b6e6a83b2cf001d373 (diff)
downloadmpv-cbb7ef057ce2f843d97146da9390452ae1c37d72.tar.bz2
mpv-cbb7ef057ce2f843d97146da9390452ae1c37d72.tar.xz
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
-rw-r--r--sub_cc.c11
1 files 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) {