From: Piotr Caban piotr@codeweavers.com
--- dlls/oledb32/datainit.c | 20 ++++++++++++++------ dlls/oledb32/tests/database.c | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 01e8f5c1b57..223f9a4291a 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -451,7 +451,7 @@ static void free_dbprop_list(struct dbprops *props)
static HRESULT parse_init_string(const WCHAR *initstring, struct dbprops *props) { - const WCHAR *start; + const WCHAR *start, *end; WCHAR *eq; HRESULT hr = S_OK;
@@ -464,9 +464,14 @@ static HRESULT parse_init_string(const WCHAR *initstring, struct dbprops *props) WCHAR *delim, quote; BSTR value, name;
- name = SysAllocStringLen(start, eq - start); + while (iswspace(*start)) start++; + end = eq; + while (end != start && iswspace(end[-1])) end--; + + name = SysAllocStringLen(start, end - start); /* skip equal sign to get value */ eq++; + while (iswspace(*eq)) eq++;
quote = (*eq == '"' || *eq == ''') ? *eq : 0; if (quote) @@ -474,20 +479,23 @@ static HRESULT parse_init_string(const WCHAR *initstring, struct dbprops *props) /* for quoted value string, skip opening mark, look for terminating one */ eq++; delim = wcschr(eq, quote); + end = delim; } else + { delim = wcschr(eq, ';'); + end = delim ? delim : eq + wcslen(eq); + while (end != eq && iswspace(end[-1])) end--; + }
- if (delim) - value = SysAllocStringLen(eq, delim - eq); - else - value = SysAllocString(eq); + value = SysAllocStringLen(eq, end - eq);
/* skip semicolon if present */ if (delim) { if (*delim == quote) delim++; + while (iswspace(*delim)) delim++; if (*delim == ';') delim++; } diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index bcee13017a7..1c1da942f74 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -324,7 +324,7 @@ static void test_database(void) static const WCHAR *initial_catalog_prop = L"Data Source=initial_catalog_test;Initial Catalog=dummy_catalog"; static const WCHAR *extended_prop = L"data source=dummy;Extended Properties="DRIVER=A Wine ODBC driver;UID=wine;";"; static const WCHAR *extended_prop2 = L"data source='dummy';customprop='123.4';"; - static const WCHAR *multi_provider_prop_test = L"Data Source=provider_prop_test;a=1;b=2;c=3;"; + static const WCHAR *multi_provider_prop_test = L"Data Source=provider_prop_test; a =\t1 ;b='2' ;c=3;"; IDataInitialize *datainit = NULL; HRESULT hr;