On Thu, Oct 21, 2010 at 08:25:00AM +1100, Sunny Bains wrote:
>> /* Get mbmaxlen from mbminmaxlen. */
>> -#define DATA_MBMAXLEN(mbminmaxlen) ((mbminmaxlen) / DATA_MBMAX)
>> +#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX))
>
>This cast was dropped in the final version to catch type mismatch
>between the two macros. If someone changes the type of the underlying
>variables after your fix we will not catch the mismatch. Unless the
>original fix didn't solve the problem this change should be reverted.
The original fix was causing a warning in handler0alter.cc:
ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
>= DATA_MBMINLEN(col->mbminmaxlen));
ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
> DATA_MBMINLEN(col->mbminmaxlen) || flen == len);
This is because DATA_MBMAXLEN would have returned unsigned and
DATA_MBMINLEN (after the cast that you added) would have returned ulint:
unsigned mbminmaxlen:5; /*!< minimum and maximum length of a
character, in bytes;
DATA_MBMINMAXLEN(mbminlen,mbmaxlen);
mbminlen=DATA_MBMINLEN(mbminmaxlen);
mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
Best regards,
Marko