From 1167f20d14ba58bc045e3a248aeb71884c99a488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Apr 2014 16:08:38 +0200 Subject: [PATCH] Warning fixes, etc. --- ext/jpge/jpgd.cpp | 2 +- ext/rg_etc1/rg_etc1.cpp | 6 +++--- gfx_es2/glsl_program.cpp | 5 ++++- util/text/utf8.cpp | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ext/jpge/jpgd.cpp b/ext/jpge/jpgd.cpp index 34e2224e7d..cc47bd721c 100644 --- a/ext/jpge/jpgd.cpp +++ b/ext/jpge/jpgd.cpp @@ -874,7 +874,7 @@ void *jpeg_decoder::alloc(size_t nSize, bool zero) } if (!rv) { - int capacity = JPGD_MAX(32768 - 256, (nSize + 2047) & ~2047); + int capacity = (int)JPGD_MAX(32768 - 256, (nSize + 2047) & ~2047); mem_block *b = (mem_block*)jpgd_malloc(sizeof(mem_block) + capacity); if (!b) { stop_decoding(JPGD_NOTENOUGHMEM); } b->m_pNext = m_pMem_blocks; m_pMem_blocks = b; diff --git a/ext/rg_etc1/rg_etc1.cpp b/ext/rg_etc1/rg_etc1.cpp index 6c174b4e71..7a5fce713e 100644 --- a/ext/rg_etc1/rg_etc1.cpp +++ b/ext/rg_etc1/rg_etc1.cpp @@ -1803,7 +1803,7 @@ namespace rg_etc1 { if (block_inten[0] > m_pSorted_luma[n - 1]) { - const uint min_error = labs(block_inten[0] - m_pSorted_luma[n - 1]); + const uint min_error = (uint)(labs(block_inten[0] - m_pSorted_luma[n - 1])); if (min_error >= trial_solution.m_error) continue; } @@ -1817,7 +1817,7 @@ namespace rg_etc1 { if (m_pSorted_luma[0] > block_inten[3]) { - const uint min_error = labs(m_pSorted_luma[0] - block_inten[3]); + const uint min_error = (uint)(labs(m_pSorted_luma[0] - block_inten[3])); if (min_error >= trial_solution.m_error) continue; } @@ -1909,7 +1909,7 @@ done: for (uint packed_c = 0; packed_c < limit; packed_c++) { int v = etc1_decode_value(diff, inten, selector, packed_c); - uint err = labs(v - static_cast(color)); + uint err = (uint)labs(v - static_cast(color)); if (err < best_error) { best_error = err; diff --git a/gfx_es2/glsl_program.cpp b/gfx_es2/glsl_program.cpp index 3ae758d695..fdf88ea807 100644 --- a/gfx_es2/glsl_program.cpp +++ b/gfx_es2/glsl_program.cpp @@ -264,7 +264,10 @@ void glsl_destroy(GLSLProgram *program) { } void glsl_bind(const GLSLProgram *program) { - glUseProgram(program->program_); + if (program) + glUseProgram(program->program_); + else + glUseProgram(0); } void glsl_unbind() { diff --git a/util/text/utf8.cpp b/util/text/utf8.cpp index 8f9dca5210..5d5292e689 100644 --- a/util/text/utf8.cpp +++ b/util/text/utf8.cpp @@ -308,7 +308,7 @@ int u8_read_escape_sequence(const char *str, uint32_t *dest) if (dno > 0) ch = strtol(digs, NULL, 16); } - *dest = ch; + *dest = (uint32_t)ch; return i; }