summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-27 20:27:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-27 20:27:09 +0300
commitafc8206f4fc571d4923a922abd493882cebfe963 (patch)
tree0c1b56f8ed819da538b935cbbf87008f201929b6 /protocols
parent6e86c5f8e838457ad96d0b25f475eb0d2266fbee (diff)
minor code cleaning
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 770df68ddd..5c8e945453 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -244,15 +244,15 @@ static JabberErrorCodeToStrMapping[] = {
{ JABBER_ERROR_REMOTE_SERVER_ERROR, LPGENW("Remote server error") },
{ JABBER_ERROR_SERVICE_UNAVAILABLE, LPGENW("Service unavailable") },
{ JABBER_ERROR_REMOTE_SERVER_TIMEOUT, LPGENW("Remote server timeout") },
- { -1, LPGENW("Unknown error") }
};
wchar_t* JabberErrorStr(int errorCode)
{
- int i;
+ for (auto &it : JabberErrorCodeToStrMapping)
+ if (it.code == errorCode)
+ return it.str;
- for (i = 0; JabberErrorCodeToStrMapping[i].code != -1 && JabberErrorCodeToStrMapping[i].code != errorCode; i++);
- return JabberErrorCodeToStrMapping[i].str;
+ return LPGENW("Unknown error");
}
CMStringW JabberErrorMsg(const TiXmlElement *errorNode, int *pErrorCode)