32 #include "wine/unicode.h" 114 if( st->
strings[
i].persistent_refcount ||
115 st->
strings[
i].nonpersistent_refcount )
132 for(
i = st->
freeslot; i < st->maxcount;
i++ )
133 if( !st->
strings[
i].persistent_refcount &&
134 !st->
strings[
i].nonpersistent_refcount )
138 if( !st->
strings[
i].persistent_refcount &&
139 !st->
strings[
i].nonpersistent_refcount )
162 ERR(
"oops. expected freeslot to be free...\n");
168 if (len1 < len2)
return -1;
169 else if (len1 > len2)
return 1;
172 if (*str1 == *str2) { str1++; str2++; }
173 else return *str1 - *str2;
185 i = (low + high) / 2;
216 st->
strings[
n].persistent_refcount = refcount;
217 st->
strings[
n].nonpersistent_refcount = 0;
221 st->
strings[
n].persistent_refcount = 0;
222 st->
strings[
n].nonpersistent_refcount = refcount;
270 if( st->
strings[
n].persistent_refcount ||
271 st->
strings[
n].nonpersistent_refcount )
279 st->
strings[
n].persistent_refcount += refcount;
281 st->
strings[
n].nonpersistent_refcount += refcount;
323 st->
strings[
n].persistent_refcount++;
325 st->
strings[
n].nonpersistent_refcount++;
357 if(
id && !st->
strings[
id].persistent_refcount && !st->
strings[
id].nonpersistent_refcount)
412 i = (low + high) / 2;
432 if( st->
strings[0].data || st->
strings[0].persistent_refcount || st->
strings[0].nonpersistent_refcount)
433 ERR(
"oops. element 0 has a string\n");
440 if( !st->
strings[
i].persistent_refcount )
455 (*poolsize) += holesize + 4;
497 if ( (poolsize > 4) && (
pool[1] & 0x8000) )
500 *bytes_per_strref =
sizeof(
USHORT);
520 if (
pool[
i*2] == 0 && refs == 0)
545 ERR(
"string table corrupt?\n");
551 ERR(
"Failed to add string %d\n",
n );
557 ERR(
"string table load failed! (%08x != %08x), please report\n",
datasize,
offset );
585 WARN(
"Failed to alloc pool %d bytes\n", poolsize );
605 *bytes_per_strref =
sizeof(
USHORT);
610 if( !st->
strings[
i].persistent_refcount )
622 ERR(
"failed to fetch string\n");
638 pool[
n*2 + 2 ] = sz&0xffff;
639 pool[
n*2 + 3 ] = (sz>>16);
658 TRACE(
"Wrote StringData r=%08x\n",
r);
662 TRACE(
"Wrote StringPool r=%08x\n",
r);
#define ERROR_INVALID_PARAMETER
#define memmove(s1, s2, n)
USHORT persistent_refcount
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
#define WideCharToMultiByte
static void string_totalsize(const string_table *st, UINT *datasize, UINT *poolsize)
USHORT nonpersistent_refcount
GLdouble GLdouble GLdouble r
GLuint GLuint GLsizei count
static UINT string2id(const string_table *st, const char *buffer, UINT *id)
#define ERROR_NOT_ENOUGH_MEMORY
UINT write_stream_data(IStorage *stg, LPCWSTR stname, LPCVOID data, UINT sz, BOOL bTable) DECLSPEC_HIDDEN
static void insert_string_sorted(string_table *st, UINT string_id)
int msi_add_string(string_table *st, const WCHAR *data, int len, enum StringPersistence persistence)
static void * msi_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
static string_table * init_stringtable(int entries, UINT codepage)
#define ERROR_FUNCTION_FAILED
UINT msi_set_string_table_codepage(string_table *st, UINT codepage)
struct msistring * strings
UINT msi_save_string_table(const string_table *st, IStorage *storage, UINT *bytes_per_strref)
static const WCHAR szEmpty[]
UINT msi_get_string_table_codepage(const string_table *st)
string_table * msi_load_string_table(IStorage *stg, UINT *bytes_per_strref)
VOID msi_destroy_stringtable(string_table *st)
WINE_DEFAULT_DEBUG_CHANNEL(commctrl)
static UINT id2string(const string_table *st, UINT id, char *buffer, UINT *sz)
static int cmp_string(const WCHAR *str1, int len1, const WCHAR *str2, int len2)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static void set_st_entry(string_table *st, UINT n, WCHAR *str, int len, USHORT refcount, enum StringPersistence persistence)
static BOOL validate_codepage(UINT codepage)
HRESULT msi_init_string_table(IStorage *stg)
static const WCHAR szStringPool[]
#define memcpy(s1, s2, n)
BOOL WINAPI IsValidCodePage(UINT CodePage)
UINT msi_string2id(const string_table *st, const WCHAR *str, int len, UINT *id)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static int st_find_free_entry(string_table *st)
const WCHAR * msi_string_lookup(const string_table *st, UINT id, int *len)
static size_t const unsigned char size_t count
static int find_insert_index(const string_table *st, UINT string_id)
#define MultiByteToWideChar
static const WCHAR szStringData[]
static BOOL msi_free(void *mem)
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
static void * msi_realloc_zero(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
static int add_string(string_table *st, UINT n, const char *data, UINT len, USHORT refcount, enum StringPersistence persistence)
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)