rigs-of-rods icon indicating copy to clipboard operation
rigs-of-rods copied to clipboard

Fixed gcc warning

Open tritonas00 opened this issue 2 years ago • 0 comments

Lately gcc complains:

[ 41%] Building CXX object source/main/CMakeFiles/RoR.dir/physics/flex/FlexMeshWheel.cpp.o
/home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/physics/flex/FlexMeshWheel.cpp: In constructor ‘RoR::FlexMeshWheel::FlexMeshWheel(Ogre::Entity*, RoR::GfxActor*, int, int, int, int, const std::string&, const std::string&, float, bool)’:
/home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/physics/flex/FlexMeshWheel.cpp:86:38: warning: argument 1 value ‘1844674407370955155 ’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
   86 |     m_indices=(unsigned short*)malloc(m_index_count*sizeof(unsigned short));
      |                                ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12.1.0/cstdlib:75,
                 from /usr/include/c++/12.1.0/ext/string_conversions.h:41,
                 from /usr/include/c++/12.1.0/bits/basic_string.h:3960,
                 from /usr/include/c++/12.1.0/string:53,
                 from /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/phc.h:25,
                 from /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/CMakeFiles/RoR.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/stdlib.h:540:14: note: in a call to allocation function ‘void* malloc(size_t)’ declared here
  540 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
      |              ^~~~~~

I don't know if this is the correct way to fix it but it suppress the warning.

tritonas00 avatar Jun 06 '22 18:06 tritonas00