summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/gg.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2016-06-19 00:50:49 +0000
committerSzymon Tokarz <wsx22@o2.pl>2016-06-19 00:50:49 +0000
commit58613ba2100154117afdffe63853bbb95a2901da (patch)
treef6013a156869edd3549351cb91cce38556352c2e /protocols/Gadu-Gadu/src/gg.cpp
parent7ca306fd83e41b3ee0e45f24c17bd2b04d0fe87e (diff)
Gadu-Gadu protocol
Fix strerror related loging - GG\libgadu code uses ansi logging (enabled only in debug mode) - use: as_strerror(errno) to properly override strerror(errno) - use properly strerror, _tcserror, as_strerror, ws_strerror in GG code git-svn-id: http://svn.miranda-ng.org/main/trunk@17008 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/gg.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index e218ad8cde..feb65aa5d9 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -75,6 +75,26 @@ TCHAR* ws_strerror(int code)
return _tcserror(code);
}
+char* as_strerror(int code)
+{
+ static char err_desc[160];
+
+ // Not a windows error display WinSock
+ if (code == 0)
+ {
+ char buff[128];
+ int len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
+ if (len == 0)
+ mir_snprintf(err_desc, "WinSock %u: Unknown error.", WSAGetLastError());
+ else
+ mir_snprintf(err_desc, "WinSock %d: %s", WSAGetLastError(), buff);
+ return err_desc;
+ }
+
+ // Return normal error
+ return strerror(code);
+}
+
//////////////////////////////////////////////////////////
// Build the crc table
void crc_gentable(void)