Suppress some complier warnings.
authorHiroshi Inoue <inoue@tpf.co.jp>
Tue, 7 Oct 2008 21:45:40 +0000 (21:45 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Tue, 7 Oct 2008 21:45:40 +0000 (21:45 +0000)
environ.c
info.c
odbcapi.c
version.h

index ccb6687af2f0fd262227a440111be02e40c5eda9..b764bb5295593d76e6ac8691ddc8eacec30ac95a 100644 (file)
--- a/environ.c
+++ b/environ.c
@@ -506,7 +506,6 @@ PGAPI_Error(
 EnvironmentClass *
 EN_Constructor(void)
 {
-   CSTR    func = "EN_Constructor";
    EnvironmentClass *rv = NULL;
 #ifdef WIN32
    WORD        wVersionRequested;
@@ -518,31 +517,33 @@ EN_Constructor(void)
 
    if (WSAStartup(wVersionRequested, &wsaData))
    {
-       mylog("%s: WSAStartup error\n", func);
+       mylog("%s: WSAStartup error\n", __FUNCTION__);
        return rv;
    }
    /* Verify that this is the minimum version of WinSock */
    if (LOBYTE(wsaData.wVersion) != major ||
        HIBYTE(wsaData.wVersion) != minor)
    {
-       mylog("%s: WSAStartup version=(%d,%d)\n", func,
+       mylog("%s: WSAStartup version=(%d,%d)\n", __FUNCTION__,
            LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion));
+       goto cleanup;
    }
 #endif /* WIN32 */
 
    rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
-cleanup:
-   if (rv)
+   if (NULL == rv)
    {
-       rv->errormsg = 0;
-       rv->errornumber = 0;
-       rv->flag = 0;
-       INIT_ENV_CS(rv);
+       mylog("%s: malloc error\n", __FUNCTION__);
+       goto cleanup;
    }
+   rv->errormsg = 0;
+   rv->errornumber = 0;
+   rv->flag = 0;
+   INIT_ENV_CS(rv);
+cleanup:
 #ifdef WIN32
-   else
+   if (NULL == rv)
    {
-       mylog("%s: malloc error\n", func);
        WSACleanup();
    }
 #endif /* WIN32 */
diff --git a/info.c b/info.c
index be739513bd59b52446dd51fb7468fb74a5ea6dc9..734444e84ebb45d6ad9d83ef6e568b1b708cb2d5 100644 (file)
--- a/info.c
+++ b/info.c
@@ -70,7 +70,7 @@ PGAPI_GetInfo(
    char        tmp[MAX_INFO_STRING];
    SQLULEN         len = 0,
                value = 0;
-   RETCODE     result;
+   RETCODE     result = SQL_ERROR;
    char        odbcver[16];
    int     i_odbcver;
 
@@ -770,7 +770,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
        default:
            /* unrecognized key */
            CC_set_error(conn, CONN_NOT_IMPLEMENTED_ERROR, "Unrecognized key passed to PGAPI_GetInfo.", NULL);
-           return SQL_ERROR;
+           goto cleanup;
    }
 
    result = SQL_SUCCESS;
@@ -838,7 +838,7 @@ PGAPI_GetTypeInfo(
    CSTR func = "PGAPI_GetTypeInfo";
    StatementClass *stmt = (StatementClass *) hstmt;
    ConnectionClass *conn;
-   QResultClass    *res;
+   QResultClass    *res = NULL;
    TupleField  *tuple;
    int         i, result_cols;
 
@@ -919,7 +919,12 @@ mylog("aunq_match=%d pgtcount=%d\n", aunq_match, pgtcount);
            }
            for (cnt = 0; cnt < pgtcount; cnt ++)
            {
-               tuple = QR_AddNew(res);
+               if (tuple = QR_AddNew(res), NULL == tuple)
+               {
+                   result = SQL_ERROR;
+                   SC_set_error(stmt, STMT_NO_MEMORY_ERROR, "Couldn't QR_AddNew.", func);
+                   goto cleanup;
+               }
 
                /* These values can't be NULL */
                if (aunq_match == cnt)
@@ -977,7 +982,10 @@ cleanup:
     */
    stmt->status = STMT_FINISHED;
    stmt->currTuple = -1;
-   SC_set_rowset_start(stmt, -1, FALSE);
+   if (SQL_SUCCEEDED(result))
+       SC_set_rowset_start(stmt, -1, FALSE);
+   else
+       SC_set_Result(stmt, NULL);
    SC_set_current_col(stmt, -1);
 
    if (stmt->internal)
@@ -3415,7 +3423,7 @@ PGAPI_ColumnPrivileges(
    size_t      cq_len,cq_size;
    char        *col_query;
    BOOL    search_pattern;
-   QResultClass    *res;
+   QResultClass    *res = NULL;
 
    mylog("%s: entering...\n", func);
 
@@ -3472,8 +3480,7 @@ PGAPI_ColumnPrivileges(
    if (res = CC_send_query(conn, column_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(res))
    {
        SC_set_error(stmt, STMT_EXEC_ERROR, "PGAPI_ColumnPrivileges query error", func);
-       QR_Destructor(res);
-       return SQL_ERROR;
+       goto cleanup;
    }
    SC_set_Result(stmt, res);
 
@@ -3485,6 +3492,8 @@ PGAPI_ColumnPrivileges(
    /* set up the current tuple pointer for SQLFetch */
    result = SQL_SUCCESS;
 cleanup:
+   if (!SQL_SUCCEEDED(result))
+       QR_Destructor(res);
    /* set up the current tuple pointer for SQLFetch */
    stmt->status = STMT_FINISHED;
    stmt->currTuple = -1;
index 82cdd04a884d61a93beccaeef60c85acbbcf098d..8f8cadf9f90da71c7e351d9faec5d02d12896265 100644 (file)
--- a/odbcapi.c
+++ b/odbcapi.c
@@ -534,7 +534,7 @@ SQLGetInfo(HDBC ConnectionHandle,
    ENTER_CONN_CS(conn);
    CC_clear_error(conn);
 #if (ODBCVER >= 0x0300)
-   mylog("[SQLGetInfo(30)]");
+   mylog("[%s(30)]", func);
    if ((ret = PGAPI_GetInfo(ConnectionHandle, InfoType, InfoValue,
                BufferLength, StringLength)) == SQL_ERROR)
    {
index cc01ed94b121c419188b24495e63b32d050c8587..a10d7faf4971926602fe522d33f7e26f6d3bdf08 100644 (file)
--- a/version.h
+++ b/version.h
@@ -12,6 +12,6 @@
 #define POSTGRESDRIVERVERSION      "08.03.0201"
 #define POSTGRES_RESOURCE_VERSION  "08.03.0201\0"
 #define PG_DRVFILE_VERSION     8,3,02,01
-#define PG_BUILD_VERSION       "200810070001"
+#define PG_BUILD_VERSION       "200810080001"
 
 #endif