# HG changeset patch # User Herman Bloggs # Date 1043349948 0 # Node ID 217572342740fba77d66cb198e6ccfc6d3670f21 # Parent cb629f3efee68201168a6c31964bccd24026b2d8 [gaim-migrate @ 4675] wgaim_escape_dirsep committer: Tailor Script diff -r cb629f3efee6 -r 217572342740 src/win32/win32dep.c --- a/src/win32/win32dep.c Thu Jan 23 19:24:12 2003 +0000 +++ b/src/win32/win32dep.c Thu Jan 23 19:25:48 2003 +0000 @@ -92,6 +92,33 @@ return gaimexe_hInstance; } +/* Escape windows dir separators. This is needed when paths are saved, + and on being read back have their '\' chars used as an escape char. + Returns and allocated string which needs to be freed. +*/ +char* wgaim_escape_dirsep( char* filename ) { + int sepcount=0; + char* ret=NULL; + int cnt=0; + + ret = filename; + while(*ret) { + if(*ret == '\\') + sepcount++; + ret++; + } + ret = g_malloc0(strlen(filename) + sepcount + 1); + while(*filename) { + ret[cnt] = *filename; + if(*filename == '\\') + ret[++cnt] = '\\'; + filename++; + cnt++; + } + ret[cnt] = '\0'; + return ret; +} + /* Determine whether the specified dll contains the specified procedure. If so, load it (if not already loaded). */ FARPROC wgaim_find_and_loadproc( char* dllname, char* procedure ) { @@ -210,7 +237,6 @@ void wgaim_init(void) { WORD wVersionRequested; WSADATA wsaData; - int err; char* locale=0; char newenv[128]; @@ -226,10 +252,7 @@ */ wVersionRequested = MAKEWORD( 2, 2 ); - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) { - return 1; - } + WSAStartup( wVersionRequested, &wsaData ); /* Confirm that the winsock DLL supports 2.2 */ /* Note that if the DLL supports versions greater than @@ -240,7 +263,6 @@ HIBYTE( wsaData.wVersion ) != 2 ) { debug_printf("Could not find a usable WinSock DLL. Oh well.\n"); WSACleanup( ); - return 1; } /* get default locale */ diff -r cb629f3efee6 -r 217572342740 src/win32/win32dep.h --- a/src/win32/win32dep.h Thu Jan 23 19:24:12 2003 +0000 +++ b/src/win32/win32dep.h Thu Jan 23 19:25:48 2003 +0000 @@ -22,6 +22,7 @@ FARPROC wgaim_find_and_loadproc(char*, char*); HINSTANCE wgaim_hinstance(void); extern void wgaim_im_blink(GtkWidget*); +extern char* wgaim_escape_dirsep(char*); /* Determine Gaim paths */ extern char* wgaim_install_dir(void);