← Back to team overview

maria-developers team mailing list archive

Re: [Commits] 11deb41: MDEV-7499 - System variables have broken default values on big endian

 

Hi Sergei,

thanks for your review.

On Wed, Feb 04, 2015 at 12:38:04PM +0100, Sergei Golubchik wrote:
> > MDEV-7499 - System variables have broken default values on big endian
...skip...

> > +    case PLUGIN_VAR_LONGLONG:
> > +    case PLUGIN_VAR_SET:
> > +    case PLUGIN_VAR_DOUBLE:
> > +      return (uchar*) &option.def_value;
> 
> PLUGIN_VAR_LONGLONG and PLUGIN_VAR_SET - ok, but for PLUGIN_VAR_DOUBLE
> I'd either copy it to thd->sys_var_tmp too or add an assert, like this
> 
>     case PLUGIN_VAR_DOUBLE:
>       compile_time_assert(sizeof(double) == sizeof(option.def_value));
>       /* fall through */
>     case PLUGIN_VAR_LONGLONG:
>     case PLUGIN_VAR_SET:
>       return (uchar*) &option.def_value;
> 
> More for documentation purposes than for protection agains a wrong
> sizeof(double). It explains why you don't copy the value.
I did copy to thd->sys_var_tmp initially, but it returned scrambled value.
But now I see that there is getopt_ulonglong2double(), which may do the trick.
I'll try it. If it won't work I'll add an assertion.

Thanks,
Sergey


References