diff --git a/rEFIt_UEFI/cpp_foundation/XArray.h b/rEFIt_UEFI/cpp_foundation/XArray.h new file mode 100755 index 000000000..de8dc1247 --- /dev/null +++ b/rEFIt_UEFI/cpp_foundation/XArray.h @@ -0,0 +1,336 @@ +//************************************************************************************************* +//************************************************************************************************* +// +// XArray +// +// Developed by jief666, from 1997. +// +//************************************************************************************************* +//************************************************************************************************* + +#if !defined(__XARRAY_H__) +#define __XARRAY_H__ + +//#include "../Platform/Platform.h" // for DebugLog +VOID EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...); // To avoid include Platform just for this +extern "C" { + #include + #include + #include // for CpuDeadLoop(); +} +#include "XToolsCommon.h" + + +#if 0 +#define XArray_DBG(...) DebugLog(2, __VA_ARGS__) +#else +#define XArray_DBG(...) +#endif + +template +class XArray +{ + protected: + TYPE *m_data; + xsize m_len; + xsize m_size; + xsize _GrowBy; + + public: + void Init(); + XArray() { Init(); } + XArray(const XArray &anArray); + const XArray &operator =(const XArray &anArray); + virtual ~XArray(); + + public: + const TYPE *Data() const { return m_data; } + TYPE *Data() { return m_data; } + + public: + xsize Size() const { return m_size; } + xsize Length() const { return m_len; } + void SetLength(xsize l); + + const TYPE& ElementAt(xsize nIndex) const; + TYPE& ElementAt(xsize nIndex); + + const TYPE& operator[](xsize nIndex) const { return ElementAt(nIndex); } + TYPE& operator[](xsize nIndex) { return ElementAt(nIndex); } + const TYPE& operator[]( int nIndex) const { return ElementAt(nIndex); } + TYPE& operator[]( int nIndex) { return ElementAt(nIndex); } + + operator const void *() const { return m_data; }; + operator void *() { return m_data; }; + operator const TYPE *() const { return m_data; }; + operator TYPE *() { return m_data; }; + + const TYPE * operator +( int i) const { return m_data+i; }; + TYPE * operator +( int i) { return m_data+i; }; + const TYPE * operator +(xsize i) const { return m_data+i; }; + TYPE * operator +(xsize i) { return m_data+i; }; + const TYPE * operator -( int i) const { return m_data-i; }; + TYPE * operator -( int i) { return m_data-i; }; + const TYPE * operator -(xsize i) const { return m_data-i; }; + TYPE * operator -(xsize i) { return m_data-i; }; + +// xsize Add(const TYPE newElement); +// TYPE AddNew(); +// xsize Inserts(const TYPE &newElement, xsize pos, xsize count); + + void CheckSize(xsize nNewSize); + void CheckSize(xsize nNewSize, xsize nGrowBy); + + xsize AddUninitialized(xsize count); // add count uninitialzed elements + xsize Add(const TYPE newElement, xsize count = 1); + xsize AddArray(const TYPE *newElements, xsize count = 1); + xsize Insert(const TYPE newElement, xsize pos, xsize count = 1); + + void Remove(const TYPE *Element); + void Remove(const TYPE &Element); + void RemoveAtIndex(xsize nIndex); + void RemoveAtIndex(int nIndex); + + void Empty(); + + xsize IdxOf(TYPE& e) const; + bool ExistIn(TYPE& e) const { return IdxOf(e) != MAX_XSIZE; } +}; + +//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// +// XArray +// +//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +template +xsize XArray::IdxOf(TYPE& e) const +{ + xsize i; + + for ( i=0 ; i +void XArray::Init() +{ + m_data = NULL; + m_size = 0; + m_len = 0; + _GrowBy = XArrayGrowByDefault; +} + +/* Constructeur */ +template +XArray::XArray(const XArray &anArray) +{ + Init(); + Add(anArray.Data(), anArray.Length()); +} + +/* operator = */ +template +const XArray &XArray::operator =(const XArray &anArray) +{ + xsize ui; + + Empty(); + for ( ui=0 ; ui +XArray::~XArray() +{ +//printf("XArray Destructor\n"); + if ( m_data ) Xfree(m_data); +} + +/* CheckSize() */ +template +void XArray::CheckSize(xsize nNewSize, xsize nGrowBy) +{ +//XArray_DBG("CheckSize: m_len=%d, m_size=%d, nGrowBy=%d, nNewSize=%d\n", m_len, m_size, nGrowBy, nNewSize); + if ( nNewSize > m_size ) { + nNewSize += nGrowBy; + m_data = (TYPE *)Xrealloc( m_size * sizeof(TYPE), nNewSize * sizeof(TYPE), (void *)m_data); + if ( !m_data ) { + DebugLog(2, "XArray::CheckSize(nNewSize=%llu, nGrowBy=%llu) : Xrealloc(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, nNewSize*sizeof(TYPE), m_data); + CpuDeadLoop(); + } +// memset(&_Data[_Size], 0, (nNewSize-_Size) * sizeof(TYPE)); // Could help for debugging, but zeroing in not needed. + m_size = nNewSize; + } +} + +/* CheckSize() */ +template +void XArray::CheckSize(xsize nNewSize) +{ + CheckSize(nNewSize, XArrayGrowByDefault); +} + +/* SetLength (xsize i) */ +template +void XArray::SetLength(xsize l) +{ + m_len = l; + #ifdef DEBUG + if(m_len > m_size) { + DebugLog(2, "XArray::SetLength(xsize) -> _Len > _Size"); + CpuDeadLoop(); + } + #endif +} + + +/* ElementAt() */ +template +TYPE &XArray::ElementAt(xsize index) +{ + #ifdef _DEBUG + if ( index >= m_len ) { + DebugLog(2, "XArray::ElementAt(xsize) -> Operator [] : index > m_len"); + CpuDeadLoop(); + } + #endif + return m_data[index]; +} + +/* ElementAt() */ +template +const TYPE& XArray::ElementAt(xsize index) const +{ + #ifdef _DEBUG + if ( index >= m_len ) { + DebugLog(2, "XArray::ElementAt(xsize) const -> Operator [] : index > m_len"); + CpuDeadLoop(); + } + #endif + return m_data[index]; +} + +/* Add(xsize) */ +template +xsize XArray::AddUninitialized(xsize count) +{ + CheckSize(m_len+count); + m_len += count; + return m_len-count; +} + +/* Add(TYPE, xsize) */ +template +xsize XArray::Add(const TYPE newElement, xsize count) +{ +// XArray_DBG("xsize XArray::Add(const TYPE newElement, xsize count) -> Enter. count=%d _Len=%d _Size=%d\n", count, m_len, m_size); + xsize i; + + CheckSize(m_len+count); + for ( i=0 ; i +xsize XArray::AddArray(const TYPE *newElements, xsize count) +{ + xsize i; + + CheckSize(m_len+count); + for ( i=0 ; i +xsize XArray::Insert(const TYPE newElement, xsize pos, xsize count) +{ + xsize i; + + if ( pos < m_len ) { + CheckSize(m_len+count); + memmove(&m_data[pos], &m_data[pos+count], (m_len-pos)*sizeof(TYPE)); + for ( i=0 ; i +void XArray::RemoveAtIndex(xsize nIndex) +{ + if ( nIndex < m_len ) { + if ( nIndex nIndex > m_len\n"); + #endif +} + +/* Remove(int) */ +template +void XArray::RemoveAtIndex(int nIndex) +{ + #if defined(__XTOOLS_INT_CHECK__) + if ( nIndex < 0 ) { + DebugLog(2, "XArray::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex); + CpuDeadLoop(); + } + #endif + + RemoveAtIndex( (xsize)nIndex ); // Check of nIndex is made in Remove(xsize nIndex) + return; +} + +/* Remove(TYPE) */ +template +void XArray::Remove(const TYPE &Element) +{ + xsize i; + + for ( i=0 ; i Element not found\n"); + #endif +} + +/* Remove(TYPE *) */ +template +void XArray::Remove(const TYPE *Element) +{ + Remove(*Element); +} + +/* Empty() */ +template +void XArray::Empty() +{ +//printf("XArray Empty\n"); + m_len = 0; +} + +#endif diff --git a/rEFIt_UEFI/cpp_foundation/XObjArray.h b/rEFIt_UEFI/cpp_foundation/XObjArray.h new file mode 100755 index 000000000..39b3dcdc2 --- /dev/null +++ b/rEFIt_UEFI/cpp_foundation/XObjArray.h @@ -0,0 +1,577 @@ +//************************************************************************************************* +//************************************************************************************************* +// +// XObjArray +// +// Developed by jief666, from 1997. +// +//************************************************************************************************* +//************************************************************************************************* + +#if !defined(__XOBJARRAY_H__) +#define __XOBJARRAY_H__ + +//#include "../Platform/Platform.h" // for DebugLog +VOID EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...); // To avoid include Platform just for this +extern "C" { + #include + #include + #include // for CpuDeadLoop(); +} +#include "XToolsCommon.h" + + +#if 1 +#define XObjArray_DBG(...) DebugLog(2, __VA_ARGS__) +#else +#define XObjArray_DBG(...) +#endif + + + +template +class XObjArrayEntry +{ + public: + TYPE* Object; + bool FreeIt; +}; + +template +class XObjArrayNC +{ + public: + XObjArrayEntry *_Data; + xsize _Len; + xsize _Size; + + public: + void Init(); + XObjArrayNC() { Init(); } + virtual ~XObjArrayNC(); + + protected: + XObjArrayNC(const XObjArrayNC &anObjArrayNC) { throw "Intentionally not defined"; } + const XObjArrayNC &operator =(const XObjArrayNC &anObjArrayNC) { throw "Intentionally not defined"; } + xsize _getLen() const { return _Len; } + + public: + xsize Size() const { return _Size; } + xsize Length() const { return _Len; } + + bool NotNull() const { return Length() > 0; } + bool IsNull() const { return Length() == 0; } + + const TYPE &ElementAt(xsize nIndex) const; + TYPE &ElementAt(xsize nIndex); + + // This was useful for realtime debugging with a debugger that do not recognise references. That was years and years ago. Probably not needed anymore. + #ifdef _DEBUG_iufasdfsfk + const TYPE *DbgAt(int i) const { if ( i >= 0 && (xsize)i < _Len ) return &ElementAt ((xsize) i); else return NULL; } + #endif + + const TYPE &operator[](xsize nIndex) const { return ElementAt(nIndex); } + TYPE &operator[](xsize nIndex) { return ElementAt(nIndex); } + + xsize AddReference(TYPE *newElement, bool FreeIt); + +// xsize InsertRef(TYPE *newElement, xsize pos, bool FreeIt = false); + xsize InsertRef(TYPE *newElement, xsize pos, bool FreeIt); + + void SetFreeIt(xsize nIndex, bool Flag); + void SetFreeIt(const TYPE *Element, bool Flag); + + void Remove(const TYPE *Element); + void RemoveWithoutFreeing(const TYPE *Element); + void Remove(const TYPE &Element); + void RemoveAtIndex(xsize nIndex); + void RemoveAtIndex(int nIndex); + void RemoveWithoutFreeing(xsize nIndex); // If you use this, there might be a design problem somewhere ??? + //void Remove(int nIndex); + void RemoveAllBut(const TYPE *Element); + + void Empty(); + + public: + void CheckSize(xsize nNewSize, xsize nGrowBy = XArrayGrowByDefault); + +}; + +template +class XObjArray : public XObjArrayNC +{ + public: + XObjArray() : XObjArrayNC() {} + XObjArray(const XObjArray &anObjArray); + const XObjArray &operator =(const XObjArray &anObjArray); + + xsize AddCopy(const TYPE &newElement, bool FreeIt = true); + xsize AddCopies(const TYPE &n1, bool FreeIt = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, const TYPE &n13, bool FreeThem = true); + xsize AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, const TYPE &n13, const TYPE &n14, bool FreeThem = true); + //TYPE & AddNew(bool FreeIt = true); + + xsize InsertCopy(const TYPE &newElement, xsize pos); + +}; + +//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// +// XObjArray +// +//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + +/* Constructeur */ +template +void XObjArrayNC::Init() +{ + _Data = NULL; + _Size = 0; + _Len = 0; + // THis was useful for realtime debugging with a debugger that do not recognise references. + #ifdef _DEBUG_iufasdfsfk + { + const TYPE *tmp; + tmp = DbgAt(0); + } + #endif +} + +/* Constructeur */ +template +XObjArray::XObjArray(const XObjArray &anObjArray) +{ + xsize ui; + + XObjArrayNC::Init(); + this->CheckSize(anObjArray.Length(), (xsize)0); + for ( ui=0 ; ui +const XObjArray &XObjArray::operator =(const XObjArray &anObjArray) +{ + xsize ui; + + XObjArrayNC::Empty(); + CheckSize(anObjArray.Length(), 0); + for ( ui=0 ; ui +XObjArrayNC::~XObjArrayNC() +{ +//printf("XObjArray Destructor\n"); + Empty(); + if ( _Data ) Xfree(_Data); +} + +/* CheckSize() */ +template +void XObjArrayNC::CheckSize(xsize nNewSize, xsize nGrowBy) +{ + if ( _Size < nNewSize ) { + nNewSize += nGrowBy + 1; + _Data = (XObjArrayEntry *)Xrealloc(sizeof(XObjArrayEntry) * _Size, sizeof(XObjArrayEntry) * nNewSize, (void *)_Data ); + if ( !_Data ) { + XObjArray_DBG("XObjArrayNC::CheckSize(nNewSize=%llu, nGrowBy=%llu) : Xrealloc(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, _Size, sizeof(XObjArrayEntry) * nNewSize, _Data); + } +// memset(&_Data[_Size], 0, (nNewSize-_Size) * sizeof(XObjArrayEntry)); + _Size = nNewSize; + } +} + +/* ElementAt() */ +template +TYPE &XObjArrayNC::ElementAt(xsize index) +{ + if ( index >= _Len ) { + DebugLog(2, "XObjArray::ElementAt(xsize) -> operator [] - index (%d) greater than length (%d)\n", index, _Len); + CpuDeadLoop(); + } + return *((TYPE *)(_Data[index].Object)); +} + +/* ElementAt() */ +template +const TYPE &XObjArrayNC::ElementAt(xsize index) const +{ + if ( index >= _Len ) { + DebugLog(2, "XObjArray::ElementAt(xsize) -> operator [] - index (%d) greater than length (%d)\n", index, _Len); + CpuDeadLoop(); + } + return *((TYPE *)(_Data[index].Object)); +} + +///* Add() */ +//template +//TYPE &XObjArray::AddNew(bool FreeIt) +//{ +// XObjArrayNC::CheckSize(XObjArray::_getLen()+1); +// XObjArray::_Data[XObjArray::_Len].Object = new TYPE; +// XObjArray::_Data[XObjArray::_Len].FreeIt = FreeIt; +// XObjArray::_Len += 1; +// return *((TYPE *)(XObjArray::_Data[XObjArray::_Len-1].Object)); +//} + +/* Add(TYPE &, xsize) */ +template +xsize XObjArray::AddCopy(const TYPE &newElement, bool FreeIt) +{ + XObjArrayNC::CheckSize(XObjArray::_Len+1); + XObjArray::_Data[XObjArray::_Len].Object = new TYPE(newElement); + XObjArray::_Data[XObjArray::_Len].FreeIt = FreeIt; + XObjArray::_Len += 1; + return XObjArray::_Len-1; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, bool FreeIt) +{ + return AddCopy(n1, FreeIt); +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, bool FreeThem) +{ + xsize ui = AddCopies(n1, FreeThem); + AddCopy(n2, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, FreeThem); + AddCopy(n3, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, FreeThem); + AddCopy(n4, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, FreeThem); + AddCopy(n5, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, FreeThem); + AddCopy(n6, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, FreeThem); + AddCopy(n7, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, FreeThem); + AddCopy(n8, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, FreeThem); + AddCopy(n9, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, n9, FreeThem); + AddCopy(n10, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, FreeThem); + AddCopy(n11, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, FreeThem); + AddCopy(n12, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, const TYPE &n13, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, FreeThem); + AddCopy(n13, FreeThem); + return ui; +} + +template +xsize XObjArray::AddCopies(const TYPE &n1, const TYPE &n2, const TYPE &n3, const TYPE &n4, const TYPE &n5, const TYPE &n6, const TYPE &n7, const TYPE &n8, const TYPE &n9, const TYPE &n10, const TYPE &n11, const TYPE &n12, const TYPE &n13, const TYPE &n14, bool FreeThem) +{ + xsize ui = AddCopies(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, FreeThem); + AddCopy(n14, FreeThem); + return ui; +} + +/* Add(TYPE *, xsize) */ +template +xsize XObjArrayNC::AddReference(TYPE *newElement, bool FreeIt) +{ + XObjArrayNC::CheckSize(XObjArrayNC::_Len+1); + XObjArrayNC::_Data[XObjArrayNC::_Len].Object = newElement; + XObjArrayNC::_Data[XObjArrayNC::_Len].FreeIt = FreeIt; + XObjArrayNC::_Len += 1; + return XObjArrayNC::_Len-1; +} + +/* Insert(TYPE &, xsize) */ +template +xsize XObjArray::InsertCopy(const TYPE &newElement, xsize pos) +{ + if ( pos < XObjArray::_Len ) { + XObjArrayNC::CheckSize(XObjArray::_Len+1); + memmove(&XObjArray::_Data[pos+1], &XObjArray::_Data[pos], (XObjArray::_Len-pos)*sizeof(XObjArrayEntry)); + XObjArray::_Data[pos].Object = new TYPE(newElement); + XObjArray::_Data[pos].FreeIt = true; + XObjArray::_Len += 1; + return pos; + }else{ + return AddCopy(newElement); + } +} + +/* Insert(TYPE &, xsize) */ +template +xsize XObjArrayNC::InsertRef(TYPE *newElement, xsize pos, bool FreeIt) +{ + if ( pos < XObjArrayNC::_Len ) { + CheckSize(XObjArrayNC::_Len+1); + memmove(&XObjArrayNC::_Data[pos+1], &XObjArrayNC::_Data[pos], (XObjArrayNC::_Len-pos)*sizeof(XObjArrayEntry)); + _Data[pos].Object = newElement; + _Data[pos].FreeIt = FreeIt; + XObjArrayNC::_Len += 1; + return pos; + }else{ + return AddRef(newElement, FreeIt); + } +} + +/* SetFreeIt(xsize, bool) */ +template +void XObjArrayNC::SetFreeIt(xsize nIndex, bool Flag) +{ + if ( nIndex < XObjArrayNC::_Len ) + { + XObjArrayNC::_Data[nIndex].FreeIt = Flag; + } + else{ + #if defined(_DEBUG) + throw "XObjArray::SetFreeIt(xsize) -> nIndex >= _Len\n"; + #endif + } +} + +/* SetFreeIt(const TYPE *Element, bool) */ +template +void XObjArrayNC::SetFreeIt(const TYPE *Element, bool Flag) +{ + xsize i; + + for ( i=0 ; i < XObjArrayNC::_Len ; i+= 1) { + if ( ((TYPE *)XObjArrayNC::_Data[i].Object) == Element ) { + SetFreeIt(i, Flag); + return ; + } + } + #if defined(_DEBUG) + throw "XObjArray::SetFreeIt(const TYPE *) -> nIndex >= _Len\n"; + #endif +} + +/* Remove(xsize) */ +template +void XObjArrayNC::RemoveAtIndex(xsize nIndex) +{ + if ( nIndex < XObjArrayNC::_Len ) + { + if ( nIndex >= XObjArrayNC::_Len ) { + DebugLog(2, "void XObjArrayNC::RemoveAtIndex(xsize nIndex) : BUG nIndex (%d) is > Length(). System halted\n", nIndex); + CpuDeadLoop(); + } + } + if ( _Data[nIndex].FreeIt ) + { + TYPE *TmpObject; // BCB 4 oblige me to use a tmp var for doing the delete. + + TmpObject = (TYPE *)(_Data[nIndex].Object); + delete TmpObject; + } + if ( nIndex::_Len-1 ) Xmemcpy(&_Data[nIndex], &_Data[nIndex+1], (_Len-nIndex-1)*sizeof(XObjArrayEntry)); + _Len -= 1; + return; +} + +//------------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------------- +/* RemoveWithoutFreeing(xsize) */ +template +void XObjArrayNC::RemoveWithoutFreeing(xsize nIndex) +{ + if ( nIndex < _Len ) + { + if ( nIndex<_Len-1 ) memcpy(&_Data[nIndex], &_Data[nIndex+1], (_Len-nIndex-1)*sizeof(XObjArrayEntry)); + _Len -= 1; + return; + } + #if defined(_DEBUG) + throw "XObjArray::RemoveWithoutFreeing(xsize) -> nIndex > _Len\n"; + #endif +} + +//------------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------------- +/* Remove(int) */ +template +void XObjArrayNC::RemoveAtIndex(int nIndex) +{ + #if defined(__XTOOLS_INT_CHECK__) + if ( nIndex < 0 ) { + DebugLog(2, "XArray::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex); + CpuDeadLoop(); + } + #endif + RemoveAtIndex( (xsize)nIndex ); // Remove(xsize) will check that index is < _Len +} + +/* Remove(const TYPE &) */ +template +void XObjArrayNC::Remove(const TYPE &Element) +{ + xsize i; + + for ( i=0 ; i<_Len ; i+= 1) { + if ( *((TYPE *)(_Data[i].Object)) == Element ) { + Remove(i); + return ; + } + } + #if defined(_DEBUG) + throw "XObjArray::Remove(TYPE &) -> Not found\n"; + #endif +} + +//------------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------------- +/* Remove(const TYPE *) */ +template +void XObjArrayNC::Remove(const TYPE *Element) +{ + xsize i; + + for ( i=0 ; i<_Len ; i+= 1) { + if ( ((TYPE *)_Data[i].Object) == Element ) { + Remove(i); + return ; + } + } + #if defined(_DEBUG) + throw "XObjArray::Remove(TYPE *) -> not found\n"; + #endif +} + +//------------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------------- +/* RemoveWithoutFreeing(const TYPE *) */ +template +void XObjArrayNC::RemoveWithoutFreeing(const TYPE *Element) +{ + xsize i; + + for ( i=0 ; i<_Len ; i+= 1) { + if ( ((TYPE *)_Data[i].Object) == Element ) { + RemoveWithoutFreeing(i); + return ; + } + } + #if defined(_DEBUG) + throw "XObjArray::RemoveWithoutFreeing(TYPE *) -> not found\n"; + #endif +} + +//------------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------------- +template +void XObjArrayNC::RemoveAllBut(const TYPE *Element) +{ + xsize i; + + for ( i=_Len ; i-- ; ) { + if ( ((TYPE *)_Data[i].Object) != Element ) { + Remove(i); + } + } +} + +/* Empty() */ +template +void XObjArrayNC::Empty() +{ + xsize i; + + if ( _Len > 0 ) { + for ( i=0 ; i<_Len ; i+= 1) { + if ( _Data[i].FreeIt ) + { + TYPE *TmpObject; // BCB 4 oblige me to use a tmp var for doing the delete. + + TmpObject = (TYPE *)(_Data[i].Object); + delete TmpObject; + } + } + _Len = 0; + } +} + +#endif diff --git a/rEFIt_UEFI/cpp_util/XStringW.cpp b/rEFIt_UEFI/cpp_foundation/XStringW.cpp similarity index 90% rename from rEFIt_UEFI/cpp_util/XStringW.cpp rename to rEFIt_UEFI/cpp_foundation/XStringW.cpp index 74541306f..ee5aa195e 100755 --- a/rEFIt_UEFI/cpp_util/XStringW.cpp +++ b/rEFIt_UEFI/cpp_foundation/XStringW.cpp @@ -1,6 +1,13 @@ -//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +//************************************************************************************************* +//************************************************************************************************* +// // STRING -//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// +// Developed by jief666, from 1997. +// +//************************************************************************************************* +//************************************************************************************************* + #if !defined(__XStringW_CPP__) #define __XStringW_CPP__ @@ -11,6 +18,7 @@ #define DBG(...) #endif +#include "XToolsCommon.h" #include "XStringW.h" extern "C" { @@ -21,15 +29,15 @@ extern "C" { #include "refit/IO.h" UINTN XStringWGrowByDefault = 1024; -//const XStringW NullXStringW; +const XStringW NullXStringW; void XStringW::Init(UINTN aSize) { //DBG("Init aSize=%d\n", aSize); - m_data = (wchar_t*)AllocatePool( (aSize+1)*sizeof(wchar_t) ); /* le 0 terminal n'est pas compté dans mSize */ + m_data = (wchar_t*)Xalloc( (aSize+1)*sizeof(wchar_t) ); /* le 0 terminal n'est pas compté dans mSize */ if ( !m_data ) { - DBG("XStringW::Init(%d) : AllocatePool returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t)); + DBG("XStringW::Init(%d) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t)); CpuDeadLoop(); } m_size = aSize; @@ -110,9 +118,9 @@ wchar_t *XStringW::CheckSize(UINTN nNewSize, UINTN nGrowBy) if ( m_size < nNewSize ) { nNewSize += nGrowBy; - m_data = (wchar_t*)ReallocatePool(m_size*sizeof(wchar_t), (nNewSize+1)*sizeof(wchar_t), m_data); + m_data = (wchar_t*)Xrealloc(m_size*sizeof(wchar_t), (nNewSize+1)*sizeof(wchar_t), m_data); if ( !m_data ) { - DBG("XStringW::CheckSize(%d, %d) : ReallocatePool(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, (nNewSize+1)*sizeof(wchar_t), m_data); + DBG("XStringW::CheckSize(%d, %d) : Xrealloc(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, (nNewSize+1)*sizeof(wchar_t), m_data); CpuDeadLoop(); } m_size = nNewSize; @@ -244,14 +252,14 @@ void XStringW::SPrintf(const wchar_t *format, ...) XStringW XStringW::basename() const { UINTN idx = RIdxOf(LPATH_SEPARATOR); - if ( idx == MAX_UINTN ) return XStringW(); + if ( idx == MAX_UINTN ) return NullXStringW; return SubString(idx+1, length()-idx-1); } XStringW XStringW::dirname() const { UINTN idx = RIdxOf(LPATH_SEPARATOR); - if ( idx == MAX_UINTN ) return XStringW(); + if ( idx == MAX_UINTN ) return NullXStringW; return SubString(0, idx); } diff --git a/rEFIt_UEFI/cpp_util/XStringW.h b/rEFIt_UEFI/cpp_foundation/XStringW.h similarity index 100% rename from rEFIt_UEFI/cpp_util/XStringW.h rename to rEFIt_UEFI/cpp_foundation/XStringW.h diff --git a/rEFIt_UEFI/cpp_foundation/XToolsCommon.cpp b/rEFIt_UEFI/cpp_foundation/XToolsCommon.cpp new file mode 100644 index 000000000..1fbe58145 --- /dev/null +++ b/rEFIt_UEFI/cpp_foundation/XToolsCommon.cpp @@ -0,0 +1,3 @@ +#include "XToolsCommon.h" + +xsize XArrayGrowByDefault; diff --git a/rEFIt_UEFI/cpp_foundation/XToolsCommon.h b/rEFIt_UEFI/cpp_foundation/XToolsCommon.h new file mode 100755 index 000000000..88c861d6b --- /dev/null +++ b/rEFIt_UEFI/cpp_foundation/XToolsCommon.h @@ -0,0 +1,19 @@ +#ifndef __XTOOLSCOMMON_H__ +#define __XTOOLSCOMMON_H__ + +#define xsize UINTN +#define MAX_XSIZE MAX_UINTN + +extern xsize XArrayGrowByDefault; +extern xsize XBufferGrowByDefault; + +/* For convience, operator [] is define with int parameter. + * Defining __XTOOLS_INT_CHECK__ make a check that the parameter is >= 0 + */ +#define __XTOOLS_INT_CHECK__ + +#define Xalloc(AllocationSize) AllocatePool(AllocationSize) +#define Xrealloc(OldSize, NewSize, OldBuffer) ReallocatePool(OldSize, NewSize, OldBuffer) +#define Xfree(Buffer) FreePool(Buffer) +#define Xmemcpy(dest,source,count) CopyMem(dest, (void*)(source), count) +#endif diff --git a/rEFIt_UEFI/cpp_unit_test/XArray_tests.cpp b/rEFIt_UEFI/cpp_unit_test/XArray_tests.cpp new file mode 100644 index 000000000..4365861eb --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/XArray_tests.cpp @@ -0,0 +1,21 @@ +#include "../cpp_foundation/XArray.h" + +#include "../Platform/Platform.h" + +int XArray_tests() +{ + XArray array1; + array1.Add(12); + array1.Add(34); + array1.Add(56); + + if ( array1[0] != 12 ) return 1; + if ( array1[1] != 34 ) return 2; + if ( array1[2] != 56 ) return 3; + + array1.RemoveAtIndex(1); + + if ( array1[1] != 56 ) return 4; + + return 0; +} diff --git a/rEFIt_UEFI/cpp_unit_test/XArray_tests.h b/rEFIt_UEFI/cpp_unit_test/XArray_tests.h new file mode 100644 index 000000000..e4f3c0c83 --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/XArray_tests.h @@ -0,0 +1,3 @@ + + +int XArray_tests(); diff --git a/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.cpp b/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.cpp new file mode 100644 index 000000000..3e9f37452 --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.cpp @@ -0,0 +1,63 @@ +#include "../cpp_foundation/XObjArray.h" + +#include "../Platform/Platform.h" + +class TestObjInt +{ + public: + UINTN m_v; + bool* m_destructor_called; + + TestObjInt(UINTN v, bool* destructor_called) : m_v(v), m_destructor_called(destructor_called) + { + *m_destructor_called=false; + }; + ~TestObjInt() + { + *m_destructor_called = true; + }; +}; + +int XObjArray_tests() +{ + bool m_destructor_called11; + bool m_destructor_called12; + bool m_destructor_called13; + bool m_destructor_called14; + + TestObjInt* obj14 = new TestObjInt(14, &m_destructor_called14); + { + TestObjInt obj11(11, &m_destructor_called11); + + { + XObjArray array1; + array1.AddReference(&obj11, false); // Do not free this object when the array is freed, This object declared on the stack, so it'll be free by C++ + array1.AddReference(new TestObjInt(12, &m_destructor_called12), true); // Free this object. C++ doesn't keep any reference of new allocated object. So it won't be freed by C++ + array1.AddReference(new TestObjInt(13, &m_destructor_called13), true); // Free this object. C++ doesn't keep any reference of new allocated object. So it won't be freed by C++ + array1.AddReference(obj14, false); // We keep a reference an obj14. Let's not ask the array to free it. + + if ( array1[0].m_v != 11 ) return 1; + if ( array1[1].m_v != 12 ) return 2; + if ( array1[2].m_v != 13 ) return 3; + if ( array1[3].m_v != 14 ) return 4; + + array1.RemoveAtIndex(1); + + if ( array1[1].m_v != 13 ) return 5; + } + + // Here the array and objects we added saying true as second parameter of AddReference. + if ( !m_destructor_called12 ) return 6; + if ( !m_destructor_called13 ) return 7; + // obj11 and obj14 should not be destroyed yet. + if ( m_destructor_called11 ) return 8; + if ( m_destructor_called14 ) return 9; + } + // obj11 must be destroyed by C++. + if ( !m_destructor_called11 ) return 10; + + delete(obj14); + if ( !m_destructor_called14 ) return 11; + + return 0; +} diff --git a/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.h b/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.h new file mode 100644 index 000000000..7f1c399f5 --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/XObjArray_tests.h @@ -0,0 +1,3 @@ + + +int XObjArray_tests(); diff --git a/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp new file mode 100644 index 000000000..ec6cbd27a --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp @@ -0,0 +1,35 @@ +#ifdef DEBUG_CLOVER +DBG("g_str = %s\n", g_str.data()); +DBG("g_str2 = %s\n", g_str2.data()); +extern XStringW global_str1; +DBG("global_str1 = %s\n", global_str1.data()); +extern XStringW global_str2; +DBG("global_str2 = %s\n", global_str2.data()); +{ +// XStringW str(L"local str value"); +// DBG("str = %s\n", str.data()); +// str.StrCat(L" appended text"); +// DBG("str = %s, len=%d\n", str.data(), str.length()); +// +// XStringW str2(str); +// DBG("str2 = %s\n", str2.data()); +// str2.StrnCpy(str.data(), 2); +// DBG("str2 = %s\n", str2.data()); +// str2.StrnCat(L"2ndtext", 2); +// DBG("str2 = %s\n", str2.data()); +// str2.Insert(1, str); +// DBG("str2 = %s\n", str2.data()); +// str2 += L"3rdtext"; +// DBG("str2 = %s\n", str2.data()); +// +// XStringW* str3 = new XStringW(); +// *str3 = L"str3data"; +// DBG("str3 = %s\n", str3->data()); +// delete str3; +} +// +destruct_globals_objects(NULL); // That should be done just before quitting clover module. Now, it's just for test. +DBG("press"); +PauseForKey(L"press"); +#endif + diff --git a/rEFIt_UEFI/cpp_unit_test/all_tests.cpp b/rEFIt_UEFI/cpp_unit_test/all_tests.cpp new file mode 100644 index 000000000..0bf9773db --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/all_tests.cpp @@ -0,0 +1,36 @@ +#include "../cpp_foundation/XStringW.h" +#include "../cpp_foundation/XArray.h" +#include "../cpp_foundation/XObjArray.h" + +#include "XArray_tests.h" +#include "XObjArray_tests.h" + +#include "../Platform/Platform.h" + +bool all_tests() +{ + bool all_ok = true; + int ret; + + ret = XArray_tests(); + if ( ret != 0 ) { + DebugLog(2, "XArray_tests() failed at test %d\n", ret); + all_ok = false; + } + ret = XObjArray_tests(); + if ( ret != 0 ) { + DebugLog(2, "XObjArray_tests() failed at test %d\n", ret); + all_ok = false; + } + + if ( !all_ok ) { + DebugLog(2, "A test failed, module %d, test %d \n"); + PauseForKey(L"press"); + }else{ +#ifdef JIEF_DEBUG + DebugLog(2, "All tests are ok\n"); + PauseForKey(L"press"); +#endif + } + return all_ok; +} diff --git a/rEFIt_UEFI/cpp_unit_test/all_tests.h b/rEFIt_UEFI/cpp_unit_test/all_tests.h new file mode 100644 index 000000000..f8a396ebe --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/all_tests.h @@ -0,0 +1,2 @@ + +bool all_tests(); diff --git a/rEFIt_UEFI/cpp_util/global1.cpp b/rEFIt_UEFI/cpp_util/global1.cpp index a3fd9cf43..72e7a657c 100644 --- a/rEFIt_UEFI/cpp_util/global1.cpp +++ b/rEFIt_UEFI/cpp_util/global1.cpp @@ -1,2 +1,2 @@ -#include "XStringW.h" +#include "../cpp_foundation/XStringW.h" XStringW global_str1(L"global_str1"); diff --git a/rEFIt_UEFI/cpp_util/global2.cpp b/rEFIt_UEFI/cpp_util/global2.cpp index f41e43d5a..31acaa1c5 100644 --- a/rEFIt_UEFI/cpp_util/global2.cpp +++ b/rEFIt_UEFI/cpp_util/global2.cpp @@ -1,2 +1,2 @@ -#include "XStringW.h" +#include "../cpp_foundation/XStringW.h" XStringW global_str2(L"global_str2"); diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 0c4f54c9f..62609debe 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -158,8 +158,6 @@ Platform/sse3_patcher.h Platform/sse3_5_patcher.h ../Version.h - cpp_util/XStringW.h - cpp_util/XStringW.cpp cpp_util/memory.cpp cpp_util/global1.cpp cpp_util/global2.cpp @@ -170,7 +168,11 @@ cpp_util/operatorNewDelete.cpp cpp_util/operatorNewDelete.h cpp_util/remove_ref.h - + cpp_foundation/XStringW.h + cpp_foundation/XStringW.cpp + cpp_foundation/XArray.h + cpp_foundation/XObjArray.h + [Sources.IA32] libeg/ftol.asm | MSFT @@ -317,7 +319,7 @@ [Pcd] [BuildOptions] - XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-omit-frame-pointer -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-writable-strings -Wno-unused-const-variable -DJCONST=const + XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-omit-frame-pointer -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-writable-strings -Wno-unused-const-variable -DJCONST=const -Wno-incompatible-ms-struct GCC:*_*_*_CC_FLAGS = -std=c99 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args GCC:*_*_*_CXX_FLAGS = -std=c++11 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-write-strings -Wno-unused-const-variable -Wno-pointer-arith -DJCONST=const MSFT:*_*_*_CC_FLAGS = /Os /wd4201 /D JCONST=const diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index cf2593046..12bb79676 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -35,9 +35,10 @@ */ #include "../Platform/Platform.h" -#include "../cpp_util/XStringW.h" #include "../cpp_util/globals_ctor.h" #include "../cpp_util/globals_dtor.h" +#include "../cpp_foundation/XStringW.h" +#include "../cpp_unit_test/all_tests.h" #include "entry_scan.h" #include "nanosvg.h" @@ -2072,41 +2073,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, construct_globals_objects(); // do this after SelfLoadedImage is initialized -#ifdef JIEF_DEBUG -DBG("g_str = %s\n", g_str.data()); -DBG("g_str2 = %s\n", g_str2.data()); -extern XStringW global_str1; -DBG("global_str1 = %s\n", global_str1.data()); -extern XStringW global_str2; -DBG("global_str2 = %s\n", global_str2.data()); -{ -// XStringW str(L"local str value"); -// DBG("str = %s\n", str.data()); -// str.StrCat(L" appended text"); -// DBG("str = %s, len=%d\n", str.data(), str.length()); -// -// XStringW str2(str); -// DBG("str2 = %s\n", str2.data()); -// str2.StrnCpy(str.data(), 2); -// DBG("str2 = %s\n", str2.data()); -// str2.StrnCat(L"2ndtext", 2); -// DBG("str2 = %s\n", str2.data()); -// str2.Insert(1, str); -// DBG("str2 = %s\n", str2.data()); -// str2 += L"3rdtext"; -// DBG("str2 = %s\n", str2.data()); -// -// XStringW* str3 = new XStringW(); -// *str3 = L"str3data"; -// DBG("str3 = %s\n", str3->data()); -// delete str3; -} -// -destruct_globals_objects(NULL); // That should be done just before quitting clover module. Now, it's just for test. -DBG("press"); -PauseForKey(L"press"); -#endif - + all_tests(); //dumping SETTING structure // if you change something in Platform.h, please uncomment and test that all offsets diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 80bf13951..2b303df55 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -39,7 +39,7 @@ //#include "../include/scroll_images.h" //#include "../Platform/Platform.h" -#include "../cpp_util/XStringW.h" +//#include "../cpp_foundation/XStringW.h" #include "Version.h" //#include "colors.h"