Fix ResultSpec processing
This commit is contained in:
parent
0acd5714e0
commit
c9d48a4a6c
@ -94,7 +94,7 @@ TALER_DB_extract_result (PGresult *result,
|
|||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"field '%s' does not exist in result\n",
|
"field '%s' does not exist in result\n",
|
||||||
rs->fname);
|
rs[i].fname);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,26 +111,28 @@ TALER_DB_extract_result (PGresult *result,
|
|||||||
(rs[i].dst_size != len) )
|
(rs[i].dst_size != len) )
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
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,
|
rs[i].fname,
|
||||||
(int) len,
|
(unsigned int) len,
|
||||||
(int) rs->dst_size);
|
(unsigned int) rs[i].dst_size);
|
||||||
for (j=0;j<i;j++)
|
for (j=0; j<i; j++)
|
||||||
if (0 == rs[i].dst_size)
|
if (0 == rs[j].dst_size)
|
||||||
{
|
{
|
||||||
GNUNET_free (rs[i].dst);
|
GNUNET_free (rs[j].dst);
|
||||||
rs[i].dst = NULL;
|
rs[j].dst = NULL;
|
||||||
*rs[i].result_size = 0;
|
*rs[j].result_size = 0;
|
||||||
}
|
}
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
res = PQgetvalue (result, row, fnum);
|
res = PQgetvalue (result, row, fnum);
|
||||||
GNUNET_assert (NULL != res);
|
GNUNET_assert (NULL != res);
|
||||||
if (0 == rs->dst_size)
|
if (0 == rs[i].dst_size)
|
||||||
*(void**) rs->dst = GNUNET_malloc (*rs->result_size = len);
|
{
|
||||||
memcpy (rs->dst,
|
*rs[i].result_size = len;
|
||||||
res,
|
*((void **) rs[i].dst) = GNUNET_malloc (len);
|
||||||
len);
|
rs[i].dst = *((void **) rs[i].dst);
|
||||||
|
}
|
||||||
|
memcpy (rs[i].dst, res, len);
|
||||||
}
|
}
|
||||||
if (GNUNET_YES == had_null)
|
if (GNUNET_YES == had_null)
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
|
Loading…
Reference in New Issue
Block a user