return FALSE;
}
-} // namespace anon
+} // namespace
-void init(int argc, char * argv[])
+void init(int argc, char ** argv[])
{
/* Note from Angus, 17 Jan 2005:
*
*/
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+ // Removing an argument from argv leads to an assertion on Windows
+ // when compiling with MSVC 2015 in debug mode (see bug #10440).
+ // To avoid this we make a copy of the array of pointers.
+ char ** newargv = (char **) malloc((argc + 1) * sizeof(char *));
+ if (newargv) {
+ memcpy(newargv, *argv, (argc + 1) * sizeof(char *));
+ *argv = newargv;
+ } else {
+ lyxerr << "LyX warning: Cannot make a copy of "
+ "command line arguments!"
+ << endl;
+ }
+#endif
+
+
// Get the wide program arguments array
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
argv_ = CommandLineToArgvW(GetCommandLineW(), &argc_);
setEnv("TEXFONTS", newtexfonts);
}
+ QString const wname = toqstr(filename);
+
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
- char const * action = (mode == VIEW) ? "open" : "edit";
- bool success = reinterpret_cast<intptr_t>(ShellExecute(NULL, action,
- to_local8bit(from_utf8(filename)).c_str(), NULL, NULL, 1)) > 32;
+ wchar_t const * action = (mode == VIEW) ? L"open" : L"edit";
+ bool success = reinterpret_cast<intptr_t>(ShellExecuteW(NULL, action,
+ reinterpret_cast<wchar_t const *>(wname.utf16()),
+ NULL, NULL, 1)) > 32;
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
setEnv("TEXINPUTS", oldtexinputs);