[Assorted-commits] SF.net SVN: assorted:[1404] cpp-commons/trunk/src/commons
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-05-11 21:46:32
|
Revision: 1404 http://assorted.svn.sourceforge.net/assorted/?rev=1404&view=rev Author: yangzhang Date: 2009-05-11 21:46:03 +0000 (Mon, 11 May 2009) Log Message: ----------- fixed some build warnings Modified Paths: -------------- cpp-commons/trunk/src/commons/files.h cpp-commons/trunk/src/commons/versioned_heap.h Modified: cpp-commons/trunk/src/commons/files.h =================================================================== --- cpp-commons/trunk/src/commons/files.h 2009-05-08 10:43:41 UTC (rev 1403) +++ cpp-commons/trunk/src/commons/files.h 2009-05-11 21:46:03 UTC (rev 1404) @@ -108,7 +108,8 @@ closingfd fd(checknnegerr(open(path, O_RDONLY))); check0x(fstat(fd, &sb)); - check(sb.st_size <= 0xffffffff); + // TODO why waaas this herre? + // check(sb.st_size <= 0xffffffff); // TODO Why don't we need (static) cast here? Isn't this a lossy cast? len = sb.st_size; Modified: cpp-commons/trunk/src/commons/versioned_heap.h =================================================================== --- cpp-commons/trunk/src/commons/versioned_heap.h 2009-05-08 10:43:41 UTC (rev 1403) +++ cpp-commons/trunk/src/commons/versioned_heap.h 2009-05-11 21:46:03 UTC (rev 1404) @@ -224,7 +224,7 @@ } char *page; - posix_memalign(reinterpret_cast<void**>(&page), pgsz_, pgsz_); + check0x(posix_memalign(reinterpret_cast<void**>(&page), pgsz_, pgsz_)); hdr &h = *reinterpret_cast<hdr*>(page); h.version = 0; h.index = pages_.size(); @@ -370,8 +370,15 @@ raw_reader r(meta); // Deserialize metadata. - r.read(reinterpret_cast<size_t&>(first_free_)); - r.read(reinterpret_cast<size_t&>(last_free_)); + size_t first_free, last_free; + r.read(first_free); + r.read(last_free); + first_free_ = reinterpret_cast<hdr*>(first_free); + last_free_ = reinterpret_cast<hdr*>(last_free); + // TODO why do next 2 lines this give me this warning? + // error: dereferencing type-punned pointer will break strict-aliasing rules + //r.read(reinterpret_cast<size_t&>(first_free_)); + //r.read(reinterpret_cast<size_t&>(last_free_)); r.read(pgsz_); char *p0 = reinterpret_cast<char*>(data); ind2ptr_mut(first_free_, p0, pgsz_); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |