Rob Shearman : quartz: Don' t assume that strlenW of a constant string can be determined at compile time .

Alexandre Julliard julliard at winehq.org
Fri Feb 29 06:17:08 CST 2008


Module: wine
Branch: master
Commit: 1c0122d14e8dd3e4d54678b9538aba1aadfaba3e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1c0122d14e8dd3e4d54678b9538aba1aadfaba3e

Author: Rob Shearman <rob at codeweavers.com>
Date:   Fri Feb 29 11:12:32 2008 +0000

quartz: Don't assume that strlenW of a constant string can be determined at compile time.

Use sizeof instead to calculate the size of wszKeyName in 
FilterMapper2_CreateCategory.

---

 dlls/quartz/filtermapper.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index 8b7cf7d..eeba0b1 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -41,6 +41,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
+#define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
+
 /* Unexposed IAMFilterData interface */
 typedef struct IAMFilterData IAMFilterData;
 
@@ -311,7 +313,7 @@ static HRESULT WINAPI FilterMapper2_CreateCategory(
 {
     LPWSTR wClsidAMCat = NULL;
     LPWSTR wClsidCategory = NULL;
-    WCHAR wszKeyName[strlenW(wszClsidSlash) + strlenW(wszSlashInstance) + (CHARS_IN_GUID-1) * 2 + 1];
+    WCHAR wszKeyName[ARRAYSIZE(wszClsidSlash)-1 + ARRAYSIZE(wszSlashInstance)-1 + (CHARS_IN_GUID-1) * 2 + 1];
     HKEY hKey = NULL;
     LONG lRet;
     HRESULT hr;




More information about the wine-cvs mailing list