]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Fix the build
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 1 May 2018 12:34:59 +0000 (22:34 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 1 May 2018 12:34:59 +0000 (22:34 +1000)
contrib/bobtoolz/DEntity.cpp
libs/container/hashfunc.h
radiant/renderstate.cpp
tools/quake3/common/threads.c
tools/quake3/q3map2/surface.c

index f4d9f0b16dac5927dc77844115e83f0ef9ba4a81..d764c312d58cfc69665311aca2ba25f24fcf2317 100644 (file)
@@ -164,7 +164,7 @@ bool DEntity::LoadFromPrt(char *filename)
 
         for (unsigned int j = 0; j < portals.node[i].portal_count; j++) {
             for (unsigned int k = 0; k < portals.node[i].portal[j].point_count - 2; k++) {
-                vec3_t v1, v2, normal, n;
+                vec3_t v1{}, v2{}, normal{}, n{};
                 VectorSubtract(portals.node[i].portal[j].point[k + 2].p, portals.node[i].portal[j].point[k + 1].p, v1);
                 VectorSubtract(portals.node[i].portal[j].point[k].p, portals.node[i].portal[j].point[k + 1].p, v2);
                 CrossProduct(v1, v2, n);
index 6d2166971488b65e7601395d47a533c8aefe9d4e..305202d0c9f00435bdcdab0c0798363abf5a8ef2 100644 (file)
@@ -203,17 +203,17 @@ inline ub4 hash(
        c += length;
        switch ( len )          /* all the case statements fall through */
        {
-       case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 );
-       case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 );
-       case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 );
+       case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 ); __attribute((fallthrough));
+       case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 ); __attribute((fallthrough));
+       case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 ); __attribute((fallthrough));
        /* the first byte of c is reserved for the length */
-       case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 );
-       case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 );
-       case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 );
-       case 5: b += UB1Traits::as_ub1( k[4] );
-       case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 );
-       case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 );
-       case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 );
+       case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 ); __attribute((fallthrough));
+       case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 ); __attribute((fallthrough));
+       case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 ); __attribute((fallthrough));
+       case 5: b += UB1Traits::as_ub1( k[4] );  __attribute((fallthrough));
+       case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 ); __attribute((fallthrough));
+       case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 ); __attribute((fallthrough));
+       case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 ); __attribute((fallthrough));
        case 1: a += UB1Traits::as_ub1( k[0] );
                /* case 0: nothing left to add */
        }
index faa04502e1ff524033d19c5c0d1bd0053d9bb936..1da08b71dad6c1061891abb7d73fb9269171ebd3 100644 (file)
@@ -2463,16 +2463,22 @@ void OpenGLShader::construct(const char *name)
                     switch (alphafunc) {
                         case IShader::eAlways:
                             state.m_alphafunc = GL_ALWAYS;
+                            break;
                         case IShader::eEqual:
                             state.m_alphafunc = GL_EQUAL;
+                            break;
                         case IShader::eLess:
                             state.m_alphafunc = GL_LESS;
+                            break;
                         case IShader::eGreater:
                             state.m_alphafunc = GL_GREATER;
+                            break;
                         case IShader::eLEqual:
                             state.m_alphafunc = GL_LEQUAL;
+                            break;
                         case IShader::eGEqual:
                             state.m_alphafunc = GL_GEQUAL;
+                            break;
                     }
                 }
                 reinterpret_cast<Vector3 &>( state.m_colour ) = m_shader->getTexture()->color;
index 054dc746625ef214d0b73ecc65793160db865cc6..fd38ef9f9c70cfb13098aa7119daf99e372a3f3c 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "globaldefs.h"
+#include <stdint.h>
 #if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
index e47f256735e3ac081e976fd2c1577ecc986469b6..a51db8c176c7e91f59c67e183da6db59bcc3f137 100644 (file)
@@ -781,6 +781,10 @@ byte GetShaderIndexForPoint( indexMap_t *im, vec3_t eMins, vec3_t eMaxs, vec3_t
 }
 
 
+#define snprintf_ignore(s, n, format, ...) do { \
+    size_t __n = snprintf(s, n, format, __VA_ARGS__); \
+    if (n >= n) {} /* truncated, ignore */ \
+} while (0)
 
 /*
    GetIndexedShader() - ydnar
@@ -827,10 +831,10 @@ shaderInfo_t *GetIndexedShader( shaderInfo_t *parent, indexMap_t *im, int numPoi
 
        /* make a shader name */
        if ( minShaderIndex == maxShaderIndex ) {
-               sprintf( shader, "textures/%s_%d", im->shader, maxShaderIndex );
+               snprintf_ignore( shader, sizeof shader, "textures/%s_%d", im->shader, maxShaderIndex );
        }
        else{
-               sprintf( shader, "textures/%s_%dto%d", im->shader, minShaderIndex, maxShaderIndex );
+               snprintf_ignore( shader, sizeof shader, "textures/%s_%dto%d", im->shader, minShaderIndex, maxShaderIndex );
        }
 
        /* get the shader */
@@ -926,17 +930,17 @@ mapDrawSurface_t *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, windin
        /* ydnar: sky hack/fix for GL_CLAMP borders on ati cards */
        if ( skyFixHack && si->skyParmsImageBase[ 0 ] != '\0' ) {
                //%     Sys_FPrintf( SYS_VRB, "Enabling sky hack for shader %s using env %s\n", si->shader, si->skyParmsImageBase );
-               sprintf( tempShader, "%s_lf", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_lf", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
-               sprintf( tempShader, "%s_rt", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_rt", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
-               sprintf( tempShader, "%s_ft", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_ft", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
-               sprintf( tempShader, "%s_bk", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_bk", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
-               sprintf( tempShader, "%s_up", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_up", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
-               sprintf( tempShader, "%s_dn", si->skyParmsImageBase );
+               snprintf_ignore( tempShader, sizeof tempShader, "%s_dn", si->skyParmsImageBase );
                DrawSurfaceForShader( tempShader );
        }