[Bf-blender-cvs] [0f8ebd21e3a] master: Cleanup: reduce scope, quiet unused variable warnings

Campbell Barton noreply at git.blender.org
Wed Aug 31 07:05:21 CEST 2022


Commit: 0f8ebd21e3a0b32e1d982382acad4422a07ac707
Author: Campbell Barton
Date:   Wed Aug 31 14:26:47 2022 +1000
Branches: master
https://developer.blender.org/rB0f8ebd21e3a0b32e1d982382acad4422a07ac707

Cleanup: reduce scope, quiet unused variable warnings

When building without thumbnails some variables weren't used,
reduce their scope as well as the BlPath sub-string.

===================================================================

M	source/blender/blenlib/intern/winstuff.c

===================================================================

diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index e90a0ee02db..7e2c5e8f1dd 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -63,23 +63,17 @@ bool BLI_windows_register_blend_extension(const bool background)
   char buffer[256];
 
   char BlPath[MAX_PATH];
-  char InstallDir[FILE_MAXDIR];
-  char SysDir[FILE_MAXDIR];
-  const char *ThumbHandlerDLL;
-  char RegCmd[MAX_PATH * 2];
   char MBox[256];
-  char *blender_app;
-#  ifndef _WIN64
-  BOOL IsWOW64;
-#  endif
 
   printf("Registering file extension...");
   GetModuleFileName(0, BlPath, MAX_PATH);
 
   /* Replace the actual app name with the wrapper. */
-  blender_app = strstr(BlPath, "blender.exe");
-  if (blender_app != NULL) {
-    strcpy(blender_app, "blender-launcher.exe");
+  {
+    char *blender_app = strstr(BlPath, "blender.exe");
+    if (blender_app != NULL) {
+      strcpy(blender_app, "blender-launcher.exe");
+    }
   }
 
   /* root is HKLM by default */
@@ -157,12 +151,17 @@ bool BLI_windows_register_blend_extension(const bool background)
   }
 
 #  ifdef WITH_BLENDER_THUMBNAILER
-  BLI_windows_get_executable_dir(InstallDir);
-  GetSystemDirectory(SysDir, FILE_MAXDIR);
-  ThumbHandlerDLL = "BlendThumb.dll";
-  snprintf(
-      RegCmd, MAX_PATH * 2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL);
-  system(RegCmd);
+  {
+    char RegCmd[MAX_PATH * 2];
+    char InstallDir[FILE_MAXDIR];
+    char SysDir[FILE_MAXDIR];
+    BLI_windows_get_executable_dir(InstallDir);
+    GetSystemDirectory(SysDir, FILE_MAXDIR);
+    const char *ThumbHandlerDLL = "BlendThumb.dll";
+    snprintf(
+        RegCmd, MAX_PATH * 2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL);
+    system(RegCmd);
+  }
 #  endif
 
   RegCloseKey(root);



More information about the Bf-blender-cvs mailing list