pkgsrc/devel/sfio/patches/patch-ae
2011-12-19 14:19:43 +00:00

33 lines
808 B
Text

$NetBSD: patch-ae,v 1.4 2011/12/19 14:19:43 wiz Exp $
Avoid compiler warning.
--- src/lib/sfio/sfwr.c.orig 1999-07-30 14:58:33.000000000 +0000
+++ src/lib/sfio/sfwr.c
@@ -14,8 +14,9 @@ Sfio_t* f;
reg char* buf;
reg size_t n;
#endif
-{ reg char *sp, *wbuf, *endbuf;
+{ reg char *wbuf, *endbuf;
reg ssize_t s, w, wr;
+ char *sp;
s = w = 0;
wbuf = buf;
@@ -30,10 +31,14 @@ reg size_t n;
sp = buf+1;
if(buf[0] == 0 && buf[_Sfpage-1] == 0)
{ /* check byte at a time until int-aligned */
- while(((ulong)sp)%sizeof(int))
+ Sfulong_t dumbo;
+
+ (void) memcpy(&dumbo, &sp, sizeof(dumbo));
+ while(dumbo % sizeof(int) != 0)
{ if(*sp != 0)
goto chk_hole;
sp += 1;
+ (void) memcpy(&dumbo, &sp, sizeof(dumbo));
}
/* check using int to speed up */