Make some local variables in public headers const

Shutting up code analyser.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6392 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-05-13 14:42:13 +00:00
parent cc9edcb973
commit d90d1ae93b
5 changed files with 14 additions and 15 deletions

View File

@ -186,7 +186,7 @@ namespace scene
SMD3QuaternionTag* get(const core::stringc& name)
{
SMD3QuaternionTag search ( name );
s32 index = Container.linear_search ( search );
const s32 index = Container.linear_search ( search );
if ( index >= 0 )
return &Container[index];
return 0;
@ -199,7 +199,7 @@ namespace scene
void set_used(u32 new_size)
{
s32 diff = (s32) new_size - (s32) Container.allocated_size();
const s32 diff = (s32) new_size - (s32) Container.allocated_size();
if ( diff > 0 )
{
SMD3QuaternionTag e("");

View File

@ -81,7 +81,7 @@ public:
{
const core::rect<s32>& r2 = Parent->getAbsolutePosition();
core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
const core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
@ -194,9 +194,8 @@ public:
if (Parent)
{
core::rect<s32> r(Parent->getAbsolutePosition());
core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
const core::rect<s32> r(Parent->getAbsolutePosition());
const core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)DesiredRect.UpperLeftCorner.X / d.Width;

View File

@ -293,8 +293,8 @@ void IProfiler::stop(s32 id)
{
if ( Timer )
{
u32 timeNow = Timer->getRealTime();
s32 idx = ProfileDatas.binary_search(SProfileData(id));
const u32 timeNow = Timer->getRealTime();
const s32 idx = ProfileDatas.binary_search(SProfileData(id));
if ( idx >= 0 )
{
SProfileData &data = ProfileDatas[idx];
@ -303,7 +303,7 @@ void IProfiler::stop(s32 id)
{
// update data for this id
++data.CountCalls;
u32 diffTime = timeNow - data.LastTimeStarted;
const u32 diffTime = timeNow - data.LastTimeStarted;
data.TimeSum += diffTime;
if ( diffTime > data.LongestTime )
data.LongestTime = diffTime;
@ -336,7 +336,7 @@ s32 IProfiler::add(const core::stringw &name, const core::stringw &groupName)
}
else
{
s32 id = NextAutoId;
const s32 id = NextAutoId;
--NextAutoId;
add( id, name, groupName );
return id;
@ -400,7 +400,7 @@ bool IProfiler::findDataIndex(u32 & result, const core::stringw &name) const
const SProfileData* IProfiler::getProfileDataById(u32 id)
{
SProfileData data(id);
s32 idx = ProfileDatas.binary_search(data);
const s32 idx = ProfileDatas.binary_search(data);
if ( idx >= 0 )
return &ProfileDatas[idx];
return NULL;

View File

@ -736,7 +736,7 @@ namespace scene
IsVisible = in->getAttributeAsBool("Visible", IsVisible);
if (in->existsAttribute("AutomaticCulling"))
{
s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
const s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
scene::AutomaticCullingNames);
if (tmpState != -1)
AutomaticCullingState = (u32)tmpState;

View File

@ -47,7 +47,7 @@ inline bool hasFileExtension(const io::path& filename, const io::path& ext0,
//! cut the filename extension from a source file path and store it in a dest file path
inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
{
s32 endPos = source.findLast ( '.' );
const s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest;
}
@ -55,7 +55,7 @@ inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
//! get the filename extension from a file path
inline io::path& getFileNameExtension ( io::path &dest, const io::path &source )
{
s32 endPos = source.findLast ( '.' );
const s32 endPos = source.findLast ( '.' );
if ( endPos < 0 )
dest = "";
else
@ -176,7 +176,7 @@ static inline io::path mergeFilename(const io::path& path, const io::path& filen
if ( !result.empty() )
{
fschar_t last = result.lastChar();
const fschar_t last = result.lastChar();
if ( last != IRR_TEXT('/') && last != IRR_TEXT('\\') )
result += IRR_TEXT('/');
}