Skip to content

Commit

Permalink
Merge pull request #93 from shane-kerr/warning-fixes
Browse files Browse the repository at this point in the history
Fix warnings from recent gcc versions
  • Loading branch information
shane-kerr authored Sep 14, 2018
2 parents 3c71e6a + 84e2bf0 commit d863259
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char
switch(vDataToHash.size() & 3)
{
case 3: k1 ^= tail[2] << 16;
// fall thru
case 2: k1 ^= tail[1] << 8;
// fall thru
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4235,7 +4235,9 @@ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash
unsigned char pchPadding1[64];
}
tmp;
memset(&tmp, 0, sizeof(tmp));
// We cast our structure to void* for this memset() to silence
// warnings from gcc.
memset((void *)&tmp, 0, sizeof(tmp));

tmp.block.nVersion = pblock->nVersion;
tmp.block.hashPrevBlock = pblock->hashPrevBlock;
Expand Down
8 changes: 7 additions & 1 deletion src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ CMessageHeader::CMessageHeader()
CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
{
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
strncpy(pchCommand, pszCommand, COMMAND_SIZE);
int i;
for (i=0; (i < COMMAND_SIZE) && (pszCommand[i] != '\0'); i++) {
pchCommand[i] = pszCommand[i];
}
while (i < COMMAND_SIZE) {
pchCommand[i++] = '\0';
}
nMessageSize = nMessageSizeIn;
nChecksum = 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
sRecurringSendEntries = value.toString();
settings.setValue("sRecurringSendEntries", sRecurringSendEntries);
}
break;
case PasswordOnSend:
bPasswordOnSend = value.toBool();
settings.setValue("bPasswordOnSend",bPasswordOnSend);
Expand Down

0 comments on commit d863259

Please sign in to comment.