diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-17 23:15:57 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-17 23:15:57 +0000 |
commit | 65cf85ee6e83594f4de5d6d06012bde070b6c6b1 (patch) | |
tree | 50b3747038b77088ee0bef29f6594a74807397c3 /protocols/Gadu-Gadu/src/token.cpp | |
parent | 2d26921c87c663de4725963d7da87c6eacd1e3d3 (diff) |
GaduGadu: Cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@14241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/token.cpp')
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 11f72ef8ce..14dc02b004 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -106,16 +106,12 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l // Gets GG token
int GGPROTO::gettoken(GGTOKEN *token)
{
- struct gg_http *h = NULL;
- struct gg_token *t = NULL;
- IMGSRVC_MEMIO memio = {0};
- GGTOKENDLGDATA dat = {0};
-
// Zero tokens
mir_strcpy(token->id, "");
mir_strcpy(token->val, "");
- if (!(h = gg_token(0)) || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
+ struct gg_http *h = gg_token(0);
+ if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
TCHAR error[128];
mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -123,22 +119,25 @@ int GGPROTO::gettoken(GGTOKEN *token) return FALSE;
}
- if (!(t = (struct gg_token *)h->data) || (!h->body)) {
+ struct gg_token *t = (struct gg_token *)h->data;
+ if (!t || !h->body) {
TCHAR error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
+ mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
// Return token id
+ GGTOKENDLGDATA dat = {0};
strncpy(dat.id, t->tokenid, sizeof(dat.id));
dat.width = t->width;
dat.height = t->height;
// Load bitmap
+ IMGSRVC_MEMIO memio = {0};
memio.iLen = h->body_size;
- memio.pBuf = (void *)h->body;
+ memio.pBuf = h->body;
memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
dat.hBitmap = (HBITMAP) CallService(MS_IMG_LOADFROMMEM, (WPARAM) &memio, 0);
|