Mercurial > pidgin
diff libpurple/win32/libc_interface.c @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | e60f5e8bb77e |
line wrap: on
line diff
--- a/libpurple/win32/libc_interface.c Mon Mar 19 06:11:46 2007 +0000 +++ b/libpurple/win32/libc_interface.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,5 +1,5 @@ /* - * gaim + * purple * * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> * @@ -41,7 +41,7 @@ static char errbuf[1024]; /* helpers */ -static int wgaim_is_socket( int fd ) { +static int wpurple_is_socket( int fd ) { int optval; unsigned int optlen = sizeof(int); @@ -50,7 +50,7 @@ if( error == WSAENOTSOCK ) return FALSE; else { - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_is_socket: getsockopt returned error: %d\n", error); + purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_is_socket: getsockopt returned error: %d\n", error); return FALSE; } } @@ -58,7 +58,7 @@ } /* socket.h */ -int wgaim_socket (int namespace, int style, int protocol) { +int wpurple_socket (int namespace, int style, int protocol) { int ret; ret = socket( namespace, style, protocol ); @@ -70,7 +70,7 @@ return ret; } -int wgaim_connect(int socket, struct sockaddr *addr, u_long length) { +int wpurple_connect(int socket, struct sockaddr *addr, u_long length) { int ret; ret = connect( socket, addr, length ); @@ -84,7 +84,7 @@ return 0; } -int wgaim_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) { +int wpurple_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) { if(getsockopt(socket, level, optname, optval, optlenptr) == SOCKET_ERROR ) { errno = WSAGetLastError(); return -1; @@ -92,7 +92,7 @@ return 0; } -int wgaim_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) { +int wpurple_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) { if(setsockopt(socket, level, optname, optval, optlen) == SOCKET_ERROR ) { errno = WSAGetLastError(); return -1; @@ -100,7 +100,7 @@ return 0; } -int wgaim_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) { +int wpurple_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) { if(getsockname(socket, addr, lenptr) == SOCKET_ERROR) { errno = WSAGetLastError(); return -1; @@ -108,7 +108,7 @@ return 0; } -int wgaim_bind(int socket, struct sockaddr *addr, socklen_t length) { +int wpurple_bind(int socket, struct sockaddr *addr, socklen_t length) { if(bind(socket, addr, length) == SOCKET_ERROR) { errno = WSAGetLastError(); return -1; @@ -116,7 +116,7 @@ return 0; } -int wgaim_listen(int socket, unsigned int n) { +int wpurple_listen(int socket, unsigned int n) { if(listen(socket, n) == SOCKET_ERROR) { errno = WSAGetLastError(); return -1; @@ -124,7 +124,7 @@ return 0; } -int wgaim_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { +int wpurple_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { int ret; if ((ret = sendto(socket, buf, len, flags, to, tolen) ) == SOCKET_ERROR) { @@ -136,7 +136,7 @@ /* fcntl.h */ /* This is not a full implementation of fcntl. Update as needed.. */ -int wgaim_fcntl(int socket, int command, int val) { +int wpurple_fcntl(int socket, int command, int val) { switch( command ) { case F_SETFL: { @@ -166,13 +166,13 @@ return 0; } default: - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_fcntl: Unsupported command\n"); + purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_fcntl: Unsupported command\n"); return -1; }/*end switch*/ } /* sys/ioctl.h */ -int wgaim_ioctl(int fd, int command, void* val) { +int wpurple_ioctl(int fd, int command, void* val) { switch( command ) { case FIONBIO: { @@ -225,7 +225,7 @@ } /* arpa/inet.h */ -int wgaim_inet_aton(const char *name, struct in_addr *addr) { +int wpurple_inet_aton(const char *name, struct in_addr *addr) { if((addr->s_addr = inet_addr(name)) == INADDR_NONE) return 0; else @@ -234,7 +234,7 @@ /* Thanks to GNU wget for this inet_ntop() implementation */ const char * -wgaim_inet_ntop (int af, const void *src, char *dst, socklen_t cnt) +wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt) { /* struct sockaddr can't accomodate struct sockaddr_in6. */ union { @@ -271,7 +271,7 @@ /* netdb.h */ -struct hostent* wgaim_gethostbyname(const char *name) { +struct hostent* wpurple_gethostbyname(const char *name) { struct hostent *hp; if((hp = gethostbyname(name)) == NULL) { @@ -282,7 +282,7 @@ } /* string.h */ -char* wgaim_strerror( int errornum ) { +char* wpurple_strerror( int errornum ) { if( errornum > WSABASEERR ) { sprintf( errbuf, "Windows socket error #%d", errornum ); return errbuf; @@ -296,10 +296,10 @@ /* * We need to figure out whether fd is a file or socket handle. */ -int wgaim_read(int fd, void *buf, unsigned int size) { +int wpurple_read(int fd, void *buf, unsigned int size) { int ret; - if(wgaim_is_socket(fd)) { + if(wpurple_is_socket(fd)) { if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) { errno = WSAGetLastError(); if(errno == WSAEWOULDBLOCK) @@ -323,7 +323,7 @@ } } -int wgaim_send(int fd, const void *buf, unsigned int size, int flags) { +int wpurple_send(int fd, const void *buf, unsigned int size, int flags) { int ret; ret = send(fd, buf, size, flags); @@ -337,15 +337,15 @@ return ret; } -int wgaim_write(int fd, const void *buf, unsigned int size) { +int wpurple_write(int fd, const void *buf, unsigned int size) { - if(wgaim_is_socket(fd)) - return wgaim_send(fd, buf, size, 0); + if(wpurple_is_socket(fd)) + return wpurple_send(fd, buf, size, 0); else return write(fd, buf, size); } -int wgaim_recv(int fd, void *buf, size_t len, int flags) { +int wpurple_recv(int fd, void *buf, size_t len, int flags) { int ret; if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) { @@ -358,10 +358,10 @@ } } -int wgaim_close(int fd) { +int wpurple_close(int fd) { int ret; - if( wgaim_is_socket(fd) ) { + if( wpurple_is_socket(fd) ) { if( (ret = closesocket(fd)) == SOCKET_ERROR ) { errno = WSAGetLastError(); return -1; @@ -373,7 +373,7 @@ return close(fd); } -int wgaim_gethostname(char *name, size_t size) { +int wpurple_gethostname(char *name, size_t size) { if(gethostname(name, size) == SOCKET_ERROR) { errno = WSAGetLastError(); return -1; @@ -383,7 +383,7 @@ /* sys/time.h */ -int wgaim_gettimeofday(struct timeval *p, struct timezone *z) { +int wpurple_gettimeofday(struct timeval *p, struct timezone *z) { int res = 0; struct _timeb timebuffer; @@ -404,7 +404,7 @@ /* stdio.h */ -int wgaim_rename (const char *oldname, const char *newname) { +int wpurple_rename (const char *oldname, const char *newname) { struct stat oldstat, newstat; if(g_stat(oldname, &oldstat) == 0) { @@ -421,7 +421,7 @@ is not a sub dir of oldname, newname should be deleted and oldname should be renamed. */ - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_rename does not behave here as it should\n"); + purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_rename does not behave here as it should\n"); return g_rename(oldname, newname); } } @@ -453,7 +453,7 @@ /* time.h */ -struct tm * wgaim_localtime_r (const time_t *time, struct tm *resultp) { +struct tm * wpurple_localtime_r (const time_t *time, struct tm *resultp) { struct tm* tmptm; if(!time) @@ -466,7 +466,7 @@ } /* - * Used by gaim_utf8_strftime() by way of gaim_internal_strftime() + * Used by purple_utf8_strftime() by way of purple_internal_strftime() * in src/util.c * * Code derived from PostgreSQL src/timezone/pgtz.c: @@ -845,7 +845,7 @@ }; const char * -wgaim_get_timezone_abbreviation(const struct tm *tm) +wpurple_get_timezone_abbreviation(const struct tm *tm) { int i; char tzname[128]; @@ -855,13 +855,13 @@ if (!tm) { - gaim_debug_warning("wgaim", "could not determine current date/time: localtime failed\n"); + purple_debug_warning("wpurple", "could not determine current date/time: localtime failed\n"); return ""; } if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0) { - gaim_debug_error("wgaim", "timezone name is too long for the buffer\n"); + purple_debug_error("wpurple", "timezone name is too long for the buffer\n"); return ""; } @@ -870,7 +870,7 @@ if (strcmp(tzname, win32_tzmap[i].wstd) == 0) { #if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", + purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n", win32_tzmap[i].ustd, tzname); #endif /* Cache the Result */ @@ -886,7 +886,7 @@ if (strcmp(tzname, win32_tzmap[i].wdst) == 0) { #if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", + purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n", win32_tzmap[i].udst, tzname); #endif /* Cache the Result */ @@ -913,7 +913,7 @@ KEY_READ, &rootKey) != ERROR_SUCCESS) { - gaim_debug_warning("wgaim", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError()); + purple_debug_warning("wpurple", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError()); return ""; } @@ -939,13 +939,13 @@ { if (r == ERROR_NO_MORE_ITEMS) break; - gaim_debug_warning("wgaim", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r); + purple_debug_warning("wpurple", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r); break; } if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS) { - gaim_debug_warning("wgaim", "could not open registry subkey to identify Windows timezone: %i\n", (int) r); + purple_debug_warning("wpurple", "could not open registry subkey to identify Windows timezone: %i\n", (int) r); break; } @@ -953,7 +953,7 @@ namesize = sizeof(zonename); if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) { - gaim_debug_warning("wgaim", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r); + purple_debug_warning("wpurple", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r); RegCloseKey(key); break; } @@ -968,7 +968,7 @@ namesize = sizeof(zonename); if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) { - gaim_debug_warning("wgaim", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r); + purple_debug_warning("wpurple", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r); RegCloseKey(key); break; } @@ -993,7 +993,7 @@ if (strcmp(localtzname, win32_tzmap[i].wstd) == 0) { #if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", + purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", win32_tzmap[i].ustd, tzname, localtzname); #endif /* Cache the Result */ @@ -1007,7 +1007,7 @@ if (strcmp(localtzname, win32_tzmap[i].wdst) == 0) { #if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", + purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", win32_tzmap[i].udst, tzname, localtzname); #endif /* Cache the Result */ @@ -1022,7 +1022,7 @@ } } - gaim_debug_warning("wgaim", "could not find a match for Windows timezone \"%s\"\n", tzname); + purple_debug_warning("wpurple", "could not find a match for Windows timezone \"%s\"\n", tzname); return ""; } @@ -1048,7 +1048,7 @@ * Since: 2.8 */ int -wgaim_g_access (const gchar *filename, +wpurple_g_access (const gchar *filename, int mode) { if (G_WIN32_HAVE_WIDECHAR_API ())