diff options
| author | Edwin Mons <edwin.mons@isode.com> | 2018-10-29 16:28:14 (GMT) |
|---|---|---|
| committer | Edwin Mons <edwin.mons@isode.com> | 2018-11-08 11:31:20 (GMT) |
| commit | cf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f (patch) | |
| tree | 69e11e13ff2e5127d2cbfcc164be761cf104a1b2 /Sluift/component.cpp | |
| parent | 5ce9e19ef0744f530a797c30a82e9723eb7ea306 (diff) | |
| download | swift-cf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f.zip swift-cf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f.tar.bz2 | |
Consistently use unsigned short for network ports
Network ports are now consistently stored as unsigned shorts, apart from
the options and user interface, where -1 is still used to denote the use
of default ports.
Test-Information:
Unit tests pass on macOS 10.13 and Debian 9
On macOS: tested the UI with various proxy and manual ports, behaviour
as expected.
Change-Id: I7a65f40083022887aa30ed7b21eadc56d0c52be1
Diffstat (limited to 'Sluift/component.cpp')
| -rw-r--r-- | Sluift/component.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Sluift/component.cpp b/Sluift/component.cpp index f3c2e37..c1b1da4 100644 --- a/Sluift/component.cpp +++ b/Sluift/component.cpp | |||
| @@ -96,13 +96,13 @@ SLUIFT_LUA_FUNCTION(Component, async_connect) { | |||
| 96 | SluiftComponent* component = getComponent(L); | 96 | SluiftComponent* component = getComponent(L); |
| 97 | 97 | ||
| 98 | std::string host; | 98 | std::string host; |
| 99 | int port = 0; | 99 | unsigned short port = 0; |
| 100 | if (lua_istable(L, 2)) { | 100 | if (lua_istable(L, 2)) { |
| 101 | if (boost::optional<std::string> hostString = Lua::getStringField(L, 2, "host")) { | 101 | if (boost::optional<std::string> hostString = Lua::getStringField(L, 2, "host")) { |
| 102 | host = *hostString; | 102 | host = *hostString; |
| 103 | } | 103 | } |
| 104 | if (boost::optional<int> portInt = Lua::getIntField(L, 2, "port")) { | 104 | if (boost::optional<int> portInt = Lua::getIntField(L, 2, "port")) { |
| 105 | port = *portInt; | 105 | port = boost::numeric_cast<unsigned short>(*portInt); |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | component->connect(host, port); | 108 | component->connect(host, port); |
Swift