[Widelands-cvs] SF.net SVN: widelands:[5010] trunk/src/io/filesystem/filesystem.cc
Status: Beta
Brought to you by:
sirver
From: <si...@us...> - 2010-01-22 20:43:33
|
Revision: 5010 http://widelands.svn.sourceforge.net/widelands/?rev=5010&view=rev Author: sirver Date: 2010-01-22 20:43:27 +0000 (Fri, 22 Jan 2010) Log Message: ----------- merge fs-optimisation: Avoid unnecessary copying and checks when fixing paths on WIN32. There is no need to convert a character to a string just to check it against '/'. Also, the range-checked at(j) usage is not needed as the loop is iterating within the bounds of the string data. Modified Paths: -------------- trunk/src/io/filesystem/filesystem.cc Modified: trunk/src/io/filesystem/filesystem.cc =================================================================== --- trunk/src/io/filesystem/filesystem.cc 2010-01-22 20:43:09 UTC (rev 5009) +++ trunk/src/io/filesystem/filesystem.cc 2010-01-22 20:43:27 UTC (rev 5010) @@ -221,12 +221,9 @@ #ifdef WIN32 // remove all slashes with backslashes so following can work. std::string fixedpath(path); - std::string temp; - uint32_t path_size = path.size(); - for (uint32_t j = 0; j < path_size; ++j) { - temp = fixedpath.at(j); - if (temp == "/") - fixedpath.at(j) = '\\'; + for (uint32_t j = 0; j < path.size(); ++j) { + if (fixedpath[j] == '/') + fixedpath[j] = '\\'; } bool absolute = pathIsAbsolute(fixedpath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |