divVerent / s2tc

S2TC - a subset of a wellknown texture compression scheme (actually Color Cell Compression)

Home Page:https://github.com/divVerent/s2tc/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lot of build warnings

opened this issue · comments

I got a lot of build warnings when trying to build s2tc. Here are my fixes:

--- a/s2tc_algorithm.cpp       Mon Nov 04 12:44:51 2013 +0100
+++ b/s2tc_algorithm.cpp       Mon Nov 04 12:45:38 2013 +0100
@@ -57,7 +57,7 @@
        }
        inline color_t make_color_t(int i)
        {
-               return (color_t) {i >> 3, i >> 2, i >> 3};
+               return (color_t) {(signed char)(i >> 3), (signed char)(i >> 2), (signed char)(i >> 3)};
        }
        inline bool operator==(const color_t &a, const color_t &b)
        {
@@ -705,7 +705,7 @@
        // REFINE_ALWAYS: refine, do not check
        inline void s2tc_dxt5_encode_alpha_refine_always(bitarray<uint64_t, 16, 3> &out, const unsigned char *in, int iw, int w, int h, unsigned char &a0, unsigned char &a1)
        {
-               unsigned char ramp[2] = {
+               unsigned char ramp[6] = {
                        a0,
                        a1
                };
@@ -1285,6 +1285,7 @@
                                                }
                                                else
                                                {
-                                                       int alphadiffuse = 8 - alphabits;
                                                        for(y = 0; y < h; ++y)
                                                                for(x = 0; x < w; ++x)
                                                                        out[(x + y * w) * 4 + 3] = rgba[(x + y * w) * srccomps + 3] >> (8 - alphabits);

Forgot to post the warnings:

s2tc_algorithm.cpp: In function ‘{anonymous}::color_t {anonymous}::make_color_t(int)’:
s2tc_algorithm.cpp:60:23: warning: narrowing conversion of ‘(i >> 3)’ from ‘int’ to ‘signed char’ inside { } [-Wnarrowing]
   return (color_t) {i >> 3, i >> 2, i >> 3};
                       ^
s2tc_algorithm.cpp:60:31: warning: narrowing conversion of ‘(i >> 2)’ from ‘int’ to ‘signed char’ inside { } [-Wnarrowing]
   return (color_t) {i >> 3, i >> 2, i >> 3};
                               ^
s2tc_algorithm.cpp:60:39: warning: narrowing conversion of ‘(i >> 3)’ from ‘int’ to ‘signed char’ inside { } [-Wnarrowing]
   return (color_t) {i >> 3, i >> 2, i >> 3};
                                       ^
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 1; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
        int alphadiffuse = 8 - alphabits;
            ^
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 1; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 1; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 4; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 4; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 4; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 8; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 8; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 3; int alphabits = 8; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 3; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 3]’
s2tc_algorithm.cpp:1453:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 1; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 1; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 1; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 1]’
s2tc_algorithm.cpp:1435:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 4; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 4; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 4; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 4]’
s2tc_algorithm.cpp:1438:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 8; DitherMode dither = (DitherMode)0u]’:
s2tc_algorithm.cpp:1417:67:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 8; DitherMode dither = (DitherMode)1u]’:
s2tc_algorithm.cpp:1421:69:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In instantiation of ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int) [with int srccomps = 4; int alphabits = 8; DitherMode dither = (DitherMode)2u]’:
s2tc_algorithm.cpp:1424:77:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, DitherMode) [with int srccomps = 4; int alphabits = 8]’
s2tc_algorithm.cpp:1442:54:   required from ‘void {anonymous}::rgb565_image(unsigned char*, const unsigned char*, int, int, int, DitherMode) [with int srccomps = 4]’
s2tc_algorithm.cpp:1457:54:   required from here
s2tc_algorithm.cpp:1288:12: warning: unused variable ‘alphadiffuse’ [-Wunused-variable]
s2tc_algorithm.cpp: In function ‘(anonymous namespace)::s2tc_dxt5_encode_alpha_refine_always(bitarray&, unsigned char const*, int, int, int, unsigned char&, unsigned char&)’:
s2tc_algorithm.cpp:357:29: warning: ‘MEM[(const unsigned char *)&ramp + 2B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return (a - (int) b) * (a - (int) b);
                             ^
s2tc_algorithm.cpp:708:17: note: ‘MEM[(const unsigned char *)&ramp + 2B]’ was declared here
   unsigned char ramp[2] = {
                 ^
s2tc_algorithm.cpp:357:29: warning: ‘MEM[(const unsigned char *)&ramp + 3B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return (a - (int) b) * (a - (int) b);
                             ^
s2tc_algorithm.cpp:708:17: note: ‘MEM[(const unsigned char *)&ramp + 3B]’ was declared here
   unsigned char ramp[2] = {
                 ^
s2tc_algorithm.cpp:357:29: warning: ‘MEM[(const unsigned char *)&ramp + 4B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return (a - (int) b) * (a - (int) b);
                             ^
s2tc_algorithm.cpp:708:17: note: ‘MEM[(const unsigned char *)&ramp + 4B]’ was declared here
   unsigned char ramp[2] = {
                 ^
s2tc_algorithm.cpp:357:29: warning: ‘MEM[(const unsigned char *)&ramp + 5B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return (a - (int) b) * (a - (int) b);
                             ^
s2tc_algorithm.cpp:708:17: note: ‘MEM[(const unsigned char *)&ramp + 5B]’ was declared here
   unsigned char ramp[2] = {
                 ^