← Back to team overview

maria-developers team mailing list archive

Re: 3365: removed dependency of tests from ulong size

 

Hi, Sanja!

On Apr 12, sanja@xxxxxxxxxxxxxxxx wrote:
> At file:///home/bell/maria/bzr/work-maria-5.5-MDEV-219-1/
> 
> ------------------------------------------------------------
> revno: 3365
> revision-id: sanja@xxxxxxxxxxxxxxxx-20120412051920-972kyz35kujeljyw
> parent: sergii@xxxxxxxxx-20120405135727-1kxtscd76rq6xw5o
> committer: sanja@xxxxxxxxxxxxxxxx
> branch nick: work-maria-5.5-MDEV-219-1
> timestamp: Thu 2012-04-12 08:19:20 +0300
> message:
>   removed dependency of tests from ulong size
> 
> === modified file 'sql/sql_cache.cc'
> --- a/sql/sql_cache.cc	2012-03-27 23:04:46 +0000
> +++ b/sql/sql_cache.cc	2012-04-12 05:19:20 +0000
> @@ -1348,9 +1348,15 @@ ulong Query_cache::resize(ulong query_ca
>  
>  ulong Query_cache::set_min_res_unit(ulong size)
>  {
> -  if (size < min_allocation_unit)
> -    size= min_allocation_unit;
> -  return (min_result_data_size= ALIGN_SIZE(size));
> +  if (size > 0xFFFFFFF8)
> +    size= 0xFFFFFFF8; /* assign maximum 32bit aligned to avoid overflow */

why wouldn't you change size to be uint or ulonglong?

> +  else
> +  {
> +    if (size < min_allocation_unit)
> +      size= min_allocation_unit;
> +    size= ALIGN_SIZE(size);
> +  }
> +  return (min_result_data_size= size);
>  }

Regards,
Sergei