[MPlayer-cvslog] r32850 - in trunk: libmpdemux/video.c sub/sub.c

diego subversion at mplayerhq.hu
Fri Feb 4 11:06:02 CET 2011


Author: diego
Date: Fri Feb  4 11:06:01 2011
New Revision: 32850

Log:
Do not pointlessly cast the return value of memalign().

memalign() returns void*, which is compatible with any pointer in C.

Modified:
   trunk/libmpdemux/video.c
   trunk/sub/sub.c

Modified: trunk/libmpdemux/video.c
==============================================================================
--- trunk/libmpdemux/video.c	Fri Feb  4 11:01:46 2011	(r32849)
+++ trunk/libmpdemux/video.c	Fri Feb  4 11:06:01 2011	(r32850)
@@ -130,7 +130,7 @@ switch(video_codec){
    }
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
    if(!videobuffer) {
-     videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
+     videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
      if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
      else {
        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
@@ -225,7 +225,7 @@ switch(video_codec){
    }
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
    if(!videobuffer) {
-     videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
+     videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
      if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
      else {
        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
@@ -290,7 +290,7 @@ mpeg_header_parser:
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
    // ========= Read & process sequence header & extension ============
    if(!videobuffer) {
-     videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
+     videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
      if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
      else {
        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
@@ -358,7 +358,7 @@ mpeg_header_parser:
    }
    mp_msg(MSGT_DECVIDEO,MSGL_INFO,"found\n");
    if(!videobuffer) {
-     videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
+     videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
      if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
      else {
        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);

Modified: trunk/sub/sub.c
==============================================================================
--- trunk/sub/sub.c	Fri Feb  4 11:01:46 2011	(r32849)
+++ trunk/sub/sub.c	Fri Feb  4 11:06:01 2011	(r32850)
@@ -157,8 +157,8 @@ static void alloc_buf(mp_osd_obj_t* obj)
 	obj->allocated = len;
 	free(obj->bitmap_buffer);
 	free(obj->alpha_buffer);
-	obj->bitmap_buffer = (unsigned char *)memalign(16, len);
-	obj->alpha_buffer = (unsigned char *)memalign(16, len);
+	obj->bitmap_buffer = memalign(16, len);
+	obj->alpha_buffer  = memalign(16, len);
     }
     memset(obj->bitmap_buffer, sub_bg_color, len);
     memset(obj->alpha_buffer, sub_bg_alpha, len);


More information about the MPlayer-cvslog mailing list