Fix compiler warnings in i386-linux-gnu.
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Wed, 23 May 2018 10:54:38 +0000 (19:54 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Wed, 23 May 2018 10:54:38 +0000 (19:54 +0900)
14 files changed:
connection.c
convert.c
descriptor.c
execute.c
misc.c
odbcapi30.c
options.c
pgapi30.c
psqlodbc.h
qresult.c
results.c
statement.c
test/src/result-conversions-test.c
win_unicode.c

index b33656fa2ed112922b3271b4e5fbc9450a2a85c1..069f428ce0f5686aab179bd2227a267282ee6c17 100644 (file)
@@ -1321,7 +1321,7 @@ static int handle_show_results(const QResultClass *res)
        if (strcmp(QR_get_fieldname(qres, 0), TRANSACTION_ISOLATION) == 0)
        {
            conn->server_isolation = isolation_str_to_enum(QR_get_value_backend_text(qres, 0, 0));
-           MYLOG(0, "isolation %d to be %d\n", conn->server_isolation, conn->isolation);
+           MYLOG(0, "isolation " FORMAT_UINTEGER " to be " FORMAT_UINTEGER "\n", conn->server_isolation, conn->isolation);
            if (0 == conn->isolation)
                conn->isolation = conn->server_isolation;
            if (0 == conn->default_isolation)
@@ -1348,7 +1348,7 @@ SQLUINTEGER   CC_get_isolation(ConnectionClass *self)
        isolation = self->server_isolation;
    }
    QR_Destructor(res);
-MYLOG(0, "isolation=%d\n", isolation);
+MYLOG(0, "isolation=" FORMAT_UINTEGER "\n", isolation);
    return isolation;
 }
 
index 458fced0be23aedb1ebc9970981ff4f0a468d7b2..9a4562c89cbea6647d2501c97f88ac562dc92100 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -2947,7 +2947,7 @@ MYLOG(DETAIL_LOG_LEVEL, "entering prepared=%d\n", stmt->prepared);
            qp->from_pos = stmt->from_pos;
            qp->where_pos = stmt->where_pos;
        }
-MYLOG(DETAIL_LOG_LEVEL, "type=%d concur=%d\n", stmt->options.cursor_type, stmt->options.scroll_concurrency);
+MYLOG(DETAIL_LOG_LEVEL, "type=" FORMAT_UINTEGER " concur=" FORMAT_UINTEGER "\n", stmt->options.cursor_type, stmt->options.scroll_concurrency);
    }
 
    SC_miscinfo_clear(stmt);
index 1499adedf08faebe06629fe030f0cdaa59fe55ef..295b58c3e11d60f77231a38f3ec96ffae9f70010 100644 (file)
@@ -562,7 +562,7 @@ MYLOG(DETAIL_LOG_LEVEL, "src=%p target=%p type=%d", src, target, srchd->desc_typ
                targethd->desc_type = srchd->desc_type;
            }
            ard_src = &(src->ardf);
-MYPRINTF(DETAIL_LOG_LEVEL, " rowset_size=" FORMAT_LEN " bind_size=%d ope_ptr=%p off_ptr=%p\n",
+MYPRINTF(DETAIL_LOG_LEVEL, " rowset_size=" FORMAT_LEN " bind_size=" FORMAT_UINTEGER " ope_ptr=%p off_ptr=%p\n",
 ard_src->size_of_rowset, ard_src->bind_size,
 ard_src->row_operation_ptr, ard_src->row_offset_ptr);
            ard_tgt = &(target->ardf);
index 2679ff86734425b6dfcdccc7edfea3f1da335e3e..e9419e9664c7a75d84908d32cea48699fd924dcc 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -1224,7 +1224,7 @@ PGAPI_NativeSql(HDBC hdbc,
    ConnectionClass *conn = (ConnectionClass *) hdbc;
    RETCODE     result;
 
-   MYLOG(0, "entering...cbSqlStrIn=%d\n", cbSqlStrIn);
+   MYLOG(0, "entering...cbSqlStrIn=" FORMAT_INTEGER "\n", cbSqlStrIn);
 
    ptr = (cbSqlStrIn == 0) ? "" : make_string(szSqlStrIn, cbSqlStrIn, NULL, 0);
    if (!ptr)
diff --git a/misc.c b/misc.c
index f7ff1d2e1804eee34fdf38ec26daee40b9e3ea97..66a88573d9a3ccdf6295c60e416a4dbce311654b 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -116,7 +116,7 @@ make_string(const SQLCHAR *s, SQLINTEGER len, char *buf, size_t bufsize)
        length = strlen((char *) s);
    else
    {
-       MYLOG(0, "invalid length=%d\n", len);
+       MYLOG(0, "invalid length=" FORMAT_INTEGER "\n", len);
        return NULL;
    }
    if (buf)
index 7fa1cbde124b5ac8cb92a980c0946ace03fa3bd6..e2d1061764b76244a598eba154659a255fb3ebca 100644 (file)
@@ -353,7 +353,7 @@ SQLGetEnvAttr(HENV EnvironmentHandle,
    RETCODE ret;
    EnvironmentClass *env = (EnvironmentClass *) EnvironmentHandle;
 
-   MYLOG(0, "Entering %d\n", Attribute);
+   MYLOG(0, "Entering " FORMAT_INTEGER "\n", Attribute);
    ENTER_ENV_CS(env);
    ret = SQL_SUCCESS;
    switch (Attribute)
@@ -387,7 +387,7 @@ SQLGetConnectAttr(HDBC ConnectionHandle,
 {
    RETCODE ret;
 
-   MYLOG(0, "Entering %d\n", Attribute);
+   MYLOG(0, "Entering " FORMAT_UINTEGER "\n", Attribute);
    CC_examine_global_transaction((ConnectionClass*) ConnectionHandle);
    ENTER_CONN_CS((ConnectionClass *) ConnectionHandle);
    CC_clear_error((ConnectionClass *) ConnectionHandle);
@@ -406,7 +406,7 @@ SQLGetStmtAttr(HSTMT StatementHandle,
    RETCODE ret;
    StatementClass  *stmt = (StatementClass *) StatementHandle;
 
-   MYLOG(0, "Entering Handle=%p %d\n", StatementHandle, Attribute);
+   MYLOG(0, "Entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, Attribute);
    ENTER_STMT_CS(stmt);
    SC_clear_error(stmt);
    StartRollbackState(stmt);
@@ -426,7 +426,7 @@ SQLSetConnectAttr(HDBC ConnectionHandle,
    RETCODE ret;
    ConnectionClass *conn = (ConnectionClass *) ConnectionHandle;
 
-   MYLOG(0, "Entering %d\n", Attribute);
+   MYLOG(0, "Entering " FORMAT_INTEGER "\n", Attribute);
    CC_examine_global_transaction(conn);
    ENTER_CONN_CS(conn);
    CC_clear_error(conn);
@@ -474,7 +474,7 @@ SQLSetEnvAttr(HENV EnvironmentHandle,
    RETCODE ret;
    EnvironmentClass *env = (EnvironmentClass *) EnvironmentHandle;
 
-   MYLOG(0, "Entering att=%d," FORMAT_ULEN "\n", Attribute, (SQLULEN) Value);
+   MYLOG(0, "Entering att=" FORMAT_INTEGER "," FORMAT_ULEN "\n", Attribute, (SQLULEN) Value);
    ENTER_ENV_CS(env);
    switch (Attribute)
    {
@@ -535,7 +535,7 @@ SQLSetStmtAttr(HSTMT StatementHandle,
    StatementClass *stmt = (StatementClass *) StatementHandle;
    RETCODE ret;
 
-   MYLOG(0, "Entering Handle=%p %d," FORMAT_ULEN "\n", StatementHandle, Attribute, (SQLULEN) Value);
+   MYLOG(0, "Entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "\n", StatementHandle, Attribute, (SQLULEN) Value);
    ENTER_STMT_CS(stmt);
    SC_clear_error(stmt);
    StartRollbackState(stmt);
index 7950d1258c9b3d289c7317377989591a8751ab5d..5818cdb609705a620954c3b624c5654ad26534fe 100644 (file)
--- a/options.c
+++ b/options.c
@@ -547,12 +547,12 @@ PGAPI_GetConnectOption(HDBC hdbc,
 #endif /* SQL_ATTR_CONNECTION_DEAD */
            MYLOG(0, "CONNECTION_DEAD status=%d", conn->status);
            *((SQLUINTEGER *) pvParam) = CC_not_connected(conn);
-           MYPRINTF(0, " val=%d\n", *((SQLUINTEGER *) pvParam));
+           MYPRINTF(0, " val=" FORMAT_UINTEGER "\n", *((SQLUINTEGER *) pvParam));
                         break;
 
        case SQL_ATTR_ANSI_APP:
            *((SQLUINTEGER *) pvParam) = CC_is_in_ansi_app(conn);
-           MYLOG(0, "ANSI_APP val=%d\n", *((SQLUINTEGER *) pvParam));
+           MYLOG(0, "ANSI_APP val=" FORMAT_UINTEGER "\n", *((SQLUINTEGER *) pvParam));
                         break;
 
            /* These options should be handled by driver manager */
@@ -713,12 +713,12 @@ PGAPI_GetStmtOption(HSTMT hstmt,
            break;
 
        case SQL_CONCURRENCY:   /* NOT REALLY SUPPORTED */
-           MYLOG(0, "SQL_CONCURRENCY %d\n", stmt->options.scroll_concurrency);
+           MYLOG(0, "SQL_CONCURRENCY " FORMAT_INTEGER "\n", stmt->options.scroll_concurrency);
            *((SQLINTEGER *) pvParam) = stmt->options.scroll_concurrency;
            break;
 
        case SQL_CURSOR_TYPE:   /* PARTIAL SUPPORT */
-           MYLOG(0, "SQL_CURSOR_TYPE %d\n", stmt->options.cursor_type);
+           MYLOG(0, "SQL_CURSOR_TYPE " FORMAT_INTEGER "\n", stmt->options.cursor_type);
            *((SQLINTEGER *) pvParam) = stmt->options.cursor_type;
            break;
 
index d3a26349f5ecd3357694dc82a9768e99be6919b0..ba0dd6d731bbccd81392def43ae9b10e9c013aef 100644 (file)
--- a/pgapi30.c
+++ b/pgapi30.c
@@ -401,7 +401,7 @@ PGAPI_GetConnectAttr(HDBC ConnectionHandle,
    RETCODE ret = SQL_SUCCESS;
    SQLINTEGER  len = 4;
 
-   MYLOG(0, "entering %d\n", Attribute);
+   MYLOG(0, "entering " FORMAT_INTEGER "\n", Attribute);
    switch (Attribute)
    {
        case SQL_ATTR_ASYNC_ENABLE:
@@ -1552,7 +1552,7 @@ PGAPI_GetStmtAttr(HSTMT StatementHandle,
    RETCODE     ret = SQL_SUCCESS;
    SQLINTEGER  len = 0;
 
-   MYLOG(0, "entering Handle=%p %d\n", StatementHandle, Attribute);
+   MYLOG(0, "entering Handle=%p " FORMAT_INTEGER "\n", StatementHandle, Attribute);
    switch (Attribute)
    {
        case SQL_ATTR_FETCH_BOOKMARK_PTR:   /* 16 */
@@ -1655,7 +1655,7 @@ PGAPI_SetConnectAttr(HDBC ConnectionHandle,
    BOOL    unsupported = FALSE;
    int newValue;
 
-   MYLOG(0, "entering for %p: %d %p\n", ConnectionHandle, Attribute, Value);
+   MYLOG(0, "entering for %p: " FORMAT_INTEGER " %p\n", ConnectionHandle, Attribute, Value);
    switch (Attribute)
    {
        case SQL_ATTR_METADATA_ID:
@@ -1812,7 +1812,7 @@ PGAPI_GetDescField(SQLHDESC DescriptorHandle,
    RETCODE     ret = SQL_SUCCESS;
    DescriptorClass *desc = (DescriptorClass *) DescriptorHandle;
 
-   MYLOG(0, "entering h=%p rec=%d field=%d blen=%d\n", DescriptorHandle, RecNumber, FieldIdentifier, BufferLength);
+   MYLOG(0, "entering h=%p rec=" FORMAT_SMALLI " field=" FORMAT_SMALLI " blen=" FORMAT_INTEGER "\n", DescriptorHandle, RecNumber, FieldIdentifier, BufferLength);
    switch (DC_get_desc_type(desc))
    {
        case SQL_ATTR_APP_ROW_DESC:
@@ -1862,7 +1862,7 @@ PGAPI_SetDescField(SQLHDESC DescriptorHandle,
    RETCODE     ret = SQL_SUCCESS;
    DescriptorClass *desc = (DescriptorClass *) DescriptorHandle;
 
-   MYLOG(0, "entering h=%p(%d) rec=%d field=%d val=%p,%d\n", DescriptorHandle, DC_get_desc_type(desc), RecNumber, FieldIdentifier, Value, BufferLength);
+   MYLOG(0, "entering h=%p(%d) rec=" FORMAT_SMALLI " field=" FORMAT_SMALLI " val=%p," FORMAT_INTEGER "\n", DescriptorHandle, DC_get_desc_type(desc), RecNumber, FieldIdentifier, Value, BufferLength);
    switch (DC_get_desc_type(desc))
    {
        case SQL_ATTR_APP_ROW_DESC:
@@ -1913,7 +1913,7 @@ PGAPI_SetStmtAttr(HSTMT StatementHandle,
    CSTR func = "PGAPI_SetStmtAttr";
    StatementClass *stmt = (StatementClass *) StatementHandle;
 
-   MYLOG(0, "entering Handle=%p %d," FORMAT_ULEN "(%p)\n", StatementHandle, Attribute, (SQLULEN) Value, Value);
+   MYLOG(0, "entering Handle=%p " FORMAT_INTEGER "," FORMAT_ULEN "(%p)\n", StatementHandle, Attribute, (SQLULEN) Value, Value);
    switch (Attribute)
    {
        case SQL_ATTR_ENABLE_AUTO_IPD:  /* 15 */
index f66eacbe8fd19cbef649149c7c28980d8ff17947..e08bf44a3eb0b3d4a13366d1ba7f2d5c769648e4 100644 (file)
@@ -154,6 +154,8 @@ typedef UInt4   OID;
 #define SQL_FALSE FALSE
 #endif /* SQL_FALSE */
 
+#define    FORMAT_SMALLI   "%d"    /* SQLSMALLINT */
+#define    FORMAT_USMALLI  "%u"    /* SQLUSMALLINT */
 #ifdef WIN32
 #ifndef    SSIZE_T_DEFINED
 #define    ssize_t SSIZE_T
index 466a482086448ece8c50abee7599c345dd248ace..c89a3eab70e92192b764409cdfcb583b5bd0b144 100644 (file)
--- a/qresult.c
+++ b/qresult.c
@@ -814,7 +814,7 @@ MYLOG(DETAIL_LOG_LEVEL, "entering %p->num_fields=%d\n", self, self->num_fields);
        {
            SQLLEN  tuple_size = self->count_backend_allocated;
 
-           MYLOG(0, "REALLOC: old_count = " FORMAT_LEN ", size = " FORMAT_SIZE_T "\n", tuple_size, self->num_fields * sizeof(TupleField) * tuple_size);
+           MYLOG(0, "REALLOC: old_count = " FORMAT_LEN ", size = " FORMAT_SIZE_T "\n", tuple_size, (size_t) (self->num_fields * sizeof(TupleField) * tuple_size));
            if (tuple_size < 1)
                tuple_size = TUPLE_MALLOC_INC;
            else
index 8aa88f1d47f2c8fa57d62f4d7c60b7a4c7c76240..eec6a484d42aa0f960f9c61dbb488ed8d84f1e21 100644 (file)
--- a/results.c
+++ b/results.c
@@ -3751,7 +3751,7 @@ SC_pos_newload(StatementClass *stmt, const UInt4 *oidint, BOOL tidRef,
                        appendData = TRUE;
                    else
                    {
-MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " <> backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
+MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " <> backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=" FORMAT_UINTEGER "\n",
 num_total_rows, num_cached_rows,
 QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt), stmt->options.cursor_type);
                    }
@@ -3778,7 +3778,7 @@ QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt), stmt->options.cursor_t
            }
            if (appendData)
            {
-MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " == backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
+MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " == backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=" FORMAT_UINTEGER "\n",
 num_total_rows, num_cached_rows,
 QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt), stmt->options.cursor_type);
                if (num_cached_rows >= res->count_backend_allocated)
index 0a9623d2f230cd1f715e3c64edf574b689eb340e..1f52338a01370d8f5ed2a6a7dae9111e6b70e9d4 100644 (file)
@@ -1966,7 +1966,7 @@ SC_execute(StatementClass *self)
        QueryInfo   *qryi = NULL;
 
        qflag |= (SQL_CONCUR_READ_ONLY != self->options.scroll_concurrency ? CREATE_KEYSET : 0);
-       MYLOG(0, "       Sending SELECT statement on stmt=%p, cursor_name='%s' qflag=%d,%d\n", self, SC_cursor_name(self), qflag, self->options.scroll_concurrency);
+       MYLOG(0, "       Sending SELECT statement on stmt=%p, cursor_name='%s' qflag=%d," FORMAT_UINTEGER "\n", self, SC_cursor_name(self), qflag, self->options.scroll_concurrency);
 
        /* send the declare/select */
        if (useCursor)
@@ -2363,7 +2363,7 @@ SC_log_error(const char *func, const char *desc, const StatementClass *self)
            QLOG(level, "                 stmt_with_params='%s'\n", NULLCHECK(self->stmt_with_params));
            QLOG(level, "                 data_at_exec=%d, current_exec_param=%d, put_data=%d\n", self->data_at_exec, self->current_exec_param, self->put_data);
            QLOG(level, "                 currTuple=" FORMAT_LEN ", current_col=%d, lobj_fd=%d\n", self->currTuple, self->current_col, self->lobj_fd);
-           QLOG(level, "                 maxRows=" FORMAT_LEN ", rowset_size=" FORMAT_LEN ", keyset_size=" FORMAT_LEN ", cursor_type=%u, scroll_concurrency=%d\n", self->options.maxRows, rowsetSize, self->options.keyset_size, self->options.cursor_type, self->options.scroll_concurrency);
+           QLOG(level, "                 maxRows=" FORMAT_LEN ", rowset_size=" FORMAT_LEN ", keyset_size=" FORMAT_LEN ", cursor_type=" FORMAT_UINTEGER ", scroll_concurrency=" FORMAT_UINTEGER "\n", self->options.maxRows, rowsetSize, self->options.keyset_size, self->options.cursor_type, self->options.scroll_concurrency);
            QLOG(level, "                 cursor_name='%s'\n", SC_cursor_name(self));
 
            QLOG(level, "                 ----------------QResult Info -------------------------------\n");
index b31d9ea887f5948b4f78b32616288623d02e6634..4f0abf482fcb0575823dbcdb44de19f0f5e840c3 100644 (file)
@@ -537,7 +537,7 @@ test_conversion(const char *pgtype, const char *pgvalue, int sqltype, const char
        printf("\n");
        /* Check that the driver didn't write past the buffer */
        if ((unsigned char) resultbuf[buflen] != 0xFF)
-           printf("Driver wrote byte %02X past result buffer of size %d!\n", (unsigned char) resultbuf[buflen], buflen);
+           printf("For %s Driver wrote byte %02X past result buffer of size %d!\n", sql, (unsigned char) resultbuf[buflen], buflen);
    }
    else
    {
index 42e7fe13cef0ff652f436dc0844b52981f9dfeb7..b2e65bb6c406fa7b8965b667a055b9c5e8b64136 100644 (file)
@@ -895,7 +895,7 @@ SQLLEN  mbstoc16_lf(char16_t *c16dt, const char *c8dt, size_t n, BOOL lf_conv)
    const char  *cdt;
    mbstate_t   mbst = initial_state;
 
-MYLOG(0, " c16dt=%p size=%lu\n", c16dt, n);
+MYLOG(0, " c16dt=%p size=" FORMAT_SIZE_T "\n", c16dt, n);
    for (i = 0, cdt = c8dt; i < n || (!c16dt); i++)
    {
        if (lf_conv && PG_LINEFEED == *cdt && i > 0 && PG_CARRIAGE_RETURN != cdt[-1])
@@ -929,7 +929,7 @@ SQLLEN  c16tombs(char *c8dt, const char16_t *c16dt, size_t n)
    char    *cdt, c4byte[4];
    mbstate_t   mbst = initial_state;
 
-MYLOG(0, " c8dt=%p size=%lu\n", c8dt, n);
+MYLOG(0, " c8dt=%p size=" FORMAT_SIZE_T "u\n", c8dt, n);
    if (!c8dt)
        n = 0;
    for (i = 0, cdt = c8dt; c16dt[i] && (result < n || (!cdt)); i++)