Backwards compat with outdated sourcehook.h
authorPavol Marko <pavolmarko@gmail.com>
Fri Oct 12 20:14:10 2007 +0000 (2007-10-12)
changeset 415e267ff46b3ca
parent 414 383383ec840c
child 416 ce19c95e3f93
Backwards compat with outdated sourcehook.h
sourcehook/sourcehook.cpp
sourcehook/sourcehook_impl_cproto.h
     1.1 --- a/sourcehook/sourcehook.cpp	Fri Oct 12 19:25:20 2007 +0000
     1.2 +++ b/sourcehook/sourcehook.cpp	Fri Oct 12 20:14:10 2007 +0000
     1.3 @@ -96,7 +96,7 @@
     1.4  				{
     1.5  					if (p1->paramsPassInfo[i].type != p2->paramsPassInfo[i].type)
     1.6  						return false;
     1.7 -					if (p1->paramsPassInfo[i].flags != p2->paramsPassInfo[i].flags)
     1.8 +					if (GetRealFlags(p1->paramsPassInfo[i]) != GetRealFlags(p2->paramsPassInfo[i]))
     1.9  						return false;
    1.10  				}
    1.11  			}
     2.1 --- a/sourcehook/sourcehook_impl_cproto.h	Fri Oct 12 19:25:20 2007 +0000
     2.2 +++ b/sourcehook/sourcehook_impl_cproto.h	Fri Oct 12 20:14:10 2007 +0000
     2.3 @@ -70,9 +70,15 @@
     2.4  				return m_Proto;
     2.5  			}
     2.6  
     2.7 +			// For old sourcehook.h: flags 0 -> assume ByVal
     2.8 +			static unsigned int GetRealFlags(const PassInfo &info)
     2.9 +			{
    2.10 +				return (info.flags == 0) ? PassInfo::PassFlag_ByVal : info.flags;
    2.11 +			}
    2.12 +
    2.13  			static size_t GetRealSize(const PassInfo &info)
    2.14  			{
    2.15 -				if (info.flags & PassInfo::PassFlag_ByRef)
    2.16 +				if (GetRealFlags(info) & PassInfo::PassFlag_ByRef)
    2.17  				{
    2.18  					return sizeof(void*);
    2.19  				}