Skip to content

Commit dc86594

Browse files
committed
Bug#32107056 warning C4302 and C4311: 'type cast': in mgmapi and ndbapi [mysql#8] [noclose]
SEVERAL COMPILE WARNINGS FOR MYSQL CLUSTER ON WINDOWS WITH VS 2019 storage\ndb\src\ndbapi\Ndb.cpp: warning C4302: 'type cast': truncation from 'NdbTransaction *' to 'long' storage\ndb\src\ndbapi\Ndb.cpp: warning C4311: 'type cast': pointer truncation from 'NdbTransaction *' to 'long' Change-Id: Id80ee09ff2b44b571242b987c845f17990a3d234
1 parent 2fe0bde commit dc86594

File tree

12 files changed

+50
-50
lines changed

12 files changed

+50
-50
lines changed

storage/ndb/src/mgmapi/mgmapi.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -268,7 +268,7 @@ ndb_mgm_create_handle()
268268
h->mgmd_version_minor= -1;
269269
h->mgmd_version_build= -1;
270270

271-
DBUG_PRINT("info", ("handle: 0x%lx", (long) h));
271+
DBUG_PRINT("info", ("handle: %p", h));
272272
DBUG_RETURN(h);
273273
}
274274

@@ -292,7 +292,7 @@ int
292292
ndb_mgm_set_connectstring(NdbMgmHandle handle, const char* connect_string)
293293
{
294294
DBUG_ENTER("ndb_mgm_set_connectstring");
295-
DBUG_PRINT("info", ("handle: 0x%lx", (long) handle));
295+
DBUG_PRINT("info", ("handle: %p", handle));
296296
handle->cfg.~LocalConfig();
297297
new (&(handle->cfg)) LocalConfig;
298298
if (!handle->cfg.init(connect_string, 0) ||
@@ -388,7 +388,7 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
388388
DBUG_ENTER("ndb_mgm_destroy_handle");
389389
if(!handle)
390390
DBUG_VOID_RETURN;
391-
DBUG_PRINT("info", ("handle: 0x%lx", (long) (* handle)));
391+
DBUG_PRINT("info", ("handle: %p", (* handle)));
392392
/**
393393
* important! only disconnect if connected
394394
* other code relies on this

storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ class Extra_metadata
13731373
void** pack_data, Uint32* pack_len)
13741374
{
13751375
DBUG_ENTER("Extra_metadata::pack");
1376-
DBUG_PRINT("enter", ("data: 0x%lx len: %lu", (long) data, (ulong) len));
1376+
DBUG_PRINT("enter", ("data: %p len: %lu", data, (ulong) len));
13771377

13781378
// Allocate memory large enough to hold header and
13791379
// packed data
@@ -1419,8 +1419,8 @@ class Extra_metadata
14191419
*pack_data= blob;
14201420
*pack_len= BLOB_HEADER_SZ + compressed_len;
14211421

1422-
DBUG_PRINT("exit", ("pack_data: 0x%lx pack_len: %lu",
1423-
(long) *pack_data, (ulong) *pack_len));
1422+
DBUG_PRINT("exit", ("pack_data: %p pack_len: %lu",
1423+
*pack_data, (ulong) *pack_len));
14241424
DBUG_RETURN(0);
14251425
}
14261426

@@ -1444,7 +1444,7 @@ class Extra_metadata
14441444
void** unpack_data, Uint32* unpack_len)
14451445
{
14461446
DBUG_ENTER("Extra_metadata::unpack");
1447-
DBUG_PRINT("enter", ("pack_data: 0x%lx", (long) pack_data));
1447+
DBUG_PRINT("enter", ("pack_data: %p", pack_data));
14481448

14491449
const char* header = static_cast<const char*>(pack_data);
14501450
const Uint32 orglen = uint4korr(header+4);
@@ -1485,7 +1485,7 @@ class Extra_metadata
14851485
*unpack_data= data;
14861486
*unpack_len= orglen;
14871487

1488-
DBUG_PRINT("exit", ("frmdata: 0x%lx len: %lu", (long) *unpack_data,
1488+
DBUG_PRINT("exit", ("frmdata: %p len: %lu", *unpack_data,
14891489
(ulong) *unpack_len));
14901490
DBUG_RETURN(0);
14911491
}

storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -186,11 +186,11 @@ NdbEventOperationImpl::init(NdbEventImpl& evnt)
186186
m_mergeEvents = false;
187187
#endif
188188
m_ref_count = 0;
189-
DBUG_PRINT("info", ("m_ref_count = 0 for op: 0x%lx", (long) this));
189+
DBUG_PRINT("info", ("m_ref_count = 0 for op: %p", this));
190190

191191
m_has_error= 0;
192192

193-
DBUG_PRINT("exit",("this: 0x%lx oid: %u", (long) this, m_oid));
193+
DBUG_PRINT("exit",("this: %p oid: %u", this, m_oid));
194194
DBUG_VOID_RETURN;
195195
}
196196

@@ -935,8 +935,8 @@ NdbEventOperationImpl::receive_event()
935935
NdbTableImpl *tmp_table_impl= m_eventImpl->m_tableImpl;
936936
m_eventImpl->m_tableImpl = at;
937937

938-
DBUG_PRINT("info", ("switching table impl 0x%lx -> 0x%lx",
939-
(long) tmp_table_impl, (long) at));
938+
DBUG_PRINT("info", ("switching table impl %p -> %p",
939+
tmp_table_impl, at));
940940

941941
// change the rec attrs to refer to the new table object
942942
int i;
@@ -947,9 +947,9 @@ NdbEventOperationImpl::receive_event()
947947
{
948948
int no = p->getColumn()->getColumnNo();
949949
NdbColumnImpl *tAttrInfo = at->getColumn(no);
950-
DBUG_PRINT("info", ("rec_attr: 0x%lx "
951-
"switching column impl 0x%lx -> 0x%lx",
952-
(long) p, (long) p->m_column, (long) tAttrInfo));
950+
DBUG_PRINT("info", ("rec_attr: %p "
951+
"switching column impl %p -> %p",
952+
p, p->m_column, tAttrInfo));
953953
p->m_column = tAttrInfo;
954954
p = p->next();
955955
}
@@ -961,9 +961,9 @@ NdbEventOperationImpl::receive_event()
961961
{
962962
int no = p->getColumn()->getColumnNo();
963963
NdbColumnImpl *tAttrInfo = at->getColumn(no);
964-
DBUG_PRINT("info", ("rec_attr: 0x%lx "
965-
"switching column impl 0x%lx -> 0x%lx",
966-
(long) p, (long) p->m_column, (long) tAttrInfo));
964+
DBUG_PRINT("info", ("rec_attr: %p "
965+
"switching column impl %p -> %p",
966+
p, p->m_column, tAttrInfo));
967967
p->m_column = tAttrInfo;
968968
p = p->next();
969969
}
@@ -974,9 +974,9 @@ NdbEventOperationImpl::receive_event()
974974
{
975975
int no = p->getColumn()->getColumnNo();
976976
NdbColumnImpl *tAttrInfo = at->getColumn(no);
977-
DBUG_PRINT("info", ("blob_handle: 0x%lx "
978-
"switching column impl 0x%lx -> 0x%lx",
979-
(long) p, (long) p->theColumn, (long) tAttrInfo));
977+
DBUG_PRINT("info", ("blob_handle: %p "
978+
"switching column impl %p -> %p",
979+
p, p->theColumn, tAttrInfo));
980980
p->theColumn = tAttrInfo;
981981
p = p->next();
982982
}
@@ -1867,8 +1867,8 @@ NdbEventBuffer::getEpochEventOperations(Uint32* iter, Uint32* event_types, Uint3
18671867
*event_types = g.event_types;
18681868
if (cumulative_any_value != NULL)
18691869
*cumulative_any_value = g.cumulative_any_value;
1870-
DBUG_PRINT("info", ("gci: %u g.op: 0x%lx g.event_types: 0x%lx g.cumulative_any_value: 0x%lx 0x%x %s",
1871-
(unsigned)epoch->m_gci.getGCI(), (long) g.op,
1870+
DBUG_PRINT("info", ("gci: %u g.op: %p g.event_types: 0x%lx g.cumulative_any_value: 0x%lx 0x%x %s",
1871+
(unsigned)epoch->m_gci.getGCI(), g.op,
18721872
(long) g.event_types, (long) g.cumulative_any_value,
18731873
m_ndb->getReference(), m_ndb->getNdbObjectName()));
18741874
DBUG_RETURN(g.op);

storage/ndb/src/ndbapi/NdbInterpretedCode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2007, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -533,8 +533,8 @@ NdbInterpretedCode::branch_col(Uint32 branch_type,
533533
Uint32 label)
534534
{
535535
DBUG_ENTER("NdbInterpretedCode::branch_col");
536-
DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u",
537-
branch_type, attrId, (long) val, len, label));
536+
DBUG_PRINT("enter", ("type: %u col:%u val: %p len: %u label: %u",
537+
branch_type, attrId, val, len, label));
538538
if (val != NULL)
539539
DBUG_DUMP("value", (uchar*)val, len);
540540
else

storage/ndb/src/ndbapi/NdbOperationDefine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
481481
const char* aValuePassed)
482482
{
483483
DBUG_ENTER("NdbOperation::setValue");
484-
DBUG_PRINT("enter", ("col: %s op:%d val: 0x%lx",
484+
DBUG_PRINT("enter", ("col: %s op:%d val: %p",
485485
tAttrInfo ? tAttrInfo->m_name.c_str() : "NULL",
486-
theOperationType, (long) aValuePassed));
486+
theOperationType, aValuePassed));
487487

488488
int tReturnCode;
489489
Uint32 tAttrId;

storage/ndb/src/ndbapi/NdbOperationInt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -1086,8 +1086,8 @@ NdbOperation::branch_col(Uint32 type,
10861086
Uint32 Label){
10871087

10881088
DBUG_ENTER("NdbOperation::branch_col");
1089-
DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u",
1090-
type, ColId, (long) val, len, Label));
1089+
DBUG_PRINT("enter", ("type: %u col:%u val: %p len: %u label: %u",
1090+
type, ColId, val, len, Label));
10911091
if (val != NULL)
10921092
DBUG_DUMP("value", (uchar*)val, len);
10931093

storage/ndb/src/ndbapi/NdbOperationSearch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -57,11 +57,11 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
5757
const char* aValuePassed)
5858
{
5959
DBUG_ENTER("NdbOperation::equal_impl");
60-
DBUG_PRINT("enter", ("col: %s op: %d val: 0x%lx",
60+
DBUG_PRINT("enter", ("col: %s op: %d val: %p",
6161
(tAttrInfo == NULL) ? "NULL" :
6262
tAttrInfo->m_name.c_str(),
6363
theOperationType,
64-
(long) aValuePassed));
64+
aValuePassed));
6565

6666
const char* aValue = aValuePassed;
6767
const Uint32 MaxKeyLenInLongWords= (NDB_MAX_KEY_SIZE + 7)/8;

storage/ndb/src/ndbapi/NdbScanOperation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -2070,9 +2070,9 @@ NdbScanOperation::doSend(int ProcessorId)
20702070
void NdbScanOperation::close(bool forceSend, bool releaseOp)
20712071
{
20722072
DBUG_ENTER("NdbScanOperation::close");
2073-
DBUG_PRINT("enter", ("this: 0x%lx tcon: 0x%lx con: 0x%lx force: %d release: %d",
2074-
(long) this,
2075-
(long) m_transConnection, (long) theNdbCon,
2073+
DBUG_PRINT("enter", ("this: %p tcon: %p con: %p force: %d release: %d",
2074+
this,
2075+
m_transConnection, theNdbCon,
20762076
forceSend, releaseOp));
20772077

20782078
if (theNdbCon != NULL)

storage/ndb/src/ndbapi/NdbTransaction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ NdbTransaction::executeNoBlobs(NdbTransaction::ExecType aTypeOfExec,
11431143
for (unsigned i = 0; i < theNdb->theNoOfCompletedTransactions; i++)
11441144
anyway += theNdb->theCompletedTransactionsArray[i] == this;
11451145
if (anyway) {
1146-
theNdb->printState("execute %lx", (long)this);
1146+
theNdb->printState("execute %p", this);
11471147
abort();
11481148
}
11491149
#endif
@@ -1211,8 +1211,8 @@ NdbTransaction::executeAsynchPrepare(NdbTransaction::ExecType aTypeOfExec,
12111211
NdbOperation::AbortOption abortOption)
12121212
{
12131213
DBUG_ENTER("NdbTransaction::executeAsynchPrepare");
1214-
DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: 0x%lx, anyObject: Ox%lx",
1215-
aTypeOfExec, (long) aCallback, (long) anyObject));
1214+
DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: %p, anyObject: %p",
1215+
aTypeOfExec, aCallback, anyObject));
12161216

12171217
/**
12181218
* Reset error.code on execute
@@ -1779,7 +1779,7 @@ NdbTransaction::release(){
17791779
theInUseState = false;
17801780
#ifdef VM_TRACE
17811781
if (theListState != NotInList && theListState != InPreparedList) {
1782-
theNdb->printState("release %lx", (long)this);
1782+
theNdb->printState("release %p", this);
17831783
abort();
17841784
}
17851785
#endif

storage/ndb/src/ndbapi/Ndbif.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2003, 2020, Oracle and/or its affiliates.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -293,7 +293,7 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
293293
localCon->theCompletionStatus = NdbTransaction::CompletedSuccess;
294294
} else {
295295
#ifdef VM_TRACE
296-
printState("abortTransactionsAfterNodeFailure %lx", (long)this);
296+
printState("abortTransactionsAfterNodeFailure %p", this);
297297
abort();
298298
#endif
299299
}

0 commit comments

Comments
 (0)