summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 15:30:47 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 15:30:47 -0300
commit93fb8bb23544a4b5b2a4a6e43e1c25d74ca9a6f0 (patch)
tree9706ada08fda4adc5e2f9cf90b41b72442c15849 /storage/myisam
parent6d5b440126aa44f838410c11fdf8cadb8df1e04f (diff)
downloadmariadb-git-93fb8bb23544a4b5b2a4a6e43e1c25d74ca9a6f0.tar.gz
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings generated by GCC 4.4.4 -Wall and -Wextra flags. One major source of warnings was the in-house function my_bcmp which (unconventionally) took pointers to unsigned characters as the byte sequences to be compared. Since my_bcmp and bcmp are deprecated functions whose only difference with memcmp is the return value, every use of the function is replaced with memcmp as the special return value wasn't actually being used by any caller. There were also various other warnings, mostly due to type mismatches, missing return values, missing prototypes, dead code (unreachable) and ignored return values.
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_open.c2
-rw-r--r--storage/myisam/mi_page.c2
-rw-r--r--storage/myisam/mi_search.c6
-rw-r--r--storage/myisam/mi_test2.c22
-rw-r--r--storage/myisam/mi_unique.c2
5 files changed, 17 insertions, 17 deletions
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index f2f390862bd..8ecb07d75e8 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -139,7 +139,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(uchar*) myisam_file_magic, 4))
{
DBUG_PRINT("error",("Wrong header in %s",name_buff));
- DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
+ DBUG_DUMP("error_dump", share->state.header.file_version,
head_length);
my_errno=HA_ERR_NOT_A_TABLE;
goto err;
diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c
index 76fac8688a7..90e31e72532 100644
--- a/storage/myisam/mi_page.c
+++ b/storage/myisam/mi_page.c
@@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
{
DBUG_PRINT("error",("page %lu had wrong page length: %u",
(ulong) page, page_size));
- DBUG_DUMP("page", (char*) tmp, keyinfo->block_length);
+ DBUG_DUMP("page", tmp, keyinfo->block_length);
info->last_keypage = HA_OFFSET_ERROR;
mi_print_error(info->s, HA_ERR_CRASHED);
my_errno = HA_ERR_CRASHED;
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index 95f817e47aa..9c842fba544 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",
("Found too long null packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0;
@@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
{
DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0; /* Error */
@@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",
("Found too long binary packed key: %u of %u at 0x%lx",
length, keyinfo->maxlength, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); /* Wrong key */
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index 23c58638166..d7c168d01b0 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
}
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys)
{
printf("prev: Found: %d records of %d\n",ant,dupp_keys);
@@ -453,7 +453,7 @@ int main(int argc, char *argv[])
goto end;
}
if (mi_rlast(file,read_record2,0) ||
- bcmp(read_record2,read_record3,reclength))
+ memcmp(read_record2,read_record3,reclength))
{
printf("Can't find last record\n");
DBUG_DUMP("record2",(uchar*) read_record2,reclength);
@@ -468,7 +468,7 @@ int main(int argc, char *argv[])
printf("prev: I found: %d records of %d\n",ant,write_count);
goto end;
}
- if (bcmp(read_record,read_record3,reclength))
+ if (memcmp(read_record,read_record3,reclength))
{
printf("Can't find first record\n");
goto end;
@@ -483,7 +483,7 @@ int main(int argc, char *argv[])
mi_rprev(file,read_record3,0) == 0 ||
mi_rnext(file,read_record3,0))
goto err;
- if (bcmp(read_record,read_record3,reclength) != 0)
+ if (memcmp(read_record,read_record3,reclength) != 0)
printf("Can't find first record\n");
if (!silent)
@@ -495,7 +495,7 @@ int main(int argc, char *argv[])
mi_rnext(file,read_record3,0) == 0 ||
mi_rprev(file,read_record3,0))
goto err;
- if (bcmp(read_record2,read_record3,reclength))
+ if (memcmp(read_record2,read_record3,reclength))
printf("Can't find last record\n");
#ifdef NOT_ANYMORE
if (!silent)
@@ -509,7 +509,7 @@ int main(int argc, char *argv[])
bzero((char*) file->lastkey,file->s->base.max_key_length*2);
if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX))
goto err;
- if (bcmp(read_record+start,key,(uint) i))
+ if (memcmp(read_record+start,key,(uint) i))
{
puts("Didn't find right record");
goto end;
@@ -528,7 +528,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-1)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1);
@@ -546,7 +546,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-2)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2);
@@ -566,7 +566,7 @@ int main(int argc, char *argv[])
if (mi_rnext(file,read_record,0))
goto err; /* Skall finnas poster */
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-3)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3);
@@ -581,7 +581,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-4)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4);
@@ -604,7 +604,7 @@ int main(int argc, char *argv[])
for (i=min(2,keys) ; i-- > 0 ;)
{
if (mi_rsame(file,read_record2,(int) i)) goto err;
- if (bcmp(read_record,read_record2,reclength) != 0)
+ if (memcmp(read_record,read_record2,reclength) != 0)
{
printf("is_rsame didn't find same record\n");
goto end;
diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c
index 02fcd9289dd..fdba84a2e67 100644
--- a/storage/myisam/mi_unique.c
+++ b/storage/myisam/mi_unique.c
@@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) ||
- bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
+ memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
{
info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos;