← Back to team overview

maria-developers team mailing list archive

Re: MariaDB made be compiled by gcc 4.8.1

 

24.10.2013 11:54, Sergei Golubchik пишет:
Hi, Sanja!

=== modified file 'storage/maria/ma_checksum.c'
--- a/storage/maria/ma_checksum.c	2008-04-03 13:40:25 +0000
+++ b/storage/maria/ma_checksum.c	2013-10-22 07:56:05 +0000
@@ -58,7 +58,7 @@ ha_checksum _ma_checksum(MARIA_HA *info,
         length= _ma_calc_blob_length(blob_size_length, pos);
         if (length)
         {
-        memcpy((char*) &pos, pos + blob_size_length, sizeof(char*));
+        memcpy((char*) &pos, pos + blob_size_length, (sizeof(char*)));
Why?
ma_checksum.c: In function '_ma_checksum':
ma_checksum.c:61:60: error: argument to 'sizeof' in 'memcpy' call is the
same pointer type 'char *' as the destination; expected 'char' or an
explicit length [-Werror=sizeof-pointer-memaccess]
memcpy((char*) &pos, pos + blob_size_length, sizeof(char*));
^
shouldn't it be:
         memcpy((char**) &pos, pos + blob_size_length, sizeof(char*));
Sanja ^^^

That would be a better fix. The result looks more logical than with
meaningless parentheses.

Or, I suppose, you can try to drop the cast completely:

          memcpy(&pos, pos + blob_size_length, sizeof(pos));

Hehe, it was my first fix (remove casting). but then I thought that the casting was done for something and decided do not touch it. If you think that this way is better I'll do it.

[skip]


Follow ups

References