From f0d32fcc57029c07755a1616c1948c1ed9433495 Mon Sep 17 00:00:00 2001 From: murf Date: Thu, 9 Oct 2008 14:56:51 +0000 Subject: Merged revisions 147807 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r147807 | murf | 2008-10-09 08:17:33 -0600 (Thu, 09 Oct 2008) | 15 lines (closes issue #13557) Reported by: nickpeirson Patches: pbx.c.patch uploaded by nickpeirson (license 579) replace_bzero+bcopy.patch uploaded by nickpeirson (license 579) Tested by: nickpeirson, murf 1. replaced all refs to bzero and bcopy to memset and memmove instead. 2. added a note to the CODING-GUIDELINES 3. add two macros to asterisk.h to prevent bzero, bcopy from creeping back into the source 4. removed bzero from configure, configure.ac, autoconfig.h.in ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@147809 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_iax2.c | 4 ++-- channels/chan_oss.c | 2 +- channels/console_gui.c | 6 +++--- channels/console_video.c | 4 ++-- channels/vcodecs.c | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'channels') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 0c6fa73ee..aea0c5b7a 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -6483,7 +6483,7 @@ static int try_transfer(struct chan_iax2_pvt *pvt, struct iax_ies *ies) memset(&ied, 0, sizeof(ied)); if (ies->apparent_addr) - bcopy(ies->apparent_addr, &new, sizeof(new)); + memmove(&new, ies->apparent_addr, sizeof(new)); if (ies->callno) newcall = ies->callno; if (!newcall || !new.sin_addr.s_addr || !new.sin_port) { @@ -6619,7 +6619,7 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c memset(&us, 0, sizeof(us)); if (ies->apparent_addr) - bcopy(ies->apparent_addr, &us, sizeof(us)); + memmove(&us, ies->apparent_addr, sizeof(us)); if (ies->username) ast_copy_string(peer, ies->username, sizeof(peer)); if (ies->refresh) diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 9cfd6449e..796a8f4a0 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -701,7 +701,7 @@ static struct ast_frame *oss_read(struct ast_channel *c) /* XXX can be simplified returning &ast_null_frame */ /* prepare a NULL frame in case we don't have enough data to return */ - bzero(f, sizeof(struct ast_frame)); + memset(f, '\0', sizeof(struct ast_frame)); f->frametype = AST_FRAME_NULL; f->src = oss_tech.type; diff --git a/channels/console_gui.c b/channels/console_gui.c index 73791883c..0fb32d5a2 100644 --- a/channels/console_gui.c +++ b/channels/console_gui.c @@ -135,7 +135,7 @@ static struct gui_info *cleanup_sdl(struct gui_info *gui) if (gui->win[i].bmp) SDL_FreeYUVOverlay(gui->win[i].bmp); } - bzero(gui, sizeof(gui)); + memset(gui, '\0', sizeof(gui)); ast_free(gui); SDL_Quit(); return NULL; @@ -182,7 +182,7 @@ static void show_frame(struct video_desc *env, int out) bmp = gui->win[out].bmp; SDL_LockYUVOverlay(bmp); /* output picture info - this is sdl, YUV420P */ - bzero(&p_out, sizeof(p_out)); + memset(&p_out, '\0', sizeof(p_out)); p_out.data[0] = bmp->pixels[0]; p_out.data[1] = bmp->pixels[1]; p_out.data[2] = bmp->pixels[2]; @@ -943,7 +943,7 @@ static int keypad_cfg_read(struct gui_info *gui, const char *val) return 0; s1[0] = s2[0] = '\0'; - bzero(&e, sizeof(e)); + memset(&e, '\0', sizeof(e)); i = sscanf(val, "%14s %14s %d %d %d %d %d", s1, s2, &e.x0, &e.y0, &e.x1, &e.y1, &e.h); diff --git a/channels/console_video.c b/channels/console_video.c index 554d03c39..b5566638d 100644 --- a/channels/console_video.c +++ b/channels/console_video.c @@ -231,7 +231,7 @@ void fbuf_free(struct fbuf_t *b) if (b->data && b->size) ast_free(b->data); - bzero(b, sizeof(*b)); + memset(b, '\0', sizeof(*b)); /* restore some fields */ b->w = x.w; b->h = x.h; @@ -472,7 +472,7 @@ static AVPicture *fill_pict(struct fbuf_t *b, AVPicture *p) int len = b->w; /* Y linesize, bytes */ int luv = b->w/2; /* U/V linesize, bytes */ - bzero(p, sizeof(*p)); + memset(p, '\0', sizeof(*p)); switch (b->pix_fmt) { case PIX_FMT_RGB555: case PIX_FMT_RGB565: diff --git a/channels/vcodecs.c b/channels/vcodecs.c index ae3770920..f48171f05 100644 --- a/channels/vcodecs.c +++ b/channels/vcodecs.c @@ -204,7 +204,7 @@ void dump_buf(struct fbuf_t *b) if ( x == 0) { /* new line */ if (i != 0) ast_log(LOG_WARNING, "%s\n", buf); - bzero(buf, sizeof(buf)); + memset(buf, '\0', sizeof(buf)); sprintf(buf, "%04x: ", i); } sprintf(buf + 6 + x*3, "%02x ", b->data[i]); @@ -504,7 +504,7 @@ static int ffmpeg_decode(struct video_dec_desc *v, struct fbuf_t *b) } } if (srclen != 0) /* update b with leftover data */ - bcopy(src, b->data, srclen); + memmove(b->data, src, srclen); b->used = srclen; b->ebit = 0; return full_frame; @@ -582,7 +582,7 @@ static struct ast_frame *h263_encap(struct fbuf_t *b, int mtu, if (len < H263_MIN_LEN) /* unreasonably small */ return NULL; - bzero(h263_hdr, sizeof(h263_hdr)); + memset(h263_hdr, '\0', sizeof(h263_hdr)); /* Now set the header bytes. Only type A by now, * and h[0] = h[2] = h[3] = 0 by default. * PTYPE starts 30 bits in the picture, so the first useful @@ -647,7 +647,7 @@ static struct ast_frame *h263_encap(struct fbuf_t *b, int mtu, if (!f) break; - bcopy(h, f->data, 4); /* copy the h263 header */ + memmove(f->data.ptr, h, 4); /* copy the h263 header */ /* XXX to do: if not aligned, fix sbit and ebit, * then move i back by 1 for the next frame */ @@ -737,7 +737,7 @@ static struct ast_frame *h261_encap(struct fbuf_t *b, int mtu, if (len < H261_MIN_LEN) /* unreasonably small */ return NULL; - bzero(h261_hdr, sizeof(h261_hdr)); + memset(h261_hdr, '\0', sizeof(h261_hdr)); /* Similar to the code in h263_encap, but the marker there is longer. * Start a few bytes within the bitstream to avoid hitting the marker @@ -801,7 +801,7 @@ static struct ast_frame *h261_encap(struct fbuf_t *b, int mtu, break; /* recompute header with I=0, V=1 */ h[0] = ( (sbit & 7) << 5 ) | ( (ebit & 7) << 2 ) | 1; - bcopy(h, f->data, 4); /* copy the h261 header */ + memmove(f->data.ptr, h, 4); /* copy the h261 header */ if (ebit) /* not aligned, restart from previous byte */ i--; sbit = (8 - ebit) & 7; @@ -902,7 +902,7 @@ static int mpeg4_decode(struct video_dec_desc *v, struct fbuf_t *b) } datalen -= ret; if (datalen > 0) /* update b with leftover bytes */ - bcopy(b->data + ret, b->data, datalen); + memmove(b->data, b->data + ret, datalen); b->used = datalen; b->ebit = 0; return full_frame; -- cgit v1.2.3