[MPlayer-dev-eng] [PATCH] bzero to memset

Gianluigi Tiesi mplayer at netfarm.it
Sat Jan 8 13:23:26 CET 2005


While compiling with -O0, I've noticed multiple unreferenced bzero
calls, since bzero is deprecated I've converted it in memset
equivalents.
Follows the patch.

Bye
-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
diff -Nur main.orig/libao2/ao_macosx.c main/libao2/ao_macosx.c
--- main.orig/libao2/ao_macosx.c	Sat Jan  8 10:06:34 2005
+++ main/libao2/ao_macosx.c	Sat Jan  8 12:15:55 2005
@@ -459,7 +459,7 @@
   
   /* zero output buffer */
   for (i = 0; i < NUM_BUFS; i++)
-    bzero(ao->buffer[i], ao->buffer_len);
+    memset(ao->buffer[i], 0, ao->buffer_len);
 
   pthread_mutex_unlock(&ao->buffer_mutex);
        
diff -Nur main.orig/libmpcodecs/native/RTjpegN.c main/libmpcodecs/native/RTjpegN.c
--- main.orig/libmpcodecs/native/RTjpegN.c	Sat Dec  4 22:59:25 2004
+++ main/libmpcodecs/native/RTjpegN.c	Sat Jan  8 12:16:38 2005
@@ -3138,7 +3138,7 @@
   fprintf(stderr, "RTjpeg: Could not allocate memory\n");
   exit(-1);
  }
- bzero(RTjpeg_old, ((4*RTjpeg_width*RTjpeg_height)));
+ memset(RTjpeg_old, 0, ((4*RTjpeg_width*RTjpeg_height)));
 }
 
 #ifdef MMX
diff -Nur main.orig/libmpcodecs/vd_theora.c main/libmpcodecs/vd_theora.c
--- main.orig/libmpcodecs/vd_theora.c	Sat Dec  4 22:59:20 2004
+++ main/libmpcodecs/vd_theora.c	Sat Jan  8 12:19:16 2005
@@ -139,7 +139,7 @@
    mp_image_t* mpi;
    int i;
 
-   bzero (&op, sizeof (op));
+   memset(&op, 0, sizeof(op));
    op.bytes = len;
    op.packet = data;
    op.granulepos = -1;
diff -Nur main.orig/libmpdemux/demux_ts.c main/libmpdemux/demux_ts.c
--- main.orig/libmpdemux/demux_ts.c	Sat Dec  4 22:59:33 2004
+++ main/libmpdemux/demux_ts.c	Sat Jan  8 12:17:06 2005
@@ -475,7 +475,7 @@
 	req_spid = param->spid;
 
 	has_tables = 0;
-	bzero(pes_priv1, sizeof(pes_priv1));
+	memset(pes_priv1, 0, sizeof(pes_priv1));
 	init_pos = stream_tell(demuxer->stream);
 	mp_msg(MSGT_DEMUXER, MSGL_INFO, "PROBING UP TO %llu, PROG: %d\n", (uint64_t) param->probe, param->prog);
 	while((pos <= init_pos + param->probe) && (! demuxer->stream->eof))
diff -Nur main.orig/libmpdemux/network.c main/libmpdemux/network.c
--- main.orig/libmpdemux/network.c	Sat Jan  8 10:06:38 2005
+++ main/libmpdemux/network.c	Sat Jan  8 12:17:15 2005
@@ -228,7 +228,7 @@
 	}
 	
 	
-	bzero(&server_address, sizeof(server_address));
+	memset(&server_address, 0, sizeof(server_address));
 	
 #ifndef HAVE_WINSOCK2
 #ifdef USE_ATON
diff -Nur main.orig/libmpdvdkit2/bsdi_ioctl.c main/libmpdvdkit2/bsdi_ioctl.c
--- main.orig/libmpdvdkit2/bsdi_ioctl.c	Sat Dec  4 22:59:41 2004
+++ main/libmpdvdkit2/bsdi_ioctl.c	Sat Jan  8 12:17:31 2005
@@ -694,7 +694,7 @@
 	struct	cdrom_tocentry entry;
 	int	ret, i;
 
-	bzero(tracks, sizeof (*tracks));
+	memset(tracks, 0, sizeof (*tracks));
 	ret = cdrom_ioctl(fd, CDROMREADTOCHDR, &header);
 /*
  * This whole business is a crock anyhow so we don't bother distinguishing
diff -Nur main.orig/subreader.c main/subreader.c
--- main.orig/subreader.c	Sun Dec  5 06:09:30 2004
+++ main/subreader.c	Sat Jan  8 12:17:57 2005
@@ -819,10 +819,10 @@
     static unsigned jacoTimeres = 30;
     static int jacoShift = 0;
 
-    bzero(current, sizeof(subtitle));
-    bzero(line1, LINE_LEN);
-    bzero(line2, LINE_LEN);
-    bzero(directive, LINE_LEN);
+    memset(current, 0, sizeof(subtitle));
+    memset(line1, 0, LINE_LEN);
+    memset(line2, 0, LINE_LEN);
+    memset(directive, 0, LINE_LEN);
     while (!current->text[0]) {
 	if (!fgets(line1, LINE_LEN, fd)) {
 	    return NULL;


More information about the MPlayer-dev-eng mailing list