Constified possible data

This commit is contained in:
Nobuyoshi Nakada 2021-02-23 19:08:31 +09:00
parent 19cc24b34b
commit da18d6f015
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -137,7 +137,7 @@ static FARPROC get_proc_address(const char *module, const char *func, HANDLE *mh
#define RUBY_CRITICAL if (0) {} else /* just remark */ #define RUBY_CRITICAL if (0) {} else /* just remark */
/* errno mapping */ /* errno mapping */
static struct { static const struct {
DWORD winerr; DWORD winerr;
int err; int err;
} errmap[] = { } errmap[] = {
@ -3318,12 +3318,12 @@ rb_w32_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
/* License: Ruby's */ /* License: Ruby's */
static FARPROC static FARPROC
get_wsa_extension_function(SOCKET s, GUID *guid) get_wsa_extension_function(SOCKET s, GUID guid)
{ {
DWORD dmy; DWORD dmy;
FARPROC ptr = NULL; FARPROC ptr = NULL;
WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, guid, sizeof(*guid), WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid),
&ptr, sizeof(ptr), &dmy, NULL, NULL); &ptr, sizeof(ptr), &dmy, NULL, NULL);
if (!ptr) if (!ptr)
errno = ENOSYS; errno = ENOSYS;
@ -3694,8 +3694,8 @@ recvmsg(int fd, struct msghdr *msg, int flags)
s = TO_SOCKET(fd); s = TO_SOCKET(fd);
if (!pWSARecvMsg) { if (!pWSARecvMsg) {
static GUID guid = WSAID_WSARECVMSG; static const GUID guid = WSAID_WSARECVMSG;
pWSARecvMsg = (WSARecvMsg_t)get_wsa_extension_function(s, &guid); pWSARecvMsg = (WSARecvMsg_t)get_wsa_extension_function(s, guid);
if (!pWSARecvMsg) if (!pWSARecvMsg)
return -1; return -1;
} }
@ -3749,8 +3749,8 @@ sendmsg(int fd, const struct msghdr *msg, int flags)
s = TO_SOCKET(fd); s = TO_SOCKET(fd);
if (!pWSASendMsg) { if (!pWSASendMsg) {
static GUID guid = WSAID_WSASENDMSG; static const GUID guid = WSAID_WSASENDMSG;
pWSASendMsg = (WSASendMsg_t)get_wsa_extension_function(s, &guid); pWSASendMsg = (WSASendMsg_t)get_wsa_extension_function(s, guid);
if (!pWSASendMsg) if (!pWSASendMsg)
return -1; return -1;
} }
@ -5088,7 +5088,7 @@ rb_w32_read_reparse_point(const WCHAR *path, rb_w32_reparse_buffer_t *rp,
*len = ret / sizeof(WCHAR); *len = ret / sizeof(WCHAR);
} }
else if (rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { else if (rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
static const WCHAR *volume = L"Volume{"; static const WCHAR volume[] = L"Volume{";
enum {volume_prefix_len = rb_strlen_lit("\\??\\")}; enum {volume_prefix_len = rb_strlen_lit("\\??\\")};
name = ((char *)rp->MountPointReparseBuffer.PathBuffer + name = ((char *)rp->MountPointReparseBuffer.PathBuffer +
rp->MountPointReparseBuffer.SubstituteNameOffset + rp->MountPointReparseBuffer.SubstituteNameOffset +