James Hawkins : msi: Save nonpersistent strings as holes in the string pool .
Alexandre Julliard
julliard at winehq.org
Thu Oct 18 07:59:34 CDT 2007
Module: wine
Branch: master
Commit: 227438832349fc8be7ba1f10d4b1ec57e2e25891
URL: http://source.winehq.org/git/wine.git/?a=commit;h=227438832349fc8be7ba1f10d4b1ec57e2e25891
Author: James Hawkins <truiken at gmail.com>
Date: Wed Oct 17 22:57:18 2007 -0500
msi: Save nonpersistent strings as holes in the string pool.
---
dlls/msi/string.c | 17 ++++++++++++-----
dlls/msi/tests/db.c | 5 +----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 0cacf1e..fecd93f 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -457,20 +457,22 @@ UINT msi_strcmp( const string_table *st, UINT lval, UINT rval, UINT *res )
static void string_totalsize( const string_table *st, UINT *datasize, UINT *poolsize )
{
- UINT i, len, max, holesize;
+ UINT i, len, holesize;
if( st->strings[0].str || st->strings[0].persistent_refcount || st->strings[0].nonpersistent_refcount)
ERR("oops. element 0 has a string\n");
*poolsize = 4;
*datasize = 0;
- max = 1;
holesize = 0;
for( i=1; i<st->maxcount; i++ )
{
if( !st->strings[i].persistent_refcount )
- continue;
- if( st->strings[i].str )
+ {
+ TRACE("[%u] nonpersistent = %s\n", i, debugstr_w(st->strings[i].str));
+ (*poolsize) += 4;
+ }
+ else if( st->strings[i].str )
{
TRACE("[%u] = %s\n", i, debugstr_w(st->strings[i].str));
len = WideCharToMultiByte( st->codepage, 0,
@@ -480,7 +482,6 @@ static void string_totalsize( const string_table *st, UINT *datasize, UINT *pool
(*datasize) += len;
if (len>0xffff)
(*poolsize) += 4;
- max = i + 1;
(*poolsize) += holesize + 4;
holesize = 0;
}
@@ -634,7 +635,13 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage )
for( i=1; i<st->maxcount; i++ )
{
if( !st->strings[i].persistent_refcount )
+ {
+ pool[ n*2 ] = 0;
+ pool[ n*2 + 1] = 0;
+ n++;
continue;
+ }
+
sz = datasize - used;
r = msi_id2stringA( st, i, data+used, &sz );
if( r != ERROR_SUCCESS )
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 8def113..c620768 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -4253,10 +4253,7 @@ static void test_stringtable(void)
sz = sizeof(buffer);
r = MsiRecordGetString(hrec, 2, buffer, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- todo_wine
- {
- ok(!lstrcmp(buffer, "five"), "Expected five, got %s\n", buffer);
- }
+ ok(!lstrcmp(buffer, "five"), "Expected five, got %s\n", buffer);
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
More information about the wine-cvs
mailing list