From 35d179fc53555ccf7d5b176a75c6f099550b836d Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 6 Aug 2011 13:54:34 -0700 Subject: [PATCH] Fix a bunch of syntax errors in pnUtils. --- .../NucleusLib/pnUtils/Private/pnUtArray.h | 142 +++++++++--------- .../NucleusLib/pnUtils/Private/pnUtHash.h | 30 ++-- .../NucleusLib/pnUtils/Private/pnUtList.h | 6 +- .../NucleusLib/pnUtils/Private/pnUtPriQ.h | 12 +- .../NucleusLib/pnUtils/Private/pnUtSkipList.h | 12 +- .../pnUtils/Private/pnUtSpareList.h | 6 +- .../NucleusLib/pnUtils/Private/pnUtSubst.h | 4 +- 7 files changed, 106 insertions(+), 106 deletions(-) diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h index c3e20f75..abe45221 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h @@ -765,16 +765,16 @@ TArray & TArray::operator= (const TArray & source) { if (&source == this) return *this; m_chunkSize = source.m_chunkSize; - AdjustSize(max(m_alloc, source.m_count), 0); - C::CopyConstruct(m_data, source.m_data, source.m_count); - m_count = source.m_count; + AdjustSize(max(this->m_alloc, source.m_count), 0); + C::CopyConstruct(this->m_data, source.m_data, source.m_count); + this->m_count = source.m_count; return *this; } //=========================================================================== template unsigned TArray::Add (const T & source) { - unsigned index = m_count; + unsigned index = this->m_count; Push(source); return index; } @@ -782,20 +782,20 @@ unsigned TArray::Add (const T & source) { //=========================================================================== template unsigned TArray::Add (const T * source, unsigned count) { - unsigned index = m_count; - AdjustSizeChunked(m_count + count, m_count); - C::CopyConstruct(&m_data[m_count], source, count); - m_count += count; + unsigned index = this->m_count; + AdjustSizeChunked(this->m_count + count, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source, count); + this->m_count += count; return index; } //=========================================================================== template unsigned TArray::AddArray (const TArray & source) { - unsigned index = m_count; - AdjustSizeChunked(m_count + source.m_count, m_count); - C::CopyConstruct(&m_data[m_count], source.m_data, source.m_count); - m_count += source.m_count; + unsigned index = this->m_count; + AdjustSizeChunked(this->m_count + source.m_count, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source.m_data, source.m_count); + this->m_count += source.m_count; return index; } @@ -804,15 +804,15 @@ template void TArray::AdjustSizeChunked (unsigned newAlloc, unsigned newCount) { // Disallow shrinking the allocation - if (newAlloc <= m_alloc) - newAlloc = m_alloc; + if (newAlloc <= this->m_alloc) + newAlloc = this->m_alloc; // Process growing the allocation else - newAlloc = CalcAllocGrowth(newAlloc, m_alloc, &m_chunkSize); + newAlloc = CalcAllocGrowth(newAlloc, this->m_alloc, &this->m_chunkSize); // Perform the allocation - AdjustSize(newAlloc, newCount); + this->AdjustSize(newAlloc, newCount); } @@ -823,38 +823,38 @@ void TArray::Copy (unsigned destIndex, unsigned sourceIndex, unsigned count // Copy the data to the destination ASSERT(destIndex + count <= m_count); ASSERT(sourceIndex + count <= m_count); - C::Assign(m_data + destIndex, m_data + sourceIndex, count); + C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count); } //=========================================================================== template void TArray::DeleteOrdered (unsigned index) { - ASSERT(index < m_count); - if (index + 1 < m_count) - C::Assign(&m_data[index], &m_data[index + 1], m_count - index - 1); - C::Destruct(&m_data[--m_count]); + ASSERT(index < this->m_count); + if (index + 1 < this->m_count) + C::Assign(&this->m_data[index], &this->m_data[index + 1], this->m_count - index - 1); + C::Destruct(&this->m_data[--this->m_count]); } //=========================================================================== template void TArray::DeleteUnordered (unsigned index) { - ASSERT(index < m_count); - if (index + 1 < m_count) - C::Assign(&m_data[index], &m_data[m_count - 1], 1); - C::Destruct(&m_data[--m_count]); + ASSERT(index < this->m_count); + if (index + 1 < this->m_count) + C::Assign(&this->m_data[index], &this->m_data[this->m_count - 1], 1); + C::Destruct(&this->m_data[--this->m_count]); } //=========================================================================== template void TArray::GrowToCount (unsigned count, bool zero) { - if (count <= m_count) + if (count <= this->m_count) return; - AdjustSizeChunked(count, m_count); + AdjustSizeChunked(count, this->m_count); if (zero) - memset(m_data + m_count, 0, (count - m_count) * sizeof(T)); - C::Construct(m_data + m_count, count - m_count); - m_count = count; + memset(this->m_data + this->m_count, 0, (count - this->m_count) * sizeof(T)); + C::Construct(this->m_data + this->m_count, count - this->m_count); + this->m_count = count; } //=========================================================================== @@ -866,9 +866,9 @@ void TArray::GrowToFit (unsigned index, bool zero) { //=========================================================================== template void TArray::ShrinkBy (unsigned count) { - ASSERT(count <= m_count); - C::Destruct(m_data + m_count - count, count); - m_count -= count; + ASSERT(count <= this->m_count); + C::Destruct(this->m_data + this->m_count - count, count); + this->m_count -= count; } //=========================================================================== @@ -876,20 +876,20 @@ template void TArray::Move (unsigned destIndex, unsigned sourceIndex, unsigned count) { // Copy the data to the destination - ASSERT(destIndex + count <= m_count); - ASSERT(sourceIndex + count <= m_count); - C::Assign(m_data + destIndex, m_data + sourceIndex, count); + ASSERT(destIndex + count <= this->m_count); + ASSERT(sourceIndex + count <= this->m_count); + C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count); // Remove it from the source if (destIndex >= sourceIndex) { - C::Destruct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); - C::Construct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); + C::Destruct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex)); + C::Construct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex)); } else { unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0; ASSERT(overlap <= count); - C::Destruct(m_data + sourceIndex + overlap, count - overlap); - C::Construct(m_data + sourceIndex + overlap, count - overlap); + C::Destruct(this->m_data + sourceIndex + overlap, count - overlap); + C::Construct(this->m_data + sourceIndex + overlap, count - overlap); } } @@ -897,72 +897,72 @@ void TArray::Move (unsigned destIndex, unsigned sourceIndex, unsigned count //=========================================================================== template T * TArray::New () { - AdjustSizeChunked(m_count + 1, m_count + 1); - return &m_data[m_count - 1]; + AdjustSizeChunked(this->m_count + 1, this->m_count + 1); + return &this->m_data[this->m_count - 1]; } //=========================================================================== template T * TArray::New (unsigned count) { - AdjustSizeChunked(m_count + count, m_count + count); - return &m_data[m_count - count]; + AdjustSizeChunked(this->m_count + count, this->m_count + count); + return &this->m_data[this->m_count - count]; } //=========================================================================== template void TArray::Push (const T & source) { - AdjustSizeChunked(m_count + 1, m_count); - C::CopyConstruct(&m_data[m_count], source); - ++m_count; + AdjustSizeChunked(this->m_count + 1, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source); + ++this->m_count; } //=========================================================================== template T TArray::Pop () { - ASSERT(m_count); - T result = m_data[--m_count]; - C::Destruct(m_data + m_count); + ASSERT(this->m_count); + T result = this->m_data[--this->m_count]; + C::Destruct(this->m_data + this->m_count); return result; } //=========================================================================== template void TArray::Reserve (unsigned additionalCount) { - AdjustSizeChunked(max(m_alloc, m_count + additionalCount), m_count); + AdjustSizeChunked(max(this->m_alloc, this->m_count + additionalCount), this->m_count); } //=========================================================================== template void TArray::Set (const T * source, unsigned count) { AdjustSizeChunked(count, 0); - C::CopyConstruct(m_data, source, count); - m_count = count; + C::CopyConstruct(this->m_data, source, count); + this->m_count = count; } //=========================================================================== template void TArray::SetChunkSize (unsigned chunkSize) { - m_chunkSize = chunkSize; + this->m_chunkSize = chunkSize; } //=========================================================================== template void TArray::SetCount (unsigned count) { - AdjustSizeChunked(max(m_alloc, count), count); + AdjustSizeChunked(max(this->m_alloc, count), count); } //=========================================================================== template void TArray::SetCountFewer (unsigned count) { - ASSERT(count <= m_count); - C::Destruct(m_data + count, m_count - count); - m_count = count; + ASSERT(count <= this->m_count); + C::Destruct(this->m_data + count, this->m_count - count); + this->m_count = count; } //=========================================================================== template void TArray::Trim () { - AdjustSize(m_count, m_count); + this->AdjustSize(this->m_count, this->m_count); } @@ -995,15 +995,15 @@ bool TSortArray::Delete (K sortKey) { // Find the correct position for this key unsigned index; - BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), &index); + BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), &index); // Verify that an entry exists for this key - unsigned count = Count(); + unsigned count = this->Count(); if ((index >= count) || (SortKey((*this)[index]) != sortKey)) return false; // Delete the entry - DeleteOrdered(index); + this->DeleteOrdered(index); return true; } @@ -1013,8 +1013,8 @@ template T * TSortArray::Find (K sortKey, unsigned * index) { // Find the correct position for this key - BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); - if (*index >= Count()) + BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index); + if (*index >= this->Count()) return nil; // Check whether the key is at that position @@ -1028,8 +1028,8 @@ template const T * TSortArray::Find (K sortKey, unsigned * index) const { // Find the correct position for this key - BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); - if (*index >= Count()) + BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index); + if (*index >= this->Count()) return nil; // Check whether the key is at that position @@ -1043,10 +1043,10 @@ template T * TSortArray::Insert (K sortKey, unsigned index) { // Insert a new entry at this position - unsigned count = Count(); - SetCount(count + 1); + unsigned count = this->Count(); + this->SetCount(count + 1); if (index < count) - Move(index + 1, index, count - index); + this->Move(index + 1, index, count - index); // Fill in the new entry T & elem = (*this)[index]; @@ -1058,8 +1058,8 @@ T * TSortArray::Insert (K sortKey, unsigned index) { //=========================================================================== template void TSortArray::Sort () { - T * ptr = Ptr(); - unsigned count = Count(); + T * ptr = this->Ptr(); + unsigned count = this->Count(); QSORT( T, ptr, diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h index a3d8b10f..1c45c149 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h @@ -451,7 +451,7 @@ T * THashTable::FindNext (const K & key, T * object) { template const T * THashTable::Find (const K & key) const { unsigned hash = key.GetHash(); - const LIST(T) & slotList = GetSlotList(hash); + const LIST(T) & slotList = this->GetSlotList(hash); for (const T * curr = slotList.Head(); curr; curr = slotList.Next(curr)) if ((GetHash(curr) == hash) && (*curr == key)) return curr; @@ -462,7 +462,7 @@ const T * THashTable::Find (const K & key) const { template const T * THashTable::FindNext (const K & key, const T * object) const { unsigned hash = key.GetHash(); - const LIST(T) & slotList = GetSlotList(hash); + const LIST(T) & slotList = this->GetSlotList(hash); for (const T * curr = slotList.Next(object); curr; curr = slotList.Next(curr)) if ((GetHash(curr) == hash) && (*curr == key)) return curr; @@ -501,8 +501,8 @@ public: //=========================================================================== template THashTableDecl::THashTableDecl () { - SetLinkOffset(linkOffset, maxSize); - SetSlotMaxCount(maxSize); + this->SetLinkOffset(linkOffset, maxSize); + this->SetSlotMaxCount(maxSize); } @@ -523,8 +523,8 @@ public: //=========================================================================== template void THashTableDyn::Initialize (int linkOffset, unsigned maxSize) { - SetLinkOffset(linkOffset, maxSize); - SetSlotMaxCount(maxSize); + this->SetLinkOffset(linkOffset, maxSize); + this->SetSlotMaxCount(maxSize); } @@ -581,10 +581,10 @@ template class THashKeyStrCmp : public THashKeyStrBase { public: bool operator== (const THashKeyStrCmp & rhs) const { - return StrCmp(m_str, rhs.m_str) == 0; + return StrCmp(this->m_str, rhs.m_str) == 0; } unsigned GetHash () const { - return StrHash(m_str); + return StrHash(this->m_str); } protected: @@ -597,10 +597,10 @@ template class THashKeyStrCmpI : public THashKeyStrBase { public: bool operator== (const THashKeyStrCmpI & rhs) const { - return StrCmpI(m_str, rhs.m_str) == 0; + return StrCmpI(this->m_str, rhs.m_str) == 0; } unsigned GetHash () const { - return StrHashI(m_str); + return StrHashI(this->m_str); } protected: @@ -621,7 +621,7 @@ public: THashKeyStrPtr () { } THashKeyStrPtr (const C str[]) : T(str) { } void SetString (const C str[]) { - m_str = str; + this->m_str = str; } }; @@ -648,12 +648,12 @@ public: SetString(nil); } void SetString (const C str[]) { // deprecated - if (m_str) - FREE(const_cast(m_str)); + if (this->m_str) + FREE(const_cast(this->m_str)); if (str) - m_str = StrDup(str); + this->m_str = StrDup(str); else - m_str = nil; + this->m_str = nil; } }; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h index 3d436873..6da06c0c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h @@ -554,7 +554,7 @@ inline T * TList::NewFlags (unsigned flags, ELinkType linkType, T * existingN //=========================================================================== template inline T * TList::NewZero (ELinkType linkType, T * existingNode, const char file[], int line) { - return NewFlags(MEM_ZERO, linkType, existingNode, file, line); + return NewFlags(0, linkType, existingNode, file, line); } //=========================================================================== @@ -605,7 +605,7 @@ public: //=========================================================================== template TListDecl::TListDecl () { - SetLinkOffset(linkOffset); + this->SetLinkOffset(linkOffset); } @@ -626,5 +626,5 @@ public: //=========================================================================== template void TListDyn::Initialize (int linkOffset) { - SetLinkOffset(linkOffset); + this->SetLinkOffset(linkOffset); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h index cd2d6876..7b6ed941 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h @@ -99,7 +99,7 @@ private: int m_linkOffset; ARRAY(C *) m_array; - friend TBasePriority; + friend class TBasePriority; }; //=========================================================================== @@ -332,7 +332,7 @@ inline void TPriorityQueue::UnlinkAll () { template class TPriorityQueueDecl : public TPriorityQueue { public: - TPriorityQueueDecl () { SetLinkOffset(linkOffset); } + TPriorityQueueDecl () { this->SetLinkOffset(linkOffset); } }; @@ -345,7 +345,7 @@ public: template class TPriorityQueueDyn : public TPriorityQueue { public: - void Initialize (int linkOffset) { SetLinkOffset(linkOffset); } + void Initialize (int linkOffset) { this->SetLinkOffset(linkOffset); } }; @@ -381,7 +381,7 @@ private: TPriorityQueue * m_queue; unsigned m_index; - friend TPriorityQueue; + friend class TPriorityQueue; }; //=========================================================================== @@ -421,7 +421,7 @@ public: if (value == m_value) return; m_value = value; - Relink(); + this->Relink(); } T Get () const { return m_value; @@ -454,7 +454,7 @@ public: if (m_time == time) return; m_time = time; - Relink(); + this->Relink(); } unsigned Get () const { return m_time; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h index e6002d6c..684ede09 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h @@ -97,13 +97,13 @@ class TSkipList { private: enum { kMaxLevels = 32 }; - template + template struct TNode { - const K * key; - T * object; + const K2 * key; + T2 * object; unsigned level; - TNode * prev; - TNode * next[1]; // variable size array + TNode * prev; + TNode * next[1]; // variable size array }; typedef TNode Node; @@ -147,7 +147,7 @@ public: //============================================================================ template -typename TSkipList::TNode * TSkipList::AllocNode (unsigned level) { +typename TSkipList::Node* TSkipList::AllocNode (unsigned level) { unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node); Node * node = (Node *)ALLOC(size); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h index a6fcdef5..6a0487b5 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h @@ -102,13 +102,13 @@ public: //=========================================================================== template void * TSpareList::Alloc () { - return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name()); + return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name()); } //=========================================================================== template void TSpareList::CleanUp () { - CBaseSpareList::CleanUp(typeid(T).raw_name()); + CBaseSpareList::CleanUp(typeid(T).name()); } //=========================================================================== @@ -127,5 +127,5 @@ void TSpareList::Free (T * node) { //=========================================================================== template T * TSpareList::New () { - return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name())) T; + return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name())) T; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h index 03d140da..51cbd82e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h @@ -36,10 +36,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com template struct SubstParsedData { - template + template struct SubstBlock { bool isVar; - chartype * data; + char_type * data; unsigned strLen; SubstBlock()