msi [2/2]: Use lstrlenW instead of sizeof to compute the length of local const unicode strings

James Hawkins truiken at gmail.com
Thu Oct 19 19:30:59 CDT 2006


Hi,

Changelog:
* Use lstrlenW instead of sizeof to compute the length of local const
unicode strings.

 dlls/msi/database.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/database.c b/dlls/msi/database.c
index b793863..44c20e6 100644
--- a/dlls/msi/database.c
+++ b/dlls/msi/database.c
@@ -339,7 +339,7 @@ static LPWSTR msi_build_createsql_prelud
 
     static const WCHAR create_fmt[] = {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','%','s','`',' ','(',' ',0};
 
-    size = sizeof(create_fmt) + lstrlenW(table) - 2;
+    size = lstrlenW(create_fmt) + lstrlenW(table) - 1;
     prelude = msi_alloc(size * sizeof(WCHAR));
     if (!prelude)
         return NULL;
@@ -494,7 +494,7 @@ static LPWSTR msi_build_insertsql_prelud
 
     static const WCHAR insert_fmt[] = {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','%','s','`',' ','(',' ',0};
 
-    size = sizeof(insert_fmt) + lstrlenW(table) - 2;
+    size = lstrlenW(insert_fmt) + lstrlenW(table) - 1;
     prelude = msi_alloc(size * sizeof(WCHAR));
     if (!prelude)
         return NULL;
@@ -600,7 +600,7 @@ static UINT msi_add_records_to_table(MSI
     {
         LPWSTR data = msi_build_insertsql_data(records, types, num_columns, i);
 
-        size = lstrlenW(prelude) + lstrlenW(columns_sql) + sizeof(mid) + lstrlenW(data) + sizeof(end) - 1; 
+        size = lstrlenW(prelude) + lstrlenW(columns_sql) + lstrlenW(mid) + lstrlenW(data) + lstrlenW(end) + 1; 
         insert_sql = msi_alloc(size * sizeof(WCHAR));
         if (!insert_sql)
             return ERROR_OUTOFMEMORY;
-- 
1.4.2.1


More information about the wine-patches mailing list