-
Notifications
You must be signed in to change notification settings - Fork 457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
miniupnpc.c: use SOCKET under windows #778
base: master
Are you sure you want to change the base?
Conversation
@irwir does it fixes your problem ? |
This complicates code but does not resolve the isssue: 32-bit signed integer vs unsigned 32 and 64-bit requires type casts with potential loss of data. |
@irwir the prototype has been unchanged for at least 13 years and never has been a problem. char *
simpleUPnPcommand(int, const char *, const char *,
const char *, struct UPNParg *,
int *); winsock2.h defines SOCKET as follow : |
For the last 6 years it was SOCKET; the link to the commit was given in my issue.
Where you have got this header? |
IMHO: Would this be a reason for good code quality in a well maintained open source project? And:
😕 ??? |
I think there is a confusion between
From mingw32. To fix this issue for good the miniupnpc API should be modified to use |
The first argument is used as a socket, hence it must be
The correct file for mingw is _socket_types.h |
In fact the 1st argument should be removed. It is not used internally in miniupnpc. |
Things may change in next versions, but this is the current code: miniupnp/miniupnpc/src/miniupnpc.c Lines 200 to 203 in a715632
connecthostport returns SOCKET type, and int s is not big enough for a 64-bit value.
|
The suggestion would be to add local |
that is exactly what this PR is doing : declaring s as |
It does, but in a strange way. |
Yes I see that passing a socket in first argument is indeed bugged. |
fixes #777