From 6c3ce8f4366aa12f33e48f8c0e7729babcfd5967 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 26 Nov 2004 20:07:27 +0000 Subject: [PATCH] * diropen, dirread -> opendir, readdir * fixed warnings git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3789 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/dirreader.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Source/dirreader.cpp b/Source/dirreader.cpp index 149e56be..a7493758 100644 --- a/Source/dirreader.cpp +++ b/Source/dirreader.cpp @@ -176,12 +176,12 @@ class posix_dir_reader : public dir_reader { public: virtual void read(const string& dir) { - //string converted_dir = convert(dir); + //convert(dir); - DIR *dip = ::diropen(dir.c_str()); + DIR *dip = ::opendir(dir.c_str()); if (dip) { dirent *dit; - while (dit = ::dirread(dip)) { + while ((dit = ::readdir(dip))) { if (dit->d_type == DT_DIR) { dir_reader::add_dir(dit->d_name); } else { @@ -194,22 +194,18 @@ public: private: - string& convert(string& path) { - string converted = path; - - string::size_type pos = converted.find('\\'); + void convert(string& path) { + string::size_type pos = path.find('\\'); while (pos != string::npos) { - converted[pos] = '/'; - pos = converted.find('\\'); + path[pos] = '/'; + pos = path.find('\\'); } /* Replace drive letter X: by /x */ - if (converted[1] == ':') { - converted[1] = ::tolower(converted[0]); - converted[0] = '/'; + if (path[1] == ':') { + path[1] = ::tolower(path[0]); + path[0] = '/'; } - - return converted; } };