fix various incidents reported by CLANG Static analyzer:
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 22:02:03 +0000 (22:02 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 22:02:03 +0000 (22:02 +0000)
  - unneeded Vars
  - possible uninitialized access

18 files changed:
webcit/calendar.c
webcit/crypto.c
webcit/event.c
webcit/marchlist.c
webcit/messages.c
webcit/netconf.c
webcit/notes.c
webcit/pushemail.c
webcit/roomops.c
webcit/serv_func.c
webcit/static.c
webcit/subst.c
webcit/subst.h
webcit/sysdep.c
webcit/tasks.c
webcit/useredit.c
webcit/webcit.c
webcit/webserver.c

index 7ddd3539174f37cd525d27846a08a3ce2269ff41..6bfbead40a9cec7d4050a6e1b5a178efeaf58f7a 100644 (file)
@@ -654,7 +654,6 @@ void load_ical_object(long msgnum, int unread,
        StrBuf *Buf;
        StrBuf *Data = NULL;
        const char *bptr;
-       int Done = 0;
        char from[128] = "";
        char mime_partnum[256];
        char mime_filename[256];
@@ -676,10 +675,9 @@ void load_ical_object(long msgnum, int unread,
                FreeStrBuf (&Buf);
                return;
        }
-       while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
+       while ((StrBuf_ServGetln(Buf)>=0)) {
                if ( (StrLength(Buf)==3) && 
                     !strcmp(ChrPtr(Buf), "000")) {
-                       Done = 1;
                        break;
                }
                bptr = ChrPtr(Buf);
index 6618ac1bce0ce821669e0794358a845d9ee47a7e..aa5c78b9fec134888284255d59aa892a2d03c33d 100644 (file)
@@ -60,7 +60,7 @@ void shutdown_ssl(void)
  */
 void init_ssl(void)
 {
-       SSL_METHOD *ssl_method;
+       const SSL_METHOD *ssl_method;
        RSA *rsa=NULL;
        X509_REQ *req = NULL;
        X509 *cer = NULL;
index 4b34b3126baf8f22e32664df2e80acbf67ea5d88..3b6399913be85db17a0489fde41a7cd981760273 100644 (file)
@@ -46,7 +46,9 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        char buf[SIZ];
        int organizer_is_me = 0;
        int i, j = 0;
+#ifdef DEBUG_UID_CALENDAR
        int sequence = 0;
+#endif
        char weekday_labels[7][32];
        char month_labels[12][32];
        long weekstart = 0;
@@ -159,9 +161,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        /* Learn the sequence */
        p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY);
+#ifdef DEBUG_UID_CALENDAR
        if (p != NULL) {
                sequence = icalproperty_get_sequence(p);
        }
+#endif
 
        /* Begin output */
        output_headers(1, 1, 2, 0, 0, 0);
@@ -175,8 +179,10 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        wc_printf("<div class=\"fix_scrollbar_bug\">");
 
+#ifdef DEBUG_UID_CALENDAR
        /************************************************************
         * Uncomment this to see the UID in calendar events for debugging
+       *************************************************************/
        wc_printf("UID == ");
        p = icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY);
        if (p != NULL) {
@@ -184,7 +190,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        }
        wc_printf("<br />\n");
        wc_printf("SEQUENCE == %d<br />\n", sequence);
-       *************************************************************/
+#endif
 
        wc_printf("<form name=\"EventForm\" method=\"POST\" action=\"save_event\">\n");
        wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
@@ -979,7 +985,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
                                                if (YESBSTR(buf)) recur.by_day[j++] =
                                                        icalrecurrencetype_day_day_of_week(i+1);
                                        }
-                                       recur.by_day[j++] = ICAL_RECURRENCE_ARRAY_MAX;
+                                       recur.by_day[j] = ICAL_RECURRENCE_ARRAY_MAX;
                                        break;
 
                                case ICAL_MONTHLY_RECURRENCE:
index 63cd84cc4fe098ef62ab191e6d2235371768aa90..fa0b8f55302f165bc06d4efdfd8e6b2511b74111 100644 (file)
@@ -58,8 +58,6 @@ void remove_march(const StrBuf *aaa)
 char *pop_march(int desired_floor)
 {
        static char TheRoom[128];
-       int TheFloor = 0;
-       int TheOrder = 32767;
        int TheWeight = 0;
        int weight;
        struct march *mptr = NULL;
@@ -81,8 +79,6 @@ char *pop_march(int desired_floor)
                if (weight > TheWeight) {
                        TheWeight = weight;
                        strcpy(TheRoom, mptr->march_name);
-                       TheFloor = mptr->march_floor;
-                       TheOrder = mptr->march_order;
                }
        }
        return (TheRoom);
index 0bd29376e10ec7fcfc1388da126c22bda5d19de6..fd6295d83e64912e30a3b78958c04933462814a7 100644 (file)
@@ -39,7 +39,6 @@ int load_message(message_summary *Msg,
        headereval *Hdr;
        void *vHdr;
        char buf[SIZ];
-       int Done = 0;
        int state=0;
        
        Buf = NewStrBuf();
@@ -63,11 +62,10 @@ int load_message(message_summary *Msg,
 
        /* begin everythingamundo table */
        HdrToken = NewStrBuf();
-       while (!Done && StrBuf_ServGetln(Buf)>=0) {
-               if ( (StrLength(Buf)==3) && 
+       while (StrBuf_ServGetln(Buf) >= 0) {
+               if ( (StrLength(Buf) ==3 ) && 
                    !strcmp(ChrPtr(Buf), "000")) 
                {
-                       Done = 1;
                        if (state < 2) {
                                if (Msg->MsgBody->Data == NULL)
                                        Msg->MsgBody->Data = NewStrBuf();
@@ -273,9 +271,10 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co
 }
 
 
-void
+long
 HttpStatus(long CitadelStatus)
 {
+       /* TODO: this doesn't realy work currently, the HTTP status isn't printed to the browser! */
        long httpstatus = 502;
        
        switch (MAJORCODE(CitadelStatus))
@@ -338,7 +337,7 @@ HttpStatus(long CitadelStatus)
                break;
        }
 
-
+       return httpstatus;
 }
 
 /*
@@ -347,7 +346,7 @@ HttpStatus(long CitadelStatus)
  */
 void handle_one_message(void) 
 {
-       long CitStatus;
+       long CitStatus = ERROR;
        int CopyMessage = 0;
        const StrBuf *Destination;
        void *vLine;
@@ -718,7 +717,7 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
        void *vViewMsg;
        void *vMsg;
        message_summary *Msg;
-       char cmd[256] = "";
+       char cmd[256];
        int i, r;
        wcsession *WCC = WC;
        HashPos *at;
@@ -728,6 +727,8 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
        SharedMessageStatus Stat;
        void *ViewSpecific;
 
+       cmd[0] = '\0';
+
        if (havebstr("is_summary") && (1 == (ibstr("is_summary")))) {
                WCC->CurRoom.view = VIEW_MAILBOX;
        }
@@ -1454,13 +1455,9 @@ void move_msg(void)
  */
 void confirm_move_msg(void)
 {
-       long msgid;
        char buf[SIZ];
        char targ[SIZ];
 
-       msgid = lbstr("msgid");
-
-
        output_headers(1, 1, 2, 0, 0, 0);
        wc_printf("<div id=\"banner\">\n");
        wc_printf("<h1>");
index cdd265a412da3f5e96c2a9b7a722f4928fa4eccc..d08c42db3d60563fd56c50b6035c7a72be2e116f 100644 (file)
@@ -97,8 +97,8 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
                Hash = NewHash(1, NULL);
 
                Buf = NewStrBuf();
-               while ((len = StrBuf_ServGetln(Buf),
-                       strcmp(ChrPtr(Buf), "000"))) {
+               while ((len = StrBuf_ServGetln(Buf), (len >= 0) && 
+                       ((len != 3) || !strcmp(ChrPtr(Buf), "000")))) {
                        Node = NewNode(Buf);
                        if (Node == NULL)
                                continue;
index 835c61f2d5658861b9c25338a0bcf0cee6dd478b..94176a31209e24d4fd7e3b6497a5074b9c562215 100644 (file)
@@ -28,7 +28,6 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread)
        StrBuf *Buf;
        StrBuf *Data = NULL;
        const char *bptr;
-       int Done = 0;
        char uid_from_headers[256];
        char mime_partnum[256];
        char mime_filename[256];
@@ -43,6 +42,7 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread)
        struct vnote *vnote_from_body = NULL;
        int vnote_inline = 0;                   /* 1 = MSG4 gave us a text/x-vnote top level */
 
+       uid_from_headers[0] = '\0';
        relevant_partnum[0] = '\0';
        serv_printf("MSG4 %ld", msgnum);        /* we need the mime headers */
        Buf = NewStrBuf();
@@ -51,10 +51,9 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread)
                FreeStrBuf (&Buf);
                return NULL;
        }
-       while ((StrBuf_ServGetln(Buf)>=0) && !Done) {
+       while ((StrBuf_ServGetln(Buf)>=0)) {
                if ( (StrLength(Buf)==3) && 
                     !strcmp(ChrPtr(Buf), "000")) {
-                       Done = 1;
                        break;
                }
                bptr = ChrPtr(Buf);
index 2f59929eb72037a921ba346be619356feb46adfc..29a9ca98f33c6bd5b2e2faf8ea65347ab1df23fb 100644 (file)
@@ -7,7 +7,6 @@
 void display_pushemail(void) 
 {
        folder Room;
-       int Done = 0;
        StrBuf *Buf;
        long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5};
        WCTemplputParams SubTP;
@@ -28,11 +27,9 @@ void display_pushemail(void)
                if (GetServerStatus(Buf, NULL) == 8) {
                        serv_puts("subj|__ Push email settings __");
                        serv_puts("000");
-                       while (!Done &&
-                              StrBuf_ServGetln(Buf) >= 0) {
+                       while (StrBuf_ServGetln(Buf) >= 0) {
                                if ( (StrLength(Buf)==3) && 
                                     !strcmp(ChrPtr(Buf), "000")) {
-                                       Done = 1;
                                        break;
                                }
                                msgnum = StrTol(Buf);
@@ -43,25 +40,19 @@ void display_pushemail(void)
                StrBuf_ServGetln(Buf);
                if (GetServerStatus(Buf, NULL) == 1) {
                        int i =0;
-                       Done = 0;
-                       while (!Done &&
-                              StrBuf_ServGetln(Buf) >= 0) {
+                       while (StrBuf_ServGetln(Buf) >= 0) {
                                if (( (StrLength(Buf)==3) && 
                                      !strcmp(ChrPtr(Buf), "000"))||
                                    ((StrLength(Buf)==4) && 
                                     !strcmp(ChrPtr(Buf), "text")))
                                {
-                                       Done = 1;
                                        break;
                                }
                        }
                        if (!strcmp(ChrPtr(Buf), "text")) {
-                               Done = 0;
-                               while (!Done &&
-                                      StrBuf_ServGetln(Buf) >= 0) {
+                               while (StrBuf_ServGetln(Buf) >= 0) {
                                        if ( (StrLength(Buf)==3) && 
                                             !strcmp(ChrPtr(Buf), "000")) {
-                                               Done = 1;
                                                break;
                                        }
                                        if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
@@ -96,7 +87,6 @@ void display_pushemail(void)
 void save_pushemail(void) 
 {
        folder Room;
-       int Done = 0;
        StrBuf *Buf;
        char buf[SIZ];
        int msgnum = 0;
@@ -125,11 +115,9 @@ void save_pushemail(void)
                return;
        }
 
-       while (!Done &&
-              StrBuf_ServGetln(Buf) >= 0) {
+       while (StrBuf_ServGetln(Buf) >= 0) {
                if ( (StrLength(Buf)==3) && 
                     !strcmp(ChrPtr(Buf), "000")) {
-                       Done = 1;
                        break;
                }
                msgnum = StrTol(Buf);
index d2204f79260e86a27509f5f70f7392ef09051438..dc671632acecb2d0b46eca5429e76468701a6c68 100644 (file)
@@ -59,7 +59,6 @@ int is_view_allowed_as_default(int which_view)
 void load_floorlist(StrBuf *Buf)
 {
        int a;
-       int Done = 0;
 
        for (a = 0; a < MAX_FLOORS; ++a)
                floorlist[a][0] = 0;
@@ -70,10 +69,9 @@ void load_floorlist(StrBuf *Buf)
                strcpy(floorlist[0], "Main Floor");
                return;
        }
-       while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
+       while (StrBuf_ServGetln(Buf) >= 0) {
                if ( (StrLength(Buf)==3) && 
                     !strcmp(ChrPtr(Buf), "000")) {
-                       Done = 1;
                        break;
                }
                extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
index f4162a5a0e84ed87dc8ec71bc5bca0d537e84092..d6751f24a7193a4fbd7f9fcc1deff3cccb28f705 100644 (file)
@@ -518,7 +518,7 @@ void text_to_server_qp(char *ptr)
                                output_len += 2;
                        }
                        buf[output_len++] = '=';
-                       buf[output_len++] = 0;
+                       buf[output_len] = '\0';
                        serv_puts((char *)buf);
                        output_len = 0;
                }
@@ -530,9 +530,8 @@ void text_to_server_qp(char *ptr)
                        sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
                        output_len += 2;
                }
-               buf[output_len++] = 0;
+               buf[output_len] = '\0';
                serv_puts((char *)buf);
-               output_len = 0;
        }
 }
 
index b5ea7965d928c00b42d519df49398d6373161cc0..fe9007a322772c4b3f26587e30130cb8eb364b9b 100644 (file)
@@ -38,7 +38,6 @@ void output_static(const char *what)
        int fd;
        struct stat statbuf;
        off_t bytes;
-       off_t count = 0;
        const char *content_type;
        int len;
        const char *Err;
@@ -65,7 +64,6 @@ void output_static(const char *what)
                        return;
                }
 
-               count = 0;
                bytes = statbuf.st_size;
 
                if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
@@ -104,7 +102,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
        struct dirent *filedir_entry;
        int d_type = 0;
         int d_namelen;
-       int d_without_ext;
        int istoplevel;
                
        filedir = opendir (DirName);
@@ -125,7 +122,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
        while ((readdir_r(filedir, d, &filedir_entry) == 0) &&
               (filedir_entry != NULL))
        {
-               char *PStart;
 #ifdef _DIRENT_HAVE_D_NAMELEN
                d_namelen = filedir_entry->d_namelen;
                d_type = filedir_entry->d_type;
@@ -143,8 +139,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
                d_namelen = strlen(filedir_entry->d_name);
                d_type = DT_UNKNOWN;
 #endif
-               d_without_ext = d_namelen;
-
                if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
                        continue; /* Ignore backup files... */
 
@@ -188,7 +182,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
                        break;
                case DT_LNK: /* TODO: check whether its a file or a directory */
                case DT_REG:
-                       PStart = filedir_entry->d_name;
                        FileName = NewStrBufDup(Dir);
                        if (ChrPtr(FileName) [ StrLength(FileName) - 1] != '/')
                                StrBufAppendBufPlain(FileName, "/", 1, 0);
@@ -229,7 +222,7 @@ void output_flat_static(void)
            (vFile != NULL))
        {
                File = (StrBuf*) vFile;
-               output_static(ChrPtr(vFile));
+               output_static(ChrPtr(File));
        }
 }
 
@@ -245,7 +238,7 @@ void output_static_safe(HashList *DirList)
            (vFile != NULL))
        {
                File = (StrBuf*) vFile;
-               output_static(ChrPtr(vFile));
+               output_static(ChrPtr(File));
        }
        else {
                lprintf(1, "output_static_safe() file %s not found. \n", 
index bfffef3f4cbf88aa07b7b0922035f4f3f8f25035..4e795d2722806d277338388a78ddcff5453102c1 100644 (file)
@@ -233,11 +233,16 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu
                        Type, 
                        ChrPtr(Error));
                */
-               StrBufPrintf(Info, "%s [%s]  %s; [%s]", 
-                            Type, 
-                            Err, 
-                            ChrPtr(Error), 
-                            ChrPtr(TP->Tokens->FlatToken));
+               FlushStrBuf(Info);
+               StrBufAppendBufPlain(Info, Type, -1, 0);
+               StrBufAppendBufPlain(Info, HKEY(" ["), 0);
+               StrBufAppendBufPlain(Info, Err, -1, 0);
+               StrBufAppendBufPlain(Info, HKEY("] "), 0);
+               StrBufAppendBuf(Info, Error, 0);
+               StrBufAppendBufPlain(Info, HKEY("; ["), 0);
+               if (TP->Tokens != NULL)
+                       StrBufAppendBuf(Info, TP->Tokens->FlatToken, 0);
+               StrBufAppendBufPlain(Info, HKEY("]"), 0);
                SerializeJson(WCC->WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
        }
        FreeStrBuf(&Info);
@@ -418,9 +423,6 @@ void VarPrintEntry(const char *Key, void *vSubst, int odd)
        case WCS_STRING:
                lprintf(1, "  -> %s\n", ChrPtr(ptr->wcs_value));
                break;
-       case WCS_SERVCMD:
-               lprintf(1, "  -> Server [%s]\n", ChrPtr(ptr->wcs_value));
-               break;
        case WCS_FUNCTION:
                lprintf(1, "  -> function at [%0xd]\n", ptr->wcs_function);
                break;
@@ -452,7 +454,6 @@ int NeedNewBuf(int type)
 {
        switch(type) {
        case WCS_STRING:
-       case WCS_SERVCMD:
        case WCS_STRBUF:
                return 1;
        case WCS_FUNCTION:
@@ -468,7 +469,6 @@ void FlushPayload(wcsubst *ptr, int reusestrbuf, int type)
        int NeedNew = NeedNewBuf(type);
        switch(ptr->wcs_type) {
        case WCS_STRING:
-       case WCS_SERVCMD:
        case WCS_STRBUF:
                if (reusestrbuf && NeedNew) {
                        FlushStrBuf(ptr->wcs_value);
@@ -527,9 +527,6 @@ wcsubst *NewSubstVar(const char *keyname, int keylen, int type)
 
        switch(ptr->wcs_type) {
        case WCS_STRING:
-       case WCS_SERVCMD:
-               ptr->wcs_value = NewStrBuf();
-               break;
        case WCS_STRBUF:
        case WCS_FUNCTION:
        case WCS_STRBUF_REF:
@@ -733,33 +730,6 @@ void SVPUTBuf(const char *keyname, int keylen, const StrBuf *Buf, int ref)
        ptr->wcs_value = (StrBuf*)Buf;
 }
 
-/**
- * \brief back end for print_value_of() ... does a server command
- * \param servcmd server command to execute on the citadel server
- */
-void pvo_do_cmd(StrBuf *Target, StrBuf *servcmd) {
-       char buf[SIZ];
-       int len;
-
-       serv_puts(ChrPtr(servcmd));
-       len = serv_getln(buf, sizeof buf);
-
-       switch(buf[0]) {
-               case '2':
-               case '3':
-               case '5':
-                       StrBufAppendPrintf(Target, "%s\n", &buf[4]);
-                       break;
-               case '1':
-                       _fmout(Target, "CENTER");
-                       break;
-               case '4':
-                       StrBufAppendPrintf(Target, "%s\n", &buf[4]);
-                       serv_puts("000");
-                       break;
-       }
-}
-
 int HaveTemplateTokenString(StrBuf *Target, 
                            WCTemplputParams *TP,
                            int N,
@@ -975,9 +945,6 @@ void print_value_of(StrBuf *Target, WCTemplputParams *TP)
                case WCS_STRING:
                        StrBufAppendBuf(Target, ptr->wcs_value, 0);
                        break;
-               case WCS_SERVCMD:
-                       pvo_do_cmd(Target, ptr->wcs_value);
-                       break;
                case WCS_FUNCTION:
                        (*ptr->wcs_function) (Target, TP);
                        break;
@@ -1021,9 +988,6 @@ int CompareSubstToToken(TemplateParam *ParamToCompare, TemplateParam *ParamToLoo
                        else
                                return ParamToCompare->lvalue == StrTol(ptr->wcs_value);
                        break;
-               case WCS_SERVCMD:
-                       return 1; 
-                       break;
                case WCS_FUNCTION:
                        return 1;
                case WCS_LONG:
@@ -1055,9 +1019,6 @@ int CompareSubstToStrBuf(StrBuf *Compare, TemplateParam *ParamToLookup)
                case WCS_STRBUF_REF:
                        return ((StrLength(Compare) == StrLength(ptr->wcs_value)) &&
                                (strcmp(ChrPtr(Compare), ChrPtr(ptr->wcs_value)) == 0));
-               case WCS_SERVCMD:
-                       return 1; 
-                       break;
                case WCS_FUNCTION:
                        return 1;
                case WCS_LONG:
@@ -1081,7 +1042,6 @@ void StrBufAppendTemplate(StrBuf *Target,
                          WCTemplputParams *TP,
                          const StrBuf *Source, int FormatTypeIndex)
 {
-        wcsession *WCC;
        char EscapeAs = ' ';
 
        if ((FormatTypeIndex < TP->Tokens->nParameters) &&
@@ -1093,7 +1053,6 @@ void StrBufAppendTemplate(StrBuf *Target,
        switch(EscapeAs)
        {
        case 'H':
-               WCC = WC;
                StrEscAppend(Target, Source, NULL, 0, 2);
                break;
        case 'X':
@@ -1581,7 +1540,6 @@ void *load_template(WCTemplate *NewTemplate)
        struct stat statbuf;
        const char *pS, *pE, *pch, *Err;
        long Line;
-       int pos;
 
        fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
        if (fd <= 0) {
@@ -1617,7 +1575,6 @@ void *load_template(WCTemplate *NewTemplate)
                int InDoubleQuotes = 0;
 
                /** Find one <? > */
-               pos = (-1);
                for (; pch < pE; pch ++) {
                        if ((*pch=='<')&&(*(pch + 1)=='?') &&
                            !((pch == pS) && /* we must ommit a <?xml */
@@ -1697,7 +1654,6 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
               (filedir_entry != NULL))
        {
                char *MinorPtr;
-               char *PStart;
 #ifdef _DIRENT_HAVE_D_NAMELEN
                d_namelen = filedir_entry->d_namelen;
                d_type = filedir_entry->d_type;
@@ -1779,7 +1735,6 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
                        if (d_without_ext > 2)
                                IsMobile = (filedir_entry->d_name[d_without_ext - 1] == 'm') &&
                                        (filedir_entry->d_name[d_without_ext - 2] == '.');
-                       PStart = filedir_entry->d_name;
                        StrBufPrintf(FileName, "%s/%s", ChrPtr(DirName),  filedir_entry->d_name);
                        MinorPtr = strchr(filedir_entry->d_name, '.');
                        if (MinorPtr != NULL)
@@ -2372,9 +2327,6 @@ int ConditionalVar(StrBuf *Target, WCTemplputParams *TP)
        switch(subst->wcs_type) {
        case WCS_FUNCTION:
                return (subst->wcs_function!=NULL);
-       case WCS_SERVCMD:
-               lprintf(1, "  -> Server [%s]\n", subst->wcs_value);/* TODO */
-               return 1;
        case WCS_STRING:
        case WCS_STRBUF:
        case WCS_STRBUF_REF:
@@ -2700,7 +2652,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
                         const char *OtherPrefix, long OtherPrefixLen,
                         const char *Default, long ldefault, long DefaultDirection)
 {
-       int isdefault = 0;
        const StrBuf *BSort = NULL;
        SortStruct *SortBy;
        void *vSortBy;
@@ -2734,7 +2685,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
 
        if (!GetHash(SortHash, SKEY(BSort), &vSortBy) || 
            (vSortBy == NULL)) {
-               isdefault = 1;
                if (!GetHash(SortHash, Default, ldefault, &vSortBy) || 
                    (vSortBy == NULL)) {
                        LogTemplateError(
@@ -2759,6 +2709,7 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
                        SortOrder = StrTol(Buf);
                }
                else {
+                       /* TODO: this is never used??? */
                        BSort = get_X_PREFS(HKEY("SortOrder"), OtherPrefix, OtherPrefixLen);
                }
 
index 970aa0368e837eb6649aab0f32cc1c1ec2a6885f..2899d05c9fdf73081665075ca7d9dfd1e885e04c 100644 (file)
@@ -26,7 +26,6 @@ extern HashList *LocalTemplateCache;
 enum {
        WCS_STRING,       /* its a string */
        WCS_FUNCTION,     /* its a function callback */
-       WCS_SERVCMD,      /* its a command to send to the citadel server */
        WCS_STRBUF,       /* its a strbuf we own */
        WCS_STRBUF_REF,   /* its a strbuf we mustn't free */
        WCS_LONG          /* its an integer */
index b3470a042c1362da057ef630d04f1a105ee5b70c..7c0acca7620df324373532c0b2e11006d402ea6a 100644 (file)
@@ -386,8 +386,6 @@ void start_daemon(char *pid_file)
                        waitpid(current_child, &status, 0);
                }
 
-               do_restart = 0;
-
                /* Did the main process exit with an actual exit code? */
                if (WIFEXITED(status)) {
 
index 42ae949ba5a4411f5b295885aaca9acf6134c471..25a638120b45374bcad4b6dc63a41daca1c1e66f 100644 (file)
@@ -181,12 +181,9 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch
        icalcomponent *vtodo;
        icalproperty *p;
        struct icaltimetype IcalTime;
-       time_t now;
        int created_new_vtodo = 0;
        icalproperty_status todoStatus;
 
-       now = time(NULL);
-
        if (supplied_vtodo != NULL) {
                vtodo = supplied_vtodo;
 
index 0bfc7ff37aee24f4cee429df3c2e82a050fdba4a..d4a5afbe214d1bb5e7817286e16accecf64149b3 100644 (file)
@@ -270,13 +270,12 @@ HashList *iterate_load_userlist(StrBuf *Target, WCTemplputParams *TP)
        if (GetServerStatus(Buf, NULL) == 1) {
                Hash = NewHash(1, NULL);
 
-               while (!Done) {
+               while (1) {
                        len = StrBuf_ServGetln(Buf);
-                       if ((len <0) || 
+                       if ((len < 0) || 
                            ((len == 3) &&
                             !strcmp(ChrPtr(Buf), "000")))
                        {
-                               Done = 1;
                                break;
                        }
                        ul = NewUserListEntry(Buf);
@@ -419,7 +418,6 @@ long locate_user_vcard_in_this_room(message_summary **VCMsg, wc_mime_attachment
        void *vMsg;
        message_summary *Msg;
        wc_mime_attachment *Att;
-       int Done;
        StrBuf *Buf;
        long vcard_msgnum = (-1L);
        int already_tried_creating_one = 0;
@@ -434,7 +432,6 @@ TRYAGAIN:
        Stat.maxload = 10000;
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
-       Done = 0;
        /* Search for the user's vCard */
        if (load_msg_ptrs("MSGS ALL||||1", &Stat, NULL) > 0) {
                at = GetNewHashPos(WCC->summ, 0);
index 9de1ad242289209df0864d5fbb24f95e3ce8c0fb..75db9ec8b54b15f98dd543650309d037c29f0591 100644 (file)
@@ -595,7 +595,6 @@ int Conditional_REST_DEPTH(StrBuf *Target, WCTemplputParams *TP)
  */
 void session_loop(void)
 {
-       int Flags = 0;
        int xhttp;
        StrBuf *Buf;
        
@@ -610,8 +609,6 @@ void session_loop(void)
        WCC->upload = NULL;
        WCC->is_mobile = 0;
        WCC->Hdr->nWildfireHeaders = 0;
-       if (WCC->Hdr->HR.Handler != NULL)
-               Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */
 
        if (WCC->Hdr->HR.ContentLength > 0) {
                if (ReadPostData() < 0) {
index 3546878dbcbeeb572aaad8d8b70a9afa3ef777fd..180e0e2b5af35557f86ff84acdbb1264db3510c0 100644 (file)
@@ -24,7 +24,6 @@ extern int verbosity;         /* Logging level */
 extern char static_icon_dir[PATH_MAX];          /* where should we find our mime icons */
 int is_https = 0;              /* Nonzero if I am an HTTPS service */
 int follow_xff = 0;            /* Follow X-Forwarded-For: header */
-int home_specified = 0;                /* did the user specify a homedir? */
 int DisableGzip = 0;
 extern pthread_mutex_t SessionListMutex;
 extern pthread_key_t MyConKey;
@@ -81,7 +80,6 @@ int main(int argc, char **argv)
        char ip_addr[256]="0.0.0.0";
        int relh=0;
        int home=0;
-       int home_specified=0;
        char relhome[PATH_MAX]="";
        char webcitdir[PATH_MAX] = DATADIR;
        char *pidfile = NULL;
@@ -131,7 +129,6 @@ int main(int argc, char **argv)
                                safestrncpy(relhome, relhome, sizeof relhome);
                        }
                        /* free(hdir); TODO: SHOULD WE DO THIS? */
-                       home_specified = 1;
                        home=1;
                        break;
                case 'd':