mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- speed improvement for anti-hack checking
This commit is contained in:
@@ -992,14 +992,13 @@ string ModeInfo::getString() const{
|
||||
|
||||
void ValueCheckerVault::addItemToVault(const void *ptr,int value) {
|
||||
Checksum checksum;
|
||||
checksum.addString(intToStr(value));
|
||||
vaultList[ptr] = intToStr(checksum.getSum());
|
||||
vaultList[ptr] = checksum.addInt(value);
|
||||
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] add vault key [%p] value [%s] [%d]\n",__FILE__,__FUNCTION__,__LINE__,ptr,intToStr(checksum.getSum()).c_str(),value);
|
||||
}
|
||||
|
||||
void ValueCheckerVault::checkItemInVault(const void *ptr,int value) const {
|
||||
map<const void *,string>::const_iterator iterFind = vaultList.find(ptr);
|
||||
map<const void *,int32>::const_iterator iterFind = vaultList.find(ptr);
|
||||
if(iterFind == vaultList.end()) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
// printf("In [%s::%s Line: %d] check vault key [%p] value [%d]\n",__FILE__,__FUNCTION__,__LINE__,ptr,value);
|
||||
@@ -1011,8 +1010,7 @@ void ValueCheckerVault::checkItemInVault(const void *ptr,int value) const {
|
||||
throw std::runtime_error("memory value has been unexpectedly modified (not found)!");
|
||||
}
|
||||
Checksum checksum;
|
||||
checksum.addString(intToStr(value));
|
||||
if(iterFind->second != intToStr(checksum.getSum())) {
|
||||
if(iterFind->second != checksum.addInt(value)) {
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
// printf("In [%s::%s Line: %d] check vault key [%p] value [%s] [%d]\n",__FILE__,__FUNCTION__,__LINE__,ptr,intToStr(checksum.getSum()).c_str(),value);
|
||||
// for(map<const void *,string>::const_iterator iterFind = vaultList.begin();
|
||||
|
Reference in New Issue
Block a user