Browse Source

coding standards

cl-refactor
subtly 10 years ago
parent
commit
1cd510a541
  1. 8
      alethzero/Connect.h
  2. 8
      alethzero/MainWin.cpp
  3. 4
      libp2p/Network.h

8
alethzero/Connect.h

@ -35,15 +35,19 @@ public:
explicit Connect(QWidget* _parent = 0);
~Connect();
/// Populate host chooser with default host entries
void setEnvironment(QStringList const& _nodes);
/// clear dialogue inputs
void reset();
// Form field values:
/// @returns host string chosen or entered
QString host();
/// @returns NodeId entered
QString nodeId();
/// @returns true if Required is checked
bool required();
private:

8
alethzero/MainWin.cpp

@ -259,7 +259,7 @@ NetworkPreferences Main::netPrefs() const
}
catch (...)
{
listenIP = "";
listenIP.clear();
}
auto publicIP = ui->forcePublicIP->text().toStdString();
@ -269,11 +269,11 @@ NetworkPreferences Main::netPrefs() const
}
catch (...)
{
publicIP = "";
publicIP.clear();
}
if (isPublicAddress(publicIP))
return NetworkPreferences(publicIP, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked());
return NetworkPreferences(publicIP, listenIP, ui->port->value(), ui->upnp->isChecked());
else
return NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked());
}
@ -1796,7 +1796,7 @@ void Main::on_connect_triggered()
{
nodeID = NodeId(fromHex(m_connect.nodeId().toStdString()));
}
catch (BadHexCharacter()) {}
catch (BadHexCharacter&) {}
m_connect.reset();

4
libp2p/Network.h

@ -43,10 +43,10 @@ struct NetworkPreferences
NetworkPreferences(unsigned short lp = 30303): listenPort(lp) {}
// Network Preferences with specific Listen IP
NetworkPreferences(std::string l, unsigned short lp = 30303, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {}
NetworkPreferences(std::string const& l, unsigned short lp = 30303, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {}
// Network Preferences with intended Public IP
NetworkPreferences(std::string publicIP, std::string l = std::string(), unsigned short lp = 30303, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); }
NetworkPreferences(std::string const& publicIP, std::string const& l = std::string(), unsigned short lp = 30303, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); }
std::string publicIPAddress;
std::string listenIPAddress;

Loading…
Cancel
Save