From: wessels <> Date: Tue, 16 May 2000 13:09:33 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~1974 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cac03dd2d4c3d51d8cb33e449ecebbd89a9757af;p=thirdparty%2Fsquid.git DW: - We really should use the xmemcpy macro instead of memcpy. --- diff --git a/src/MemBuf.cc b/src/MemBuf.cc index 2c2d881431..cd7163035d 100644 --- a/src/MemBuf.cc +++ b/src/MemBuf.cc @@ -1,5 +1,5 @@ /* - * $Id: MemBuf.cc,v 1.23 2000/03/06 16:23:28 wessels Exp $ + * $Id: MemBuf.cc,v 1.24 2000/05/16 07:09:33 wessels Exp $ * * DEBUG: section 59 auto-growing Memory Buffer with printf * AUTHOR: Alex Rousskov @@ -332,7 +332,7 @@ memBufGrow(MemBuf * mb, mb_size_t min_cap) /* copy and free old buffer if needed */ if (old_mb.buf && old_mb.freefunc) { - memcpy(mb->buf, old_mb.buf, old_mb.size); + xmemcpy(mb->buf, old_mb.buf, old_mb.size); (*old_mb.freefunc) (old_mb.buf); } else { assert(!old_mb.buf && !old_mb.freefunc); diff --git a/src/acl.cc b/src/acl.cc index 1c289dd37f..13d76a3287 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.218 2000/05/12 00:29:06 wessels Exp $ + * $Id: acl.cc,v 1.219 2000/05/16 07:09:33 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -2419,7 +2419,7 @@ aclMatchArp(void *dataptr, struct in_addr c) ipAddr.sin_port = 0; ipAddr.sin_addr = c; memset(&arpReq, '\0', sizeof(arpReq)); - memcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); + xmemcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); /* Query ARP table */ if (ioctl(HttpSockets[0], SIOCGARP, &arpReq) != -1) { /* Skip non-ethernet interfaces */ @@ -2465,7 +2465,7 @@ aclMatchArp(void *dataptr, struct in_addr c) ipAddr.sin_port = 0; ipAddr.sin_addr = c; memset(&arpReq, '\0', sizeof(arpReq)); - memcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); + xmemcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); strncpy(arpReq.arp_dev, ifr->ifr_name, sizeof(arpReq.arp_dev) - 1); arpReq.arp_dev[sizeof(arpReq.arp_dev) - 1] = '\0'; /* Query ARP table */ @@ -2522,7 +2522,7 @@ aclMatchArp(void *dataptr, struct in_addr c) ipAddr.sin_port = 0; ipAddr.sin_addr = c; memset(&arpReq, '\0', sizeof(arpReq)); - memcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); + xmemcpy(&arpReq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); /* Query ARP table */ if (ioctl(HttpSockets[0], SIOCGARP, &arpReq) != -1) { /* diff --git a/src/fs/coss/store_io_coss.cc b/src/fs/coss/store_io_coss.cc index d6ff2e817c..d361a269a5 100644 --- a/src/fs/coss/store_io_coss.cc +++ b/src/fs/coss/store_io_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.cc,v 1.2 2000/05/12 00:29:19 wessels Exp $ + * $Id: store_io_coss.cc,v 1.3 2000/05/16 07:09:36 wessels Exp $ * * DEBUG: section 81 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -198,7 +198,7 @@ storeCossOpen(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, /* make local copy so we don't have to lock membuf */ if (p) { cstate->readbuffer = xmalloc(sio->st_size); - memcpy(cstate->readbuffer, p, sio->st_size); + xmemcpy(cstate->readbuffer, p, sio->st_size); } else { /* Do the allocation */ /* this is the first time we've been called on a new sio @@ -303,7 +303,7 @@ storeCossWrite(SwapDir * SD, storeIOState * sio, char *buf, size_t size, off_t o diskoffset = sio->swap_filen + sio->offset; dest = storeCossMemPointerFromDiskOffset(SD, diskoffset, &membuf); assert(dest != NULL); - memcpy(dest, buf, size); + xmemcpy(dest, buf, size); sio->offset += size; if (free_func) (free_func) (buf); @@ -333,11 +333,11 @@ storeCossReadDone(int fd, const char *buf, int len, int errflag, void *my_data) if (cstate->readbuffer == NULL) { cstate->readbuffer = xmalloc(sio->st_size); p = storeCossMemPointerFromDiskOffset(SD, sio->swap_filen, NULL); - memcpy(cstate->readbuffer, p, sio->st_size); + xmemcpy(cstate->readbuffer, p, sio->st_size); storeCossMemBufUnlock(SD, sio); } sio->offset += len; - memcpy(cstate->requestbuf, &cstate->readbuffer[cstate->requestoffset], + xmemcpy(cstate->requestbuf, &cstate->readbuffer[cstate->requestoffset], cstate->requestlen); rlen = (size_t) cstate->requestlen; } diff --git a/src/http.cc b/src/http.cc index 8e5f4a9f96..ac514c1c9b 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.361 2000/05/16 07:06:04 wessels Exp $ + * $Id: http.cc,v 1.362 2000/05/16 07:09:34 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -329,7 +329,7 @@ httpProcessReplyHeader(HttpStateData * httpState, const char *buf, int size) assert(httpState->reply_hdr_state == 0); hdr_len = httpState->reply_hdr_size; room = 8191 - hdr_len; - memcpy(httpState->reply_hdr + hdr_len, buf, room < size ? room : size); + xmemcpy(httpState->reply_hdr + hdr_len, buf, room < size ? room : size); hdr_len += room < size ? room : size; httpState->reply_hdr[hdr_len] = '\0'; httpState->reply_hdr_size = hdr_len; diff --git a/src/stat.cc b/src/stat.cc index a32a5cb3a6..7af228f63d 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.327 2000/05/12 00:29:08 wessels Exp $ + * $Id: stat.cc,v 1.328 2000/05/16 07:09:34 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -970,7 +970,7 @@ statCountersCopy(StatCounters * dest, const StatCounters * orig) { assert(dest && orig); /* this should take care of all the fields, but "special" ones */ - memcpy(dest, orig, sizeof(*dest)); + xmemcpy(dest, orig, sizeof(*dest)); /* prepare space where to copy special entries */ statCountersInitSpecial(dest); /* now handle special cases */ diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index 3f3d52c3c4..849eac1fb6 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: test_cache_digest.cc,v 1.24 2000/03/06 16:23:36 wessels Exp $ + * $Id: test_cache_digest.cc,v 1.25 2000/05/16 07:09:34 wessels Exp $ * * AUTHOR: Alex Rousskov * @@ -436,7 +436,7 @@ accessLogReader(FileIterator * fi) * strcmp(hier, "SSL_PARENT_MISS") && * strcmp(hier, "DEFAULT_PARENT"); */ - memcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key)); + xmemcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key)); /*fprintf(stdout, "%s:%d: %s %s %s %s\n", * fname, count, method, storeKeyText(entry->key), url, hier); */ return frOk;