This repository was archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 417
Mark all functions with a @safe interface as @trusted #3839
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,15 +45,15 @@ enum NI_MAXSERV = 32; | |
@nogc | ||
{ | ||
int WSAStartup(ushort wVersionRequested, LPWSADATA lpWSAData); | ||
int WSACleanup(); | ||
SOCKET socket(int af, int type, int protocol); | ||
@trusted int WSACleanup(); | ||
@trusted SOCKET socket(int af, int type, int protocol); | ||
int ioctlsocket(SOCKET s, int cmd, uint* argp); | ||
int bind(SOCKET s, const(sockaddr)* name, socklen_t namelen); | ||
int connect(SOCKET s, const(sockaddr)* name, socklen_t namelen); | ||
int listen(SOCKET s, int backlog); | ||
@trusted int listen(SOCKET s, int backlog); | ||
SOCKET accept(SOCKET s, sockaddr* addr, socklen_t* addrlen); | ||
int closesocket(SOCKET s); | ||
int shutdown(SOCKET s, int how); | ||
@trusted int closesocket(SOCKET s); | ||
@trusted int shutdown(SOCKET s, int how); | ||
int getpeername(SOCKET s, sockaddr* name, socklen_t* namelen); | ||
int getsockname(SOCKET s, sockaddr* name, socklen_t* namelen); | ||
int send(SOCKET s, const(void)* buf, int len, int flags); | ||
|
@@ -64,11 +64,11 @@ int getsockopt(SOCKET s, int level, int optname, void* optval, socklen_t* optlen | |
int setsockopt(SOCKET s, int level, int optname, const(void)* optval, socklen_t optlen); | ||
uint inet_addr(const char* cp); | ||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, const(timeval)* timeout); | ||
char* inet_ntoa(in_addr ina); | ||
@trusted char* inet_ntoa(in_addr ina); | ||
hostent* gethostbyname(const char* name); | ||
hostent* gethostbyaddr(const(void)* addr, int len, int type); | ||
protoent* getprotobyname(const char* name); | ||
protoent* getprotobynumber(int number); | ||
@trusted protoent* getprotobynumber(int number); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getprotobynumber#remarks says:
But the return value is mutable. So |
||
servent* getservbyname(const char* name, const char* proto); | ||
servent* getservbyport(int port, const char* proto); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inet_ntoa
cannot be@trusted
.https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-inet_ntoa#remarks says:
I.e., if you dereference the returned pointer after having called another Windows Sockets function, you've got undefined behavior. That's not safe.