forked from bartvdbraak/blender
Cleanup: win32 mixed declare/statements in main()
Make it a more clear where declarations end (ifdef's all over made it a bit confusing).
This commit is contained in:
parent
59b578e320
commit
6f43e1dfef
@ -1559,13 +1559,13 @@ char **environ = NULL;
|
||||
* or exit when running in background mode.
|
||||
*/
|
||||
int main(
|
||||
int argc,
|
||||
int argc,
|
||||
#ifdef WIN32
|
||||
const char **UNUSED(argv_c)
|
||||
#else
|
||||
const char **argv
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
bContext *C;
|
||||
SYS_SystemHandle syshandle;
|
||||
@ -1574,6 +1574,14 @@ int main(
|
||||
bArgs *ba;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
char **argv;
|
||||
int argv_num;
|
||||
#endif
|
||||
|
||||
/* --- end declarations --- */
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1800 && defined(_M_X64)
|
||||
@ -1584,16 +1592,15 @@ int main(
|
||||
/* NOTE: cannot use guardedalloc malloc here, as it's not yet initialized
|
||||
* (it depends on the args passed in, which is what we're getting here!)
|
||||
*/
|
||||
wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
char **argv = malloc(argc * sizeof(char *));
|
||||
int argci = 0;
|
||||
|
||||
for (argci = 0; argci < argc; argci++) {
|
||||
argv[argci] = alloc_utf_8_from_16(argv_16[argci], 0);
|
||||
{
|
||||
wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
argv = malloc(argc * sizeof(char *));
|
||||
for (argv_num = 0; argv_num < argc; argv_num++) {
|
||||
argv[argv_num] = alloc_utf_8_from_16(argv_16[argv_num], 0);
|
||||
}
|
||||
LocalFree(argv_16);
|
||||
}
|
||||
|
||||
LocalFree(argv_16);
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* NOTE: Special exception for guarded allocator type switch:
|
||||
* we need to perform switch from lock-free to fully
|
||||
@ -1661,7 +1668,7 @@ int main(
|
||||
setCallbacks();
|
||||
|
||||
#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE)
|
||||
/* patch to ignore argument finder gives us (pid?) */
|
||||
/* patch to ignore argument finder gives us (pid?) */
|
||||
if (argc == 2 && STREQLEN(argv[1], "-psn_", 5)) {
|
||||
extern int GHOST_HACK_getFirstFile(char buf[]);
|
||||
static char firstfilebuf[512];
|
||||
@ -1819,8 +1826,8 @@ int main(
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
while (argci) {
|
||||
free(argv[--argci]);
|
||||
while (argv_num) {
|
||||
free(argv[--argv_num]);
|
||||
}
|
||||
free(argv);
|
||||
argv = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user