Rob Shearman : msi: Cleanup unneeded string table functions.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Apr 24 07:23:59 CDT 2007
Module: wine
Branch: master
Commit: e261d602fb2db22f0532e45252298f3b23b8c070
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e261d602fb2db22f0532e45252298f3b23b8c070
Author: Rob Shearman <rob at codeweavers.com>
Date: Mon Apr 23 08:18:27 2007 +0100
msi: Cleanup unneeded string table functions.
Make string table functions that aren't used outside of string.c static.
---
dlls/msi/msipriv.h | 6 ------
dlls/msi/string.c | 44 +++++++++++++-------------------------------
2 files changed, 13 insertions(+), 37 deletions(-)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 670719c..713ae7f 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -546,21 +546,15 @@ enum StringPersistence
StringNonPersistent = 1
};
-extern BOOL msi_addstring( string_table *st, UINT string_no, const CHAR *data, int len, UINT refcount, enum StringPersistence persistence );
extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, int len, UINT refcount, enum StringPersistence persistence );
extern UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
extern UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
extern UINT msi_string2idW( string_table *st, LPCWSTR buffer, UINT *id );
extern UINT msi_string2idA( string_table *st, LPCSTR str, UINT *id );
-extern string_table *msi_init_stringtable( int entries, UINT codepage );
extern VOID msi_destroy_stringtable( string_table *st );
-extern UINT msi_string_count( string_table *st );
-extern UINT msi_id_persistent_refcount( string_table *st, UINT i );
-extern UINT msi_string_totalsize( string_table *st, UINT *datasize, UINT *poolsize );
extern UINT msi_strcmp( string_table *st, UINT lval, UINT rval, UINT *res );
extern const WCHAR *msi_string_lookup_id( string_table *st, UINT id );
-extern UINT msi_string_get_codepage( string_table *st );
extern HRESULT msi_init_string_table( IStorage *stg );
extern string_table *msi_load_string_table( IStorage *stg );
extern UINT msi_save_string_table( string_table *st, IStorage *storage );
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 21b10ee..ef6d7c7 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -1,7 +1,8 @@
/*
- * Implementation of the Microsoft Installer (msi.dll)
+ * String Table Functions
*
* Copyright 2002-2004, Mike McCormack for CodeWeavers
+ * Copyright 2007 Robert Shearman for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -74,7 +75,7 @@ static UINT msistring_makehash( const WCHAR *str )
return hash % HASH_SIZE;
}
-string_table *msi_init_stringtable( int entries, UINT codepage )
+static string_table *init_stringtable( int entries, UINT codepage )
{
string_table *st;
int i;
@@ -171,7 +172,7 @@ static void set_st_entry( string_table *st, UINT n, LPWSTR str, UINT refcount, e
st->freeslot = n + 1;
}
-int msi_addstring( string_table *st, UINT n, const CHAR *data, int len, UINT refcount, enum StringPersistence persistence )
+static int msi_addstring( string_table *st, UINT n, const CHAR *data, int len, UINT refcount, enum StringPersistence persistence )
{
LPWSTR str;
int sz;
@@ -448,19 +449,7 @@ UINT msi_strcmp( string_table *st, UINT lval, UINT rval, UINT *res )
return ERROR_SUCCESS;
}
-UINT msi_string_count( string_table *st )
-{
- return st->maxcount;
-}
-
-UINT msi_id_persistent_refcount( string_table *st, UINT i )
-{
- if( i >= st->maxcount )
- return 0;
- return st->strings[i].persistent_refcount;
-}
-
-UINT msi_string_totalsize( string_table *st, UINT *datasize, UINT *poolsize )
+static void string_totalsize( string_table *st, UINT *datasize, UINT *poolsize )
{
UINT i, len, max, holesize;
@@ -493,12 +482,6 @@ UINT msi_string_totalsize( string_table *st, UINT *datasize, UINT *poolsize )
holesize += 4;
}
TRACE("data %u pool %u codepage %x\n", *datasize, *poolsize, st->codepage );
- return max;
-}
-
-UINT msi_string_get_codepage( string_table *st )
-{
- return st->codepage;
}
static const WCHAR szStringData[] = {
@@ -544,7 +527,7 @@ string_table *msi_load_string_table( IStorage *stg )
codepage = pool[0] | ( pool[1] << 16 );
else
codepage = CP_ACP;
- st = msi_init_stringtable( count, codepage );
+ st = init_stringtable( count, codepage );
offset = 0;
n = 1;
@@ -605,7 +588,7 @@ end:
UINT msi_save_string_table( string_table *st, IStorage *storage )
{
- UINT i, count, datasize = 0, poolsize = 0, sz, used, r, codepage, n;
+ UINT i, datasize = 0, poolsize = 0, sz, used, r, codepage, n;
UINT ret = ERROR_FUNCTION_FAILED;
CHAR *data = NULL;
USHORT *pool = NULL;
@@ -613,9 +596,9 @@ UINT msi_save_string_table( string_table *st, IStorage *storage )
TRACE("\n");
/* construct the new table in memory first */
- count = msi_string_totalsize( st, &datasize, &poolsize );
+ string_totalsize( st, &datasize, &poolsize );
- TRACE("%u %u %u\n", count, datasize, poolsize );
+ TRACE("%u %u %u\n", st->maxcount, datasize, poolsize );
pool = msi_alloc( poolsize );
if( ! pool )
@@ -631,14 +614,13 @@ UINT msi_save_string_table( string_table *st, IStorage *storage )
}
used = 0;
- codepage = msi_string_get_codepage( st );
+ codepage = st->codepage;
pool[0]=codepage&0xffff;
pool[1]=(codepage>>16);
n = 1;
- for( i=1; i<count; i++ )
+ for( i=1; i<st->maxcount; i++ )
{
- UINT refcount = msi_id_persistent_refcount( st, i );
- if( !refcount )
+ if( !st->strings[i].persistent_refcount )
continue;
sz = datasize - used;
r = msi_id2stringA( st, i, data+used, &sz );
@@ -651,7 +633,7 @@ UINT msi_save_string_table( string_table *st, IStorage *storage )
sz--;
if (sz)
- pool[ n*2 + 1 ] = refcount;
+ pool[ n*2 + 1 ] = st->strings[i].persistent_refcount;
else
pool[ n*2 + 1 ] = 0;
if (sz < 0x10000)
More information about the wine-cvs
mailing list