issue #1363: Fix crc32 for 32bit processors

This commit is contained in:
Ludovic Chopin
2021-05-30 20:19:02 +02:00
committed by Pierrick Le Gall
parent e2c219ed63
commit 3239296bf3
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -2677,7 +2677,7 @@
@fclose($v_file);
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
$p_header['crc'] = @hash("crc32b", $v_content);
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
@@ -2715,7 +2715,7 @@
$v_content = $p_filedescr['content'];
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
$p_header['crc'] = @hash("crc32b", $v_content);
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+4 -4
View File
@@ -212,7 +212,7 @@ class Template
{
$compile_id = "1";
$compile_id .= ($real_dir = realpath($dir))===false ? $dir : $real_dir;
$this->smarty->compile_id = base_convert(crc32($compile_id), 10, 36 );
$this->smarty->compile_id = base_convert(hash("crc32b", $compile_id), 16, 36 );
}
}
@@ -1021,7 +1021,7 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
$this->smarty->registerFilter($type, $callback);
}
}
$this->smarty->compile_id .= '.'.base_convert(crc32($compile_id), 10, 36);
$this->smarty->compile_id .= '.'.base_convert(hash("crc32b", $compile_id), 16, 36);
}
}
@@ -1896,7 +1896,7 @@ final class FileCombiner
if (count($pending)>1)
{
$key = join('>', $key);
$file = PWG_COMBINED_DIR . base_convert(crc32($key),10,36) . '.' . $this->type;
$file = PWG_COMBINED_DIR . base_convert(hash("crc32b", $key), 16, 36) . '.' . $this->type;
if ($force || !file_exists(PHPWG_ROOT_PATH.$file) )
{
$output = '';
@@ -1945,7 +1945,7 @@ final class FileCombiner
$key = array($combinable->path, $combinable->version);
if ($conf['template_compile_check'])
$key[] = filemtime( PHPWG_ROOT_PATH . $combinable->path );
$file = PWG_COMBINED_DIR . 't' . base_convert(crc32(implode(',',$key)),10,36) . '.' . $this->type;
$file = PWG_COMBINED_DIR . 't' . base_convert(hash("crc32b", implode(',', $key)), 16, 36) . '.' . $this->type;
if (!$force && file_exists(PHPWG_ROOT_PATH.$file) )
{
$combinable->path = $file;