aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/keystore.h2
-rw-r--r--src/qt/guiutil.cpp60
-rw-r--r--src/qt/guiutil.h57
-rw-r--r--src/qt/intro.cpp18
-rw-r--r--src/qt/receivecoinsdialog.cpp18
-rw-r--r--src/qt/receivecoinsdialog.h15
-rw-r--r--src/qt/transactionview.cpp10
-rw-r--r--src/qt/transactionview.h13
-rw-r--r--src/rpcprotocol.cpp2
-rw-r--r--src/rpcwallet.cpp3
-rw-r--r--src/test/bignum_tests.cpp7
-rw-r--r--src/test/netbase_tests.cpp2
13 files changed, 127 insertions, 83 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index da842a9e6f..c725c4f1c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,9 +90,7 @@ version.o: obj/build.h
libbitcoin_server_a_SOURCES = \
addrman.cpp \
alert.cpp \
- rpcserver.cpp \
bloom.cpp \
- chainparams.cpp \
checkpoints.cpp \
coins.cpp \
init.cpp \
@@ -107,6 +105,7 @@ libbitcoin_server_a_SOURCES = \
rpcmisc.cpp \
rpcnet.cpp \
rpcrawtransaction.cpp \
+ rpcserver.cpp \
txdb.cpp \
txmempool.cpp \
$(JSON_H) \
diff --git a/src/keystore.h b/src/keystore.h
index 0d55e6c81e..79d8661aca 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -32,7 +32,7 @@ public:
virtual void GetKeys(std::set<CKeyID> &setAddress) const =0;
virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
- // Support for BIP 0013 : see https://en.bitcoin.it/wiki/BIP_0013
+ // Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0;
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 4a4fece3e1..7b264d27c7 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -33,6 +33,9 @@
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
+#if BOOST_FILESYSTEM_VERSION >= 3
+#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
+#endif
#include <QAbstractItemView>
#include <QApplication>
@@ -54,6 +57,10 @@
#include <QUrlQuery>
#endif
+#if BOOST_FILESYSTEM_VERSION >= 3
+static boost::filesystem::detail::utf8_codecvt_facet utf8;
+#endif
+
namespace GUIUtil {
QString dateTimeStr(const QDateTime &date)
@@ -352,7 +359,7 @@ void openDebugLogfile()
/* Open debug.log with the associated application */
if (boost::filesystem::exists(pathDebug))
- QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string())));
+ QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug)));
}
ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) :
@@ -385,14 +392,15 @@ void TableViewLastColumnResizingFixer::connectViewHeadersSignals()
connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
}
-//we need to disconnect these while handling the resize events, otherwise we can enter infinite loops
+// We need to disconnect these while handling the resize events, otherwise we can enter infinite loops.
void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals()
{
disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int)));
disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
}
-//setup the resize mode, handles compatibility for QT5 and below as the method signatures changed. (refactored here for readability)
+// Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed.
+// Refactored here for readability.
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode)
{
#if QT_VERSION < 0x050000
@@ -402,7 +410,8 @@ void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex,
#endif
}
-void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) {
+void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width)
+{
tableView->setColumnWidth(nColumnIndex, width);
tableView->horizontalHeader()->resizeSection(nColumnIndex, width);
}
@@ -431,7 +440,7 @@ int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column)
return nResult;
}
-//make sure we don't make the columns wider than the table's viewport's width.
+// Make sure we don't make the columns wider than the tables viewport width.
void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
{
disconnectViewHeadersSignals();
@@ -446,14 +455,15 @@ void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
}
}
-//make column use all the space available, useful during window resizing.
-void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) {
+// Make column use all the space available, useful during window resizing.
+void TableViewLastColumnResizingFixer::stretchColumnWidth(int column)
+{
disconnectViewHeadersSignals();
resizeColumn(column, getAvailableWidthForColumn(column));
connectViewHeadersSignals();
}
-//when a section is resized this is a slot-proxy for ajustAmountColumnWidth()
+// When a section is resized this is a slot-proxy for ajustAmountColumnWidth().
void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize)
{
adjustTableColumnsWidth();
@@ -464,8 +474,8 @@ void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int o
}
}
-//when the table's geometry is ready, we manually perform the Stretch of the "Message" column
-//as the "Stretch" resize mode does not allow for interactive resizing.
+// When the tabless geometry is ready, we manually perform the stretch of the "Message" column,
+// as the "Stretch" resize mode does not allow for interactive resizing.
void TableViewLastColumnResizingFixer::on_geometriesChanged()
{
if ((getColumnsWidth() - this->tableView->horizontalHeader()->width()) != 0)
@@ -481,9 +491,9 @@ void TableViewLastColumnResizingFixer::on_geometriesChanged()
* the resize modes of the last 2 columns of the table and
*/
TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth) :
- tableView(table),
- lastColumnMinimumWidth(lastColMinimumWidth),
- allColumnsMinimumWidth(allColsMinimumWidth)
+ tableView(table),
+ lastColumnMinimumWidth(lastColMinimumWidth),
+ allColumnsMinimumWidth(allColsMinimumWidth)
{
columnCount = tableView->horizontalHeader()->count();
lastColumnIndex = columnCount - 1;
@@ -493,7 +503,6 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive);
}
-
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
@@ -718,4 +727,27 @@ void setClipboard(const QString& str)
QApplication::clipboard()->setText(str, QClipboard::Selection);
}
+#if BOOST_FILESYSTEM_VERSION >= 3
+boost::filesystem::path qstringToBoostPath(const QString &path)
+{
+ return boost::filesystem::path(path.toStdString(), utf8);
+}
+
+QString boostPathToQString(const boost::filesystem::path &path)
+{
+ return QString::fromStdString(path.string(utf8));
+}
+#else
+#warning Conversion between boost path and QString can use invalid character encoding with boost_filesystem v2 and older
+boost::filesystem::path qstringToBoostPath(const QString &path)
+{
+ return boost::filesystem::path(path.toStdString());
+}
+
+QString boostPathToQString(const boost::filesystem::path &path)
+{
+ return QString::fromStdString(path.string());
+}
+#endif
+
} // namespace GUIUtil
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 26202e8d41..4f9416d1af 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -5,11 +5,13 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
+#include <QHeaderView>
#include <QMessageBox>
#include <QObject>
#include <QString>
#include <QTableView>
-#include <QHeaderView>
+
+#include <boost/filesystem.hpp>
class QValidatedLineEdit;
class SendCoinsRecipient;
@@ -130,30 +132,31 @@ namespace GUIUtil
*/
class TableViewLastColumnResizingFixer: public QObject
{
- Q_OBJECT
- public:
- TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
- void stretchColumnWidth(int column);
+ Q_OBJECT
- private:
- QTableView* tableView;
- int lastColumnMinimumWidth;
- int allColumnsMinimumWidth;
- int lastColumnIndex;
- int columnCount;
- int secondToLastColumnIndex;
-
- void adjustTableColumnsWidth();
- int getAvailableWidthForColumn(int column);
- int getColumnsWidth();
- void connectViewHeadersSignals();
- void disconnectViewHeadersSignals();
- void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
- void resizeColumn(int nColumnIndex, int width);
-
- private slots:
- void on_sectionResized(int logicalIndex, int oldSize, int newSize);
- void on_geometriesChanged();
+ public:
+ TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
+ void stretchColumnWidth(int column);
+
+ private:
+ QTableView* tableView;
+ int lastColumnMinimumWidth;
+ int allColumnsMinimumWidth;
+ int lastColumnIndex;
+ int columnCount;
+ int secondToLastColumnIndex;
+
+ void adjustTableColumnsWidth();
+ int getAvailableWidthForColumn(int column);
+ int getColumnsWidth();
+ void connectViewHeadersSignals();
+ void disconnectViewHeadersSignals();
+ void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
+ void resizeColumn(int nColumnIndex, int width);
+
+ private slots:
+ void on_sectionResized(int logicalIndex, int oldSize, int newSize);
+ void on_geometriesChanged();
};
bool GetStartOnSystemStartup();
@@ -164,6 +167,12 @@ namespace GUIUtil
/** Restore window size and position */
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);
+ /* Convert QString to OS specific boost path through UTF-8 */
+ boost::filesystem::path qstringToBoostPath(const QString &path);
+
+ /* Convert OS specific boost path to QString through UTF-8 */
+ QString boostPathToQString(const boost::filesystem::path &path);
+
} // namespace GUIUtil
#endif // GUIUTIL_H
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 3bc19f8645..f342606495 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -5,9 +5,12 @@
#include "intro.h"
#include "ui_intro.h"
+#include "guiutil.h"
+
#include "util.h"
#include <boost/filesystem.hpp>
+
#include <QFileDialog>
#include <QSettings>
#include <QMessageBox>
@@ -59,7 +62,7 @@ void FreespaceChecker::check()
{
namespace fs = boost::filesystem;
QString dataDirStr = intro->getPathToCheck();
- fs::path dataDir = fs::path(dataDirStr.toStdString());
+ fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
uint64_t freeBytesAvailable = 0;
int replyStatus = ST_OK;
QString replyMessage = tr("A new data directory will be created.");
@@ -143,7 +146,7 @@ void Intro::setDataDirectory(const QString &dataDir)
QString Intro::getDefaultDataDirectory()
{
- return QString::fromStdString(GetDefaultDataDir().string());
+ return GUIUtil::boostPathToQString(GetDefaultDataDir());
}
void Intro::pickDataDirectory()
@@ -159,7 +162,7 @@ void Intro::pickDataDirectory()
/* 2) Allow QSettings to override default dir */
dataDir = settings.value("strDataDir", dataDir).toString();
- if(!fs::exists(dataDir.toStdString()) || GetBoolArg("-choosedatadir", false))
+ if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", false))
{
/* If current default data directory does not exist, let the user choose one */
Intro intro;
@@ -175,7 +178,7 @@ void Intro::pickDataDirectory()
}
dataDir = intro.getDataDirectory();
try {
- fs::create_directory(dataDir.toStdString());
+ fs::create_directory(GUIUtil::qstringToBoostPath(dataDir));
break;
} catch(fs::filesystem_error &e) {
QMessageBox::critical(0, tr("Bitcoin"),
@@ -186,7 +189,12 @@ void Intro::pickDataDirectory()
settings.setValue("strDataDir", dataDir);
}
- SoftSetArg("-datadir", dataDir.toStdString());
+ /* Only override -datadir if different from the default, to make it possible to
+ * override -datadir in the bitcoin.conf file in the default data directory
+ * (to be consistent with bitcoind behavior)
+ */
+ if(dataDir != getDefaultDataDirectory())
+ SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
}
void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index 007b13d648..3ccfb429a6 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -55,8 +55,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
}
-
-
void ReceiveCoinsDialog::setModel(WalletModel *model)
{
this->model = model;
@@ -79,11 +77,9 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
connect(tableView->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
- this,
+ SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
-
- //(last 2 columns are set when the table geometry is ready) by the columnResizingFixer.
+ // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH);
}
}
@@ -202,10 +198,12 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked()
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
}
-//We override the virtual resizeEvent of the QWidget to adjust tablet's column sizes as the table's width is proportional to the dialog's.
-void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event) {
- QWidget::resizeEvent(event);
- columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
+// We override the virtual resizeEvent of the QWidget to adjust tables column
+// sizes as the tables width is proportional to the dialogs width.
+void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event)
+{
+ QWidget::resizeEvent(event);
+ columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
}
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event)
diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h
index 1d051d9324..ab63331597 100644
--- a/src/qt/receivecoinsdialog.h
+++ b/src/qt/receivecoinsdialog.h
@@ -6,12 +6,13 @@
#define RECEIVECOINSDIALOG_H
#include <QDialog>
+#include <QHeaderView>
+#include <QItemSelection>
#include <QKeyEvent>
#include <QMenu>
#include <QPoint>
#include <QVariant>
-#include <QHeaderView>
-#include <QItemSelection>
+
#include "guiutil.h"
namespace Ui {
@@ -31,16 +32,16 @@ class ReceiveCoinsDialog : public QDialog
public:
enum ColumnWidths {
- DATE_COLUMN_WIDTH = 130,
- LABEL_COLUMN_WIDTH = 120,
- AMOUNT_MINIMUM_COLUMN_WIDTH = 160,
- MINIMUM_COLUMN_WIDTH = 130
+ DATE_COLUMN_WIDTH = 130,
+ LABEL_COLUMN_WIDTH = 120,
+ AMOUNT_MINIMUM_COLUMN_WIDTH = 160,
+ MINIMUM_COLUMN_WIDTH = 130
};
explicit ReceiveCoinsDialog(QWidget *parent = 0);
~ReceiveCoinsDialog();
- void setModel(WalletModel *model);
+ void setModel(WalletModel *model);
public slots:
void clear();
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index d178efe8d5..a363150919 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -438,8 +438,10 @@ void TransactionView::focusTransaction(const QModelIndex &idx)
transactionView->setFocus();
}
-//We override the virtual resizeEvent of the QWidget to adjust tablet's column sizes as the table's width is proportional to the dialog's.
-void TransactionView::resizeEvent(QResizeEvent* event) {
- QWidget::resizeEvent(event);
- columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
+// We override the virtual resizeEvent of the QWidget to adjust tables column
+// sizes as the tables width is proportional to the dialogs width.
+void TransactionView::resizeEvent(QResizeEvent* event)
+{
+ QWidget::resizeEvent(event);
+ columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index fe8e205d6c..ef4f9d6f34 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -5,9 +5,10 @@
#ifndef TRANSACTIONVIEW_H
#define TRANSACTIONVIEW_H
-#include <QWidget>
#include "guiutil.h"
+#include <QWidget>
+
class TransactionFilterProxy;
class WalletModel;
@@ -46,11 +47,11 @@ public:
};
enum ColumnWidths {
- STATUS_COLUMN_WIDTH = 23,
- DATE_COLUMN_WIDTH = 120,
- TYPE_COLUMN_WIDTH = 120,
- AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
- MINIMUM_COLUMN_WIDTH = 23
+ STATUS_COLUMN_WIDTH = 23,
+ DATE_COLUMN_WIDTH = 120,
+ TYPE_COLUMN_WIDTH = 120,
+ AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
+ MINIMUM_COLUMN_WIDTH = 23
};
private:
diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp
index 13028fdc77..652b14d187 100644
--- a/src/rpcprotocol.cpp
+++ b/src/rpcprotocol.cpp
@@ -221,7 +221,7 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
// unspecified (HTTP errors and contents of 'error').
//
// 1.0 spec: http://json-rpc.org/wiki/specification
-// 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http
+// 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html
// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
//
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index c8b2127264..a5a7df0867 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -1918,6 +1918,3 @@ Value getwalletinfo(const Array& params, bool fHelp)
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
return obj;
}
-
-
-
diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp
index 6587389a07..d5ee8c9778 100644
--- a/src/test/bignum_tests.cpp
+++ b/src/test/bignum_tests.cpp
@@ -39,11 +39,8 @@ BOOST_AUTO_TEST_SUITE(bignum_tests)
// stack buffer overruns.
//
// For more accurate diagnostics, you can use an undefined arithmetic operation
-// detector such as the clang-based tool:
-//
-// "IOC: An Integer Overflow Checker for C/C++"
-//
-// Available at: http://embed.cs.utah.edu/ioc/
+// detector such as the clang's undefined behaviour checker.
+// See also: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
//
// It might also be useful to use Google's AddressSanitizer to detect
// stack buffer overruns, which valgrind can't currently detect.
diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp
index 7d38700736..4321852d11 100644
--- a/src/test/netbase_tests.cpp
+++ b/src/test/netbase_tests.cpp
@@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(netbase_lookupnumeric)
BOOST_AUTO_TEST_CASE(onioncat_test)
{
- // values from http://www.cypherpunk.at/onioncat/wiki/OnionCat
+ // values from https://web.archive.org/web/20121122003543/http://www.cypherpunk.at/onioncat/wiki/OnionCat
CNetAddr addr1("5wyqrzbvrdsumnok.onion");
CNetAddr addr2("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca");
BOOST_CHECK(addr1 == addr2);