diff -r 022428df37c9 -r 7d93aa4d2bf3 sourcehook/generate/sourcehook.hxx --- a/sourcehook/generate/sourcehook.hxx Tue Sep 13 16:47:42 2005 +0000 +++ b/sourcehook/generate/sourcehook.hxx Tue Sep 13 16:47:42 2005 +0000 @@ -185,8 +185,8 @@ int thisptr_offs; //!< This pointer offset }; void *ptr; //!< Pointer to the interface instance - std::list hooks_pre; //!< A list of pre-hooks - std::list hooks_post; //!< A list of post-hooks + SourceHook::List hooks_pre; //!< A list of pre-hooks + SourceHook::List hooks_post; //!< A list of post-hooks bool operator ==(void *other) const { return ptr == other; @@ -196,7 +196,7 @@ void *vfnptr; //!< Pointer to the function void *orig_entry; //!< The original vtable entry - typedef std::list IfaceList; + typedef SourceHook::List IfaceList; typedef IfaceList::iterator IfaceListIter; IfaceList ifaces; //!< List of interface pointers @@ -214,13 +214,13 @@ void *hookfunc_vfnptr; //!< Pointer to the hookfunc impl - typedef std::list VfnPtrList; + typedef SourceHook::List VfnPtrList; typedef VfnPtrList::iterator VfnPtrListIter; VfnPtrList vfnptrs; //!< List of hooked interfaces }; - typedef std::vector OrigFuncs; - typedef std::map OrigVTables; + typedef SourceHook::CVector OrigFuncs; + typedef SourceHook::THash OrigVTables; template struct CallClass { @@ -467,7 +467,7 @@ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ \ - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \ + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->find(ms_HI->vfnptrs.begin(), \ ms_HI->vfnptrs.end(), ourvfnptr); \ if (vfptriter == ms_HI->vfnptrs.end()) \ { \ @@ -476,7 +476,7 @@ } \ HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \ /* 2) Find the iface */ \ - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \ + HookManagerInfo::VfnPtr::IfaceListIter ifiter = ms_HI->find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \ if (ifiter == vfnptr.ifaces.end()) \ { \ /* The iface info was not found. Redirect the call to the original function. */ \ @@ -486,8 +486,8 @@ } \ HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \ /* 2) Declare some vars and set it up */ \ - std::list &prelist = ci.hooks_pre; \ - std::list &postlist = ci.hooks_post; \ + SourceHook::List &prelist = ci.hooks_pre; \ + SourceHook::List &postlist = ci.hooks_post; \ rettype orig_ret; \ rettype override_ret; \ rettype plugin_ret; \ @@ -501,7 +501,7 @@ #define SH_CALL_HOOKS(post, params) \ prev_res = MRES_IGNORED; \ - for (std::list::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \ + for (SourceHook::List::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \ { \ if (hiter->paused) continue; \ cur_res = MRES_IGNORED; \ @@ -544,7 +544,7 @@ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ \ - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \ + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->find(ms_HI->vfnptrs.begin(), \ ms_HI->vfnptrs.end(), ourvfnptr); \ if (vfptriter == ms_HI->vfnptrs.end()) \ { \ @@ -553,7 +553,7 @@ } \ HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \ /* 2) Find the iface */ \ - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \ + HookManagerInfo::VfnPtr::IfaceListIter ifiter = ms_HI->find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \ if (ifiter == vfnptr.ifaces.end()) \ { \ /* The iface info was not found. Redirect the call to the original function. */ \ @@ -564,8 +564,8 @@ } \ HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \ /* 2) Declare some vars and set it up */ \ - std::list &prelist = ci.hooks_pre; \ - std::list &postlist = ci.hooks_post; \ + SourceHook::List &prelist = ci.hooks_pre; \ + SourceHook::List &postlist = ci.hooks_post; \ META_RES &cur_res = SH_GLOB_SHPTR->GetCurResRef(); \ META_RES &prev_res = SH_GLOB_SHPTR->GetPrevResRef(); \ META_RES &status = SH_GLOB_SHPTR->GetStatusRef(); \ @@ -575,7 +575,7 @@ #define SH_CALL_HOOKS_void(post, params) \ prev_res = MRES_IGNORED; \ - for (std::list::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \ + for (SourceHook::List::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \ { \ if (hiter->paused) continue; \ cur_res = MRES_IGNORED; \ @@ -686,8 +686,8 @@ using namespace ::SourceHook; \ MemFuncInfo mfi; \ GetFuncInfo(m_CC->ptr, m_MFP, mfi); \ - OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \ - if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \ + OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \ + if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \ return (m_CC->ptr->*m_MFP)call; \ \ /* It's hooked. Call the original function. */ \ @@ -696,7 +696,7 @@ RetType(EmptyClass::*mfpnew)prms; \ void *addr; \ } u; \ - u.addr = iter->second[mfi.vtblindex]; \ + u.addr = iter->val[mfi.vtblindex]; \ \ void *adjustedthisptr = reinterpret_cast(reinterpret_cast(m_CC->ptr) + mfi.thisptroffs); \ return (reinterpret_cast(adjustedthisptr)->*u.mfpnew)call; \ @@ -709,8 +709,8 @@ using namespace ::SourceHook; \ MemFuncInfo mfi; \ GetFuncInfo(m_CC->ptr, m_MFP, mfi); \ - OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \ - if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \ + OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \ + if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \ return (m_CC->ptr->*m_MFP)call; \ \ /* It's hooked. Call the original function. */ \ @@ -723,7 +723,7 @@ intptr_t adjustor; \ } s; \ } u; \ - u.s.addr = iter->second[mfi.vtblindex]; \ + u.s.addr = iter->val[mfi.vtblindex]; \ u.s.adjustor = mfi.thisptroffs; \ \ return (reinterpret_cast(m_CC->ptr)->*u.mfpnew)call; \