comparison 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
comparison
equal deleted inserted replaced
15821:84b0f9b23ede 15822:32c366eeeb99
1 /* 1 /*
2 * gaim 2 * purple
3 * 3 *
4 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> 4 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
39 #endif 39 #endif
40 40
41 static char errbuf[1024]; 41 static char errbuf[1024];
42 42
43 /* helpers */ 43 /* helpers */
44 static int wgaim_is_socket( int fd ) { 44 static int wpurple_is_socket( int fd ) {
45 int optval; 45 int optval;
46 unsigned int optlen = sizeof(int); 46 unsigned int optlen = sizeof(int);
47 47
48 if( (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&optval, &optlen)) == SOCKET_ERROR ) { 48 if( (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&optval, &optlen)) == SOCKET_ERROR ) {
49 int error = WSAGetLastError(); 49 int error = WSAGetLastError();
50 if( error == WSAENOTSOCK ) 50 if( error == WSAENOTSOCK )
51 return FALSE; 51 return FALSE;
52 else { 52 else {
53 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_is_socket: getsockopt returned error: %d\n", error); 53 purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_is_socket: getsockopt returned error: %d\n", error);
54 return FALSE; 54 return FALSE;
55 } 55 }
56 } 56 }
57 return TRUE; 57 return TRUE;
58 } 58 }
59 59
60 /* socket.h */ 60 /* socket.h */
61 int wgaim_socket (int namespace, int style, int protocol) { 61 int wpurple_socket (int namespace, int style, int protocol) {
62 int ret; 62 int ret;
63 63
64 ret = socket( namespace, style, protocol ); 64 ret = socket( namespace, style, protocol );
65 65
66 if( ret == INVALID_SOCKET ) { 66 if( ret == INVALID_SOCKET ) {
68 return -1; 68 return -1;
69 } 69 }
70 return ret; 70 return ret;
71 } 71 }
72 72
73 int wgaim_connect(int socket, struct sockaddr *addr, u_long length) { 73 int wpurple_connect(int socket, struct sockaddr *addr, u_long length) {
74 int ret; 74 int ret;
75 75
76 ret = connect( socket, addr, length ); 76 ret = connect( socket, addr, length );
77 77
78 if( ret == SOCKET_ERROR ) { 78 if( ret == SOCKET_ERROR ) {
82 return -1; 82 return -1;
83 } 83 }
84 return 0; 84 return 0;
85 } 85 }
86 86
87 int wgaim_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) { 87 int wpurple_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) {
88 if(getsockopt(socket, level, optname, optval, optlenptr) == SOCKET_ERROR ) { 88 if(getsockopt(socket, level, optname, optval, optlenptr) == SOCKET_ERROR ) {
89 errno = WSAGetLastError(); 89 errno = WSAGetLastError();
90 return -1; 90 return -1;
91 } 91 }
92 return 0; 92 return 0;
93 } 93 }
94 94
95 int wgaim_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) { 95 int wpurple_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) {
96 if(setsockopt(socket, level, optname, optval, optlen) == SOCKET_ERROR ) { 96 if(setsockopt(socket, level, optname, optval, optlen) == SOCKET_ERROR ) {
97 errno = WSAGetLastError(); 97 errno = WSAGetLastError();
98 return -1; 98 return -1;
99 } 99 }
100 return 0; 100 return 0;
101 } 101 }
102 102
103 int wgaim_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) { 103 int wpurple_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) {
104 if(getsockname(socket, addr, lenptr) == SOCKET_ERROR) { 104 if(getsockname(socket, addr, lenptr) == SOCKET_ERROR) {
105 errno = WSAGetLastError(); 105 errno = WSAGetLastError();
106 return -1; 106 return -1;
107 } 107 }
108 return 0; 108 return 0;
109 } 109 }
110 110
111 int wgaim_bind(int socket, struct sockaddr *addr, socklen_t length) { 111 int wpurple_bind(int socket, struct sockaddr *addr, socklen_t length) {
112 if(bind(socket, addr, length) == SOCKET_ERROR) { 112 if(bind(socket, addr, length) == SOCKET_ERROR) {
113 errno = WSAGetLastError(); 113 errno = WSAGetLastError();
114 return -1; 114 return -1;
115 } 115 }
116 return 0; 116 return 0;
117 } 117 }
118 118
119 int wgaim_listen(int socket, unsigned int n) { 119 int wpurple_listen(int socket, unsigned int n) {
120 if(listen(socket, n) == SOCKET_ERROR) { 120 if(listen(socket, n) == SOCKET_ERROR) {
121 errno = WSAGetLastError(); 121 errno = WSAGetLastError();
122 return -1; 122 return -1;
123 } 123 }
124 return 0; 124 return 0;
125 } 125 }
126 126
127 int wgaim_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { 127 int wpurple_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) {
128 int ret; 128 int ret;
129 if ((ret = sendto(socket, buf, len, flags, to, tolen) 129 if ((ret = sendto(socket, buf, len, flags, to, tolen)
130 ) == SOCKET_ERROR) { 130 ) == SOCKET_ERROR) {
131 errno = WSAGetLastError(); 131 errno = WSAGetLastError();
132 return -1; 132 return -1;
134 return ret; 134 return ret;
135 } 135 }
136 136
137 /* fcntl.h */ 137 /* fcntl.h */
138 /* This is not a full implementation of fcntl. Update as needed.. */ 138 /* This is not a full implementation of fcntl. Update as needed.. */
139 int wgaim_fcntl(int socket, int command, int val) { 139 int wpurple_fcntl(int socket, int command, int val) {
140 switch( command ) { 140 switch( command ) {
141 case F_SETFL: 141 case F_SETFL:
142 { 142 {
143 int ret=0; 143 int ret=0;
144 144
164 return -1; 164 return -1;
165 } 165 }
166 return 0; 166 return 0;
167 } 167 }
168 default: 168 default:
169 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_fcntl: Unsupported command\n"); 169 purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_fcntl: Unsupported command\n");
170 return -1; 170 return -1;
171 }/*end switch*/ 171 }/*end switch*/
172 } 172 }
173 173
174 /* sys/ioctl.h */ 174 /* sys/ioctl.h */
175 int wgaim_ioctl(int fd, int command, void* val) { 175 int wpurple_ioctl(int fd, int command, void* val) {
176 switch( command ) { 176 switch( command ) {
177 case FIONBIO: 177 case FIONBIO:
178 { 178 {
179 if (ioctlsocket(fd, FIONBIO, (unsigned long *)val) == SOCKET_ERROR) { 179 if (ioctlsocket(fd, FIONBIO, (unsigned long *)val) == SOCKET_ERROR) {
180 errno = WSAGetLastError(); 180 errno = WSAGetLastError();
223 return -1; 223 return -1;
224 }/*end switch*/ 224 }/*end switch*/
225 } 225 }
226 226
227 /* arpa/inet.h */ 227 /* arpa/inet.h */
228 int wgaim_inet_aton(const char *name, struct in_addr *addr) { 228 int wpurple_inet_aton(const char *name, struct in_addr *addr) {
229 if((addr->s_addr = inet_addr(name)) == INADDR_NONE) 229 if((addr->s_addr = inet_addr(name)) == INADDR_NONE)
230 return 0; 230 return 0;
231 else 231 else
232 return 1; 232 return 1;
233 } 233 }
234 234
235 /* Thanks to GNU wget for this inet_ntop() implementation */ 235 /* Thanks to GNU wget for this inet_ntop() implementation */
236 const char * 236 const char *
237 wgaim_inet_ntop (int af, const void *src, char *dst, socklen_t cnt) 237 wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
238 { 238 {
239 /* struct sockaddr can't accomodate struct sockaddr_in6. */ 239 /* struct sockaddr can't accomodate struct sockaddr_in6. */
240 union { 240 union {
241 struct sockaddr_in6 sin6; 241 struct sockaddr_in6 sin6;
242 struct sockaddr_in sin; 242 struct sockaddr_in sin;
269 return (const char *) dst; 269 return (const char *) dst;
270 } 270 }
271 271
272 272
273 /* netdb.h */ 273 /* netdb.h */
274 struct hostent* wgaim_gethostbyname(const char *name) { 274 struct hostent* wpurple_gethostbyname(const char *name) {
275 struct hostent *hp; 275 struct hostent *hp;
276 276
277 if((hp = gethostbyname(name)) == NULL) { 277 if((hp = gethostbyname(name)) == NULL) {
278 errno = WSAGetLastError(); 278 errno = WSAGetLastError();
279 return NULL; 279 return NULL;
280 } 280 }
281 return hp; 281 return hp;
282 } 282 }
283 283
284 /* string.h */ 284 /* string.h */
285 char* wgaim_strerror( int errornum ) { 285 char* wpurple_strerror( int errornum ) {
286 if( errornum > WSABASEERR ) { 286 if( errornum > WSABASEERR ) {
287 sprintf( errbuf, "Windows socket error #%d", errornum ); 287 sprintf( errbuf, "Windows socket error #%d", errornum );
288 return errbuf; 288 return errbuf;
289 } 289 }
290 else 290 else
294 /* unistd.h */ 294 /* unistd.h */
295 295
296 /* 296 /*
297 * We need to figure out whether fd is a file or socket handle. 297 * We need to figure out whether fd is a file or socket handle.
298 */ 298 */
299 int wgaim_read(int fd, void *buf, unsigned int size) { 299 int wpurple_read(int fd, void *buf, unsigned int size) {
300 int ret; 300 int ret;
301 301
302 if(wgaim_is_socket(fd)) { 302 if(wpurple_is_socket(fd)) {
303 if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) { 303 if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) {
304 errno = WSAGetLastError(); 304 errno = WSAGetLastError();
305 if(errno == WSAEWOULDBLOCK) 305 if(errno == WSAEWOULDBLOCK)
306 errno = EAGAIN; 306 errno = EAGAIN;
307 return -1; 307 return -1;
321 /* fd is not a socket handle.. pass it off to read */ 321 /* fd is not a socket handle.. pass it off to read */
322 return read(fd, buf, size); 322 return read(fd, buf, size);
323 } 323 }
324 } 324 }
325 325
326 int wgaim_send(int fd, const void *buf, unsigned int size, int flags) { 326 int wpurple_send(int fd, const void *buf, unsigned int size, int flags) {
327 int ret; 327 int ret;
328 328
329 ret = send(fd, buf, size, flags); 329 ret = send(fd, buf, size, flags);
330 330
331 if (ret == SOCKET_ERROR) { 331 if (ret == SOCKET_ERROR) {
335 return -1; 335 return -1;
336 } 336 }
337 return ret; 337 return ret;
338 } 338 }
339 339
340 int wgaim_write(int fd, const void *buf, unsigned int size) { 340 int wpurple_write(int fd, const void *buf, unsigned int size) {
341 341
342 if(wgaim_is_socket(fd)) 342 if(wpurple_is_socket(fd))
343 return wgaim_send(fd, buf, size, 0); 343 return wpurple_send(fd, buf, size, 0);
344 else 344 else
345 return write(fd, buf, size); 345 return write(fd, buf, size);
346 } 346 }
347 347
348 int wgaim_recv(int fd, void *buf, size_t len, int flags) { 348 int wpurple_recv(int fd, void *buf, size_t len, int flags) {
349 int ret; 349 int ret;
350 350
351 if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) { 351 if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) {
352 errno = WSAGetLastError(); 352 errno = WSAGetLastError();
353 if(errno == WSAEWOULDBLOCK) 353 if(errno == WSAEWOULDBLOCK)
356 } else { 356 } else {
357 return ret; 357 return ret;
358 } 358 }
359 } 359 }
360 360
361 int wgaim_close(int fd) { 361 int wpurple_close(int fd) {
362 int ret; 362 int ret;
363 363
364 if( wgaim_is_socket(fd) ) { 364 if( wpurple_is_socket(fd) ) {
365 if( (ret = closesocket(fd)) == SOCKET_ERROR ) { 365 if( (ret = closesocket(fd)) == SOCKET_ERROR ) {
366 errno = WSAGetLastError(); 366 errno = WSAGetLastError();
367 return -1; 367 return -1;
368 } 368 }
369 else 369 else
371 } 371 }
372 else 372 else
373 return close(fd); 373 return close(fd);
374 } 374 }
375 375
376 int wgaim_gethostname(char *name, size_t size) { 376 int wpurple_gethostname(char *name, size_t size) {
377 if(gethostname(name, size) == SOCKET_ERROR) { 377 if(gethostname(name, size) == SOCKET_ERROR) {
378 errno = WSAGetLastError(); 378 errno = WSAGetLastError();
379 return -1; 379 return -1;
380 } 380 }
381 return 0; 381 return 0;
382 } 382 }
383 383
384 /* sys/time.h */ 384 /* sys/time.h */
385 385
386 int wgaim_gettimeofday(struct timeval *p, struct timezone *z) { 386 int wpurple_gettimeofday(struct timeval *p, struct timezone *z) {
387 int res = 0; 387 int res = 0;
388 struct _timeb timebuffer; 388 struct _timeb timebuffer;
389 389
390 if (z != 0) { 390 if (z != 0) {
391 _tzset(); 391 _tzset();
402 return res; 402 return res;
403 } 403 }
404 404
405 /* stdio.h */ 405 /* stdio.h */
406 406
407 int wgaim_rename (const char *oldname, const char *newname) { 407 int wpurple_rename (const char *oldname, const char *newname) {
408 struct stat oldstat, newstat; 408 struct stat oldstat, newstat;
409 409
410 if(g_stat(oldname, &oldstat) == 0) { 410 if(g_stat(oldname, &oldstat) == 0) {
411 /* newname exists */ 411 /* newname exists */
412 if(g_stat(newname, &newstat) == 0) { 412 if(g_stat(newname, &newstat) == 0) {
419 else { 419 else {
420 /* This is not quite right.. If newname is empty and 420 /* This is not quite right.. If newname is empty and
421 is not a sub dir of oldname, newname should be 421 is not a sub dir of oldname, newname should be
422 deleted and oldname should be renamed. 422 deleted and oldname should be renamed.
423 */ 423 */
424 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_rename does not behave here as it should\n"); 424 purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_rename does not behave here as it should\n");
425 return g_rename(oldname, newname); 425 return g_rename(oldname, newname);
426 } 426 }
427 } 427 }
428 /* oldname is not a dir */ 428 /* oldname is not a dir */
429 else { 429 else {
451 451
452 } 452 }
453 453
454 /* time.h */ 454 /* time.h */
455 455
456 struct tm * wgaim_localtime_r (const time_t *time, struct tm *resultp) { 456 struct tm * wpurple_localtime_r (const time_t *time, struct tm *resultp) {
457 struct tm* tmptm; 457 struct tm* tmptm;
458 458
459 if(!time) 459 if(!time)
460 return NULL; 460 return NULL;
461 tmptm = localtime(time); 461 tmptm = localtime(time);
464 else 464 else
465 return NULL; 465 return NULL;
466 } 466 }
467 467
468 /* 468 /*
469 * Used by gaim_utf8_strftime() by way of gaim_internal_strftime() 469 * Used by purple_utf8_strftime() by way of purple_internal_strftime()
470 * in src/util.c 470 * in src/util.c
471 * 471 *
472 * Code derived from PostgreSQL src/timezone/pgtz.c: 472 * Code derived from PostgreSQL src/timezone/pgtz.c:
473 * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c 473 * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c
474 */ 474 */
843 NULL, NULL 843 NULL, NULL
844 } 844 }
845 }; 845 };
846 846
847 const char * 847 const char *
848 wgaim_get_timezone_abbreviation(const struct tm *tm) 848 wpurple_get_timezone_abbreviation(const struct tm *tm)
849 { 849 {
850 int i; 850 int i;
851 char tzname[128]; 851 char tzname[128];
852 char localtzname[256]; 852 char localtzname[256];
853 HKEY rootKey; 853 HKEY rootKey;
854 int idx; 854 int idx;
855 855
856 if (!tm) 856 if (!tm)
857 { 857 {
858 gaim_debug_warning("wgaim", "could not determine current date/time: localtime failed\n"); 858 purple_debug_warning("wpurple", "could not determine current date/time: localtime failed\n");
859 return ""; 859 return "";
860 } 860 }
861 861
862 if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0) 862 if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0)
863 { 863 {
864 gaim_debug_error("wgaim", "timezone name is too long for the buffer\n"); 864 purple_debug_error("wpurple", "timezone name is too long for the buffer\n");
865 return ""; 865 return "";
866 } 866 }
867 867
868 for (i = 0; win32_tzmap[i].wstd != NULL; i++) 868 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
869 { 869 {
870 if (strcmp(tzname, win32_tzmap[i].wstd) == 0) 870 if (strcmp(tzname, win32_tzmap[i].wstd) == 0)
871 { 871 {
872 #if 0 872 #if 0
873 gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", 873 purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n",
874 win32_tzmap[i].ustd, tzname); 874 win32_tzmap[i].ustd, tzname);
875 #endif 875 #endif
876 /* Cache the Result */ 876 /* Cache the Result */
877 if (i > 0) { 877 if (i > 0) {
878 if (win32_tzmap[0].wstd[0] != '\0') 878 if (win32_tzmap[0].wstd[0] != '\0')
884 return win32_tzmap[i].ustd; 884 return win32_tzmap[i].ustd;
885 } 885 }
886 if (strcmp(tzname, win32_tzmap[i].wdst) == 0) 886 if (strcmp(tzname, win32_tzmap[i].wdst) == 0)
887 { 887 {
888 #if 0 888 #if 0
889 gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", 889 purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n",
890 win32_tzmap[i].udst, tzname); 890 win32_tzmap[i].udst, tzname);
891 #endif 891 #endif
892 /* Cache the Result */ 892 /* Cache the Result */
893 if (i > 0) { 893 if (i > 0) {
894 if (win32_tzmap[0].wdst[0] != '\0') 894 if (win32_tzmap[0].wdst[0] != '\0')
911 "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", 911 "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
912 0, 912 0,
913 KEY_READ, 913 KEY_READ,
914 &rootKey) != ERROR_SUCCESS) 914 &rootKey) != ERROR_SUCCESS)
915 { 915 {
916 gaim_debug_warning("wgaim", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError()); 916 purple_debug_warning("wpurple", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError());
917 return ""; 917 return "";
918 } 918 }
919 919
920 for (idx = 0;; idx++) 920 for (idx = 0;; idx++)
921 { 921 {
937 NULL, 937 NULL,
938 &lastwrite)) != ERROR_SUCCESS) 938 &lastwrite)) != ERROR_SUCCESS)
939 { 939 {
940 if (r == ERROR_NO_MORE_ITEMS) 940 if (r == ERROR_NO_MORE_ITEMS)
941 break; 941 break;
942 gaim_debug_warning("wgaim", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r); 942 purple_debug_warning("wpurple", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r);
943 break; 943 break;
944 } 944 }
945 945
946 if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS) 946 if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
947 { 947 {
948 gaim_debug_warning("wgaim", "could not open registry subkey to identify Windows timezone: %i\n", (int) r); 948 purple_debug_warning("wpurple", "could not open registry subkey to identify Windows timezone: %i\n", (int) r);
949 break; 949 break;
950 } 950 }
951 951
952 memset(zonename, 0, sizeof(zonename)); 952 memset(zonename, 0, sizeof(zonename));
953 namesize = sizeof(zonename); 953 namesize = sizeof(zonename);
954 if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) 954 if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
955 { 955 {
956 gaim_debug_warning("wgaim", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r); 956 purple_debug_warning("wpurple", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r);
957 RegCloseKey(key); 957 RegCloseKey(key);
958 break; 958 break;
959 } 959 }
960 if (strcmp(tzname, zonename) == 0) 960 if (strcmp(tzname, zonename) == 0)
961 { 961 {
966 } 966 }
967 memset(zonename, 0, sizeof(zonename)); 967 memset(zonename, 0, sizeof(zonename));
968 namesize = sizeof(zonename); 968 namesize = sizeof(zonename);
969 if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) 969 if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
970 { 970 {
971 gaim_debug_warning("wgaim", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r); 971 purple_debug_warning("wpurple", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r);
972 RegCloseKey(key); 972 RegCloseKey(key);
973 break; 973 break;
974 } 974 }
975 if (strcmp(tzname, zonename) == 0) 975 if (strcmp(tzname, zonename) == 0)
976 { 976 {
991 for (i = 0; win32_tzmap[i].wstd != NULL; i++) 991 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
992 { 992 {
993 if (strcmp(localtzname, win32_tzmap[i].wstd) == 0) 993 if (strcmp(localtzname, win32_tzmap[i].wstd) == 0)
994 { 994 {
995 #if 0 995 #if 0
996 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", 996 purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
997 win32_tzmap[i].ustd, tzname, localtzname); 997 win32_tzmap[i].ustd, tzname, localtzname);
998 #endif 998 #endif
999 /* Cache the Result */ 999 /* Cache the Result */
1000 if (win32_tzmap[0].wstd[0] != '\0') 1000 if (win32_tzmap[0].wstd[0] != '\0')
1001 g_free(win32_tzmap[0].wstd); 1001 g_free(win32_tzmap[0].wstd);
1005 return win32_tzmap[i].ustd; 1005 return win32_tzmap[i].ustd;
1006 } 1006 }
1007 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0) 1007 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0)
1008 { 1008 {
1009 #if 0 1009 #if 0
1010 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", 1010 purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
1011 win32_tzmap[i].udst, tzname, localtzname); 1011 win32_tzmap[i].udst, tzname, localtzname);
1012 #endif 1012 #endif
1013 /* Cache the Result */ 1013 /* Cache the Result */
1014 if (win32_tzmap[0].wdst[0] != '\0') 1014 if (win32_tzmap[0].wdst[0] != '\0')
1015 g_free(win32_tzmap[0].wdst); 1015 g_free(win32_tzmap[0].wdst);
1020 return win32_tzmap[i].udst; 1020 return win32_tzmap[i].udst;
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 gaim_debug_warning("wgaim", "could not find a match for Windows timezone \"%s\"\n", tzname); 1025 purple_debug_warning("wpurple", "could not find a match for Windows timezone \"%s\"\n", tzname);
1026 return ""; 1026 return "";
1027 } 1027 }
1028 1028
1029 #if !GLIB_CHECK_VERSION(2,8,0) 1029 #if !GLIB_CHECK_VERSION(2,8,0)
1030 /** 1030 /**
1046 * error. 1046 * error.
1047 * 1047 *
1048 * Since: 2.8 1048 * Since: 2.8
1049 */ 1049 */
1050 int 1050 int
1051 wgaim_g_access (const gchar *filename, 1051 wpurple_g_access (const gchar *filename,
1052 int mode) 1052 int mode)
1053 { 1053 {
1054 if (G_WIN32_HAVE_WIDECHAR_API ()) 1054 if (G_WIN32_HAVE_WIDECHAR_API ())
1055 { 1055 {
1056 wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); 1056 wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);