[Bf-blender-cvs] [e1698e37500] master: Windows: Clean-up warning while building blendthumb

Ray Molenkamp noreply at git.blender.org
Wed Mar 11 16:28:28 CET 2020


Commit: e1698e37500a0cfe1b5744a4de691edc2ef52158
Author: Ray Molenkamp
Date:   Wed Mar 11 09:27:35 2020 -0600
Branches: master
https://developer.blender.org/rBe1698e37500a0cfe1b5744a4de691edc2ef52158

Windows: Clean-up warning while building blendthumb

Casting a 64 bit pointer to a 32 bit DWORD gave 2 warnings.
Solved by storing the actual DWORD in the registry table.

Would have preferred to use a union, but C++ doesn't let you
initialize anything other than the first field, and C99 style
initializers are not supported until C++20, so this solution
will have to do until then.

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

M	source/blender/blendthumb/src/Dll.cpp

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

diff --git a/source/blender/blendthumb/src/Dll.cpp b/source/blender/blendthumb/src/Dll.cpp
index 08b3d253be8..89572334937 100644
--- a/source/blender/blendthumb/src/Dll.cpp
+++ b/source/blender/blendthumb/src/Dll.cpp
@@ -159,7 +159,8 @@ struct REGISTRY_ENTRY {
   PCWSTR pszKeyName;
   PCWSTR pszValueName;
   DWORD dwValueType;
-  PCWSTR pszData;
+  PCWSTR pszData;     //These two fields could/should have been a union, but C++
+  DWORD dwData;       //only lets you initalize the first field in a union.
 };
 
 // Creates a registry key (if needed) and sets the default value of the key
@@ -187,7 +188,7 @@ HRESULT CreateRegKeyAndSetValue(const REGISTRY_ENTRY *pRegistryEntry)
         break;
       case REG_DWORD:
         size = sizeof(DWORD);
-        data = (DWORD)pRegistryEntry->pszData;
+        data = pRegistryEntry->dwData;
         lpData = (BYTE *)&data;
         break;
       default:
@@ -235,7 +236,7 @@ STDAPI DllRegisterServer()
          L"Software\\Classes\\.blend\\",
          L"Treatment",
          REG_DWORD,
-         0},  // doesn't appear to do anything...
+         0,0},  // doesn't appear to do anything...
         {HKEY_CURRENT_USER,
          L"Software\\Classes\\.blend\\ShellEx\\{e357fccd-a995-4576-b01f-234630154e96}",
          NULL,



More information about the Bf-blender-cvs mailing list