mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
Various warning fixes and devirtualization
* Remove ArrayString * devirtualize GetCount and SetCount, they're no longer needed * set storage duration of fmt::placeholder to extern to be consistent * make length unsigned and the return value of sprintf signed * remove dead code "s.Close()" is never reached * devirtualize WrteToLog() * devirtualize Ini functions
This commit is contained in:
parent
1975b7e139
commit
4066950975
6 changed files with 21 additions and 113 deletions
|
@ -142,9 +142,9 @@ public:
|
|||
return m_array[num];
|
||||
}
|
||||
|
||||
virtual u32 GetCount() const { return m_count; }
|
||||
u32 GetCount() const { return m_count; }
|
||||
|
||||
virtual void SetCount(const u32 count, bool memzero = true)
|
||||
void SetCount(const u32 count, bool memzero = true)
|
||||
{
|
||||
if(m_count >= count) return;
|
||||
|
||||
|
@ -199,96 +199,6 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
class ArrayString : public Array<char>
|
||||
{
|
||||
public:
|
||||
ArrayString() : Array()
|
||||
{
|
||||
}
|
||||
|
||||
ArrayString(const wxString& value) : Array()
|
||||
{
|
||||
*this = value;
|
||||
}
|
||||
|
||||
ArrayString(const char* value) : Array()
|
||||
{
|
||||
*this = value;
|
||||
}
|
||||
|
||||
virtual u32 GetCount() const
|
||||
{
|
||||
return m_array ? strlen(m_array) : 0;
|
||||
}
|
||||
|
||||
virtual void SetCount(const u32 count, bool memzero = true)
|
||||
{
|
||||
if(m_count && count < m_count - 1)
|
||||
{
|
||||
m_array[count] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
Array::SetCount(count + 1, memzero);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayString& operator = (const char* right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(right)
|
||||
{
|
||||
size_t len = strlen(right);
|
||||
|
||||
if(len)
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right, len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString& operator = (const ArrayString& right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(size_t len = right.GetCount())
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right.GetPtr(), len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString& operator = (const wxString& right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(size_t len = right.Len())
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right.c_str(), len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString* Clone() const
|
||||
{
|
||||
ArrayString* new_array = new ArrayString();
|
||||
(*new_array) = m_array;
|
||||
|
||||
return new_array;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct Stack : public Array<T>
|
||||
{
|
||||
Stack() : Array<T>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue