summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freeze/Main.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-09-17 00:28:00 +0200
committerJose <jose@zeroc.com>2016-09-17 00:28:00 +0200
commit47c3b5d2b03d3286cba2a3b4890e57fdd6135132 (patch)
tree40e05ffec6df92a5b88fdb675d775580f41547c1 /cpp/src/slice2freeze/Main.cpp
parent3.6.3 version fixes (diff)
downloadice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.bz2
ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.xz
ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.zip
Fix ICE-4787 - slice compilers and unicode paths
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r--cpp/src/slice2freeze/Main.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 07c7ffc3d84..449f1374eb0 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -190,7 +190,7 @@ struct IndexType
};
void
-usage(const char* n)
+usage(const string& n)
{
getErrorStream() << "Usage: " << n << " [options] file-base [slice-files...]\n";
getErrorStream() <<
@@ -1430,7 +1430,7 @@ gen(const string& name, const UnitPtr& u, const vector<string>& includePaths, co
}
int
-compile(int argc, char* argv[])
+compile(const vector<string>& argv)
{
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
@@ -1456,20 +1456,11 @@ compile(int argc, char* argv[])
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
- bool validate = false;
- for(int i = 0; i < argc; ++i)
- {
- if(string(argv[i]) == "--validate")
- {
- validate = true;
- break;
- }
- }
-
+ bool validate = find(argv.begin(), argv.end(), "--validate") != argv.end();
vector<string> args;
try
{
- args = opts.parse(argc, const_cast<const char**>(argv));
+ args = opts.parse(argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
@@ -2112,31 +2103,35 @@ compile(int argc, char* argv[])
return status;
}
-int
-main(int argc, char* argv[])
+#ifdef _WIN32
+int wmain(int argc, wchar_t* argv[])
+#else
+int main(int argc, char* argv[])
+#endif
{
+ vector<string> args = argvToArgs(argc, argv);
try
{
- return compile(argc, argv);
+ return compile(args);
}
catch(const std::exception& ex)
{
- getErrorStream() << argv[0] << ": error:" << ex.what() << endl;
+ getErrorStream() << args[0] << ": error:" << ex.what() << endl;
return EXIT_FAILURE;
}
catch(const std::string& msg)
{
- getErrorStream() << argv[0] << ": error:" << msg << endl;
+ getErrorStream() << args[0] << ": error:" << msg << endl;
return EXIT_FAILURE;
}
catch(const char* msg)
{
- getErrorStream() << argv[0] << ": error:" << msg << endl;
+ getErrorStream() << args[0] << ": error:" << msg << endl;
return EXIT_FAILURE;
}
catch(...)
{
- getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl;
+ getErrorStream() << args[0] << ": error:" << "unknown exception" << endl;
return EXIT_FAILURE;
}
}