]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Remove -Wno-sign-compare
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 7 Aug 2017 11:51:59 +0000 (21:51 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 7 Aug 2017 11:51:59 +0000 (21:51 +1000)
13 files changed:
CMakeLists.txt
contrib/bobtoolz/misc.cpp
contrib/prtview/portals.cpp
libs/generic/constant.h
libs/splines/q_shared.cpp
libs/splines/q_shared.h
plugins/iqmmodel/iqm.cpp
plugins/mapq3/plugin.cpp
radiant/patch.cpp
radiant/undo.cpp
tools/quake3/common/trilib.c
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/q3map2.h

index 8ee2a34fb9981c34f9c3bb3f707b3bf77864986f..00e9814594206f19a44cec94df9d951c0069cb7d 100644 (file)
@@ -89,7 +89,6 @@ addflags("-pedantic")
 
 addflags_c("-Wno-deprecated-declarations") # vfs.c: g_strdown
 
-addflags("-Wno-sign-compare")
 addflags("-Wno-unused-function")
 addflags("-Wno-unused-variable")
 addflags("-Wno-unused-parameter")
index 977879f59e4b0fe4f239356eddef76aa623e87f3..202065fc0a70cd9b3068d8bc435a8df8f70f890d 100644 (file)
@@ -129,7 +129,7 @@ char* TranslateString( char *buf ){
 
        std::size_t l = strlen( buf );
        char* out = buf2;
-       for ( int i = 0 ; i < l ; i++ )
+       for ( std::size_t i = 0 ; i < l ; i++ )
        {
                if ( buf[i] == '\n' ) {
                        *out++ = '\r';
index c9b80176321a069a87885004db01a66c93d1def2..0522fe40e3e3b0c873517472bb7f4a3ac75d0566 100644 (file)
@@ -603,7 +603,7 @@ void CPortalsDrawSolid::render( RenderStateFlags state ) const {
 }
 
 void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const {
-       for ( int n = 0; n < portals.portal_count; n++ )
+       for ( unsigned int n = 0; n < portals.portal_count; n++ )
        {
                if ( portals.lines == 2 && !portals.portal[n].hint ) {
                        continue;
@@ -613,26 +613,26 @@ void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const {
                        if ( clip.min[0] < portals.portal[n].min[0] ) {
                                continue;
                        }
-                       else if ( clip.min[1] < portals.portal[n].min[1] ) {
+                       if ( clip.min[1] < portals.portal[n].min[1] ) {
                                continue;
                        }
-                       else if ( clip.min[2] < portals.portal[n].min[2] ) {
+                       if ( clip.min[2] < portals.portal[n].min[2] ) {
                                continue;
                        }
-                       else if ( clip.max[0] > portals.portal[n].max[0] ) {
+                       if ( clip.max[0] > portals.portal[n].max[0] ) {
                                continue;
                        }
-                       else if ( clip.max[1] > portals.portal[n].max[1] ) {
+                       if ( clip.max[1] > portals.portal[n].max[1] ) {
                                continue;
                        }
-                       else if ( clip.max[2] > portals.portal[n].max[2] ) {
+                       if ( clip.max[2] > portals.portal[n].max[2] ) {
                                continue;
                        }
                }
 
                glBegin( GL_LINE_LOOP );
 
-               for ( int p = 0; p < portals.portal[n].point_count; p++ )
+               for ( unsigned int p = 0; p < portals.portal[n].point_count; p++ )
                        glVertex3fv( portals.portal[n].inner_point[p].p );
 
                glEnd();
index 83817947faf57d6add630748556ff968fb321079..ab64ec393ca33ec3b10a04dd4dfcd18ff93dd8f8 100644 (file)
@@ -43,6 +43,7 @@ inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const
 #define TYPE_CONSTANT( name, value, type ) struct name ## _CONSTANT_ { typedef type Value; static Value evaluate() { return value; } }; typedef ConstantWrapper<name ## _CONSTANT_> name
 #define STRING_CONSTANT( name, value ) TYPE_CONSTANT ( name, value, const char* )
 #define INTEGER_CONSTANT( name, value ) TYPE_CONSTANT ( name, value, int )
+#define UINT_CONSTANT( name, value ) TYPE_CONSTANT ( name, value, unsigned int )
 
 STRING_CONSTANT( EmptyString, "" );
 
index 204d980d176a6e5ad53afa6104303cfbf8d9a41b..1df4dfcd2c5de67676a444b0ddd2c2b9528f0d84 100644 (file)
@@ -546,7 +546,7 @@ char* Q_strrchr( const char* string, int c ){
    Safe strncpy that ensures a trailing zero
    =============
  */
-void Q_strncpyz( char *dest, const char *src, int destsize ) {
+void Q_strncpyz( char *dest, const char *src, std::size_t destsize ) {
        if ( !src ) {
                Com_Error( ERR_FATAL, "Q_strncpyz: NULL src" );
        }
@@ -633,10 +633,8 @@ char *Q_strupr( char *s1 ) {
 
 
 // never goes past bounds or leaves without a terminating 0
-void Q_strcat( char *dest, int size, const char *src ) {
-       int l1;
-
-       l1 = strlen( dest );
+void Q_strcat( char *dest, std::size_t size, const char *src ) {
+       auto l1 = strlen( dest );
        if ( l1 >= size ) {
                Com_Error( ERR_FATAL, "Q_strcat: already overflowed" );
        }
@@ -689,14 +687,17 @@ char *Q_CleanStr( char *string ) {
 }
 
 
-void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... ) {
-       int len;
+void QDECL Com_sprintf( char *dest, std::size_t size, const char *fmt, ... ) {
        va_list argptr;
        char bigbuffer[32000];      // big, but small enough to fit in PPC stack
 
        va_start( argptr,fmt );
-       len = vsprintf( bigbuffer,fmt,argptr );
+       int ret = vsprintf( bigbuffer,fmt,argptr );
        va_end( argptr );
+       if ( ret < 0 ) {
+               Com_Error(ERR_FATAL, "Com_sprintf: vsprintf failed");
+       }
+       auto len = static_cast<size_t>(ret);
        if ( len >= sizeof( bigbuffer ) ) {
                Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
        }
index 61f1024be1c2bd8e3509e922b383233cf2c37bd1..09a20b814052c287005687dd8a65fe533a02449b 100644 (file)
@@ -65,6 +65,8 @@
 #include <stdlib.h>
 #include <time.h>
 #include <ctype.h>
+#include <cstddef>
+
 #ifdef WIN32                // mac doesn't have malloc.h
 #include <malloc.h>         // for _alloca()
 #endif
@@ -591,7 +593,7 @@ void Com_Parse3DMatrix( const char *( *buf_p ), int z, int y, int x, float *m );
 extern "C" {
 #endif
 
-void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... );
+void QDECL Com_sprintf( char *dest, std::size_t size, const char *fmt, ... );
 
 
 // mode parm for FS_FOpenFile
@@ -624,8 +626,8 @@ char    *Q_strupr( char *s1 );
 char    *Q_strrchr( const char* string, int c );
 
 // buffer size safe library replacements
-void    Q_strncpyz( char *dest, const char *src, int destsize );
-void    Q_strcat( char *dest, int size, const char *src );
+void    Q_strncpyz( char *dest, const char *src, std::size_t destsize );
+void    Q_strcat( char *dest, std::size_t size, const char *src );
 
 // strlen that discounts Quake color sequences
 int Q_PrintStrlen( const char *string );
index c1f7db89abaf198ff9c6fcb9e0acc8623cd045fc..d7c4bf4b582fe50bc97e9d3f11729c233bf92f92 100644 (file)
@@ -192,7 +192,7 @@ void IQMSurface_read(Model& model, const byte* buffer, ArchiveFile& file)
     
     int ofs_position = -1, ofs_st = -1, ofs_normal = -1;
     PointerInputStream vaStream (buffer + header.ofs_vertexarrays);
-    for (int i = 0; i < header.num_vertexarrays; i++)
+    for (unsigned int i = 0; i < header.num_vertexarrays; i++)
     {
         iqmvertexarray_t va;
         istream_read_iqmVertexarray (vaStream, va);
@@ -238,7 +238,7 @@ void IQMSurface_read(Model& model, const byte* buffer, ArchiveFile& file)
     }
     
     PointerInputStream triangleStream(buffer + header.ofs_triangles);
-       for(int i = 0; i < header.num_triangles; ++i)
+       for(unsigned int i = 0; i < header.num_triangles; ++i)
     {
       iqmTriangle_t triangle;
       istream_read_iqmTriangle(triangleStream, triangle);
index b107f583ec9116ba76649a6bb6f5de41f6cb3fe1..766a7ebaa6da23265253118145aa7636ca036ad5 100644 (file)
@@ -71,7 +71,7 @@ MapDoom3Dependencies& m_dependencies;
 public:
 typedef MapFormat Type;
 STRING_CONSTANT( Name, "mapdoom3" );
-INTEGER_CONSTANT( MapVersion, 2 );
+UINT_CONSTANT( MapVersion, 2 );
 
 MapDoom3API( MapDoom3Dependencies& dependencies ) : m_dependencies( dependencies ){
        GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "doom3 maps", "*.map" ) );
@@ -142,7 +142,7 @@ MapDoom3Dependencies& m_dependencies;
 public:
 typedef MapFormat Type;
 STRING_CONSTANT( Name, "mapquake4" );
-INTEGER_CONSTANT( MapVersion, 3 );
+UINT_CONSTANT( MapVersion, 3 );
 
 MapQuake4API( MapDoom3Dependencies& dependencies ) : m_dependencies( dependencies ){
        GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake4 maps", "*.map" ) );
index b31def460421835a87b98173fc706e21e7e24991..dca55b79b2176b13bf33f80df1151fda5e82dad3 100644 (file)
@@ -1357,14 +1357,13 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
                // vPos[1] = aabb.origin;
                // vPos[2] = vector3_added(aabb.origin, aabb.extents);
 
-               int i, j;
                float f = 1 / cos( M_PI / n );
-               for ( i = 0; i < width; ++i )
+               for ( std::size_t i = 0; i < width; ++i )
                {
                        float angle = ( M_PI * i ) / n; // 0 to 2pi
                        float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
                        float y = vPos[1][1] + ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f );
-                       for ( j = 0; j < height; ++j )
+                       for ( std::size_t j = 0; j < height; ++j )
                        {
                                float z = vPos[0][2] + ( vPos[2][2] - vPos[0][2] ) * ( j / (float)( height - 1 ) );
                                PatchControl *v;
@@ -1383,12 +1382,11 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
                // vPos[1] = aabb.origin;
                // vPos[2] = vector3_added(aabb.origin, aabb.extents);
 
-               int i, j;
                float f = 1 / cos( M_PI / n );
-               for ( i = 0; i < width; ++i )
+               for ( std::size_t i = 0; i < width; ++i )
                {
                        float angle = ( M_PI * i ) / n;
-                       for ( j = 0; j < height; ++j )
+                       for ( std::size_t j = 0; j < height; ++j )
                        {
                                float x = vPos[1][0] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
                                float y = vPos[1][1] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f );
@@ -1410,13 +1408,12 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
                // vPos[1] = aabb.origin;
                // vPos[2] = vector3_added(aabb.origin, aabb.extents);
 
-               int i, j;
                float f = 1 / cos( M_PI / n );
                float g = 1 / cos( M_PI / ( 2 * m ) );
-               for ( i = 0; i < width; ++i )
+               for ( std::size_t i = 0; i < width; ++i )
                {
                        float angle = ( M_PI * i ) / n;
-                       for ( j = 0; j < height; ++j )
+                       for ( std::size_t j = 0; j < height; ++j )
                        {
                                float angle2 = ( M_PI * j ) / ( 2 * m );
                                float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) *  sin( angle2 ) * ( ( j & 1 ) ? g : 1.0f ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f );
index 9910fb98a1b68ac2bc7495b8af64eb0a492058a8..eb536d8879e7e9b8954ff09e03f67d6965033749 100644 (file)
@@ -57,7 +57,7 @@ DebugScopeTimer( const char* operation )
 
 class RadiantUndoSystem : public UndoSystem
 {
-INTEGER_CONSTANT( MAX_UNDO_LEVELS, 1024 );
+UINT_CONSTANT( MAX_UNDO_LEVELS, 1024 );
 
 class Snapshot
 {
index 8b063b0f5c3876fe6b4d25d8a8514223824ff57f..d3ec168a18a931ec1f309ba20c7e9e1d72907662 100644 (file)
@@ -61,7 +61,7 @@ typedef struct {
 
 
 static void ByteSwapTri( tf_triangle *tri ){
-       int i;
+       unsigned int i;
 
        for ( i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
        {
index 34c22833b64f1821d71a55f219cd37463e92908d..b63d14b233f1cab25b55488ce1beb260473e0014 100644 (file)
@@ -3183,7 +3183,7 @@ void IlluminateVertexes( int num ){
    determines opaque brushes in the world and find sky shaders for sunlight calculations
  */
 
-void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ){
+void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned int mask_all, unsigned int test_all ){
        int i, j, b;
        unsigned int compileFlags, allCompileFlags;
        qboolean inside;
index 44cd0b581d39fe26306918bb09cd30429ed729a3..7b677c83690ac7866a4cc827e8f187ca056c62d4 100644 (file)
@@ -1825,7 +1825,7 @@ void                        FloodLightRawLightmap( int num );
 void                        IlluminateRawLightmap( int num );
 void                        IlluminateVertexes( int num );
 
-void                        SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all );
+void                        SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned int mask_all, unsigned int test_all );
 void                        SetupBrushes( void );
 void                        SetupClusters( void );
 qboolean                    ClusterVisible( int a, int b );