=== modified file 'mysys/my_bitmap.c' --- mysys/my_bitmap.c 2011-02-16 15:26:19 +0000 +++ mysys/my_bitmap.c 2011-05-18 18:09:57 +0000 @@ -301,7 +301,7 @@ void bitmap_set_prefix(MY_BITMAP *map, u m+= prefix_bytes; if ((prefix_bits= prefix_size & 7)) *(m++)= (1 << prefix_bits)-1; - if ((d= no_bytes_in_map(map)-prefix_bytes)) + if ((d= no_bytes_in_map(map) - (m - (uchar *) map->bitmap))) bzero(m, d); } === modified file 'sql/sql_bitmap.h' --- sql/sql_bitmap.h 2008-01-29 11:14:34 +0000 +++ sql/sql_bitmap.h 2011-05-18 18:13:05 +0000 @@ -47,7 +47,11 @@ template class Bitm void intersect(ulonglong map2buff) { MY_BITMAP map2; - bitmap_init(&map2, (uint32 *)&map2buff, sizeof(ulonglong)*8, 0); + ulonglong buf; + + /* bitmap_init() initializes the supplied buffer */ + bitmap_init(&map2, (uint32 *) &buf, sizeof(ulonglong) * 8, 0); + buf= map2buff; bitmap_intersect(&map, &map2); } /* Use highest bit for all bits above sizeof(ulonglong)*8. */ @@ -87,9 +91,9 @@ template class Bitm ulonglong to_ulonglong() const { if (sizeof(buffer) >= 8) - return uint8korr(buffer); + return uint8korr((uchar *) buffer); DBUG_ASSERT(sizeof(buffer) >= 4); - return (ulonglong) uint4korr(buffer); + return (ulonglong) uint4korr((uchar *) buffer); } };