X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fuimisc.c;h=249f8f8e69f04172784f0b32bd2c6d28dfd62fb5;hb=387cf9b050e1291d4600d27ad12bbe123f4a1f40;hp=794e976e004559fb5a4d1379c446d35b662ea555;hpb=ccce0b4b3fe66fdb95e271f2d1ca2cd6d741e175;p=doldaconnect.git diff --git a/lib/uimisc.c b/lib/uimisc.c index 794e976..249f8f8 100644 --- a/lib/uimisc.c +++ b/lib/uimisc.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #ifdef HAVE_CONFIG_H @@ -35,7 +34,7 @@ #endif #include #include -#include +#include #ifdef HAVE_KRB5 #include @@ -206,77 +205,6 @@ struct krb5data int valid, fwd, fwded; }; -static char *hexencode(char *data, size_t datalen) -{ - char *buf, this; - size_t bufsize, bufdata; - int dig; - - buf = NULL; - bufsize = bufdata = 0; - for(; datalen > 0; datalen--, data++) - { - dig = (*data & 0xF0) >> 4; - if(dig > 9) - this = 'A' + dig - 10; - else - this = dig + '0'; - addtobuf(buf, this); - dig = *data & 0x0F; - if(dig > 9) - this = 'A' + dig - 10; - else - this = dig + '0'; - addtobuf(buf, this); - } - addtobuf(buf, 0); - return(buf); -} - -static char *hexdecode(char *data, size_t *len) -{ - char *buf, this; - size_t bufsize, bufdata; - - buf = NULL; - bufsize = bufdata = 0; - for(; *data; data++) - { - if((*data >= 'A') && (*data <= 'F')) - { - this = (this & 0x0F) | ((*data - 'A' + 10) << 4); - } else if((*data >= '0') && (*data <= '9')) { - this = (this & 0x0F) | ((*data - '0') << 4); - } else { - if(buf != NULL) - free(buf); - return(NULL); - } - data++; - if(!*data) - { - if(buf != NULL) - free(buf); - return(NULL); - } - if((*data >= 'A') && (*data <= 'F')) - { - this = (this & 0xF0) | (*data - 'A' + 10); - } else if((*data >= '0') && (*data <= '9')) { - this = (this & 0xF0) | (*data - '0'); - } else { - if(buf != NULL) - free(buf); - return(NULL); - } - addtobuf(buf, this); - } - addtobuf(buf, 0); - if(len != NULL) - *len = bufdata - 1; - return(buf); -} - static void process_krb5(struct dc_response *resp, struct logindata *data) { int ret; @@ -995,9 +923,9 @@ static int sortlist1(const struct dc_respline *l1, const struct dc_respline *l2) return(wcscmp(l1->argv[1], l2->argv[1])); } -static int sortlist2(const struct dc_fnetpeer *p1, const struct dc_fnetpeer *p2) +static int sortlist2(const struct dc_fnetpeer **p1, const struct dc_fnetpeer **p2) { - return(wcscmp(p1->id, p2->id)); + return(wcscmp((*p1)->id, (*p2)->id)); } static void fillpeer(struct dc_fnetpeer *peer, struct dc_respline *r) @@ -1064,9 +992,9 @@ static int getpeerlistcallback(struct dc_response *resp) delpeer(plist[o]); o++; } else { + fillpeer(plist[o], resp->rlines + i); i++; o++; - fillpeer(plist[o], resp->rlines + i); } } else if(i < resp->numlines) { peer = addpeer(fn, resp->rlines[i].argv[1], resp->rlines[i].argv[2]);