Merge pull request #965 from PhenomRetroShare/Fix_GccWarning

Fic Gcc warnings:
This commit is contained in:
Gioacchino 2017-09-15 16:23:38 +02:00 committed by GitHub
commit 195127f43c
4 changed files with 15 additions and 9 deletions

View File

@ -704,8 +704,10 @@ bool p3FileDatabase::convertPointerToEntryIndex(const void *p, EntryIndex& e, ui
{ {
// trust me, I can do this ;-) // trust me, I can do this ;-)
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
e = EntryIndex( *reinterpret_cast<uint32_t*>(&p) & ENTRY_INDEX_BIT_MASK ) ; e = EntryIndex( *reinterpret_cast<uint32_t*>(&p) & ENTRY_INDEX_BIT_MASK ) ;
friend_index = (*reinterpret_cast<uint32_t*>(&p)) >> NB_ENTRY_INDEX_BITS ; friend_index = (*reinterpret_cast<uint32_t*>(&p)) >> NB_ENTRY_INDEX_BITS ;
#pragma GCC diagnostic pop
if(friend_index == 0) if(friend_index == 0)
{ {

View File

@ -57,9 +57,11 @@
* C++ dynamic dispatching that may have a noticeable impact on runtime * C++ dynamic dispatching that may have a noticeable impact on runtime
* performances. * performances.
*/ */
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#define RS_REGISTER_SERIAL_MEMBER_TYPED(I, T) do {\ #define RS_REGISTER_SERIAL_MEMBER_TYPED(I, T) do {\
RsTypeSerializer::serial_process<T>(j, ctx, reinterpret_cast<T&>(I), #I);\ RsTypeSerializer::serial_process<T>(j, ctx, reinterpret_cast<T&>(I), #I);\
} while(0) } while(0)
#pragma GCC diagnostic pop
/** @def RS_REGISTER_ITEM_TYPE(T) /** @def RS_REGISTER_ITEM_TYPE(T)
* Use this macro into `youritem.cc` only if you need to process members of * Use this macro into `youritem.cc` only if you need to process members of

View File

@ -128,7 +128,7 @@ RsRegularExpression::Expression * AdvancedSearchDialog::getRsExpr()
// iterate through the items in elements and // iterate through the items in elements and
#warning Phenom (2017-07-21): I don't know if it is a real memLeak for wholeExpression. If not remove this warning and add a comment how it is deleted. #warning Phenom (2017-07-21): I don t know if it is a real memLeak for wholeExpression. If not remove this warning and add a comment how it is deleted.
// cppcheck-suppress memleak // cppcheck-suppress memleak
for (int i = 1; i < expressions->size(); ++i) { for (int i = 1; i < expressions->size(); ++i) {
// extract the expression information and compound it with the // extract the expression information and compound it with the

View File

@ -144,11 +144,12 @@ void RsBanListToolButton::applyIp()
uint32_t list_type; uint32_t list_type;
switch (mList) { switch (mList) {
case LIST_WHITELIST: case LIST_BLACKLIST:
list_type = RSBANLIST_TYPE_WHITELIST; list_type = RSBANLIST_TYPE_BLACKLIST;
break; break;
case LIST_BLACKLIST: case LIST_WHITELIST:
list_type = RSBANLIST_TYPE_BLACKLIST; default:
list_type = RSBANLIST_TYPE_WHITELIST;
break; break;
} }
@ -156,11 +157,12 @@ void RsBanListToolButton::applyIp()
bool changed = false; bool changed = false;
switch (mMode) { switch (mMode) {
case MODE_ADD: case MODE_REMOVE:
changed = rsBanList->addIpRange(addr, masked_bytes, list_type, ""); changed = rsBanList->removeIpRange(addr, masked_bytes, list_type);
break; break;
case MODE_REMOVE: case MODE_ADD:
changed = rsBanList->removeIpRange(addr, masked_bytes, list_type); default:
changed = rsBanList->addIpRange(addr, masked_bytes, list_type, "");
break; break;
} }