Skip to content

Commit b47d804

Browse files
rysavyjanAshe Connor
authored andcommitted
Fixes Visual C++ 2019 compiler warnings for x64 targets (commonmark#166)
warning C4311: 'type cast': pointer truncation from 'void *' to 'int' Fixes github#165
1 parent f5c77c6 commit b47d804

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extensions/tasklist.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node) {
3737
if (!node || !node->extension || strcmp(cmark_node_get_type_string(node), TYPE_STRING))
3838
return false;
3939

40-
if ((int)node->as.opaque == CMARK_TASKLIST_CHECKED) {
40+
if (node->as.opaque == (void *)CMARK_TASKLIST_CHECKED) {
4141
return true;
4242
}
4343
else {
@@ -110,7 +110,7 @@ static void commonmark_render(cmark_syntax_extension *extension,
110110
bool entering = (ev_type == CMARK_EVENT_ENTER);
111111
if (entering) {
112112
renderer->cr(renderer);
113-
if ((int)node->as.opaque == CMARK_TASKLIST_CHECKED) {
113+
if (node->as.opaque == (void *)CMARK_TASKLIST_CHECKED) {
114114
renderer->out(renderer, node, "- [x] ", false, LITERAL);
115115
} else {
116116
renderer->out(renderer, node, "- [ ] ", false, LITERAL);
@@ -131,7 +131,7 @@ static void html_render(cmark_syntax_extension *extension,
131131
cmark_strbuf_puts(renderer->html, "<li");
132132
cmark_html_render_sourcepos(node, renderer->html, options);
133133
cmark_strbuf_putc(renderer->html, '>');
134-
if ((int)node->as.opaque == CMARK_TASKLIST_CHECKED) {
134+
if (node->as.opaque == (void *)CMARK_TASKLIST_CHECKED) {
135135
cmark_strbuf_puts(renderer->html, "<input type=\"checkbox\" checked=\"\" disabled=\"\" /> ");
136136
} else {
137137
cmark_strbuf_puts(renderer->html, "<input type=\"checkbox\" disabled=\"\" /> ");
@@ -143,7 +143,7 @@ static void html_render(cmark_syntax_extension *extension,
143143

144144
static const char *xml_attr(cmark_syntax_extension *extension,
145145
cmark_node *node) {
146-
if ((int)node->as.opaque == CMARK_TASKLIST_CHECKED) {
146+
if (node->as.opaque == (void *)CMARK_TASKLIST_CHECKED) {
147147
return " completed=\"true\"";
148148
} else {
149149
return " completed=\"false\"";

0 commit comments

Comments
 (0)