diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-07 11:47:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-07 11:47:47 +0000 |
commit | 1893283990d3c128c67da900fde4b8c71b1939a7 (patch) | |
tree | 288ff80a631e6c169340b4ba3508c387c146f220 /src/my/my_query_helper.c | |
parent | f1a8e79f1cff6a135297cf4eabb6db4733456ad5 (diff) |
-fix misc issues
Diffstat (limited to 'src/my/my_query_helper.c')
-rw-r--r-- | src/my/my_query_helper.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c index 07eb2481d5..99bb4a5e41 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 */ |