(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: https://origsvn.digium.com/svn/asterisk/trunk@147807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2008-10-09 14:17:33 +00:00
parent f6c78aa0fe
commit e235a07376
18 changed files with 48 additions and 39 deletions

View File

@@ -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.ptr, 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.ptr, 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;