comparison libpurple/win32/libc_interface.c @ 22505:22fef6b952a0

I was wondering why the more sane error messges were never appearing... now I know. There is also a fix here that uses glib's internal rename stuff on recent versions because it is more robust than our win32 version.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 17 Mar 2008 20:32:02 +0000
parents 8eaaa8966e4d
children 36e5b74b2f74
comparison
equal deleted inserted replaced
22504:a65a76072f31 22505:22fef6b952a0
318 char* wpurple_strerror(int errornum) { 318 char* wpurple_strerror(int errornum) {
319 if (errornum > WSABASEERR) { 319 if (errornum > WSABASEERR) {
320 switch(errornum) { 320 switch(errornum) {
321 case WSAECONNABORTED: /* 10053 */ 321 case WSAECONNABORTED: /* 10053 */
322 snprintf(errbuf, sizeof(errbuf), _("Connection interrupted by other software on your computer.")); 322 snprintf(errbuf, sizeof(errbuf), _("Connection interrupted by other software on your computer."));
323 break;
323 case WSAECONNRESET: /* 10054 */ 324 case WSAECONNRESET: /* 10054 */
324 snprintf(errbuf, sizeof(errbuf), _("Remote host closed connection.")); 325 snprintf(errbuf, sizeof(errbuf), _("Remote host closed connection."));
326 break;
325 case WSAETIMEDOUT: /* 10060 */ 327 case WSAETIMEDOUT: /* 10060 */
326 snprintf(errbuf, sizeof(errbuf), _("Connection timed out.")); 328 snprintf(errbuf, sizeof(errbuf), _("Connection timed out."));
329 break;
327 case WSAECONNREFUSED: /*10061 */ 330 case WSAECONNREFUSED: /*10061 */
328 snprintf(errbuf, sizeof(errbuf), _("Connection refused.")); 331 snprintf(errbuf, sizeof(errbuf), _("Connection refused."));
332 break;
329 default: 333 default:
330 snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum); 334 snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum);
331 } 335 }
332 } else { 336 } else {
333 const char *tmp = g_strerror(errornum); 337 const char *tmp = g_strerror(errornum);
449 453
450 /* stdio.h */ 454 /* stdio.h */
451 455
452 int wpurple_rename (const char *oldname, const char *newname) { 456 int wpurple_rename (const char *oldname, const char *newname) {
453 struct stat oldstat, newstat; 457 struct stat oldstat, newstat;
458
459 /* As of Glib 2.8.5, g_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING to behave more sanely */
460 if (glib_check_version(2, 8, 5) == NULL) {
461 return g_rename(oldname, newname);
462 }
454 463
455 if(g_stat(oldname, &oldstat) == 0) { 464 if(g_stat(oldname, &oldstat) == 0) {
456 /* newname exists */ 465 /* newname exists */
457 if(g_stat(newname, &newstat) == 0) { 466 if(g_stat(newname, &newstat) == 0) {
458 /* oldname is a dir */ 467 /* oldname is a dir */