1.1 --- a/sourcehook/sourcehook.cpp Thu Feb 09 06:55:02 2006 +0000
1.2 +++ b/sourcehook/sourcehook.cpp Thu Feb 09 08:34:31 2006 +0000
1.3 @@ -1083,6 +1083,38 @@
1.4 //////////////////////////////////////////////////////////////////////////
1.5 // CProto
1.6 //////////////////////////////////////////////////////////////////////////
1.7 + char *CSourceHookImpl::CProto::DupProto(const char *p)
1.8 + {
1.9 + char *newproto;
1.10 + if (*p)
1.11 + {
1.12 + size_t len = strlen(p);
1.13 + newproto = new char[len+1];
1.14 + memcpy(newproto, p, len+1);
1.15 + } else {
1.16 + const ProtoInfo *pi1 = reinterpret_cast<const ProtoInfo *>(p);
1.17 + int *ar_copy = new int[pi1->numOfParams + 1];
1.18 + for (int i = 0; i <= pi1->numOfParams; i++)
1.19 + ar_copy[i] = pi1->params[i];
1.20 + ProtoInfo *copy = new ProtoInfo(pi1->retTypeSize, pi1->numOfParams, ar_copy);
1.21 + newproto = reinterpret_cast<char *>(copy);
1.22 + }
1.23 +
1.24 + return newproto;
1.25 + }
1.26 +
1.27 + void CSourceHookImpl::CProto::FreeProto(char *prot)
1.28 + {
1.29 + if (*prot)
1.30 + {
1.31 + delete [] prot;
1.32 + } else {
1.33 + ProtoInfo *pi = reinterpret_cast<ProtoInfo *>(prot);
1.34 + delete [] pi->params;
1.35 + delete pi;
1.36 + }
1.37 + }
1.38 +
1.39 bool CSourceHookImpl::CProto::Equal(const char *p1, const char *p2)
1.40 {
1.41 if (*p1 && *p2) // Case1: Both old