Bug #27691 bk compilation with VC++ 2005 fails
Submitted: 6 Apr 2007 22:33 Modified: 26 Apr 2007 16:56
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1 bk OS:Windows
Assigned to: Iggy Galarza CPU Architecture:Any

[6 Apr 2007 22:33] Todd Farmer
Description:
Compiling from internal 5.1 bk tree fails when using Visual C++ 2005 Edition due to casts in DDUG_DUMP() calls in sql\log_event.cc:

.\log_event.cc(6400) : error C2664: '_db_dump_' : cannot convert parameter 3 from 'byte *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\log_event.cc(7117) : error C2664: '_db_dump_' : cannot convert parameter 3 from 'byte *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\log_event.cc(7359) : error C2664: '_db_dump_' : cannot convert parameter 3 from 'byte *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\log_event.cc(7503) : error C2664: '_db_dump_' : cannot convert parameter 3 from 'byte *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\log_event.cc(7504) : error C2664: '_db_dump_' : cannot convert parameter 3 from 'byte *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

How to repeat:
* Get latest bk from 5.1.
* Run CMake for VS8.
* Try to compile mysqld project.

Suggested fix:
I added explicit casts at the lines indicated in the error message, which allowed compilation.  Not sure if that is the correct solution or not.

===== sql/log_event.cc 1.273 vs edited =====
6400c6400
<   DBUG_DUMP("rows", m_rows_buf, data_size);
---
>   DBUG_DUMP("rows", (const char *) m_rows_buf, data_size);
7117c7117
<   DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
---
>   DBUG_DUMP("record[0]", (const char *) table->record[0], table->s->reclength);
7359c7359
<   DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
---
>   DBUG_DUMP("record[0]", (const char *) table->record[0], table->s->reclength);
7503,7504c7503,7504
<       DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
<       DBUG_DUMP("record[1]", table->record[1], table->s->reclength);
---
>       DBUG_DUMP("record[0]", (const char *) table->record[0], table->s->reclength);
>       DBUG_DUMP("record[1]", (const char *) table->record[1], table->s->reclength);
[23 Apr 2007 20:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25188

ChangeSet@1.2576, 2007-04-23 16:42:57-04:00, iggy@recycle.(none) +1 -0
  Bug #27691 bk compilation with VC++ 2005 fails
  - Added appropiate casts.
[26 Apr 2007 11:37] Bugs System
Pushed into 5.1.18-beta
[26 Apr 2007 16:56] Paul DuBois
No changelog entry needed.