[Assorted-commits] SF.net SVN: assorted: [382] cpp-commons/trunk/src/commons/files.h
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-11 23:23:51
|
Revision: 382 http://assorted.svn.sourceforge.net/assorted/?rev=382&view=rev Author: yangzhang Date: 2008-02-11 15:23:55 -0800 (Mon, 11 Feb 2008) Log Message: ----------- fixed casting bug Modified Paths: -------------- cpp-commons/trunk/src/commons/files.h Modified: cpp-commons/trunk/src/commons/files.h =================================================================== --- cpp-commons/trunk/src/commons/files.h 2008-02-11 23:23:44 UTC (rev 381) +++ cpp-commons/trunk/src/commons/files.h 2008-02-11 23:23:55 UTC (rev 382) @@ -70,12 +70,14 @@ check(buf); // TODO Use threads to pull data to the correct initial locations? + // XXX alignment bug: not necessarily reading the full file (omitting final + // null terminators can cause issues) size_t chunk_len = len / ncpus; for (unsigned int i = 0; i < ncpus; i++) { int off = i *chunk_len; ssize_t status = pread(fd, buf + off, chunk_len, off); // We read the whole chunk or hit the end. - size_t nread = static_cast<ssize_t>(status); + size_t nread = static_cast<size_t>(status); check(status != -1 && (nread == chunk_len || off + nread == len)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |