You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2008/06/13 10:31:59 UTC
svn commit: r667418 - in /apr/apr-util/trunk/dbd: apr_dbd_oracle.c
apr_dbd_pgsql.c apr_dbd_sqlite3.c
Author: wrowe
Date: Fri Jun 13 01:31:58 2008
New Revision: 667418
URL: http://svn.apache.org/viewvc?rev=667418&view=rev
Log:
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/trunk/dbd/apr_dbd_oracle.c
apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Modified: apr/apr-util/trunk/dbd/apr_dbd_oracle.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_oracle.c?rev=667418&r1=667417&r2=667418&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_oracle.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_oracle.c Fri Jun 13 01:31:58 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/trunk/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=667418&r1=667417&r2=667418&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Fri Jun 13 01:31:58 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/trunk/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=667418&r1=667417&r2=667418&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Fri Jun 13 01:31:58 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);
Re: svn commit: r667418 - in /apr/apr-util/trunk/dbd:
apr_dbd_oracle.c apr_dbd_pgsql.c apr_dbd_sqlite3.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2008-06-13 at 03:33 -0500, William A. Rowe, Jr. wrote:
> If someone on unix with all three providers can confirm this is clean,
> I'm happy to backport.
Done in r667456.
--
Bojan
Re: svn commit: r667418 - in /apr/apr-util/trunk/dbd:
apr_dbd_oracle.c apr_dbd_pgsql.c apr_dbd_sqlite3.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2008-06-13 at 03:33 -0500, William A. Rowe, Jr. wrote:
> If someone on unix with all three providers can confirm this is clean,
> I'm happy to backport.
It's clean.
--
Bojan
Re: svn commit: r667418 - in /apr/apr-util/trunk/dbd: apr_dbd_oracle.c
apr_dbd_pgsql.c apr_dbd_sqlite3.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
If someone on unix with all three providers can confirm this is clean,
I'm happy to backport.
Bill
wrowe@apache.org wrote:
> Author: wrowe
> Date: Fri Jun 13 01:31:58 2008
> New Revision: 667418
>
> URL: http://svn.apache.org/viewvc?rev=667418&view=rev
> Log:
> 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/trunk/dbd/apr_dbd_oracle.c
> apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
> apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
>
> Modified: apr/apr-util/trunk/dbd/apr_dbd_oracle.c
> URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_oracle.c?rev=667418&r1=667417&r2=667418&view=diff
> ==============================================================================
> --- apr/apr-util/trunk/dbd/apr_dbd_oracle.c (original)
> +++ apr/apr-util/trunk/dbd/apr_dbd_oracle.c Fri Jun 13 01:31:58 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/trunk/dbd/apr_dbd_pgsql.c
> URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=667418&r1=667417&r2=667418&view=diff
> ==============================================================================
> --- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
> +++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Fri Jun 13 01:31:58 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/trunk/dbd/apr_dbd_sqlite3.c
> URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=667418&r1=667417&r2=667418&view=diff
> ==============================================================================
> --- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
> +++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Fri Jun 13 01:31:58 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);
>
>
>
>