Changeset: e9bc3e408285 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9bc3e408285
Modified Files:
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/ODBCUtil.c
clients/odbc/driver/ODBCUtil.h
clients/odbc/driver/SQLError.c
clients/odbc/driver/SQLGetDescRec.c
clients/odbc/driver/SQLGetDiagField.c
clients/odbc/driver/SQLGetDiagRec.c
Branch: Aug2018
Log Message:
Error messages are const char *.
diffs (133 lines):
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -1873,7 +1873,8 @@ ODBCFetch(ODBCStmt *stmt,
if (type == SQL_C_WCHAR) {
SQLSMALLINT n;
- ODBCutf82wchar((SQLCHAR *) ptr, SQL_NTS, (SQLWCHAR *)
origptr, origbuflen, &n);
+ ODBCutf82wchar((SQLCHAR *) ptr, SQL_NTS,
+ (SQLWCHAR *) origptr, origbuflen, &n);
#ifdef ODBCDEBUG
ODBCLOG("Writing %d bytes to %p\n",
(int) (n * sizeof(SQLWCHAR)),
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -87,7 +87,7 @@ static int utf8chkmsk[] = {
ODBC fashion.
*/
SQLCHAR *
-ODBCwchar2utf8(const SQLWCHAR *s, SQLLEN length, char **errmsg)
+ODBCwchar2utf8(const SQLWCHAR *src, SQLLEN length, const char **errmsg)
{
const SQLWCHAR *s1, *e;
unsigned long c;
@@ -166,7 +166,7 @@ ODBCwchar2utf8(const SQLWCHAR *s, SQLLEN
returns NULL, on error returns a string with an error message. The
first two arguments describe the input, the last three arguments
describe the output, both in the normal ODBC fashion. */
-char *
+const char *
ODBCutf82wchar(const SQLCHAR *s,
SQLINTEGER length,
SQLWCHAR *buf,
diff --git a/clients/odbc/driver/ODBCUtil.h b/clients/odbc/driver/ODBCUtil.h
--- a/clients/odbc/driver/ODBCUtil.h
+++ b/clients/odbc/driver/ODBCUtil.h
@@ -92,12 +92,12 @@ extern char *dupODBCstring(const SQLCHAR
errfunc((hdl), "01004", NULL, 0); \
} while (0)
-extern SQLCHAR *ODBCwchar2utf8(const SQLWCHAR *s, SQLLEN length, char
**errmsg);
-extern char *ODBCutf82wchar(const SQLCHAR *s, SQLINTEGER length, SQLWCHAR
*buf, SQLLEN buflen, SQLSMALLINT *buflenout);
+extern SQLCHAR *ODBCwchar2utf8(const SQLWCHAR *s, SQLLEN length, const char
**errmsg);
+extern const char *ODBCutf82wchar(const SQLCHAR *s, SQLINTEGER length,
SQLWCHAR *buf, SQLLEN buflen, SQLSMALLINT *buflenout);
#define fixWcharIn(ws, wsl, t, s, errfunc, hdl, exit) \
do { \
- char *e; \
+ const char *e; \
(s) = (t *) ODBCwchar2utf8((ws), (wsl), &e); \
if (e) { \
/* General error */ \
@@ -109,7 +109,8 @@ extern char *ODBCutf82wchar(const SQLCHA
} while (0)
#define fixWcharOut(r, s, sl, ws, wsl, wslp, cw, errfunc, hdl) \
do { \
- char *e = ODBCutf82wchar((s), (sl), (ws), (wsl) / (cw), &(sl));
\
+ const char *e = ODBCutf82wchar((s), (sl), (ws), \
+ (wsl) / (cw), &(sl)); \
if (e) { \
/* General error */ \
errfunc((hdl), "HY000", e, 0); \
diff --git a/clients/odbc/driver/SQLError.c b/clients/odbc/driver/SQLError.c
--- a/clients/odbc/driver/SQLError.c
+++ b/clients/odbc/driver/SQLError.c
@@ -140,15 +140,15 @@ SQLErrorW(SQLHENV EnvironmentHandle,
return SQL_ERROR;
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(state, 5, SQLState, 6, NULL);
+ const char *e = ODBCutf82wchar(state, 5, SQLState, 6, NULL);
if (e)
rc = SQL_ERROR;
}
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(errmsg, n,
- MessageText, BufferLength, &n);
+ const char *e = ODBCutf82wchar(errmsg, n,
+ MessageText, BufferLength, &n);
if (e)
rc = SQL_ERROR;
diff --git a/clients/odbc/driver/SQLGetDescRec.c
b/clients/odbc/driver/SQLGetDescRec.c
--- a/clients/odbc/driver/SQLGetDescRec.c
+++ b/clients/odbc/driver/SQLGetDescRec.c
@@ -201,7 +201,7 @@ SQLGetDescRecW(SQLHDESC DescriptorHandle
NullablePtr);
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(name, n, Name, BufferLength, &n);
+ const char *e = ODBCutf82wchar(name, n, Name, BufferLength, &n);
if (e)
rc = SQL_ERROR;
diff --git a/clients/odbc/driver/SQLGetDiagField.c
b/clients/odbc/driver/SQLGetDiagField.c
--- a/clients/odbc/driver/SQLGetDiagField.c
+++ b/clients/odbc/driver/SQLGetDiagField.c
@@ -337,8 +337,8 @@ SQLGetDiagFieldW(SQLSMALLINT HandleType,
if (ptr != DiagInfoPtr) {
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(ptr, n, DiagInfoPtr,
- BufferLength / 2, &n);
+ const char *e = ODBCutf82wchar(ptr, n, DiagInfoPtr,
+ BufferLength / 2, &n);
if (e)
rc = SQL_ERROR;
diff --git a/clients/odbc/driver/SQLGetDiagRec.c
b/clients/odbc/driver/SQLGetDiagRec.c
--- a/clients/odbc/driver/SQLGetDiagRec.c
+++ b/clients/odbc/driver/SQLGetDiagRec.c
@@ -221,15 +221,15 @@ SQLGetDiagRecW(SQLSMALLINT HandleType,
#endif
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(state, 5, SQLState, 6, NULL);
+ const char *e = ODBCutf82wchar(state, 5, SQLState, 6, NULL);
if (e)
rc = SQL_ERROR;
}
if (SQL_SUCCEEDED(rc)) {
- char *e = ODBCutf82wchar(msg, n, MessageText,
- BufferLength, &n);
+ const char *e = ODBCutf82wchar(msg, n, MessageText,
+ BufferLength, &n);
if (e)
rc = SQL_ERROR;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list