]> code.citadel.org Git - citadel.git/blobdiff - webcit/notes.c
fix various incidents reported by CLANG Static analyzer:
[citadel.git] / webcit / notes.c
index 2917122785ed673600d115c3c14504c1eb425db6..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);
@@ -213,7 +212,7 @@ void ajax_update_note(void) {
 
         if (!havebstr("note_uid")) {
                begin_ajax_response();
-               wprintf("Received ajax_update_note() request without a note UID.");
+               wc_printf("Received ajax_update_note() request without a note UID.");
                end_ajax_response();
                return;
        }
@@ -222,7 +221,7 @@ void ajax_update_note(void) {
        serv_getln(buf, sizeof buf);
        if (buf[0] != '2') {
                begin_ajax_response();
-               wprintf("Cannot find message containing vNote with the requested uid!");
+               wc_printf("Cannot find message containing vNote with the requested uid!");
                end_ajax_response();
                return;
        }
@@ -234,7 +233,7 @@ void ajax_update_note(void) {
                        serv_printf("DELE %d", msgnum);
                        serv_getln(buf, sizeof buf);
                        begin_ajax_response();
-                       wprintf("%s", buf);
+                       wc_printf("%s", buf);
                        end_ajax_response();
                        return;
                }
@@ -244,7 +243,7 @@ void ajax_update_note(void) {
        v = vnote_new_from_msg(msgnum, 0);
        if (!v) {
                begin_ajax_response();
-               wprintf("Cannot locate a vNote within message %d\n", msgnum);
+               wc_printf("Cannot locate a vNote within message %d\n", msgnum);
                end_ajax_response();
                return;
        }
@@ -351,7 +350,7 @@ void add_new_note(void) {
                vnote_free(v);
        }
        
-       readloop(readfwd);
+       readloop(readfwd, eUseDefault);
 }
 
 
@@ -426,7 +425,7 @@ int notes_GetParamsGetServerCall(SharedMessageStatus *Stat,
 {
        strcpy(cmd, "MSGS ALL");
        Stat->maxmsgs = 32767;
-       wprintf("<div id=\"new_notes_here\"></div>\n");
+       wc_printf("<div id=\"new_notes_here\"></div>\n");
        return 200;
 
 }
@@ -446,12 +445,13 @@ InitModule_NOTES
                VIEW_NOTES,
                notes_GetParamsGetServerCall,
                NULL,
+               NULL,
                notes_LoadMsgFromServer,
                NULL,
                notes_Cleanup);
 
-       WebcitAddUrlHandler(HKEY("add_new_note"), add_new_note, 0);
-       WebcitAddUrlHandler(HKEY("ajax_update_note"), ajax_update_note, 0);
+       WebcitAddUrlHandler(HKEY("add_new_note"), "", 0, add_new_note, 0);
+       WebcitAddUrlHandler(HKEY("ajax_update_note"), "", 0, ajax_update_note, 0);
 
        RegisterNamespace("VNOTE:POS:LEFT", 0, 0, tmpl_vcard_put_posleft, NULL, CTX_VNOTE);
        RegisterNamespace("VNOTE:POS:TOP", 0, 0, tmpl_vcard_put_postop, NULL, CTX_VNOTE);