Minor fixups

This commit is contained in:
GAMMACASE 2023-11-19 16:05:18 +03:00
parent bf82ba994d
commit dc3346780d
6 changed files with 90 additions and 90 deletions

View File

@ -377,7 +377,7 @@ public:
KeyValues *Element( int nIndex ) const;
CKeyValues_Data::types_t GetDataType( const char *keyName = NULL );
CKeyValues_Data::types_t GetDataType( const char *keyName = NULL ) const;
// unpack a key values list into a structure
void UnpackIntoStructure( struct KeyValuesUnpackStructure const *pUnpackTable, void *pDest );

View File

@ -85,12 +85,13 @@ protected:
int m_GrowMode; // GROW_ enum.
// FIXME: Change m_ppMemBlob into a growable array?
void *m_pHeadOfFreeList;
int m_BlocksAllocated;
int m_PeakAlloc;
unsigned short m_nAlignment;
unsigned short m_NumBlobs;
// FIXME: Change m_ppMemBlob into a growable array?
void *m_pHeadOfFreeList;
const char * m_pszAllocOwner;
// CBlob could be not a multiple of 4 bytes so stuff it at the end here to keep us otherwise aligned
CBlob m_BlobHead;

View File

@ -141,8 +141,7 @@
//
////////////////////////////////////////////////////////////////////////////////
namespace detail // we'll hide the implementation details in a nested namespace.
namespace utldelegate // we'll hide the implementation utldelegates in a nested namespace.
{
// implicit_cast< >
@ -537,7 +536,7 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
#endif // MS/Intel hacks
} // namespace detail
} // namespace utldelegate
////////////////////////////////////////////////////////////////////////////////
// Fast Delegates, part 2:
@ -590,8 +589,8 @@ class CUtlAbstractDelegate
protected:
// the data is protected, not private, because many
// compilers have problems with template friends.
typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP.
detail::GenericClass *m_pthis;
typedef void (utldelegate::GenericClass::*GenericMemFuncType)(); // arbitrary MFP.
utldelegate::GenericClass *m_pthis;
GenericMemFuncType m_pFunction;
#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
@ -683,7 +682,7 @@ public:
// It's used in cases where I've cached off a delegate previously
void UnsafeThisPointerSlam( void *pThis )
{
m_pthis = (detail::GenericClass*)( pThis );
m_pthis = (utldelegate::GenericClass*)( pThis );
}
void *UnsafeGetThisPtr()
@ -718,7 +717,7 @@ protected:
// necessary typedefs.
// This class does everything else.
namespace detail
namespace utldelegate
{
template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr>
@ -888,7 +887,7 @@ public:
};
} // namespace detail
} // namespace utldelegate
////////////////////////////////////////////////////////////////////////////////
// Fast Delegates, part 3:
@ -930,15 +929,15 @@ public:
// allows "if (dg==0) ..." to compile.
//N=0
template<class RetType=detail::DefaultVoid>
template<class RetType=utldelegate::DefaultVoid>
class FastDelegate0
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)();
typedef RetType (*UnvoidStaticFunctionPtr)();
typedef RetType (detail::GenericClass::*GenericMemFn)();
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)();
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -974,23 +973,23 @@ public:
template < class X, class Y >
FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)())
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate0(const Y *pthis, DesiredRetType (X::* function_to_bind)() const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)() const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1056,15 +1055,15 @@ private: // Invoker for static functions
};
//N=1
template<class Param1, class RetType=detail::DefaultVoid>
template<class Param1, class RetType=utldelegate::DefaultVoid>
class FastDelegate1
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1100,23 +1099,23 @@ public:
template < class X, class Y >
FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate1(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1182,15 +1181,15 @@ private: // Invoker for static functions
};
//N=2
template<class Param1, class Param2, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class RetType=utldelegate::DefaultVoid>
class FastDelegate2
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1226,23 +1225,23 @@ public:
template < class X, class Y >
FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate2(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1308,15 +1307,15 @@ private: // Invoker for static functions
};
//N=3
template<class Param1, class Param2, class Param3, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class RetType=utldelegate::DefaultVoid>
class FastDelegate3
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1352,23 +1351,23 @@ public:
template < class X, class Y >
FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate3(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1434,15 +1433,15 @@ private: // Invoker for static functions
};
//N=4
template<class Param1, class Param2, class Param3, class Param4, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class Param4, class RetType=utldelegate::DefaultVoid>
class FastDelegate4
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1478,23 +1477,23 @@ public:
template < class X, class Y >
FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate4(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1560,15 +1559,15 @@ private: // Invoker for static functions
};
//N=5
template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType=utldelegate::DefaultVoid>
class FastDelegate5
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1604,23 +1603,23 @@ public:
template < class X, class Y >
FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate5(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1686,15 +1685,15 @@ private: // Invoker for static functions
};
//N=6
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType=utldelegate::DefaultVoid>
class FastDelegate6
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1730,23 +1729,23 @@ public:
template < class X, class Y >
FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate6(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1812,15 +1811,15 @@ private: // Invoker for static functions
};
//N=7
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType=utldelegate::DefaultVoid>
class FastDelegate7
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1856,23 +1855,23 @@ public:
template < class X, class Y >
FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate7(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -1938,15 +1937,15 @@ private: // Invoker for static functions
};
//N=8
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType=detail::DefaultVoid>
template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType=utldelegate::DefaultVoid>
class FastDelegate8
{
private:
typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef typename utldelegate::DefaultVoidToVoid<RetType>::type DesiredRetType;
typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
typedef RetType (utldelegate::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
typedef utldelegate::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
ClosureType m_Closure;
public:
// Typedefs to aid generic programming
@ -1982,23 +1981,23 @@ public:
template < class X, class Y >
FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) )
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
{
m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
m_Closure.bindmemfunc(utldelegate::implicit_cast<X*>(pthis), function_to_bind);
}
// Binding to const member functions.
template < class X, class Y >
FastDelegate8(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X*>(pthis), function_to_bind);
}
template < class X, class Y >
inline void Bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const)
{
m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);
m_Closure.bindconstmemfunc(utldelegate::implicit_cast<const X *>(pthis), function_to_bind);
}
// Static functions. We convert them into a member function call.
// This constructor also provides implicit conversion
@ -2470,7 +2469,7 @@ public:
// So, I have to use a macro.
#ifdef FASTDLGT_VC6
#define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
#define FASTDLGT_RETTYPE utldelegate::VoidToDefaultVoid<RetType>::type
#else
#define FASTDLGT_RETTYPE RetType
#endif
@ -2648,7 +2647,6 @@ CUtlDelegate< FASTDLGT_RETTYPE ( Param1, Param2, Param3, Param4, Param5, Param6,
return CUtlDelegate< FASTDLGT_RETTYPE ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >(func);
}
// clean up after ourselves...
#undef FASTDLGT_RETTYPE

View File

@ -747,7 +747,7 @@ void CUtlHashtable<KeyT, ValueT, KeyHashT, KeyIsEqualT, AltKeyT, TableT>::DbgChe
// and also the validity of the user's Hash and Equal function objects.
// NOTE: will fail if function objects require any sort of state!
CUtlHashtable clone;
unsigned int bytes = sizeof(entry_t)*max(16,m_nTableSize);
unsigned int bytes = sizeof(entry_t)*MAX(16,m_nTableSize);
byte* tempbuf = (byte*) malloc(bytes);
clone.SetExternalBuffer( tempbuf, bytes, false, false );
clone = *this;

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright <EFBFBD> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
@ -16,6 +16,7 @@ class KeyValues;
class HKeySymbol
{
public:
HKeySymbol() : nIndex(~0) { }
HKeySymbol(uint32 idx) : nIndex(idx) { }

View File

@ -1255,7 +1255,7 @@ void CKeyValues3Cluster::Free( int element )
{
KeyValues3* kv = &m_KeyValues[ element ];
Destruct( kv );
memset( kv, 0, sizeof( KeyValues3 ) );
memset( (void *)kv, 0, sizeof( KeyValues3 ) );
m_nAllocatedElements &= ~( 1ull << element );
}
@ -1340,7 +1340,7 @@ void CKeyValues3ArrayCluster::Free( int element )
{
CKeyValues3Array* arr = &m_Arrays[ element ];
Destruct( arr );
memset( arr, 0, sizeof( CKeyValues3Array ) );
memset( (void *)arr, 0, sizeof( CKeyValues3Array ) );
m_nAllocatedElements &= ~( 1ull << element );
}
@ -1375,7 +1375,7 @@ void CKeyValues3TableCluster::Free( int element )
{
CKeyValues3Table* table = &m_Tables[ element ];
Destruct( table );
memset( table, 0, sizeof( CKeyValues3Table ) );
memset( (void *)table, 0, sizeof( CKeyValues3Table ) );
m_nAllocatedElements &= ~( 1ull << element );
}