(posix_close, posix_read, posix_write) [_WIN32]:
Move CANT_REACH() and return -1 into a default case. Removes warnings for MinGW of potential missing cases. (posix_accept, posix_socket) [_WIN32]: Switch handle to SOCKET to match Windows call. Cast to an int for translation map.
This commit is contained in:
parent
c7546923e9
commit
b65c2dd5ba
1 changed files with 12 additions and 9 deletions
|
@ -223,7 +223,8 @@ int
|
||||||
posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
|
posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
{
|
{
|
||||||
int new_fd;
|
int new_fd;
|
||||||
int handle, new_handle;
|
int handle;
|
||||||
|
SOCKET new_handle;
|
||||||
|
|
||||||
if (!lookup_handle(fd, FDMAP_IO_SOCKET, ENOTSOCK, NULL, &handle))
|
if (!lookup_handle(fd, FDMAP_IO_SOCKET, ENOTSOCK, NULL, &handle))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -238,7 +239,7 @@ posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
errno = WSAGetLastError();
|
errno = WSAGetLastError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
set_fd(new_fd, FDMAP_IO_SOCKET, new_handle);
|
set_fd(new_fd, FDMAP_IO_SOCKET, (int)new_handle);
|
||||||
return new_fd;
|
return new_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +305,7 @@ posix_shutdown(int fd, int how)
|
||||||
int
|
int
|
||||||
posix_socket(int domain, int type, int protocol)
|
posix_socket(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
int handle;
|
SOCKET handle;
|
||||||
int new_fd;
|
int new_fd;
|
||||||
|
|
||||||
if ((new_fd = get_fd()) < 0)
|
if ((new_fd = get_fd()) < 0)
|
||||||
|
@ -316,7 +317,7 @@ posix_socket(int domain, int type, int protocol)
|
||||||
errno = WSAGetLastError();
|
errno = WSAGetLastError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
set_fd(new_fd, FDMAP_IO_SOCKET, handle);
|
set_fd(new_fd, FDMAP_IO_SOCKET, (int)handle);
|
||||||
return new_fd;
|
return new_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,9 +388,10 @@ posix_close(int fd)
|
||||||
return result;
|
return result;
|
||||||
case FDMAP_IO_FILE:
|
case FDMAP_IO_FILE:
|
||||||
return _close(handle);
|
return _close(handle);
|
||||||
|
default:
|
||||||
|
CANT_REACH();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
CANT_REACH();
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -479,9 +481,10 @@ posix_open(const char *fname, int oflag, ...)
|
||||||
return result; \
|
return result; \
|
||||||
case FDMAP_IO_FILE: \
|
case FDMAP_IO_FILE: \
|
||||||
return (file_expr); \
|
return (file_expr); \
|
||||||
} \
|
default: \
|
||||||
CANT_REACH(); \
|
CANT_REACH(); \
|
||||||
return -1;
|
return -1; \
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POSIX equivalent for read().
|
* POSIX equivalent for read().
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue