mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
Allow binding to ports <1024 on non-linux builds (#136)
* Allow binding to ports <1024 on non-linux builds This seems to be only a restriction on Linux and Mac versions older then Mojave * Fix port check on djui_panel_join_ip_parse_port
This commit is contained in:
parent
ccf4952baa
commit
bb343f9ba2
2 changed files with 8 additions and 4 deletions
|
@ -27,7 +27,11 @@ static bool djui_panel_host_port_valid(void) {
|
|||
port += (*buffer - '0');
|
||||
buffer++;
|
||||
}
|
||||
#if __linux__
|
||||
return port >= 1024 && port <= 65535;
|
||||
#else
|
||||
return port <= 65535;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void djui_panel_host_port_text_change(struct DjuiBase* caller) {
|
||||
|
|
|
@ -52,13 +52,13 @@ static bool djui_panel_join_ip_parse_spacer(char** msg) {
|
|||
}
|
||||
|
||||
static bool djui_panel_join_ip_parse_port(char** msg) {
|
||||
int num = 0;
|
||||
int port = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
char c = **msg;
|
||||
if (c >= '0' && c <= '9') {
|
||||
// is number
|
||||
num *= 10;
|
||||
num += (c - '0');
|
||||
port *= 10;
|
||||
port += (c - '0');
|
||||
*msg = *msg + 1;
|
||||
} else if (i == 0) {
|
||||
return false;
|
||||
|
@ -67,7 +67,7 @@ static bool djui_panel_join_ip_parse_port(char** msg) {
|
|||
}
|
||||
}
|
||||
|
||||
return num >= 1024 && num <= 65535;
|
||||
return port <= 65535;
|
||||
}
|
||||
|
||||
static bool djui_panel_join_ip_valid(char* buffer) {
|
||||
|
|
Loading…
Reference in a new issue