[xmlsec] Re: Problem: Comparing decimal with hexadecimal numbers
Rich Salz
rsalz@datapower.com
Mon, 15 Sep 2003 20:06:36 -0400 (EDT)
> if( bufsize == sizeof(int) )
> i = *(int*)buf;
Since buf is a byte pointer, you're asking for portability
problems (SIGBUS, anyone?) if it's not aligned.
if (bufsize == sizeof (int))
memcpy(&i, buf, sizeof (int))
Portable and safe.
/r$
--
Rich Salz Chief Security Architect
DataPower Technology http://www.datapower.com
XS40 XML Security Gateway http://www.datapower.com/products/xs40.html
XML Security Overview http://www.datapower.com/xmldev/xmlsecurity.html