From 722bc5df7e7bde6ec865b991e500aca04c931ad5 Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Mon, 10 Aug 2015 10:06:14 -0700 Subject: Remove need to disable MSVC warning 4244 --- src/CMakeLists.txt | 2 +- src/blocks.c | 2 +- src/buffer.c | 2 +- src/html.c | 4 ++-- src/utf8.c | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ecdd016..0f04351 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -155,7 +155,7 @@ if(MSVC) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /D_CRT_SECURE_NO_WARNINGS") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4267 /wd4706 /D_CRT_SECURE_NO_WARNINGS") elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic") endif() diff --git a/src/blocks.c b/src/blocks.c index 6d3053b..49ac273 100755 --- a/src/blocks.c +++ b/src/blocks.c @@ -774,7 +774,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, container->as.code.fenced = true; container->as.code.fence_char = peek_at(&input, parser->first_nonspace); container->as.code.fence_length = matched; - container->as.code.fence_offset = parser->first_nonspace - parser->offset; + container->as.code.fence_offset = (int8_t)(parser->first_nonspace - parser->offset); container->as.code.info = cmark_chunk_literal(""); S_advance_offset(parser, &input, parser->first_nonspace + matched - parser->offset, diff --git a/src/buffer.c b/src/buffer.c index 26dfb8e..a89c82e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -133,7 +133,7 @@ void cmark_strbuf_sets(cmark_strbuf *buf, const char *string) { void cmark_strbuf_putc(cmark_strbuf *buf, int c) { S_strbuf_grow_by(buf, 1); - buf->ptr[buf->size++] = c; + buf->ptr[buf->size++] = (unsigned char)(c & 0xFF); buf->ptr[buf->size] = '\0'; } diff --git a/src/html.c b/src/html.c index e365c8c..dfe2aec 100644 --- a/src/html.c +++ b/src/html.c @@ -130,12 +130,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_HEADER: if (entering) { cr(html); - start_header[2] = '0' + node->as.header.level; + start_header[2] = (char)('0' + node->as.header.level); cmark_strbuf_puts(html, start_header); S_render_sourcepos(node, html, options); cmark_strbuf_putc(html, '>'); } else { - end_header[3] = '0' + node->as.header.level; + end_header[3] = (char)('0' + node->as.header.level); cmark_strbuf_puts(html, end_header); cmark_strbuf_puts(html, ">\n"); } diff --git a/src/utf8.c b/src/utf8.c index a742a75..319539d 100755 --- a/src/utf8.c +++ b/src/utf8.c @@ -191,10 +191,10 @@ void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf) { assert(uc >= 0); if (uc < 0x80) { - dst[0] = uc; + dst[0] = (uint8_t)(uc); len = 1; } else if (uc < 0x800) { - dst[0] = 0xC0 + (uc >> 6); + dst[0] = (uint8_t)(0xC0 + (uc >> 6)); dst[1] = 0x80 + (uc & 0x3F); len = 2; } else if (uc == 0xFFFF) { @@ -204,12 +204,12 @@ void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf) { dst[0] = 0xFE; len = 1; } else if (uc < 0x10000) { - dst[0] = 0xE0 + (uc >> 12); + dst[0] = (uint8_t)(0xE0 + (uc >> 12)); dst[1] = 0x80 + ((uc >> 6) & 0x3F); dst[2] = 0x80 + (uc & 0x3F); len = 3; } else if (uc < 0x110000) { - dst[0] = 0xF0 + (uc >> 18); + dst[0] = (uint8_t)(0xF0 + (uc >> 18)); dst[1] = 0x80 + ((uc >> 12) & 0x3F); dst[2] = 0x80 + ((uc >> 6) & 0x3F); dst[3] = 0x80 + (uc & 0x3F); -- cgit v1.2.3