]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/server/html2html.c
Don't bother reading this commit.
[citadel.git] / webcit-ng / server / html2html.c
index b6dadc35eeec1397d48282fe31cc88dda72f3c74..506a70de7fe1b538b800f5b3b2270fe8ad9a8bf4 100644 (file)
@@ -1,11 +1,10 @@
-//
 // Output an HTML message, modifying it slightly to make sure it plays nice
 // with the rest of our web framework.
 //
 // Copyright (c) 2005-2022 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
-// disclosure are subject to the GNU General Public License v3.
+// disclosure is subject to the GNU General Public License v3.
 
 #include "webcit.h"
 
 void stripquotes(char *s) {
        int len;
 
-       if (!s)
+       if (!s) {
                return;
+       }
 
        len = strlen(s);
-       if (len < 2)
+       if (len < 2) {
                return;
+       }
 
        if (((s[0] == '\"') && (s[len - 1] == '\"')) || ((s[0] == '\'') && (s[len - 1] == '\''))) {
                s[len - 1] = 0;
@@ -37,22 +38,27 @@ void extract_charset_from_meta(char *charset, char *meta_http_equiv, char *meta_
        char *ptr;
        char buf[64];
 
-       if (!charset)
+       if (!charset) {
                return;
-       if (!meta_http_equiv)
+       }
+       if (!meta_http_equiv) {
                return;
-       if (!meta_content)
+       }
+       if (!meta_content) {
                return;
+       }
 
-       if (strcasecmp(meta_http_equiv, "Content-type"))
+       if (strcasecmp(meta_http_equiv, "Content-type")) {
                return;
+       }
 
        ptr = strchr(meta_content, ';');
-       if (!ptr)
+       if (!ptr) {
                return;
+       }
 
        safestrncpy(buf, ++ptr, sizeof buf);
-       striplt(buf);
+       string_trim(buf);
        if (!strncasecmp(buf, "charset=", 8)) {
                strcpy(charset, &buf[8]);
 
@@ -66,9 +72,10 @@ void extract_charset_from_meta(char *charset, char *meta_http_equiv, char *meta_
                }
 
                // Remove wandering punctuation
-               if ((ptr = strchr(charset, '\"')))
+               if ((ptr = strchr(charset, '\"'))) {
                        *ptr = 0;
-               striplt(charset);
+               }
+               string_trim(charset);
        }
 }
 
@@ -151,7 +158,7 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam
                                meta = malloc(meta_length + 1);
                                safestrncpy(meta, meta_start, meta_length);
                                meta[meta_length] = 0;
-                               striplt(meta);
+                               string_trim(meta);
                                if (!strncasecmp(meta, "HTTP-EQUIV=", 11)) {
                                        meta_http_equiv = strdup(&meta[11]);
                                        spaceptr = strchr(meta_http_equiv, ' ');