Web: Use std::numeric_limits and std::numbers instead of defines

This commit is contained in:
Benjamin Nauck
2025-03-27 19:50:28 +01:00
parent f773550a47
commit 8d228090de

View File

@@ -89,7 +89,7 @@ private:
if (!PyArg_ParseTuple(args.ptr(), "|si", &addr, &port)) {
throw Py::Exception();
}
if (port > USHRT_MAX) {
if (port > std::numeric_limits<unsigned short>::max()) {
throw Py::OverflowError("port number is greater than maximum");
}
else if (port < 0) {
@@ -121,7 +121,7 @@ private:
if (!PyArg_ParseTuple(args.ptr(), "|sii", &addr, &port, &timeout)) {
throw Py::Exception();
}
if (port > USHRT_MAX) {
if (port > std::numeric_limits<unsigned short>::max()) {
throw Py::OverflowError("port number is greater than maximum");
}
else if (port < 0) {