diff options
author | Jose <jose@zeroc.com> | 2016-09-17 00:28:00 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-09-17 00:28:00 +0200 |
commit | 47c3b5d2b03d3286cba2a3b4890e57fdd6135132 (patch) | |
tree | 40e05ffec6df92a5b88fdb675d775580f41547c1 /cpp/src/slice2html/Gen.cpp | |
parent | 3.6.3 version fixes (diff) | |
download | ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.bz2 ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.xz ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.zip |
Fix ICE-4787 - slice compilers and unicode paths
Diffstat (limited to 'cpp/src/slice2html/Gen.cpp')
-rw-r--r-- | cpp/src/slice2html/Gen.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 2df3fd8781d..36fc080f761 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -10,20 +10,19 @@ #include <IceUtil/DisableWarnings.h> #include <IceUtil/Functional.h> #include <IceUtil/StringUtil.h> +#include <IceUtil/FileUtil.h> #include <Slice/FileTracker.h> #include <Gen.h> #include <sys/types.h> -#include <sys/stat.h> #ifdef _WIN32 -#include <direct.h> +# include <direct.h> #else -#include <unistd.h> +# include <unistd.h> #endif #include <iterator> - #include <string.h> using namespace std; @@ -352,7 +351,7 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const SyntaxTreeBasePt { item = q->substr(pos); } - + start("dt", "Symbol"); _out << term; end(); @@ -393,7 +392,7 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const SyntaxTreeBasePt { item = q->substr(pos); } - + start("dt", "Symbol"); _out << getURL(toSliceID(term, source->definitionContext()->filename()), source, false); end(); @@ -1315,14 +1314,14 @@ Slice::GeneratorBase::getTagged(const string& tag, string& comment) { return result; } - + string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1); if(pos1 == string::npos) { comment.erase(begin); return result; } - + string::size_type pos2 = comment.find('@', pos1); string line = comment.substr(pos1, pos2 - pos1); comment.erase(begin, pos2 - 1 - begin); @@ -1356,7 +1355,7 @@ Slice::GeneratorBase::getScopedMinimized(const SyntaxTreeBasePtr& target, const { return scoped.substr(2); } - + do { string scoped2 = s->scoped(); @@ -1558,9 +1557,8 @@ Slice::GeneratorBase::toStringList(const string& scoped) void Slice::GeneratorBase::makeDir(const string& dir) { - struct stat st; - int rc = stat(dir.c_str(), &st); - if(rc == 0) + IceUtilInternal::structstat st; + if(!IceUtilInternal::stat(dir, &st)) { if(!(st.st_mode & S_IFDIR)) { @@ -1572,12 +1570,7 @@ Slice::GeneratorBase::makeDir(const string& dir) return; } -#ifdef _WIN32 - rc = _mkdir(dir.c_str()); -#else - rc = mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); -#endif - if(rc != 0) + if(IceUtilInternal::mkdir(dir, 0777) != 0) { ostringstream os; os << "cannot create directory `" << dir << "': " << strerror(errno); @@ -1589,7 +1582,7 @@ Slice::GeneratorBase::makeDir(const string& dir) string Slice::GeneratorBase::readFile(const string& file) { - ifstream in(file.c_str()); + IceUtilInternal::ifstream in(file); if(!in) { ostringstream os; @@ -1605,7 +1598,7 @@ Slice::GeneratorBase::readFile(const string& file) result << line << '\n'; getline(in, line); } - + return result.str(); } @@ -1663,7 +1656,7 @@ Slice::GeneratorBase::getFooter(const string& footer) void Slice::GeneratorBase::readFile(const string& file, string& part1, string& part2) { - ifstream in(file.c_str()); + IceUtilInternal::ifstream in(file); if(!in) { ostringstream os; @@ -2567,7 +2560,7 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e) } end(); } - + _out << nl << "<hr>"; printHeaderFooter(e); @@ -2893,7 +2886,7 @@ Slice::StructGenerator::generate(const StructPtr& s) } end(); } - + _out << nl << "<hr>"; printHeaderFooter(s); @@ -2972,7 +2965,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e) } end(); } - + closeDoc(); _out << nl << "<hr>"; |