Permalink
Browse files

Re-add dummy, cast to void

  • Loading branch information...
Headline committed Aug 1, 2018
1 parent 96695e2 commit 2418a49e7dcf16072625d6d4ec006278181ecfa6
Showing with 8 additions and 2 deletions.
  1. +8 −2 core/sourcehook/sh_memory.h
@@ -322,8 +322,11 @@ namespace SourceHook
prevHandler = signal(SIGSEGV, BadReadHandler);

volatile const char *p = reinterpret_cast<const char*>(addr);
char dummy;

for (size_t i = 0; i < len; i++)
p[i];
dummy = p[i];
(void)dummy; // silence unused var, we must read from p

g_BadReadCalled = false;

@@ -344,8 +347,11 @@ namespace SourceHook
return false;

volatile const char *p = reinterpret_cast<const char *>(addr);
char dummy;

for (size_t i = 0; i < len; i++)
p[i];
dummy = p[i];
(void)dummy; // silence unused var, we must read from p

g_BadReadCalled = false;

0 comments on commit 2418a49

Please sign in to comment.