Reduce warnings

main
cel 5 years ago
parent e662f26ba0
commit d29d1a7726
Signed by: cel
GPG Key ID: C28D95BB012367EA

@ -257,7 +257,7 @@ static int zet_has_links(const char *id) {
int rc = fstat(fd, &st); int rc = fstat(fd, &st);
if (rc < 0) goto error; if (rc < 0) goto error;
char *buf = malloc(st.st_size+1); char *buf = malloc(st.st_size+1);
rc = read_all(fd, buf, st.st_size); rc = read_all(fd, (unsigned char *)buf, st.st_size);
if (rc < 0) goto error; if (rc < 0) goto error;
buf[st.st_size] = '\0'; buf[st.st_size] = '\0';
char *str = buf; char *str = buf;
@ -293,7 +293,7 @@ error:
static char *zet_get_buf_title(const struct buf *link, char *buf, size_t len) { static char *zet_get_buf_title(const struct buf *link, char *buf, size_t len) {
char id_buf[128]; char id_buf[128];
strncpy(id_buf, link->data, link->size); strncpy(id_buf, (char *)link->data, link->size);
id_buf[sizeof(id_buf)-1] = '\0'; id_buf[sizeof(id_buf)-1] = '\0';
return zet_get_title(id_buf + sigil_size, buf, len); return zet_get_title(id_buf + sigil_size, buf, len);
} }
@ -655,9 +655,9 @@ static int dpi_serve_zet_tails(int fd) {
static void unescape(char *buf, size_t len, const char *str) { static void unescape(char *buf, size_t len, const char *str) {
struct buf *ob = bufnew(1024); struct buf *ob = bufnew(1024);
houdini_unescape_url(ob, str, strlen(str)); houdini_unescape_url(ob, (unsigned char *)str, strlen(str));
if (ob->size < len) len = ob->size; if (ob->size < len) len = ob->size;
strncpy(buf, ob->data, len); strncpy(buf, (char *)ob->data, len);
buf[len] = '\0'; buf[len] = '\0';
bufrelease(ob); bufrelease(ob);
} }
@ -814,7 +814,7 @@ md_rndr_link(struct buf *ob, const struct buf *link, const struct buf *title, co
} }
static void put_link_truncated(struct buf *ob, const struct buf *link, int max_length) { static void put_link_truncated(struct buf *ob, const struct buf *link, int max_length) {
char *buf = link->data; char *buf = (char *)link->data;
size_t len = link->size; size_t len = link->size;
if (!strncmp(buf, "http", 4)) { if (!strncmp(buf, "http", 4)) {
@ -827,9 +827,12 @@ static void put_link_truncated(struct buf *ob, const struct buf *link, int max_l
len -= 8; len -= 8;
} }
} }
if (len < max_length) return houdini_escape_html0(ob, buf, len, 0); if (len < (size_t)max_length) {
houdini_escape_html0(ob, (unsigned char *)buf, len, 0);
return;
}
houdini_escape_html0(ob, buf, max_length, 0); houdini_escape_html0(ob, (unsigned char *)buf, max_length, 0);
BUFPUTSL(ob, ""); BUFPUTSL(ob, "");
} }
@ -867,7 +870,7 @@ md_rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type,
char *title = zet_get_buf_title(link, title_buf, sizeof(title_buf)); char *title = zet_get_buf_title(link, title_buf, sizeof(title_buf));
if (title != NULL) { if (title != NULL) {
BUFPUTSL(ob, "\" title=\""); BUFPUTSL(ob, "\" title=\"");
houdini_escape_html0(ob, title, strlen(title), 0); houdini_escape_html0(ob, (unsigned char *)title, strlen(title), 0);
} }
} }
@ -1147,7 +1150,7 @@ static int parse_multipart(struct http_request *req) {
if (!strcmp(name, "text")) { if (!strcmp(name, "text")) {
req->data = body; req->data = body;
req->len = end == NULL ? strlen(body) : end - body; req->len = end == NULL ? strlen(body) : (size_t)end - (size_t)body;
} }
} }
return 0; return 0;

Loading…
Cancel
Save