@@ -60,18 +60,20 @@ std::string ReadDsnString(const std::string& dsn, std::string_view key,
6060
6161#define BUFFER_SIZE (1024 )
6262 std::vector<SQLWCHAR> buf (BUFFER_SIZE);
63- int ret = SQLGetPrivateProfileString (
64- reinterpret_cast <LPCWSTR>(wdsn.c_str ()), reinterpret_cast <LPCWSTR>(wkey.c_str ()),
65- reinterpret_cast <LPCWSTR>(wdflt.c_str ()), buf.data (), static_cast <int >(buf.size ()),
66- reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
63+ int ret = SQLGetPrivateProfileString (reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdsn)),
64+ reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wkey)),
65+ reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdflt)),
66+ buf.data (), static_cast <int >(buf.size ()),
67+ reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
6768
6869 if (ret > BUFFER_SIZE) {
6970 // If there wasn't enough space, try again with the right size buffer.
7071 buf.resize (ret + 1 );
71- ret = SQLGetPrivateProfileString (
72- reinterpret_cast <LPCWSTR>(wdsn.c_str ()), reinterpret_cast <LPCWSTR>(wkey.c_str ()),
73- reinterpret_cast <LPCWSTR>(wdflt.c_str ()), buf.data (),
74- static_cast <int >(buf.size ()), reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
72+ ret = SQLGetPrivateProfileString (reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdsn)),
73+ reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wkey)),
74+ reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdflt)),
75+ buf.data (), static_cast <int >(buf.size ()),
76+ reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
7577 }
7678
7779 std::string result (" " );
@@ -101,16 +103,18 @@ std::vector<std::string> ReadAllKeys(const std::string& dsn) {
101103
102104 std::vector<SQLWCHAR> buf (BUFFER_SIZE);
103105
104- int ret = SQLGetPrivateProfileString (
105- reinterpret_cast <LPCWSTR>(wdsn.c_str ()), NULL , reinterpret_cast <LPCWSTR>(L" " ),
106- buf.data (), static_cast <int >(buf.size ()), reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
106+ int ret = SQLGetPrivateProfileString (reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdsn)),
107+ NULL , reinterpret_cast <LPCWSTR>(L" " ), buf.data (),
108+ static_cast <int >(buf.size ()),
109+ reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
107110
108111 if (ret > BUFFER_SIZE) {
109112 // If there wasn't enough space, try again with the right size buffer.
110113 buf.resize (ret + 1 );
111- ret = SQLGetPrivateProfileString (
112- reinterpret_cast <LPCWSTR>(wdsn.c_str ()), NULL , reinterpret_cast <LPCWSTR>(L" " ),
113- buf.data (), static_cast <int >(buf.size ()), reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
114+ ret = SQLGetPrivateProfileString (reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR (wdsn)),
115+ NULL , reinterpret_cast <LPCWSTR>(L" " ), buf.data (),
116+ static_cast <int >(buf.size ()),
117+ reinterpret_cast <LPCWSTR>(L" ODBC.INI" ));
114118 }
115119
116120 // When you pass NULL to SQLGetPrivateProfileString it gives back a \0 delimited list of
0 commit comments