aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--doc/build-osx.md4
-rwxr-xr-xshare/genbuild.sh2
-rw-r--r--src/hash.cpp69
-rw-r--r--src/limitedmap.h15
-rw-r--r--src/qt/bitcoingui.cpp14
-rw-r--r--src/qt/splashscreen.cpp4
-rw-r--r--src/rpcnet.cpp3
-rw-r--r--src/serialize.h2
-rw-r--r--src/test/crypto_tests.cpp2
10 files changed, 60 insertions, 57 deletions
diff --git a/README.md b/README.md
index d13011d6dc..cf650fe543 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ are testing multi-machine code that needs to operate across the internet.
If you are testing something that can run on one machine, run with the -regtest option.
In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests
-that run in -regest mode.
+that run in -regtest mode.
**DEBUG_LOCKORDER**
diff --git a/doc/build-osx.md b/doc/build-osx.md
index 5eeda5b08e..0364d3a01b 100644
--- a/doc/build-osx.md
+++ b/doc/build-osx.md
@@ -50,7 +50,7 @@ Running this command takes you into brew's interactive mode, which allows you to
$ brew install https://raw.github.com/mxcl/homebrew/master/Library/Formula/berkeley-db4.rb -–without-java
```
-These rest of these commands are run inside brew interactive mode:
+The rest of these commands are run inside brew interactive mode:
```
/private/tmp/berkeley-db4-UGpd0O/db-4.8.30 $ cd ..
/private/tmp/berkeley-db4-UGpd0O $ db-4.8.30/dist/configure --prefix=/usr/local/Cellar/berkeley-db4/4.8.30 --mandir=/usr/local/Cellar/berkeley-db4/4.8.30/share/man --enable-cxx
@@ -61,7 +61,7 @@ These rest of these commands are run inside brew interactive mode:
After exiting, you'll get a warning that the install is keg-only, which means it wasn't symlinked to `/usr/local`. You don't need it to link it to build bitcoin, but if you want to, here's how:
- $ brew --force link berkeley-db4
+ $ brew link --force berkeley-db4
### Building `bitcoind`
diff --git a/share/genbuild.sh b/share/genbuild.sh
index 0800b31229..679566e596 100755
--- a/share/genbuild.sh
+++ b/share/genbuild.sh
@@ -16,7 +16,7 @@ fi
DESC=""
SUFFIX=""
LAST_COMMIT_DATE=""
-if [ -e "$(which git 2>/dev/null)" -a -d ".git" ]; then
+if [ -e "$(which git 2>/dev/null)" -a $(git rev-parse --is-inside-work-tree 2>/dev/null) = "true" ]; then
# clean 'dirty' status of touched files that haven't been modified
git diff >/dev/null 2>/dev/null
diff --git a/src/hash.cpp b/src/hash.cpp
index 4ce4da4c30..218607a6fd 100644
--- a/src/hash.cpp
+++ b/src/hash.cpp
@@ -9,45 +9,48 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char
{
// The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
uint32_t h1 = nHashSeed;
- const uint32_t c1 = 0xcc9e2d51;
- const uint32_t c2 = 0x1b873593;
+ if (vDataToHash.size() > 0)
+ {
+ const uint32_t c1 = 0xcc9e2d51;
+ const uint32_t c2 = 0x1b873593;
- const int nblocks = vDataToHash.size() / 4;
+ const int nblocks = vDataToHash.size() / 4;
- //----------
- // body
- const uint32_t* blocks = (const uint32_t*)(&vDataToHash[0] + nblocks * 4);
+ //----------
+ // body
+ const uint32_t* blocks = (const uint32_t*)(&vDataToHash[0] + nblocks * 4);
- for (int i = -nblocks; i; i++) {
- uint32_t k1 = blocks[i];
+ for (int i = -nblocks; i; i++) {
+ uint32_t k1 = blocks[i];
- k1 *= c1;
- k1 = ROTL32(k1, 15);
- k1 *= c2;
+ k1 *= c1;
+ k1 = ROTL32(k1, 15);
+ k1 *= c2;
- h1 ^= k1;
- h1 = ROTL32(h1, 13);
- h1 = h1 * 5 + 0xe6546b64;
- }
+ h1 ^= k1;
+ h1 = ROTL32(h1, 13);
+ h1 = h1 * 5 + 0xe6546b64;
+ }
- //----------
- // tail
- const uint8_t* tail = (const uint8_t*)(&vDataToHash[0] + nblocks * 4);
-
- uint32_t k1 = 0;
-
- switch (vDataToHash.size() & 3) {
- case 3:
- k1 ^= tail[2] << 16;
- case 2:
- k1 ^= tail[1] << 8;
- case 1:
- k1 ^= tail[0];
- k1 *= c1;
- k1 = ROTL32(k1, 15);
- k1 *= c2;
- h1 ^= k1;
- };
+ //----------
+ // tail
+ const uint8_t* tail = (const uint8_t*)(&vDataToHash[0] + nblocks * 4);
+
+ uint32_t k1 = 0;
+
+ switch (vDataToHash.size() & 3) {
+ case 3:
+ k1 ^= tail[2] << 16;
+ case 2:
+ k1 ^= tail[1] << 8;
+ case 1:
+ k1 ^= tail[0];
+ k1 *= c1;
+ k1 = ROTL32(k1, 15);
+ k1 *= c2;
+ h1 ^= k1;
+ };
+ }
//----------
// finalization
diff --git a/src/limitedmap.h b/src/limitedmap.h
index 4bc8d9e5aa..03727d7c42 100644
--- a/src/limitedmap.h
+++ b/src/limitedmap.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2012 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2012-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_LIMITEDMAP_H
#define BITCOIN_LIMITEDMAP_H
-#include <assert.h> // TODO: remove
+#include <assert.h>
#include <map>
/** STL-like map container that only keeps the N elements with the highest value. */
@@ -59,12 +59,11 @@ public:
return;
}
// Shouldn't ever get here
- assert(0); //TODO remove me
- map.erase(itTarget);
+ assert(0);
}
void update(const_iterator itIn, const mapped_type& v)
{
- //TODO: When we switch to C++11, use map.erase(itIn, itIn) to get the non-const iterator
+ // TODO: When we switch to C++11, use map.erase(itIn, itIn) to get the non-const iterator.
iterator itTarget = map.find(itIn->first);
if (itTarget == map.end())
return;
@@ -77,9 +76,7 @@ public:
return;
}
// Shouldn't ever get here
- assert(0); //TODO remove me
- itTarget->second = v;
- rmap.insert(make_pair(v, itTarget));
+ assert(0);
}
size_type max_size() const { return nMaxSize; }
size_type max_size(size_type s)
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index dd5192982e..443bed14d7 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -662,6 +662,9 @@ void BitcoinGUI::setNumConnections(int count)
void BitcoinGUI::setNumBlocks(int count)
{
+ if(!clientModel)
+ return;
+
// Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
statusBar()->clearMessage();
@@ -832,7 +835,7 @@ void BitcoinGUI::changeEvent(QEvent *e)
#ifndef Q_OS_MAC // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
- if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
+ if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray())
{
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
@@ -847,16 +850,16 @@ void BitcoinGUI::changeEvent(QEvent *e)
void BitcoinGUI::closeEvent(QCloseEvent *event)
{
- if(clientModel)
- {
#ifndef Q_OS_MAC // Ignored on Mac
+ if(clientModel && clientModel->getOptionsModel())
+ {
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
!clientModel->getOptionsModel()->getMinimizeOnClose())
{
QApplication::quit();
}
-#endif
}
+#endif
QMainWindow::closeEvent(event);
}
@@ -917,8 +920,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
gotoSendCoinsPage();
return true;
}
- else
- return false;
+ return false;
}
void BitcoinGUI::setEncryptionStatus(int status)
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index 673e984691..4fe610794f 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -22,8 +22,6 @@
SplashScreen::SplashScreen(Qt::WindowFlags f, bool isTestNet) :
QWidget(0, f), curAlignment(0)
{
- //setAutoFillBackground(true);
-
// set reference point, paddings
int paddingRight = 50;
int paddingTop = 50;
@@ -114,6 +112,7 @@ SplashScreen::~SplashScreen()
void SplashScreen::slotFinish(QWidget *mainWin)
{
+ Q_UNUSED(mainWin);
hide();
}
@@ -180,4 +179,3 @@ void SplashScreen::closeEvent(QCloseEvent *event)
{
event->ignore();
}
-
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 95f42eb47f..fb159d96f6 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -11,6 +11,7 @@
#include "sync.h"
#include "timedata.h"
#include "util.h"
+#include "version.h"
#include <boost/foreach.hpp>
@@ -393,6 +394,8 @@ Value getnetworkinfo(const Array& params, bool fHelp)
Object obj;
obj.push_back(Pair("version", (int)CLIENT_VERSION));
+ obj.push_back(Pair("subversion",
+ FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>())));
obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION));
obj.push_back(Pair("localservices", strprintf("%016x", nLocalServices)));
obj.push_back(Pair("timeoffset", GetTimeOffset()));
diff --git a/src/serialize.h b/src/serialize.h
index 57f5fd069b..447d808dee 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -921,7 +921,7 @@ public:
Init(nTypeIn, nVersionIn);
}
- CDataStream(const std::vector<unsigned char>& vchIn, int nTypeIn, int nVersionIn) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
+ CDataStream(const std::vector<unsigned char>& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end())
{
Init(nTypeIn, nVersionIn);
}
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp
index a3eec270ee..68232a2ff1 100644
--- a/src/test/crypto_tests.cpp
+++ b/src/test/crypto_tests.cpp
@@ -32,7 +32,7 @@ void TestVector(const Hasher &h, const In &in, const Out &out) {
size_t len = insecure_rand() % ((in.size() - pos + 1) / 2 + 1);
hasher.Write((unsigned char*)&in[pos], len);
pos += len;
- if (pos > 0 && pos + 2 * out.size() > in.size()) {
+ if (pos > 0 && pos + 2 * out.size() > in.size() && pos < in.size()) {
// Test that writing the rest at once to a copy of a hasher works.
Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]);
BOOST_CHECK(hash == out);