From: Brian Norris <banorris@uci.edu>
Date: Thu, 14 Jun 2012 16:19:41 +0000 (-0700)
Subject: snapshot: use (void *) instead of (char *)
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=06d9618fd028c3d5a60c65ad6508cfae24741688;p=cdsspec-compiler.git

snapshot: use (void *) instead of (char *)
---

diff --git a/snapshot.cc b/snapshot.cc
index db597a2..af42843 100644
--- a/snapshot.cc
+++ b/snapshot.cc
@@ -108,11 +108,11 @@ void createSharedLibrary(){
 	int fd = shm_open( "/ModelChecker-Snapshotter", O_RDWR | O_CREAT, 0777 ); //universal permissions.
 	if( -1 == fd ) FAILURE("shm_open");
 	if( -1 == ftruncate( fd, ( size_t )SHARED_MEMORY_DEFAULT + ( size_t )STACK_SIZE_DEFAULT ) ) FAILURE( "ftruncate" );
-	char * memMapBase = ( char * ) mmap( 0, ( size_t )SHARED_MEMORY_DEFAULT + ( size_t )STACK_SIZE_DEFAULT, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
+	void * memMapBase = mmap( 0, ( size_t )SHARED_MEMORY_DEFAULT + ( size_t )STACK_SIZE_DEFAULT, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
 	if( MAP_FAILED == memMapBase ) FAILURE("mmap");
 	sTheRecord = ( struct Snapshot * )memMapBase;
-	sTheRecord->mSharedMemoryBase = memMapBase + sizeof( struct Snapshot );
-	sTheRecord->mStackBase = ( char * )memMapBase + ( size_t )SHARED_MEMORY_DEFAULT;
+	sTheRecord->mSharedMemoryBase = (void *)((uintptr_t)memMapBase + sizeof(struct Snapshot));
+	sTheRecord->mStackBase = (void *)((uintptr_t)memMapBase + (size_t)SHARED_MEMORY_DEFAULT);
 	sTheRecord->mStackSize = STACK_SIZE_DEFAULT;
 	sTheRecord->mIDToRollback = -1;
 	sTheRecord->currSnapShotID = 0;
diff --git a/snapshotimp.h b/snapshotimp.h
index 6b58ed7..ce7bb31 100644
--- a/snapshotimp.h
+++ b/snapshotimp.h
@@ -57,8 +57,8 @@ struct SnapShot {
 extern struct SnapShot * snapshotrecord;
 #else
 struct Snapshot {
-char *mSharedMemoryBase;
-char *mStackBase;
+void *mSharedMemoryBase;
+void *mStackBase;
 size_t mStackSize;
 snapshot_id mIDToRollback;
 ucontext_t mContextToRollback;