From 199d8391220c802c10557a0693e3aee9c722c2b5 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Fri, 20 Apr 2007 18:50:52 +0000 Subject: [PATCH] Made libPtr param const. Doesn't get modified so why not. Also removed some unneccessary code (for now) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40707 --- core/MemoryUtils.cpp | 9 ++++----- core/MemoryUtils.h | 8 ++------ public/IMemoryUtils.h | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/core/MemoryUtils.cpp b/core/MemoryUtils.cpp index a34c0e4e3..828077ae5 100644 --- a/core/MemoryUtils.cpp +++ b/core/MemoryUtils.cpp @@ -21,17 +21,15 @@ MemoryUtils g_MemUtils; +#if 0 MemoryUtils::MemoryUtils() { #ifdef PLATFORM_WINDOWS - /* This might be used in the future? */ - #if 0 SYSTEM_INFO info; GetSystemInfo(&info); m_PageSize = info.dwPageSize; - #endif #elif defined PLATFORM_POSIX @@ -39,8 +37,9 @@ MemoryUtils::MemoryUtils() #endif } +#endif -void *MemoryUtils::FindPattern(void *libPtr, const char *pattern, size_t len) +void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len) { DynLibInfo lib; bool found; @@ -77,7 +76,7 @@ void *MemoryUtils::FindPattern(void *libPtr, const char *pattern, size_t len) return NULL; } -bool MemoryUtils::GetLibraryInfo(void *libPtr, DynLibInfo &lib) +bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib) { unsigned long baseAddr; diff --git a/core/MemoryUtils.h b/core/MemoryUtils.h index ecb9e2789..cda165741 100644 --- a/core/MemoryUtils.h +++ b/core/MemoryUtils.h @@ -28,13 +28,9 @@ struct DynLibInfo class MemoryUtils : public IMemoryUtils { public: - MemoryUtils(); -public: - void *FindPattern(void *libPtr, const char *pattern, size_t len); + void *FindPattern(const void *libPtr, const char *pattern, size_t len); private: - bool GetLibraryInfo(void *libPtr, DynLibInfo &lib); -private: - size_t m_PageSize; + bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib); }; extern MemoryUtils g_MemUtils; diff --git a/public/IMemoryUtils.h b/public/IMemoryUtils.h index 29e1d9fb9..828ffe689 100644 --- a/public/IMemoryUtils.h +++ b/public/IMemoryUtils.h @@ -46,7 +46,7 @@ namespace SourceMod * @param len Size of the pattern in bytes. * @return Pointer to pattern found in memory, NULL if not found. */ - virtual void *FindPattern(void *libPtr, const char *pattern, size_t len) =0; + virtual void *FindPattern(const void *libPtr, const char *pattern, size_t len) =0; }; }