summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSree Harsha Totakura <sreeharsha@totakura.in>2015-03-05 16:08:55 +0100
committerSree Harsha Totakura <sreeharsha@totakura.in>2015-03-06 10:31:22 +0100
commitc9d48a4a6cda427b68032b9e2064bb28a92e0f7f (patch)
tree9ec4611c0c5c4c50c94bb2ab148bb57241aae0be
parent0acd5714e0ea48888e60d4caeeb37188a94e52b1 (diff)
downloadexchange-c9d48a4a6cda427b68032b9e2064bb28a92e0f7f.tar.gz
exchange-c9d48a4a6cda427b68032b9e2064bb28a92e0f7f.tar.bz2
exchange-c9d48a4a6cda427b68032b9e2064bb28a92e0f7f.zip
Fix ResultSpec processing
-rw-r--r--src/pq/db_pq.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
index f63fe765e..bfa929c4e 100644
--- a/src/pq/db_pq.c
+++ b/src/pq/db_pq.c
@@ -94,7 +94,7 @@ TALER_DB_extract_result (PGresult *result,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"field '%s' does not exist in result\n",
- rs->fname);
+ rs[i].fname);
return GNUNET_SYSERR;
}
@@ -111,26 +111,28 @@ TALER_DB_extract_result (PGresult *result,
(rs[i].dst_size != len) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "field '%s' has wrong size (got %d, expected %d)\n",
+ "field '%s' has wrong size (got %u, expected %u)\n",
rs[i].fname,
- (int) len,
- (int) rs->dst_size);
- for (j=0;j<i;j++)
- if (0 == rs[i].dst_size)
+ (unsigned int) len,
+ (unsigned int) rs[i].dst_size);
+ for (j=0; j<i; j++)
+ if (0 == rs[j].dst_size)
{
- GNUNET_free (rs[i].dst);
- rs[i].dst = NULL;
- *rs[i].result_size = 0;
+ GNUNET_free (rs[j].dst);
+ rs[j].dst = NULL;
+ *rs[j].result_size = 0;
}
return GNUNET_SYSERR;
}
res = PQgetvalue (result, row, fnum);
GNUNET_assert (NULL != res);
- if (0 == rs->dst_size)
- *(void**) rs->dst = GNUNET_malloc (*rs->result_size = len);
- memcpy (rs->dst,
- res,
- len);
+ if (0 == rs[i].dst_size)
+ {
+ *rs[i].result_size = len;
+ *((void **) rs[i].dst) = GNUNET_malloc (len);
+ rs[i].dst = *((void **) rs[i].dst);
+ }
+ memcpy (rs[i].dst, res, len);
}
if (GNUNET_YES == had_null)
return GNUNET_NO;