diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-22 12:13:38 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:25:48 +0100 |
| commit | 849e863a16e216100a711bb0fe0da33ab64ec577 (patch) | |
| tree | a25456396769472110093b61ebffbdda8f9c5e1f /libmsi/patch.c | |
| parent | 722565ce6f7bb2361207c43769f27c76864fdae1 (diff) | |
| download | msitools-849e863a16e216100a711bb0fe0da33ab64ec577.tar.gz msitools-849e863a16e216100a711bb0fe0da33ab64ec577.tar.xz msitools-849e863a16e216100a711bb0fe0da33ab64ec577.zip | |
remove most of the run-time processing
Diffstat (limited to 'libmsi/patch.c')
| -rw-r--r-- | libmsi/patch.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libmsi/patch.c b/libmsi/patch.c index 4801872..9410bb7 100644 --- a/libmsi/patch.c +++ b/libmsi/patch.c @@ -32,6 +32,43 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); +WCHAR **msi_split_string( const WCHAR *str, WCHAR sep ) +{ + LPCWSTR pc; + LPWSTR p, *ret = NULL; + UINT count = 0; + + if (!str) + return ret; + + /* count the number of substrings */ + for ( pc = str, count = 0; pc; count++ ) + { + pc = strchrW( pc, sep ); + if (pc) + pc++; + } + + /* allocate space for an array of substring pointers and the substrings */ + ret = msi_alloc( (count+1) * sizeof (LPWSTR) + + (lstrlenW(str)+1) * sizeof(WCHAR) ); + if (!ret) + return ret; + + /* copy the string and set the pointers */ + p = (LPWSTR) &ret[count+1]; + lstrcpyW( p, str ); + for( count = 0; (ret[count] = p); count++ ) + { + p = strchrW( p, sep ); + if (p) + *p++ = 0; + } + + return ret; +} + + static BOOL match_language( MSIPACKAGE *package, LANGID langid ) { UINT i; |
