[Assorted-commits] SF.net SVN: assorted:[1205] cpp-commons/trunk/src/commons/st/st.h
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-02-20 05:52:39
|
Revision: 1205 http://assorted.svn.sourceforge.net/assorted/?rev=1205&view=rev Author: yangzhang Date: 2009-02-20 05:52:31 +0000 (Fri, 20 Feb 2009) Log Message: ----------- fixed overflow bug; tweaks Modified Paths: -------------- cpp-commons/trunk/src/commons/st/st.h Modified: cpp-commons/trunk/src/commons/st/st.h =================================================================== --- cpp-commons/trunk/src/commons/st/st.h 2009-02-20 01:41:23 UTC (rev 1204) +++ cpp-commons/trunk/src/commons/st/st.h 2009-02-20 05:52:31 UTC (rev 1205) @@ -432,7 +432,7 @@ if (req > buf_.size()) { managed_array<char> p(checkpass(new char[req]), true); copy(start_, end_, p.get()); - checkeqnneg(st_read_fully(fd_, p + amt(), req, to), static_cast<ssize_t>(req)); + checkeqnneg(st_read_fully(fd_, p + amt(), req - amt(), to), static_cast<ssize_t>(req - amt())); start_ = end_ = buf_.get(); return p; } @@ -447,8 +447,7 @@ // Keep reading until we have enough. while (amt() < req) { - ssize_t res = st_read(fd_, end_, rem(), to); - checknneg(res); + ssize_t res = checknnegerr(st_read(fd_, end_, rem(), to)); if (res == 0) break; else end_ += res; } @@ -486,8 +485,7 @@ // Keep reading until we have enough. while (amt() < req) { - ssize_t res = st_read(fd_, end_, rem(), to); - checknneg(res); + ssize_t res = checknnegerr(st_read(fd_, end_, rem(), to)); if (res == 0) break; else end_ += res; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |