[Bf-blender-cvs] [a0d6b5481e5] temp-cpp-file-system: Fix compile errors on Windows

Julian Eisel noreply at git.blender.org
Tue Aug 3 19:17:42 CEST 2021


Commit: a0d6b5481e5f346559f9c5c81e2ba11262b6ea4f
Author: Julian Eisel
Date:   Tue Aug 3 19:16:35 2021 +0200
Branches: temp-cpp-file-system
https://developer.blender.org/rBa0d6b5481e5f346559f9c5c81e2ba11262b6ea4f

Fix compile errors on Windows

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

M	source/blender/blenlib/BLI_fileops.h
M	source/blender/blenlib/intern/storage.cc

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

diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index feb4d27945f..b77c04f2d2a 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -96,7 +96,10 @@ typedef enum eFileAttributes {
   FILE_ATTR_JUNCTION_POINT = 1 << 13, /* Folder Symbolic-link. */
   FILE_ATTR_MOUNT_POINT = 1 << 14,    /* Volume mounted as a folder. */
   FILE_ATTR_HARDLINK = 1 << 15,       /* Duplicated directory entry. */
+
+  FILE_ATTR_MAX
 } eFileAttributes;
+ENUM_OPERATORS(eFileAttributes, FILE_ATTR_MAX);
 
 #define FILE_ATTR_ANY_LINK \
   (FILE_ATTR_ALIAS | FILE_ATTR_REPARSE_POINT | FILE_ATTR_SYMLINK | FILE_ATTR_JUNCTION_POINT | \
diff --git a/source/blender/blenlib/intern/storage.cc b/source/blender/blenlib/intern/storage.cc
index e416e815e65..19d8d60dedd 100644
--- a/source/blender/blenlib/intern/storage.cc
+++ b/source/blender/blenlib/intern/storage.cc
@@ -248,7 +248,7 @@ size_t BLI_file_size(const char *path)
 #ifndef __APPLE__
 eFileAttributes BLI_file_attributes(const char *path)
 {
-  int ret = 0;
+  eFileAttributes ret = static_cast<eFileAttributes>(0);
 
 #  ifdef WIN32
 
@@ -326,30 +326,30 @@ bool BLI_file_alias_target(const char *filepath,
 
   IShellLinkW *Shortcut = NULL;
   hr = CoCreateInstance(
-      &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (LPVOID *)&Shortcut);
+      CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID *)&Shortcut);
 
   bool success = false;
   if (SUCCEEDED(hr)) {
     IPersistFile *PersistFile;
-    hr = Shortcut->lpVtbl->QueryInterface(Shortcut, &IID_IPersistFile, (LPVOID *)&PersistFile);
+    hr = Shortcut->QueryInterface(&PersistFile);
     if (SUCCEEDED(hr)) {
       WCHAR path_utf16[FILE_MAXDIR] = {0};
       if (conv_utf_8_to_16(filepath, path_utf16, ARRAY_SIZE(path_utf16)) == 0) {
-        hr = PersistFile->lpVtbl->Load(PersistFile, path_utf16, STGM_READ);
+        hr = PersistFile->Load(path_utf16, STGM_READ);
         if (SUCCEEDED(hr)) {
-          hr = Shortcut->lpVtbl->Resolve(Shortcut, 0, SLR_NO_UI | SLR_UPDATE);
+          hr = Shortcut->Resolve(0, SLR_NO_UI | SLR_UPDATE);
           if (SUCCEEDED(hr)) {
             wchar_t target_utf16[FILE_MAXDIR] = {0};
-            hr = Shortcut->lpVtbl->GetPath(Shortcut, target_utf16, FILE_MAXDIR, NULL, 0);
+            hr = Shortcut->GetPath(target_utf16, FILE_MAXDIR, NULL, 0);
             if (SUCCEEDED(hr)) {
               success = (conv_utf_16_to_8(target_utf16, r_targetpath, FILE_MAXDIR) == 0);
             }
           }
-          PersistFile->lpVtbl->Release(PersistFile);
+          PersistFile->Release();
         }
       }
     }
-    Shortcut->lpVtbl->Release(Shortcut);
+    Shortcut->Release();
   }
 
   CoUninitialize();



More information about the Bf-blender-cvs mailing list