Merge remote-tracking branch 'upstream/development' into camera_and_editor_viewport_widget_improvements
Signed-off-by: Yuriy Toporovskyy <toporovskyy.y@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_CRYARRAY_H
|
||||
#pragma once
|
||||
|
||||
#include "CryLegacyAllocator.h"
|
||||
#include <CryLegacyAllocator.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convenient iteration macros
|
||||
@@ -675,7 +675,7 @@ namespace NArray
|
||||
|
||||
I capacity() const
|
||||
{
|
||||
I aligned_bytes = Align(size() * sizeof(T), sizeof(I));
|
||||
I aligned_bytes = static_cast<I>(Align(size() * sizeof(T), sizeof(I)));
|
||||
if (m_nSizeCap & nCAP_BIT)
|
||||
{
|
||||
// Capacity stored in word following data
|
||||
@@ -693,7 +693,7 @@ namespace NArray
|
||||
// Store size, and assert against overflow.
|
||||
assert(s <= c);
|
||||
m_nSizeCap = s;
|
||||
I aligned_bytes = Align(s * sizeof(T), sizeof(I));
|
||||
I aligned_bytes = static_cast<I>(Align(s * sizeof(T), sizeof(I)));
|
||||
if (c * sizeof(T) >= aligned_bytes + sizeof(I))
|
||||
{
|
||||
// Has extra capacity, more than word-alignment
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "LegacyAllocator.h"
|
||||
|
||||
#include <AzCore/std/algorithm.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryModule allocation API
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -95,128 +93,3 @@ inline void* CryModuleReallocAlignImpl(void* prev, size_t size, size_t alignment
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryCrt alloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline size_t CryCrtSize(void* p)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
}
|
||||
|
||||
inline void* CryCrtMalloc(size_t size)
|
||||
{
|
||||
return CryModuleMalloc(size);
|
||||
}
|
||||
|
||||
inline size_t CryCrtFree(void* p)
|
||||
{
|
||||
size_t size = CryCrtSize(p);
|
||||
CryModuleFree(p);
|
||||
return size;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CrySystemCrt alloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline size_t CrySystemCrtSize(void* p)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
}
|
||||
|
||||
inline void* CrySystemCrtMalloc(size_t size)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().Allocate(size, 0, 0, "AZ::LegacyAllocator");
|
||||
}
|
||||
|
||||
inline void* CrySystemCrtRealloc(void* p, size_t size)
|
||||
{
|
||||
// Use LegacyAllocator's special ReAllocate
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().ReAllocate(p, size, 0);
|
||||
}
|
||||
|
||||
inline size_t CrySystemCrtFree(void* p)
|
||||
{
|
||||
size_t size = CrySystemCrtSize(p);
|
||||
CryModuleFree(p);
|
||||
return size;
|
||||
}
|
||||
|
||||
inline size_t CrySystemCrtGetUsedSpace()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryMalloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void* CryMalloc(size_t size, size_t& allocated, size_t alignment)
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
allocated = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The original implementation guaranteed 16 byte min alignment
|
||||
alignment = AZStd::GetMax<size_t>(alignment, 16);
|
||||
void* ptr = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().Allocate(size, alignment, 0, "CryMalloc", __FILE__, __LINE__);
|
||||
allocated = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline void* CryRealloc(void* memblock, size_t size, size_t& allocated, size_t& oldsize, size_t alignment)
|
||||
{
|
||||
oldsize = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(memblock);
|
||||
void* ptr = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().ReAllocate(memblock, size, alignment);
|
||||
allocated = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline size_t CryFree(void* p, size_t /*alignment*/)
|
||||
{
|
||||
size_t size = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().DeAllocate(p, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
inline size_t CryGetMemSize(void* memblock, size_t /*sourceSize*/)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(memblock);
|
||||
}
|
||||
|
||||
inline int CryMemoryGetAllocatedSize()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline int CryMemoryGetPoolSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline int CryStats([[maybe_unused]] char* buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int CryGetUsedHeapSize()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
inline int CryGetWastedHeapSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void CryCleanup()
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().GarbageCollect();
|
||||
}
|
||||
|
||||
inline void CryResetStats(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct INameTable
|
||||
const char* GetStr() { return (char*)(this + 1); }
|
||||
void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/};
|
||||
int Release() { return --nRefCount; };
|
||||
int GetMemoryUsage() { return sizeof(SNameEntry) + strlen(GetStr()); }
|
||||
int GetMemoryUsage() { return static_cast<int>(sizeof(SNameEntry) + strlen(GetStr())); }
|
||||
int GetLength(){return nLength; }
|
||||
};
|
||||
|
||||
@@ -102,14 +102,14 @@ public:
|
||||
if (!pEntry)
|
||||
{
|
||||
// Create a new entry.
|
||||
unsigned int nLen = strlen(str);
|
||||
unsigned int allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
|
||||
size_t nLen = strlen(str);
|
||||
size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
|
||||
pEntry = (SNameEntry*)CryModuleMalloc(allocLen);
|
||||
assert(pEntry != NULL);
|
||||
pEntry->nTag = SNameEntry::TAG;
|
||||
pEntry->nRefCount = 0;
|
||||
pEntry->nLength = nLen;
|
||||
pEntry->nAllocSize = allocLen;
|
||||
pEntry->nLength = static_cast<int>(nLen);
|
||||
pEntry->nAllocSize = static_cast<int>(allocLen);
|
||||
// Copy string to the end of name entry.
|
||||
char* pEntryStr = const_cast<char*>(pEntry->GetStr());
|
||||
memcpy(pEntryStr, str, nLen + 1);
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
int n = 0;
|
||||
for (it = m_nameMap.begin(); it != m_nameMap.end(); it++)
|
||||
{
|
||||
nSize += strlen(it->first);
|
||||
nSize += static_cast<int>(strlen(it->first));
|
||||
nSize += it->second->GetMemoryUsage();
|
||||
n++;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
}
|
||||
virtual int GetNumberOfEntries()
|
||||
{
|
||||
return m_nameMap.size();
|
||||
return static_cast<int>(m_nameMap.size());
|
||||
}
|
||||
|
||||
// Log all names inside CryName table.
|
||||
|
||||
@@ -159,8 +159,8 @@ public:
|
||||
return numElements != m_elements.size();
|
||||
}
|
||||
|
||||
ILINE int Count() const { return m_elements.size(); }
|
||||
ILINE unsigned int Size() const { return m_elements.size(); }
|
||||
ILINE size_t Count() const { return m_elements.size(); }
|
||||
ILINE size_t Size() const { return m_elements.size(); }
|
||||
|
||||
ILINE int IsEmpty() const { return m_elements.empty(); }
|
||||
|
||||
|
||||
@@ -1266,7 +1266,7 @@ inline void CryStringT<T>::resize(size_type nCount, value_type _Ch)
|
||||
}
|
||||
else if (nCount < length())
|
||||
{
|
||||
_header()->nLength = nCount;
|
||||
_header()->nLength = static_cast<int>(nCount);
|
||||
m_str[length()] = 0; // Make null terminated string.
|
||||
}
|
||||
}
|
||||
@@ -1971,7 +1971,7 @@ inline CryStringT<T>& CryStringT<T>::erase(size_type nIndex, size_type nCount)
|
||||
_MakeUnique();
|
||||
size_type nNumToCopy = length() - (nIndex + nCount) + 1;
|
||||
_move(m_str + nIndex, m_str + nIndex + nCount, nNumToCopy);
|
||||
_header()->nLength = length() - nCount;
|
||||
_header()->nLength = static_cast<int>(length() - nCount);
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -2013,7 +2013,7 @@ inline CryStringT<T>& CryStringT<T>::insert(size_type nIndex, size_type nCount,
|
||||
|
||||
_move(m_str + nIndex + nCount, m_str + nIndex, (nNewLength - nIndex - nCount) + 1);
|
||||
_set(m_str + nIndex, ch, nCount);
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
CRY_STRING_DEBUG(m_str)
|
||||
|
||||
return *this;
|
||||
@@ -2050,7 +2050,7 @@ inline CryStringT<T>& CryStringT<T>::insert(size_type nIndex, const_str pstr, si
|
||||
|
||||
_move(m_str + nIndex + nInsertLength, m_str + nIndex, (nNewLength - nIndex - nInsertLength + 1));
|
||||
_copy(m_str + nIndex, pstr, nInsertLength);
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
m_str[length()] = 0;
|
||||
}
|
||||
CRY_STRING_DEBUG(m_str)
|
||||
@@ -2164,7 +2164,7 @@ inline CryStringT<T>& CryStringT<T>::replace(const_str strOld, const_str strNew)
|
||||
}
|
||||
strStart += _strlen(strStart) + 1;
|
||||
}
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
}
|
||||
CRY_STRING_DEBUG(m_str)
|
||||
|
||||
@@ -2289,7 +2289,7 @@ inline CryStringT<T>& CryStringT<T>::TrimRight(const value_type* sCharSet)
|
||||
// Just shrink length of the string.
|
||||
size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique
|
||||
_MakeUnique();
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
m_str[nNewLength] = 0;
|
||||
}
|
||||
|
||||
@@ -2317,7 +2317,7 @@ inline CryStringT<T>& CryStringT<T>::TrimRight()
|
||||
// Just shrink length of the string.
|
||||
size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique
|
||||
_MakeUnique();
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
m_str[nNewLength] = 0;
|
||||
}
|
||||
|
||||
@@ -2353,7 +2353,7 @@ inline CryStringT<T>& CryStringT<T>::TrimLeft(const value_type* sCharSet)
|
||||
_MakeUnique();
|
||||
size_type nNewLength = length() - nOff;
|
||||
_move(m_str, m_str + nOff, nNewLength + 1);
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
m_str[nNewLength] = 0;
|
||||
}
|
||||
|
||||
@@ -2376,7 +2376,7 @@ inline CryStringT<T>& CryStringT<T>::TrimLeft()
|
||||
_MakeUnique();
|
||||
size_type nNewLength = length() - nOff;
|
||||
_move(m_str, m_str + nOff, nNewLength + 1);
|
||||
_header()->nLength = nNewLength;
|
||||
_header()->nLength = static_cast<int>(nNewLength);
|
||||
m_str[nNewLength] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2094,7 +2094,7 @@ public:
|
||||
{
|
||||
if (activeStreams & (1U << i))
|
||||
{
|
||||
nMeshSize += ((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount();
|
||||
nMeshSize += static_cast<uint32>(((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount());
|
||||
nMeshSize += TARGET_DEFAULT_ALIGN - (nMeshSize & (TARGET_DEFAULT_ALIGN - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,9 +1426,9 @@ struct STexSamplerFX
|
||||
SAFE_RELEASE(m_pITarget);
|
||||
}
|
||||
|
||||
int Size()
|
||||
size_t Size()
|
||||
{
|
||||
int nSize = sizeof(*this);
|
||||
size_t nSize = sizeof(*this);
|
||||
nSize += m_szName.capacity();
|
||||
nSize += m_szTexture.capacity();
|
||||
#if SHADER_REFLECT_TEXTURE_SLOTS
|
||||
@@ -1805,9 +1805,9 @@ struct SEfResTexture
|
||||
return m_Ext.m_pTexModifier;
|
||||
}
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
|
||||
size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
|
||||
nSize += m_Name.size();
|
||||
nSize += m_Sampler.Size();
|
||||
nSize += m_Ext.Size();
|
||||
@@ -1900,9 +1900,9 @@ struct SBaseShaderResources
|
||||
|
||||
uint8 m_VoxelCoverage;
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
|
||||
size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
@@ -2032,9 +2032,9 @@ struct SInputShaderResources
|
||||
TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name
|
||||
SDeformInfo m_DeformInfo;
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
|
||||
size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
|
||||
nSize += m_TexturePath.size();
|
||||
nSize += sizeof(SDeformInfo);
|
||||
|
||||
|
||||
@@ -843,7 +843,7 @@ namespace Unicode
|
||||
{
|
||||
const size_t offset = Append ? out.size() : 0;
|
||||
length += offset;
|
||||
out.resize(length); // resize() can't fail without exceptions, so assert instead.
|
||||
out.resize(static_cast<int>(length)); // resize() can't fail without exceptions, so assert instead.
|
||||
assert((out.size() == length) && "Buffer resize failed (out-of-memory?)");
|
||||
const CharType* base = length ? out.data() : 0;
|
||||
ptr = const_cast<CharType*>(base + offset);
|
||||
|
||||
@@ -408,8 +408,7 @@ typename VectorMap<K, V, T, A>::key_compare VectorMap<K, V, T, A>::key_comp() co
|
||||
template <typename K, typename V, typename T, typename A>
|
||||
typename VectorMap<K, V, T, A>::iterator VectorMap<K, V, T, A>::lower_bound(const key_type& key)
|
||||
{
|
||||
int count = 0;
|
||||
count = m_entries.size();
|
||||
int count = static_cast<int>(m_entries.size());
|
||||
iterator first = m_entries.begin();
|
||||
iterator last = m_entries.end();
|
||||
for (; 0 < count; )
|
||||
@@ -432,8 +431,7 @@ typename VectorMap<K, V, T, A>::iterator VectorMap<K, V, T, A>::lower_bound(cons
|
||||
template <typename K, typename V, typename T, typename A>
|
||||
typename VectorMap<K, V, T, A>::const_iterator VectorMap<K, V, T, A>::lower_bound(const key_type& key) const
|
||||
{
|
||||
int count = 0;
|
||||
count = m_entries.size();
|
||||
int count = static_cast<int>(m_entries.size());
|
||||
const_iterator first = m_entries.begin();
|
||||
const_iterator last = m_entries.end();
|
||||
for (; 0 < count; )
|
||||
|
||||
@@ -475,8 +475,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
|
||||
return conv_union.pDst;
|
||||
}
|
||||
|
||||
#include "CryLegacyAllocator.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DEPRECATED
|
||||
#define DEPRECATED
|
||||
|
||||
@@ -112,7 +112,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
CryLog("%s \"%s\" found in %s ...", szLog, PathUtil::GetFile(filenameLog.c_str()), PathUtil::GetPath(filenameLog).c_str());
|
||||
}
|
||||
|
||||
int nLen = file.GetLength();
|
||||
size_t nLen = file.GetLength();
|
||||
char* sAllText = new char [nLen + 16];
|
||||
file.ReadRaw(sAllText, nLen);
|
||||
sAllText[nLen] = '\0';
|
||||
|
||||
@@ -161,7 +161,7 @@ struct SLevelNameAutoComplete
|
||||
: public IConsoleArgumentAutoComplete
|
||||
{
|
||||
AZStd::vector<AZStd::string> levels;
|
||||
virtual int GetCount() const { return levels.size(); };
|
||||
virtual int GetCount() const { return static_cast<int>(levels.size()); };
|
||||
virtual const char* GetValue(int nIndex) const { return levels[nIndex].c_str(); };
|
||||
};
|
||||
// definition and declaration must be separated for devirtualization
|
||||
|
||||
@@ -479,7 +479,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
|
||||
if (i == ELOCALIZED_COLUMN_SOUNDMOOD)
|
||||
{
|
||||
const char* pSoundMoodName = pFind + strlen(sLocalizedColumnNames[i]) + 1;
|
||||
int nSoundMoodNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1;
|
||||
int nSoundMoodNameLength = static_cast<int>(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1);
|
||||
if (nSoundMoodNameLength > 0)
|
||||
{
|
||||
SoundMoodIndex[nCellIndex] = pSoundMoodName;
|
||||
@@ -490,7 +490,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
|
||||
if (i == ELOCALIZED_COLUMN_EVENTPARAMETER)
|
||||
{
|
||||
const char* pParameterName = pFind + strlen(sLocalizedColumnNames[i]) + 1;
|
||||
int nParameterNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1;
|
||||
int nParameterNameLength = static_cast<int>(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1);
|
||||
if (nParameterNameLength > 0)
|
||||
{
|
||||
EventParameterIndex[nCellIndex] = pParameterName;
|
||||
@@ -622,7 +622,7 @@ bool CLocalizedStringsManager::InitLocalizationData(
|
||||
|
||||
CRY_ASSERT(m_tagFileNames.size() < 255);
|
||||
|
||||
uint8 curNumTags = m_tagFileNames.size();
|
||||
uint8 curNumTags = static_cast<uint8>(m_tagFileNames.size());
|
||||
|
||||
m_tagFileNames[sType].filenames = vEntries;
|
||||
m_tagFileNames[sType].id = curNumTags + 1;
|
||||
@@ -757,7 +757,7 @@ bool CLocalizedStringsManager::ReleaseLocalizationDataByTag(
|
||||
|
||||
bool bVecEntryErased = false;
|
||||
//Then remove the entries in the storage vector
|
||||
const uint32 numEntries = m_pLanguage->m_vLocalizedStrings.size();
|
||||
const int32 numEntries = static_cast<int32>(m_pLanguage->m_vLocalizedStrings.size());
|
||||
for (int32 i = numEntries - 1; i >= 0; i--)
|
||||
{
|
||||
SLocalizedStringEntry* entry = m_pLanguage->m_vLocalizedStrings[i];
|
||||
@@ -1405,7 +1405,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
|
||||
// SoundMood Entries
|
||||
{
|
||||
pEntry->SoundMoods.resize(SoundMoodValues.size());
|
||||
pEntry->SoundMoods.resize(static_cast<int>(SoundMoodValues.size()));
|
||||
if (SoundMoodValues.size() > 0)
|
||||
{
|
||||
std::map<int, float>::const_iterator itEnd = SoundMoodValues.end();
|
||||
@@ -1421,7 +1421,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
|
||||
// EventParameter Entries
|
||||
{
|
||||
pEntry->EventParameters.resize(EventParameterValues.size());
|
||||
pEntry->EventParameters.resize(static_cast<int>(EventParameterValues.size()));
|
||||
if (EventParameterValues.size() > 0)
|
||||
{
|
||||
std::map<int, float>::const_iterator itEnd = EventParameterValues.end();
|
||||
@@ -2196,7 +2196,7 @@ int CLocalizedStringsManager::GetLocalizedStringCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_pLanguage->m_vLocalizedStrings.size();
|
||||
return static_cast<int>(m_pLanguage->m_vLocalizedStrings.size());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2310,10 +2310,10 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr
|
||||
int maxArgUsed = 0;
|
||||
int lastPos = 0;
|
||||
int curPos = 0;
|
||||
const int sourceLen = sString.length();
|
||||
const int sourceLen = static_cast<int>(sString.length());
|
||||
while (true)
|
||||
{
|
||||
int foundPos = sString.find(token, curPos);
|
||||
int foundPos = static_cast<int>(sString.find(token, curPos));
|
||||
if (foundPos != string::npos)
|
||||
{
|
||||
if (foundPos + 1 < sourceLen)
|
||||
|
||||
@@ -484,7 +484,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
|
||||
break;
|
||||
}
|
||||
|
||||
int bufferlen = sizeof(szBuffer) - prefixSize;
|
||||
int bufferlen = static_cast<int>(sizeof(szBuffer) - prefixSize);
|
||||
if (bufferlen > 0)
|
||||
{
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
|
||||
@@ -216,8 +216,8 @@ public:
|
||||
CryFatalError("Can't replace strings in an xml node that reuses strings");
|
||||
}
|
||||
|
||||
int nStrLen1 = strlen(str1);
|
||||
int nStrLen2 = strlen(str2);
|
||||
int nStrLen1 = static_cast<int>(strlen(str1));
|
||||
int nStrLen2 = static_cast<int>(strlen(str2));
|
||||
|
||||
// undo ptr1 add.
|
||||
if (m_ptr != m_start)
|
||||
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
pos = 1;
|
||||
for (;; )
|
||||
{
|
||||
pos = szValue.find_first_of("\\", pos);
|
||||
pos = static_cast<int>(szValue.find_first_of("\\", pos));
|
||||
|
||||
if (pos == string::npos)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ public:
|
||||
pos = 1;
|
||||
for (;; )
|
||||
{
|
||||
pos = szValue.find_first_of("\"", pos);
|
||||
pos = static_cast<int>(szValue.find_first_of("\"", pos));
|
||||
|
||||
if (pos == string::npos)
|
||||
{
|
||||
@@ -414,7 +414,7 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
|
||||
INDENT_LOG_DURING_SCOPE();
|
||||
|
||||
int nLen = file.GetLength();
|
||||
int nLen = static_cast<int>(file.GetLength());
|
||||
if (nLen == 0)
|
||||
{
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't get length for Config file %s", filename.c_str());
|
||||
|
||||
@@ -103,7 +103,7 @@ void CView::SetViewShakeEx(const SShakeParams& params)
|
||||
return;
|
||||
}
|
||||
|
||||
int shakes(m_shakes.size());
|
||||
int shakes = static_cast<int>(m_shakes.size());
|
||||
SShake* pSetShake(NULL);
|
||||
|
||||
for (int i = 0; i < shakes; ++i)
|
||||
@@ -180,7 +180,7 @@ void CView::ProcessShaking(float frameTime)
|
||||
m_viewParams.shakingRatio = 0;
|
||||
m_viewParams.groundOnly = false;
|
||||
|
||||
int shakes(m_shakes.size());
|
||||
int shakes = static_cast<int>(m_shakes.size());
|
||||
for (int i = 0; i < shakes; ++i)
|
||||
{
|
||||
ProcessShake(&m_shakes[i], frameTime);
|
||||
@@ -486,7 +486,7 @@ void CView::ProcessShakeNormal_DoShaking(SShake* pShake, float frameTime)
|
||||
//------------------------------------------------------------------------
|
||||
void CView::StopShake(int shakeID)
|
||||
{
|
||||
uint32 num = m_shakes.size();
|
||||
uint32 num = static_cast<int>(m_shakes.size());
|
||||
for (uint32 i = 0; i < num; ++i)
|
||||
{
|
||||
if (m_shakes[i].ID == shakeID && m_shakes[i].updating)
|
||||
|
||||
@@ -1341,7 +1341,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel)
|
||||
{
|
||||
if (isCtrlModifierActive)
|
||||
{
|
||||
m_nScrollLine = m_dqConsoleBuffer.size() - 1;
|
||||
m_nScrollLine = static_cast<int>(m_dqConsoleBuffer.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1454,7 +1454,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CXConsole::GetLineCount() const
|
||||
{
|
||||
return m_dqConsoleBuffer.size();
|
||||
return static_cast<int>(m_dqConsoleBuffer.size());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2675,7 +2675,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink)
|
||||
{
|
||||
assert(inpSink);
|
||||
|
||||
int nCount = m_OutputSinks.size();
|
||||
int nCount = static_cast<int>(m_OutputSinks.size());
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
@@ -2965,7 +2965,7 @@ bool CXConsole::IsHashCalculated()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CXConsole::GetNumCheatVars()
|
||||
{
|
||||
return m_randomCheckedVariables.size();
|
||||
return static_cast<int>(m_randomCheckedVariables.size());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -70,7 +70,7 @@ struct CConsoleCommandArgs
|
||||
CConsoleCommandArgs(string& line, std::vector<string>& args)
|
||||
: m_line(line)
|
||||
, m_args(args) {};
|
||||
virtual int GetArgCount() const { return m_args.size(); };
|
||||
virtual int GetArgCount() const { return static_cast<int>(m_args.size()); };
|
||||
// Get argument by index, nIndex must be in 0 <= nIndex < GetArgCount()
|
||||
virtual const char* GetArg(int nIndex) const
|
||||
{
|
||||
|
||||
@@ -190,8 +190,9 @@ bool SaveArray(const IdTable& idTable, XmlNodeRef& definition, XmlNodeRef& data,
|
||||
}
|
||||
|
||||
bool needIndex = false;
|
||||
for (size_t i = 1; i <= numElems; i++)
|
||||
for (size_t sizei = 1; sizei <= numElems; sizei++)
|
||||
{
|
||||
const int i = static_cast<int>(sizei);
|
||||
if (!childSource->HaveElemAt(i))
|
||||
{
|
||||
needIndex = true;
|
||||
|
||||
@@ -114,26 +114,26 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
|
||||
nTheoreticalPosition += sizeof(header);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
|
||||
header.nNodeTablePosition = nTheoreticalPosition;
|
||||
header.nNodeTablePosition = static_cast<uint32>(nTheoreticalPosition);
|
||||
header.nNodeCount = int(m_nodes.size());
|
||||
nTheoreticalPosition += header.nNodeCount * sizeof(Node);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
|
||||
header.nChildTablePosition = nTheoreticalPosition;
|
||||
header.nChildTablePosition = static_cast<uint32>(nTheoreticalPosition);
|
||||
header.nChildCount = int(m_childs.size());
|
||||
nTheoreticalPosition += header.nChildCount * sizeof(NodeIndex);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
|
||||
header.nAttributeTablePosition = nTheoreticalPosition;
|
||||
header.nAttributeTablePosition = static_cast<uint32>(nTheoreticalPosition);
|
||||
header.nAttributeCount = int(m_attributes.size());
|
||||
nTheoreticalPosition += header.nAttributeCount * sizeof(Attribute);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
|
||||
header.nStringDataPosition = nTheoreticalPosition;
|
||||
header.nStringDataPosition = static_cast<uint32>(nTheoreticalPosition);
|
||||
header.nStringDataSize = m_nStringDataSize;
|
||||
nTheoreticalPosition += header.nStringDataSize;
|
||||
|
||||
header.nXMLSize = nTheoreticalPosition;
|
||||
header.nXMLSize = static_cast<uint32>(nTheoreticalPosition);
|
||||
|
||||
// Swap endianness of the data structures
|
||||
if (bNeedSwapEndian)
|
||||
@@ -328,7 +328,7 @@ int XMLBinary::CXMLBinaryWriter::AddString(const XmlString& sString)
|
||||
// We don't have such string yet, so we should add it to the tables.
|
||||
m_strings.push_back(sString);
|
||||
itStringEntry = m_stringMap.insert(StringMap::value_type(sString, m_nStringDataSize)).first;
|
||||
m_nStringDataSize += sString.length() + 1;
|
||||
m_nStringDataSize += static_cast<uint>(sString.length() + 1);
|
||||
}
|
||||
|
||||
// Return offset of the string in the string data buffer.
|
||||
|
||||
@@ -91,7 +91,7 @@ XmlNodeRef CXmlUtils::LoadXmlFromFile(const char* sFilename, bool bReuseStrings,
|
||||
XmlNodeRef CXmlUtils::LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings, bool bSuppressWarnings)
|
||||
{
|
||||
XmlParser parser(bReuseStrings);
|
||||
XmlNodeRef node = parser.ParseBuffer(buffer, size, true, bSuppressWarnings);
|
||||
XmlNodeRef node = parser.ParseBuffer(buffer, static_cast<int>(size), true, bSuppressWarnings);
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ const char* CXmlUtils::HashXml(XmlNodeRef node)
|
||||
static char temp[16];
|
||||
static const char* hex = "0123456789abcdef";
|
||||
XmlString str = node->getXML();
|
||||
GetMD5(str.data(), str.length(), temp);
|
||||
GetMD5(str.data(), static_cast<int>(str.length()), temp);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
signature[2 * i + 0] = hex[((uint8)temp[i]) >> 4];
|
||||
|
||||
@@ -655,7 +655,7 @@ XmlNodeRef CXmlNode::findChild(const char* tag) const
|
||||
if (m_pChilds)
|
||||
{
|
||||
XmlNodes& childs = *m_pChilds;
|
||||
for (int i = 0, num = childs.size(); i < num; ++i)
|
||||
for (int i = 0, num = static_cast<int>(childs.size()); i < num; ++i)
|
||||
{
|
||||
if (childs[i]->isTag(tag))
|
||||
{
|
||||
@@ -690,7 +690,7 @@ void CXmlNode::deleteChild(const char* tag)
|
||||
if (m_pChilds)
|
||||
{
|
||||
XmlNodes& childs = *m_pChilds;
|
||||
for (int i = 0, num = childs.size(); i < num; ++i)
|
||||
for (int i = 0, num = static_cast<int>(childs.size()); i < num; ++i)
|
||||
{
|
||||
if (childs[i]->isTag(tag))
|
||||
{
|
||||
@@ -913,7 +913,7 @@ XmlNodeRef CXmlNode::clone()
|
||||
|
||||
node->m_pChilds = new XmlNodes;
|
||||
node->m_pChilds->reserve(childs.size());
|
||||
for (int i = 0, num = childs.size(); i < num; ++i)
|
||||
for (int i = 0, num = static_cast<int>(childs.size()); i < num; ++i)
|
||||
{
|
||||
node->addChild(childs[i]->clone());
|
||||
}
|
||||
@@ -956,7 +956,7 @@ static void AddTabsToString(XmlString& xml, int level)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CXmlNode::IsValidXmlString(const char* str) const
|
||||
{
|
||||
int len = strlen(str);
|
||||
int len = static_cast<int>(strlen(str));
|
||||
|
||||
{
|
||||
// Prevents invalid characters not from standard ASCII set to propagate to xml.
|
||||
@@ -1432,7 +1432,7 @@ protected:
|
||||
void XmlParserImp::CleanStack()
|
||||
{
|
||||
m_nNodeStackTop = 0;
|
||||
for (int i = 0, num = m_nodeStack.size(); i < num; i++)
|
||||
for (int i = 0, num = static_cast<int>(m_nodeStack.size()); i < num; i++)
|
||||
{
|
||||
m_nodeStack[i].node = 0;
|
||||
m_nodeStack[i].childs.resize(0);
|
||||
|
||||
Reference in New Issue
Block a user