Fix of a warning in expat parser, which turns to an error

on some Perl/XS installations (strawberry Perl 64bit)
This commit is contained in:
bubnikv 2017-02-26 23:35:44 +01:00
parent 616788a600
commit 9ea570ea4e

View File

@ -710,8 +710,11 @@ generate_hash_secret_salt(XML_Parser parser)
{
/* Process ID is 0 bits entropy if attacker has local access
* XML_Parser address is few bits of entropy if attacker has local access */
// Prusa3D specific: Fix for a following warning, which turns to an error on some Perl/XS installations:
// error: cast from 'XML_Parser' to 'long unsigned int' loses precision [-fpermissive]
unsigned long *parser_addr = (unsigned long*)&parser;
const unsigned long entropy =
gather_time_entropy() ^ getpid() ^ (unsigned long)parser;
gather_time_entropy() ^ getpid() ^ *parser_addr;
/* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
if (sizeof(unsigned long) == 4) {