Fixed reference binded to a temporary,

...possibly the cause of the failure on ark.
This commit is contained in:
Guillaume Melquiond 2010-07-26 17:11:25 +00:00
parent 4481b6fa4f
commit 1d8b649bae
2 changed files with 3 additions and 5 deletions

View file

@ -89,9 +89,7 @@ bool ends_with(const std::string& str, const std::string& suffix)
return str.size() >= suffix.size() && std::equal(suffix.begin(),suffix.end(),str.end()-suffix.size());
}
// Don't pass directory as reference, it seems to break on
// arklinux with GCC-4.3.
void get_files_in_dir(const std::string directory,
void get_files_in_dir(const std::string &directory,
std::vector<std::string>* files,
std::vector<std::string>* dirs,
file_name_option mode,
@ -104,7 +102,7 @@ void get_files_in_dir(const std::string directory,
// on the wesnoth path
#ifndef __AMIGAOS4__
if(!directory.empty() && directory[0] != '/' && !game_config::path.empty()){
const std::string& dir = game_config::path + "/" + directory;
std::string dir = game_config::path + "/" + directory;
if(is_directory(dir)) {
get_files_in_dir(dir,files,dirs,mode,filter,reorder,checksum);
return;

View file

@ -53,7 +53,7 @@ enum file_reorder_option { DONT_REORDER, DO_REORDER };
* reorder: triggers the special handling of _main.cfg and _final.cfg
* checksum: can be used to store checksum info
*/
void get_files_in_dir(const std::string dir,
void get_files_in_dir(const std::string &dir,
std::vector<std::string>* files,
std::vector<std::string>* dirs=NULL,
file_name_option mode = FILE_NAME_ONLY,