From 1893283990d3c128c67da900fde4b8c71b1939a7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 7 Jun 2016 11:47:47 +0000 Subject: -fix misc issues --- src/my/my_query_helper.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src/my/my_query_helper.c') diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c index 07eb2481d..99bb4a5e4 100644 --- a/src/my/my_query_helper.c +++ b/src/my/my_query_helper.c @@ -89,7 +89,7 @@ GNUNET_MY_query_param_string (const char *ptr) *@param cls closure *@param pq data about the query * @param qbind array of parameters to initialize - *@return -1 on error + *@return -1 on error */ static int my_conv_uint16 (void *cls, @@ -124,7 +124,7 @@ my_conv_uint16 (void *cls, struct GNUNET_MY_QueryParam GNUNET_MY_query_param_uint16 (const uint16_t *x) { - struct GNUNET_MY_QueryParam res = { + struct GNUNET_MY_QueryParam res = { .conv = &my_conv_uint16, .conv_cls = NULL, .num_params = 1, @@ -141,9 +141,9 @@ GNUNET_MY_query_param_uint16 (const uint16_t *x) *@param cls closure *@param pq data about the query * @param qbind array of parameters to initialize - *@return -1 on error + *@return -1 on error */ -static int +static int my_conv_uint32 (void *cls, const struct GNUNET_MY_QueryParam *qp, MYSQL_BIND *qbind) @@ -176,10 +176,10 @@ GNUNET_MY_query_param_uint32 (const uint32_t *x) .conv = &my_conv_uint32, .conv_cls = NULL, .num_params = 1, - .data = x, + .data = x, .data_len = sizeof (*x) }; - + return res; } @@ -189,7 +189,7 @@ GNUNET_MY_query_param_uint32 (const uint32_t *x) *@param cls closure *@param pq data about the query * @param qbind array of parameters to initialize - *@return -1 on error + *@return -1 on error */ static int my_conv_uint64 (void *cls, @@ -209,7 +209,7 @@ my_conv_uint64 (void *cls, qbind->buffer_length = sizeof (uint64_t); qbind->buffer_type = MYSQL_TYPE_LONGLONG; - return 1; + return 1; } /** @@ -237,7 +237,7 @@ GNUNET_MY_query_param_uint64 (const uint64_t *x) *@param cls closure *@param pq data about the query * @param qbind array of parameters to initialize - *@return -1 on error + *@return -1 on error */ static int my_conv_rsa_public_key (void *cls, @@ -249,16 +249,17 @@ my_conv_rsa_public_key (void *cls, size_t buf_size; GNUNET_assert(1 == qp->num_params); - + // FIXME: this leaks memory right now... buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa, &buf); - qbind->buffer = (void *)buf; - qbind->buffer_length = buf_size-1; + qbind->buffer = (void *) buf; + qbind->buffer_length = buf_size; qbind->buffer_type = MYSQL_TYPE_BLOB; return 1; } + /** * Generate query parameter for an RSA public key. The * database must contain a BLOB type in the respective position. @@ -280,18 +281,19 @@ GNUNET_MY_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x return res; } + /** * Function called to convert input argument into SQL parameters * *@param cls closure *@param pq data about the query * @param qbind array of parameters to initialize - *@return -1 on error + *@return -1 on error */ -static int +static int my_conv_rsa_signature (void *cls, - const struct GNUNET_MY_QueryParam *qp, - MYSQL_BIND * qbind) + const struct GNUNET_MY_QueryParam *qp, + MYSQL_BIND *qbind) { const struct GNUNET_CRYPTO_RsaSignature *sig = qp->data; char *buf; @@ -299,16 +301,16 @@ my_conv_rsa_signature (void *cls, GNUNET_assert(1 == qp->num_params); - buf_size = GNUNET_CRYPTO_rsa_signature_encode(sig, - &buf); - - qbind->buffer = (void *)buf; - qbind->buffer_length = buf_size-1; + buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig, + &buf); + qbind->buffer = (void *) buf; + qbind->buffer_length = buf_size; qbind->buffer_type = MYSQL_TYPE_BLOB; return 1; } + /** * Generate query parameter for an RSA signature. The * database must contain a BLOB type in the respective position @@ -354,4 +356,4 @@ GNUNET_MY_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x return GNUNET_MY_query_param_auto_from_type (&x->abs_value_us__); } -/* end of my_query_helper.c */ \ No newline at end of file +/* end of my_query_helper.c */ -- cgit v1.2.3