You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2008/06/13 12:10:44 UTC

svn commit: r667456 - in /apr/apr-util/branches/1.3.x/dbd: apr_dbd_oracle.c apr_dbd_pgsql.c apr_dbd_sqlite3.c

Author: bojan
Date: Fri Jun 13 03:10:43 2008
New Revision: 667456

URL: http://svn.apache.org/viewvc?rev=667456&view=rev
Log:
Backport r667418 from the trunk.
Signedness fixes, const'ness fix (OCIAttrGet is not
happy with a const arg) and note especially atof()
generally returns a double, which was seen as truncation.

Modified:
    apr/apr-util/branches/1.3.x/dbd/apr_dbd_oracle.c
    apr/apr-util/branches/1.3.x/dbd/apr_dbd_pgsql.c
    apr/apr-util/branches/1.3.x/dbd/apr_dbd_sqlite3.c

Modified: apr/apr-util/branches/1.3.x/dbd/apr_dbd_oracle.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/dbd/apr_dbd_oracle.c?rev=667456&r1=667455&r2=667456&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/dbd/apr_dbd_oracle.c (original)
+++ apr/apr-util/branches/1.3.x/dbd/apr_dbd_oracle.c Fri Jun 13 03:10:43 2008
@@ -262,7 +262,7 @@
     /* fetch from offset if not at the beginning */
     buf = apr_palloc(row->pool, APR_BUCKET_BUFF_SIZE);
     sql->status = OCILobRead(sql->svc, sql->err, val->buf.lobval,
-                             &length, 1 + boffset,
+                             &length, 1 + (size_t)boffset,
                              (dvoid*) buf, APR_BUCKET_BUFF_SIZE,
                              NULL, NULL, 0, SQLCS_IMPLICIT);
 /* Only with 10g, unfortunately
@@ -995,7 +995,7 @@
     int i;
     ub2 paramtype[DBD_ORACLE_MAX_COLUMNS];
     ub2 paramsize[DBD_ORACLE_MAX_COLUMNS];
-    const char *paramname[DBD_ORACLE_MAX_COLUMNS];
+    char *paramname[DBD_ORACLE_MAX_COLUMNS];
     ub4 paramnamelen[DBD_ORACLE_MAX_COLUMNS];
     int_errorcode;
 
@@ -2018,7 +2018,7 @@
         if (entry == NULL) {
             return APR_ENOENT;
         }
-        *(float*)data = atof(entry);
+        *(float*)data = (float)atof(entry);
         break;
     case APR_DBD_TYPE_DOUBLE:
         entry = dbd_oracle_get_entry(row, n);

Modified: apr/apr-util/branches/1.3.x/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/dbd/apr_dbd_pgsql.c?rev=667456&r1=667455&r2=667456&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/branches/1.3.x/dbd/apr_dbd_pgsql.c Fri Jun 13 03:10:43 2008
@@ -258,7 +258,7 @@
     }
 
     if (res->random) {
-        if (row->n >= res->ntuples) {
+        if ((row->n > 0) && (size_t)row->n >= res->ntuples) {
             *rowp = NULL;
             apr_pool_cleanup_run(pool, res->res, clear_result);
             res->res = NULL;
@@ -266,7 +266,7 @@
         }
     }
     else {
-        if (row->n >= res->ntuples) {
+        if ((row->n > 0) && (size_t)row->n >= res->ntuples) {
             /* no data; we have to fetch some */
             row->n -= res->ntuples;
             if (res->res != NULL) {
@@ -344,7 +344,7 @@
         *(apr_uint64_t*)data = apr_atoi64(PQgetvalue(row->res->res, row->n, n));
         break;
     case APR_DBD_TYPE_FLOAT:
-        *(float*)data = atof(PQgetvalue(row->res->res, row->n, n));
+        *(float*)data = (float)atof(PQgetvalue(row->res->res, row->n, n));
         break;
     case APR_DBD_TYPE_DOUBLE:
         *(double*)data = atof(PQgetvalue(row->res->res, row->n, n));
@@ -477,7 +477,7 @@
     char *sqlcmd;
     char *sqlptr;
     size_t length, qlen;
-    size_t i = 0;
+    int i = 0;
     const char **args;
     size_t alen;
     int ret;

Modified: apr/apr-util/branches/1.3.x/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/dbd/apr_dbd_sqlite3.c?rev=667456&r1=667455&r2=667456&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/branches/1.3.x/dbd/apr_dbd_sqlite3.c Fri Jun 13 03:10:43 2008
@@ -86,8 +86,8 @@
                                        apr_dbd_results_t **results,
                                        sqlite3_stmt *stmt, int seek)
 {
-    int i, ret, retry_count = 0, column_count;
-    size_t num_tuples = 0;
+    int ret, retry_count = 0, column_count;
+    size_t i, num_tuples = 0;
     int increment = 0;
     apr_dbd_row_t *row = NULL;
     apr_dbd_row_t *lastrow = NULL;
@@ -207,7 +207,7 @@
 
 static const char *dbd_sqlite3_get_name(const apr_dbd_results_t *res, int n)
 {
-    if ((n < 0) || (n >= res->sz)) {
+    if ((n < 0) || ((size_t)n >= res->sz)) {
         return NULL;
     }
 
@@ -256,7 +256,7 @@
 static apr_status_t dbd_sqlite3_datum_get(const apr_dbd_row_t *row, int n,
                                           apr_dbd_type_e type, void *data)
 {
-    if ((n < 0) || (n >= row->res->sz)) {
+    if ((n < 0) || ((size_t)n >= row->res->sz)) {
       return APR_EGENERAL;
     }
 
@@ -296,7 +296,7 @@
         *(apr_uint64_t*)data = apr_atoi64(row->columns[n]->value);
         break;
     case APR_DBD_TYPE_FLOAT:
-        *(float*)data = atof(row->columns[n]->value);
+        *(float*)data = (float)atof(row->columns[n]->value);
         break;
     case APR_DBD_TYPE_DOUBLE:
         *(double*)data = atof(row->columns[n]->value);