From 590029c092d2b205957dc6b245d7e5124d4c41e1 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Sun, 29 Mar 2009 13:13:33 +0000 Subject: [PATCH] - code optimization at crc32 hash computation --- libs/sysplugins/internal.cacheresource_file.php | 4 ++-- libs/sysplugins/internal.resource_extend.php | 2 +- libs/sysplugins/internal.resource_file.php | 2 +- libs/sysplugins/internal.template.php | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/sysplugins/internal.cacheresource_file.php b/libs/sysplugins/internal.cacheresource_file.php index 5ec9a35e..b79479d9 100644 --- a/libs/sysplugins/internal.cacheresource_file.php +++ b/libs/sysplugins/internal.cacheresource_file.php @@ -90,7 +90,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase { { $_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; if (isset($resource_name)) { - $_resource_part = (string)sprintf("%u",crc32($resource_name)) . '.' . $resource_name . $this->smarty->php_ext; + $_resource_part = (string)abs(crc32($resource_name)) . '.' . $resource_name . $this->smarty->php_ext; } else { $_resource_part = null; } @@ -145,7 +145,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase { private function buildCachedFilepath ($resource_name, $cache_id, $compile_id) { // $_filepath = md5($resource_name); - $_filepath = (string)sprintf("%u",crc32($resource_name)); + $_filepath = (string)abs(crc32($resource_name)); // if use_sub_dirs, break file into directories if ($this->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR diff --git a/libs/sysplugins/internal.resource_extend.php b/libs/sysplugins/internal.resource_extend.php index ec584d83..85c2bd3e 100644 --- a/libs/sysplugins/internal.resource_extend.php +++ b/libs/sysplugins/internal.resource_extend.php @@ -127,7 +127,7 @@ class Smarty_Internal_Resource_Extend extends Smarty_Internal_Base { { $_files = explode('|', $_template->resource_name); // $_filepath = md5($_files[0]); - $_filepath = (string)sprintf("%u",crc32($_files[0])); + $_filepath = (string)abs(crc32($_files[0])); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR diff --git a/libs/sysplugins/internal.resource_file.php b/libs/sysplugins/internal.resource_file.php index 5b3ecd15..ce1a6ff8 100644 --- a/libs/sysplugins/internal.resource_file.php +++ b/libs/sysplugins/internal.resource_file.php @@ -93,7 +93,7 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base { public function getCompiledFilepath($_template) { // $_filepath = md5($_template->resource_name); - $_filepath = (string)sprintf("%u",crc32($_template->resource_name)); + $_filepath = (string)abs(crc32($_template->resource_name)); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR diff --git a/libs/sysplugins/internal.template.php b/libs/sysplugins/internal.template.php index a2488f58..01b17608 100644 --- a/libs/sysplugins/internal.template.php +++ b/libs/sysplugins/internal.template.php @@ -44,6 +44,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { public $mustCompile = null; public $suppressHeader = false; public $extract_code = false; + public $extracted_compiled_code = ''; // Rendered content public $rendered_content = null; // Cache file