From 78c0815c4118fe24ab78cce2dc48a6232dcd824a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Jun 2012 20:55:18 +0000 Subject: - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirOTR/MirOTR/dbfilter.cpp | 20 ++--- plugins/MirOTR/MirOTR/entities.cpp | 4 +- plugins/MirOTR/MirOTR/options.cpp | 2 +- plugins/MirOTR/MirOTR/otr.cpp | 4 +- plugins/MirOTR/MirOTR/svcs_menu.cpp | 12 +-- plugins/MirOTR/MirOTR/svcs_proto.cpp | 14 ++-- plugins/MirOTR/MirOTR/svcs_srmm.cpp | 8 +- plugins/MirOTR/MirOTR/utils.cpp | 2 +- plugins/MirOTR/ekhtml/include/ekhtml_private.h | 4 +- plugins/MirOTR/ekhtml/src/ekhtml.c | 16 ++-- plugins/MirOTR/ekhtml/src/ekhtml_comment.c | 12 +-- plugins/MirOTR/ekhtml/src/ekhtml_endtag.c | 10 +-- plugins/MirOTR/ekhtml/src/ekhtml_mktables.c | 8 +- plugins/MirOTR/ekhtml/src/ekhtml_special.c | 6 +- plugins/MirOTR/ekhtml/src/ekhtml_starttag.c | 30 ++++---- plugins/MirOTR/ekhtml/testsuite/tester.c | 6 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/arcfour.c | 6 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/blowfish.c | 18 ++--- .../MirOTR/libgcrypt-1.4.6/cipher/camellia-glue.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/cast5.c | 14 ++-- plugins/MirOTR/libgcrypt-1.4.6/cipher/cipher.c | 6 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/des.c | 6 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/dsa.c | 24 +++--- plugins/MirOTR/libgcrypt-1.4.6/cipher/ecc.c | 4 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/elgamal.c | 46 ++++++------ plugins/MirOTR/libgcrypt-1.4.6/cipher/md4.c | 16 ++-- plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c | 16 ++-- plugins/MirOTR/libgcrypt-1.4.6/cipher/primegen.c | 30 ++++---- plugins/MirOTR/libgcrypt-1.4.6/cipher/pubkey.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/rijndael.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/rmd160.c | 16 ++-- plugins/MirOTR/libgcrypt-1.4.6/cipher/rsa.c | 8 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/seed.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c | 4 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/tiger.c | 16 ++-- plugins/MirOTR/libgcrypt-1.4.6/cipher/twofish.c | 6 +- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c | 32 ++++---- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c | 22 +++--- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c | 10 +-- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c | 46 ++++++------ plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h | 28 +++---- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h | 24 +++--- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c | 38 +++++----- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c | 24 +++--- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c | 32 ++++---- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c | 32 ++++---- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c | 8 +- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c | 76 +++++++++---------- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c | 86 +++++++++++----------- plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c | 14 ++-- .../MirOTR/libgcrypt-1.4.6/random/random-csprng.c | 8 +- plugins/MirOTR/libgcrypt-1.4.6/random/rndegd.c | 28 +++---- plugins/MirOTR/libgcrypt-1.4.6/random/rndlinux.c | 18 ++--- plugins/MirOTR/libgcrypt-1.4.6/random/rndunix.c | 56 +++++++------- plugins/MirOTR/libgcrypt-1.4.6/src/gcrypt.h | 2 +- plugins/MirOTR/libgcrypt-1.4.6/src/gcryptrnd.c | 2 +- plugins/MirOTR/libgcrypt-1.4.6/src/global.c | 10 +-- plugins/MirOTR/libgcrypt-1.4.6/src/misc.c | 2 +- .../MirOTR/libgcrypt-1.4.6/src/missing-string.c | 4 +- plugins/MirOTR/libgcrypt-1.4.6/src/sexp.c | 32 ++++---- plugins/MirOTR/libgcrypt-1.4.6/src/stdmem.c | 2 +- plugins/MirOTR/libgpg-error-1.9/src/w32-gettext.c | 2 +- plugins/MirOTR/libotr-3.2.0/src/proto.c | 8 +- plugins/MirOTR/libotr-3.2.0/toolkit/aes.c | 60 +++++++-------- 65 files changed, 555 insertions(+), 555 deletions(-) (limited to 'plugins/MirOTR') diff --git a/plugins/MirOTR/MirOTR/dbfilter.cpp b/plugins/MirOTR/MirOTR/dbfilter.cpp index bfc2f80e9d..aab60e18e5 100644 --- a/plugins/MirOTR/MirOTR/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/dbfilter.cpp @@ -25,7 +25,7 @@ VOID CALLBACK DeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi next = DeleteEvents.first; while (current = next) { if (difftime(time(0), current->timestamp) < 1) break; - if(!CallService(MS_DB_EVENT_GET, (WPARAM)current->hDbEvent, (LPARAM)&info)) // && info.flags&DBEF_READ) + if (!CallService(MS_DB_EVENT_GET, (WPARAM)current->hDbEvent, (LPARAM)&info)) // && info.flags&DBEF_READ) { CallService(MS_DB_EVENT_DELETE, (WPARAM)current->hContact, (LPARAM)current->hDbEvent); next = current->next; @@ -44,7 +44,7 @@ VOID CALLBACK DeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi // add prefix to sent messages int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { - if(!options.prefix_messages || !lParam) return 0; + if (!options.prefix_messages || !lParam) return 0; HANDLE hContact = (HANDLE)wParam; DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; if ((dbei->eventType != EVENTTYPE_MESSAGE) || !(dbei->flags & DBEF_SENT) || (dbei->flags & DBEF_OTR_PREFIXED)) @@ -53,21 +53,21 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 0; // just to be safe const char *proto = contact_get_proto(hContact); - if(!proto ) return 0; + if (!proto ) return 0; if (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1) return 0; if(g_metaproto && strcmp(proto, g_metaproto) == 0) { hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); - if(!hContact) return 0; + if (!hContact) return 0; proto = contact_get_proto(hContact); - if(!proto ) return 0; + if (!proto ) return 0; } ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); bool encrypted = otr_context_get_trust(context) != TRUST_NOT_PRIVATE; - if(!encrypted) return 0; + if (!encrypted) return 0; DBEVENTINFO my_dbei = *dbei; // copy the other event @@ -178,7 +178,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { } int OnDatabaseEventAdded(WPARAM wParam, LPARAM lParam) { - if(!options.delete_history) return 0; + if (!options.delete_history) return 0; DBEVENTINFO info = {0}; info.cbSize = sizeof(info); @@ -189,7 +189,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { static DWORD len = strlen(prefix); info.cbBlob = lenutf*2; info.pBlob = (PBYTE)mir_alloc(info.cbBlob); - if(!CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&info)) { + if (!CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&info)) { if(info.eventType == EVENTTYPE_MESSAGE) { HANDLE hContact = (HANDLE)wParam, hSub; if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService @@ -249,13 +249,13 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { } if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0; - if(!options.bHaveSRMMIcons) return 0; + if (!options.bHaveSRMMIcons) return 0; HANDLE hContact = mwd->hContact, hTemp; if(options.bHaveMetaContacts && (hTemp = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hTemp; - if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME)) + if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME)) return 0; lib_cs_lock(); diff --git a/plugins/MirOTR/MirOTR/entities.cpp b/plugins/MirOTR/MirOTR/entities.cpp index ce11fe3bec..ae2335bc01 100644 --- a/plugins/MirOTR/MirOTR/entities.cpp +++ b/plugins/MirOTR/MirOTR/entities.cpp @@ -327,7 +327,7 @@ static _Bool parse_entity(const char *current, char **to, const char **from, size_t maxlen) { const char *end = (const char *)memchr(current, ';', maxlen); - if(!end) return 0; + if (!end) return 0; if(current[1] == '#') { @@ -367,7 +367,7 @@ static _Bool parse_entity(const char *current, char **to, size_t decode_html_entities_utf8(char *dest, const char *src, size_t len) { - if(!src) src = dest; + if (!src) src = dest; char *to = dest; const char *from = src; diff --git a/plugins/MirOTR/MirOTR/options.cpp b/plugins/MirOTR/MirOTR/options.cpp index 1109a8fffd..f8d1dba7a1 100644 --- a/plugins/MirOTR/MirOTR/options.cpp +++ b/plugins/MirOTR/MirOTR/options.cpp @@ -88,7 +88,7 @@ void LoadOptions() { options.autoshow_verify = (DBGetContactSettingByte(0, MODULENAME, "AutoShowVerify", 1) == 1); DBVARIANT dbv; - if(!DBGetContactSettingUTF8String(0, MODULENAME, "Prefix", &dbv)) { + if (!DBGetContactSettingUTF8String(0, MODULENAME, "Prefix", &dbv)) { strncpy(options.prefix, dbv.pszVal, OPTIONS_PREFIXLEN); options.prefix[OPTIONS_PREFIXLEN-1] = 0; DBFreeVariant(&dbv); diff --git a/plugins/MirOTR/MirOTR/otr.cpp b/plugins/MirOTR/MirOTR/otr.cpp index c094314d56..dfc5575fa4 100644 --- a/plugins/MirOTR/MirOTR/otr.cpp +++ b/plugins/MirOTR/MirOTR/otr.cpp @@ -268,7 +268,7 @@ extern "C" { TCHAR buff[512]; mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT((HANDLE)opdata)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); - if(!Miranda_Terminated()) { + if (!Miranda_Terminated()) { ShowMessage((HANDLE)opdata, buff); } @@ -283,7 +283,7 @@ extern "C" { TrustLevel trusted = otr_context_get_trust(context); SetEncryptionStatus((HANDLE)opdata, trusted); TCHAR buff[1024]; - if(!is_reply) { + if (!is_reply) { if(trusted == TRUST_PRIVATE) { mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_CONTINUE_OTR), contact_get_nameT((HANDLE)opdata)); } else if (trusted == TRUST_UNVERIFIED) { diff --git a/plugins/MirOTR/MirOTR/svcs_menu.cpp b/plugins/MirOTR/MirOTR/svcs_menu.cpp index 83ef6cd660..712ea4d5b6 100644 --- a/plugins/MirOTR/MirOTR/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/svcs_menu.cpp @@ -9,9 +9,9 @@ HANDLE hMenuBuildEvent, hStopItem, hStartItem; int StartOTR(HANDLE hContact) { const char *proto = contact_get_proto(hContact); - if(!proto) return 1; // error + if (!proto) return 1; // error char *uname = contact_get_id(hContact); - if(!uname) return 1; // error + if (!uname) return 1; // error DWORD pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; @@ -74,9 +74,9 @@ int otr_disconnect_contact(HANDLE hContact) { } const char *proto = contact_get_proto(hContact); - if(!proto) return 1; // error + if (!proto) return 1; // error char *uname = contact_get_id(hContact); - if(!uname) return 1; // error + if (!uname) return 1; // error lib_cs_lock(); otrl_message_disconnect(otr_user_state, &ops, hContact, proto, proto, uname); @@ -164,14 +164,14 @@ int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { const char *proto = contact_get_proto(hContact); DWORD pol = CONTACT_DEFAULT_POLICY; - if(!proto || DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1) { + if (!proto || DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1) { goto hide_all; } if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) { // make menu act as per most online subcontact hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); - if(!hContact) + if (!hContact) goto hide_all; proto = contact_get_proto(hContact); } diff --git a/plugins/MirOTR/MirOTR/svcs_proto.cpp b/plugins/MirOTR/MirOTR/svcs_proto.cpp index 5ea6055908..89f2473597 100644 --- a/plugins/MirOTR/MirOTR/svcs_proto.cpp +++ b/plugins/MirOTR/MirOTR/svcs_proto.cpp @@ -9,7 +9,7 @@ //TODO: Social-Millionaire-Dialoge INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ - if(!lParam) return 0; + if (!lParam) return 0; CCSDATA *ccs = (CCSDATA *) lParam; @@ -21,7 +21,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINSEND, wParam, lParam); - if(!proto || !ccs->hContact) return 1; // error + if (!proto || !ccs->hContact) return 1; // error gcry_error_t err; char *newmessage = 0; @@ -40,7 +40,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ } else { oldmessage_utf = mir_utf8encode(oldmessage); } - if(!oldmessage_utf) return 1; + if (!oldmessage_utf) return 1; // don't filter OTR messages being sent (OTR messages should only happen *after* the otrl_message_sending call below) if(strncmp(oldmessage_utf, "?OTR", 4) == 0) { @@ -128,7 +128,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ } INT_PTR SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam){ - if(!lParam) return 0; + if (!lParam) return 0; CCSDATA *ccs = (CCSDATA *) lParam; if (!(ccs->wParam & PREF_UTF)) ccs->wParam |= PREF_UNICODE; @@ -159,7 +159,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ } char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); - if(!proto) + if (!proto) return 1; //error else if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINRECV, wParam, lParam); @@ -176,7 +176,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ } else { oldmessage_utf = mir_utf8encode(oldmessage); } - if(!oldmessage_utf) return 1; + if (!oldmessage_utf) return 1; char *newmessage = NULL; @@ -194,7 +194,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ lib_cs_unlock(); mir_free(uname); - if( !(pre->flags & PREF_UTF)) mir_free(oldmessage_utf); + if ( !(pre->flags & PREF_UTF)) mir_free(oldmessage_utf); oldmessage_utf = NULL; diff --git a/plugins/MirOTR/MirOTR/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/svcs_srmm.cpp index e37ee9db51..fbc2797178 100644 --- a/plugins/MirOTR/MirOTR/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/svcs_srmm.cpp @@ -14,13 +14,13 @@ BBButton OTRButton; // } // // if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0; -// if(!options.bHaveSRMMIcons) return 0; +// if (!options.bHaveSRMMIcons) return 0; // // HANDLE hContact = mwd->hContact, hTemp; // if(options.bHaveMetaContacts && (hTemp = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) // hContact = hTemp; // -// if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME)) +// if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME)) // return 0; // // lib_cs_lock(); @@ -148,7 +148,7 @@ void SetEncryptionStatus(HANDLE hContact, TrustLevel level) { char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); bool chat_room = (proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0)); - // if(!chat_room) DBWriteContactSettingByte(hContact, MODULENAME, "Encrypted", (encrypted ? 1 : 0)); + // if (!chat_room) DBWriteContactSettingByte(hContact, MODULENAME, "Encrypted", (encrypted ? 1 : 0)); if(options.bHaveSRMMIcons || options.bHaveButtonsBar) { //strcat(dbg_msg, "\nchanging icon"); @@ -197,7 +197,7 @@ void SetEncryptionStatus(HANDLE hContact, TrustLevel level) { if (options.bHaveButtonsBar) CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&button); db_dword_set(hContact, MODULENAME, "TrustLevel", level); - if(!chat_room && options.bHaveMetaContacts) { + if (!chat_room && options.bHaveMetaContacts) { HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); HANDLE hMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0); if(hMeta && hContact == hMostOnline) { diff --git a/plugins/MirOTR/MirOTR/utils.cpp b/plugins/MirOTR/MirOTR/utils.cpp index 3d3a50506e..2b592742d4 100644 --- a/plugins/MirOTR/MirOTR/utils.cpp +++ b/plugins/MirOTR/MirOTR/utils.cpp @@ -370,7 +370,7 @@ bool GetEncryptionStatus(HANDLE hContact) { char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); bool chat_room = (proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0)); - if(!chat_room) { + if (!chat_room) { if (options.bHaveMetaContacts) { HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); if(hMeta && hContact == (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0)) { diff --git a/plugins/MirOTR/ekhtml/include/ekhtml_private.h b/plugins/MirOTR/ekhtml/include/ekhtml_private.h index 47d31282fa..90d99caeb2 100644 --- a/plugins/MirOTR/ekhtml/include/ekhtml_private.h +++ b/plugins/MirOTR/ekhtml/include/ekhtml_private.h @@ -150,8 +150,8 @@ char *ekhtml_find_notcharsmap(const char *buf, int len, { const char *endp = buf + len; - for(;bufnalloced + EKHTML_BLOCKSIZE; - if((newbuf = realloc(parser->buf, newsize)) == NULL){ + if ((newbuf = realloc(parser->buf, newsize)) == NULL){ fprintf(stderr, "BAD! Can't allocate %d bytes in ekhtml_buffer_grow\n", newsize); fflush(stderr); /* Just in case someone changes the buffering scheme */ @@ -119,7 +119,7 @@ int parser_state_determine(const char *startp, const char *endp){ assert(startp != endp); - if(*startp != '<') + if (*startp != '<') return EKHTML_STATE_INDATA; firstchar = startp + 1; @@ -130,7 +130,7 @@ int parser_state_determine(const char *startp, const char *endp){ if(newstate == EKHTML_STATE_NONE){ if(firstchar + 2 >= endp) /* Not enough data to evaluate */ return EKHTML_STATE_NONE; - if(*(firstchar + 1) == '-' && *(firstchar + 2) == '-') + if (*(firstchar + 1) == '-' && *(firstchar + 2) == '-') return EKHTML_STATE_COMMENT; else return EKHTML_STATE_SPECIAL; @@ -238,7 +238,7 @@ void ekhtml_parser_feed(ekhtml_parser_t *parser, ekhtml_string_t *str){ parser->nbuf += tocopy; if(parser->nalloced == parser->nbuf){ /* Process the buffer */ - if(!ekhtml_parser_flush(parser, 0)){ + if (!ekhtml_parser_flush(parser, 0)) { /* If we didn't actually process anything, grow our buffer */ ekhtml_buffer_grow(parser); } @@ -270,7 +270,7 @@ ekhtml_parser_startendcb_add(ekhtml_parser_t *parser, const char *tag, unsigned int taglen; hnode_t *hn; - if(!tag){ + if (!tag){ if(isStart) parser->startcb_unk = startcb; else @@ -289,7 +289,7 @@ ekhtml_parser_startendcb_add(ekhtml_parser_t *parser, const char *tag, lookup_str.str = newtag; lookup_str.len = taglen; - if((hn = hash_lookup(parser->startendcb, &lookup_str))){ + if ((hn = hash_lookup(parser->startendcb, &lookup_str))) { cont = hnode_get(hn); free(newtag); if(isStart) @@ -333,7 +333,7 @@ static hash_val_t ekhtml_string_hash(const void *key){ size_t len = s->len; int c; - while(len--){ + while(len--) { c = str[len]; res = ((res << 5) + res) + c; /* res * 33 + c */ } @@ -353,7 +353,7 @@ void ekhtml_parser_destroy(ekhtml_parser_t *ekparser){ hscan_t hs; hash_scan_begin(&hs, ekparser->startendcb); - while((hn = hash_scan_next(&hs))){ + while((hn = hash_scan_next(&hs))) { ekhtml_string_t *key = (ekhtml_string_t *)hnode_getkey(hn); ekhtml_tag_container *cont = hnode_get(hn); diff --git a/plugins/MirOTR/ekhtml/src/ekhtml_comment.c b/plugins/MirOTR/ekhtml/src/ekhtml_comment.c index e37cc487b5..11c4e8cf2e 100644 --- a/plugins/MirOTR/ekhtml/src/ekhtml_comment.c +++ b/plugins/MirOTR/ekhtml/src/ekhtml_comment.c @@ -66,22 +66,22 @@ char *ekhtml_parse_comment(ekhtml_parser_t *parser, void **state_data, if(comstate->dashes == 0){ /* Still on the quest for the double dash*/ /* XXX -- Searching for '--' could be faster, doing multibyte searching, or something similar */ - for(; workp < endp - 1; workp += 2){ - if(*workp == '-') + for (; workp < endp - 1; workp += 2){ + if (*workp == '-') break; } - if(!(workp < endp - 1)){ + if (!(workp < endp - 1)) { *offset = endp - 1 - curp; return NULL; } - if((*(workp - 1) == '-') && + if ((*(workp - 1) == '-') && (workp - curp) > (sizeof("