diff --git a/ChangeLog b/ChangeLog index 407af6f015..567e53eb59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Jul 16 15:52:50 2005 Hirokazu Yamamoto + + * win32/win32.[hc]: constified socket functions. [ruby-dev:26553] + Fri Jul 15 23:59:03 2005 Nobuyoshi Nakada * lib/rdoc/parsers/parse_c.rb (handle_class_module): handle a diff --git a/win32/win32.c b/win32/win32.c index 588aecb1f0..7345f3d2df 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -410,7 +410,7 @@ static void init_env(void) NTLoginName[len] = '\0'; } -static void init_stdhandle(); +static void init_stdhandle(void); // // Initialization stuff @@ -447,7 +447,7 @@ NtInitialize(int *argc, char ***argv) } char * -getlogin() +getlogin(void) { return NTLoginName; } @@ -1664,7 +1664,7 @@ rb_w32_open_osfhandle(long osfhandle, int flags) } static void -init_stdhandle() +init_stdhandle(void) { if (fileno(stdin) < 0) { stdin->_file = 0; @@ -1682,7 +1682,7 @@ init_stdhandle() #define _set_osflags(fh, flags) (void)((fh), (flags)) static void -init_stdhandle() +init_stdhandle(void) { } #endif @@ -2044,7 +2044,7 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen) #undef bind int -rb_w32_bind(int s, struct sockaddr *addr, int addrlen) +rb_w32_bind(int s, const struct sockaddr *addr, int addrlen) { int r; @@ -2062,7 +2062,7 @@ rb_w32_bind(int s, struct sockaddr *addr, int addrlen) #undef connect int -rb_w32_connect(int s, struct sockaddr *addr, int addrlen) +rb_w32_connect(int s, const struct sockaddr *addr, int addrlen) { int r; if (!NtSocketsInitialized) { @@ -2206,7 +2206,7 @@ rb_w32_recvfrom(int s, char *buf, int len, int flags, #undef send int -rb_w32_send(int s, char *buf, int len, int flags) +rb_w32_send(int s, const char *buf, int len, int flags) { int r; if (!NtSocketsInitialized) { @@ -2223,8 +2223,8 @@ rb_w32_send(int s, char *buf, int len, int flags) #undef sendto int -rb_w32_sendto(int s, char *buf, int len, int flags, - struct sockaddr *to, int tolen) +rb_w32_sendto(int s, const char *buf, int len, int flags, + const struct sockaddr *to, int tolen) { int r; if (!NtSocketsInitialized) { @@ -2241,7 +2241,7 @@ rb_w32_sendto(int s, char *buf, int len, int flags, #undef setsockopt int -rb_w32_setsockopt(int s, int level, int optname, char *optval, int optlen) +rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen) { int r; if (!NtSocketsInitialized) { @@ -2339,7 +2339,7 @@ rb_w32_socket(int af, int type, int protocol) #undef gethostbyaddr struct hostent * -rb_w32_gethostbyaddr (char *addr, int len, int type) +rb_w32_gethostbyaddr (const char *addr, int len, int type) { struct hostent *r; if (!NtSocketsInitialized) { @@ -2356,7 +2356,7 @@ rb_w32_gethostbyaddr (char *addr, int len, int type) #undef gethostbyname struct hostent * -rb_w32_gethostbyname (char *name) +rb_w32_gethostbyname (const char *name) { struct hostent *r; if (!NtSocketsInitialized) { @@ -2390,7 +2390,7 @@ rb_w32_gethostname (char *name, int len) #undef getprotobyname struct protoent * -rb_w32_getprotobyname (char *name) +rb_w32_getprotobyname (const char *name) { struct protoent *r; if (!NtSocketsInitialized) { @@ -2424,7 +2424,7 @@ rb_w32_getprotobynumber (int num) #undef getservbyname struct servent * -rb_w32_getservbyname (char *name, char *proto) +rb_w32_getservbyname (const char *name, const char *proto) { struct servent *r; if (!NtSocketsInitialized) { @@ -2441,7 +2441,7 @@ rb_w32_getservbyname (char *name, char *proto) #undef getservbyport struct servent * -rb_w32_getservbyport (int port, char *proto) +rb_w32_getservbyport (int port, const char *proto) { struct servent *r; if (!NtSocketsInitialized) { @@ -2568,9 +2568,9 @@ void endservent(void) {} struct netent *getnetent (void) {return (struct netent *) NULL;} -struct netent *getnetbyaddr(char *name) {return (struct netent *)NULL;} +struct netent *getnetbyaddr(long net, int type) {return (struct netent *)NULL;} -struct netent *getnetbyname(long net, int type) {return (struct netent *)NULL;} +struct netent *getnetbyname(const char *name) {return (struct netent *)NULL;} struct protoent *getprotoent (void) {return (struct protoent *) NULL;} @@ -2737,9 +2737,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz) } char * -rb_w32_getcwd(buffer, size) - char *buffer; - int size; +rb_w32_getcwd(char *buffer, int size) { int length; char *bp; @@ -3701,7 +3699,7 @@ rb_w32_isatty(int fd) #ifdef __BORLANDC__ static int -too_many_files() +too_many_files(void) { FILE *f; for (f = _streams; f < _streams + _nfile; f++) { diff --git a/win32/win32.h b/win32/win32.h index ef4120dd8d..a347f04f7a 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -146,8 +146,8 @@ extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *); extern int flock(int fd, int oper); extern int rb_w32_is_socket(int); extern int rb_w32_accept(int, struct sockaddr *, int *); -extern int rb_w32_bind(int, struct sockaddr *, int); -extern int rb_w32_connect(int, struct sockaddr *, int); +extern int rb_w32_bind(int, const struct sockaddr *, int); +extern int rb_w32_connect(int, const struct sockaddr *, int); extern void rb_w32_fdset(int, fd_set*); extern void rb_w32_fdclr(int, fd_set*); extern int rb_w32_fdisset(int, fd_set*); @@ -159,19 +159,19 @@ extern int rb_w32_ioctlsocket(int, long, u_long *); extern int rb_w32_listen(int, int); extern int rb_w32_recv(int, char *, int, int); extern int rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *); -extern int rb_w32_send(int, char *, int, int); -extern int rb_w32_sendto(int, char *, int, int, struct sockaddr *, int); -extern int rb_w32_setsockopt(int, int, int, char *, int); +extern int rb_w32_send(int, const char *, int, int); +extern int rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int); +extern int rb_w32_setsockopt(int, int, int, const char *, int); extern int rb_w32_shutdown(int, int); extern int rb_w32_socket(int, int, int); extern SOCKET rb_w32_get_osfhandle(int); -extern struct hostent * rb_w32_gethostbyaddr(char *, int, int); -extern struct hostent * rb_w32_gethostbyname(char *); +extern struct hostent * rb_w32_gethostbyaddr(const char *, int, int); +extern struct hostent * rb_w32_gethostbyname(const char *); extern int rb_w32_gethostname(char *, int); -extern struct protoent * rb_w32_getprotobyname(char *); +extern struct protoent * rb_w32_getprotobyname(const char *); extern struct protoent * rb_w32_getprotobynumber(int); -extern struct servent * rb_w32_getservbyname(char *, char *); -extern struct servent * rb_w32_getservbyport(int, char *); +extern struct servent * rb_w32_getservbyname(const char *, const char *); +extern struct servent * rb_w32_getservbyport(int, const char *); extern int rb_w32_socketpair(int, int, int, int *); extern char * rb_w32_getenv(const char *); extern int rb_w32_rename(const char *, const char *);