Page MenuHomeFreeBSD

D31638.id94145.diff
No OneTemporary

D31638.id94145.diff

Index: lib/libc/string/swab.c
===================================================================
--- lib/libc/string/swab.c
+++ lib/libc/string/swab.c
@@ -43,15 +43,16 @@
void
swab(const void * __restrict from, void * __restrict to, ssize_t len)
{
- unsigned long temp;
- int n;
- char *fp, *tp;
+ unsigned char temp;
+ size_t n;
+ const unsigned char *fp;
+ unsigned char *tp;
- if (len <= 0)
+ if (len < 2) // needs to be at least 2 to work
return;
- n = len >> 1;
- fp = (char *)from;
- tp = (char *)to;
+ n = (size_t)len >> 1;
+ fp = (const unsigned char *)from;
+ tp = (unsigned char *)to;
#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp
/* round to multiple of 8 */
for (; n & 0x7; --n)

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 21, 2:13 PM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27114056
Default Alt Text
D31638.id94145.diff (713 B)

Event Timeline