summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2005-02-15 15:01:20 +0400
committerunknown <ramil@mysql.com>2005-02-15 15:01:20 +0400
commit1d633f645a7c2c8186a5b605dc1bcaf95787cc7a (patch)
tree075676802bd67d20e589f6a6d89985a601402a9b /sql/item_strfunc.cc
parentde109e463bb699305bdcf116280c412dc7da2566 (diff)
downloadmariadb-git-1d633f645a7c2c8186a5b605dc1bcaf95787cc7a.tar.gz
A fix. "(int) var" type cast doesn't work correctly for uint32 var
on some 64-bit platforms (e.g. IRIX, non-debug build).
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index a92c4e94c87..bbbcadbb071 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1645,7 +1645,8 @@ String *Item_func_format::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
double nr =args[0]->val();
- uint32 diff,length,str_length;
+ int diff;
+ uint32 length, str_length;
uint dec;
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
@@ -1670,9 +1671,12 @@ String *Item_func_format::val_str(String *str)
pos[0]= pos[-(int) diff];
while (diff)
{
- pos[0]=pos[-(int) diff]; pos--;
- pos[0]=pos[-(int) diff]; pos--;
- pos[0]=pos[-(int) diff]; pos--;
+ *pos= *(pos - diff);
+ pos--;
+ *pos= *(pos - diff);
+ pos--;
+ *pos= *(pos - diff);
+ pos--;
pos[0]=',';
pos--;
diff--;