diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 05:16:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 05:17:30 +0300 |
commit | 9ba948a4859da3308033fa6dc54f74433d7e6a21 (patch) | |
tree | 0bd6e95eb59d9af03aa32d925c68e1cbebecc246 /source/blender/blenlib/intern/winstuff.c | |
parent | 337eb8c1de4c57c34520b467d79779153335eecb (diff) |
Cleanup: style, use braces for blenlib
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index fb16ccb36bd..483351801f4 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -52,7 +52,9 @@ int BLI_getInstallationDir(char *str) GetModuleFileName(NULL, str, FILE_MAX); BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); - if (dir[a - 1] == '\\') dir[a - 1] = 0; + if (dir[a - 1] == '\\') { + dir[a - 1] = 0; + } strcpy(str, dir); @@ -62,10 +64,12 @@ int BLI_getInstallationDir(char *str) static void RegisterBlendExtension_Fail(HKEY root) { printf("failed\n"); - if (root) + if (root) { RegCloseKey(root); - if (!G.background) + } + if (!G.background) { MessageBox(0, "Could not register file extension.", "Blender error", MB_OK | MB_ICONERROR); + } TerminateProcess(GetCurrentProcess(), 1); } @@ -104,8 +108,9 @@ void RegisterBlendExtension(void) /* try HKCU on failure */ usr_mode = true; lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root); - if (lresult != ERROR_SUCCESS) + if (lresult != ERROR_SUCCESS) { RegisterBlendExtension_Fail(0); + } } lresult = RegCreateKeyEx(root, "blendfile", 0, @@ -115,8 +120,9 @@ void RegisterBlendExtension(void) lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE *)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } - if (lresult != ERROR_SUCCESS) + if (lresult != ERROR_SUCCESS) { RegisterBlendExtension_Fail(root); + } lresult = RegCreateKeyEx(root, "blendfile\\shell\\open\\command", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); @@ -125,8 +131,9 @@ void RegisterBlendExtension(void) lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE *)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } - if (lresult != ERROR_SUCCESS) + if (lresult != ERROR_SUCCESS) { RegisterBlendExtension_Fail(root); + } lresult = RegCreateKeyEx(root, "blendfile\\DefaultIcon", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); @@ -135,8 +142,9 @@ void RegisterBlendExtension(void) lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE *)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } - if (lresult != ERROR_SUCCESS) + if (lresult != ERROR_SUCCESS) { RegisterBlendExtension_Fail(root); + } lresult = RegCreateKeyEx(root, ".blend", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); @@ -145,8 +153,9 @@ void RegisterBlendExtension(void) lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE *)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } - if (lresult != ERROR_SUCCESS) + if (lresult != ERROR_SUCCESS) { RegisterBlendExtension_Fail(root); + } BLI_getInstallationDir(InstallDir); GetSystemDirectory(SysDir, FILE_MAXDIR); @@ -154,10 +163,12 @@ void RegisterBlendExtension(void) ThumbHandlerDLL = "BlendThumb64.dll"; #else IsWow64Process(GetCurrentProcess(), &IsWOW64); - if (IsWOW64 == true) + if (IsWOW64 == true) { ThumbHandlerDLL = "BlendThumb64.dll"; - else + } + else { ThumbHandlerDLL = "BlendThumb.dll"; + } #endif snprintf(RegCmd, MAX_PATH * 2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL); system(RegCmd); |