Set -module -avoid-version on libcolcon-guile.
[doldaconnect.git] / lib / uimisc.c
index 794e976..249f8f8 100644 (file)
@@ -27,7 +27,6 @@
 #include <wctype.h>
 #include <pwd.h>
 #include <string.h>
-#include <malloc.h>
 #include <stdio.h>
 
 #ifdef HAVE_CONFIG_H
@@ -35,7 +34,7 @@
 #endif
 #include <doldaconnect/uilib.h>
 #include <doldaconnect/uimisc.h>
-#include <doldaconnect/utils.h>
+#include <utils.h>
 
 #ifdef HAVE_KRB5
 #include <krb5.h>
@@ -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]);