[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: pq: aligment fixes and oid adjustments
From: |
gnunet |
Subject: |
[gnunet] branch master updated: pq: aligment fixes and oid adjustments |
Date: |
Sun, 30 Jul 2023 19:15:30 +0200 |
This is an automated email from the git hooks/post-receive script.
oec pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new fe61fe517 pq: aligment fixes and oid adjustments
fe61fe517 is described below
commit fe61fe517f8e3359869f5ae37b0a921400aaaf05
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Sun Jul 30 19:12:59 2023 +0200
pq: aligment fixes and oid adjustments
- aligment issues fixed in pq_result_helper.c
- typname for string is "text" not "varchar"
- compiler didn't like the function signature annotation `char
*elements[static num]`
NEWS: function-signature adjustment due to compiler error
---
src/include/gnunet_pq_lib.h | 4 ++--
src/pq/pq_query_helper.c | 16 ++++++++++++----
src/pq/pq_result_helper.c | 2 +-
src/pq/test_pq.c | 8 ++++----
4 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 65ba18b9b..7914a5c71 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -382,8 +382,8 @@ GNUNET_PQ_query_param_array_string (
struct GNUNET_PQ_QueryParam
GNUNET_PQ_query_param_array_ptrs_string (
unsigned int num,
- const char *elements[static num],
- const struct GNUNET_PQ_Context *db);
+ const char *elements[],
+ struct GNUNET_PQ_Context *db);
/**
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 2ffadbd75..cc24598e5 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -768,8 +768,11 @@ qconv_array (
for (unsigned int i = 0; i < num; i++)
{
size_t sz = same_sized ? meta->same_size : sizes[i];
+ size_t hsz = htonl (sz);
- *(uint32_t *) out = htonl (sz);
+ GNUNET_memcpy (out,
+ &hsz,
+ sizeof(hsz));
out += sizeof(uint32_t);
switch (meta->typ)
@@ -790,8 +793,13 @@ qconv_array (
}
case array_of_uint32:
{
+ uint32_t v;
GNUNET_assert (sizeof(uint32_t) == sz);
- *(uint32_t *) out = htonl (*(uint32_t *) in);
+
+ v = htonl (*(uint32_t *) in);
+ GNUNET_memcpy (out,
+ &v,
+ sizeof(v));
in += sz;
break;
}
@@ -1166,8 +1174,8 @@ GNUNET_PQ_query_param_array_string (
struct GNUNET_PQ_QueryParam
GNUNET_PQ_query_param_array_ptrs_string (
unsigned int num,
- const char *elements[static num],
- const struct GNUNET_PQ_Context *db)
+ const char *elements[],
+ struct GNUNET_PQ_Context *db)
{
Oid oid;
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 4fca0e6cb..f230826cb 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -1697,7 +1697,7 @@ GNUNET_PQ_result_spec_array_string (
info->typ = array_of_string;
GNUNET_assert (GNUNET_OK ==
GNUNET_PQ_get_oid_by_name (db,
- "varchar",
+ "text",
&info->oid));
struct GNUNET_PQ_ResultSpec res = {
diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c
index a20ff9ddd..d70e18e6d 100644
--- a/src/pq/test_pq.c
+++ b/src/pq/test_pq.c
@@ -76,7 +76,7 @@ postgres_prepare (struct GNUNET_PQ_Context *db)
",arr_int4"
",arr_int8"
",arr_bytea"
- ",arr_varchar"
+ ",arr_text"
",arr_abs_time"
",arr_rel_time"
",arr_timestamp"
@@ -102,7 +102,7 @@ postgres_prepare (struct GNUNET_PQ_Context *db)
",arr_int4"
",arr_int8"
",arr_bytea"
- ",arr_varchar"
+ ",arr_text"
",arr_abs_time"
",arr_rel_time"
",arr_timestamp"
@@ -280,7 +280,7 @@ run_queries (struct GNUNET_PQ_Context *db)
&sz_buf,
&arr_buf),
GNUNET_PQ_result_spec_array_string (db,
- "arr_varchar",
+ "arr_text",
&num_str,
&arr_str),
GNUNET_PQ_result_spec_end
@@ -510,7 +510,7 @@ main (int argc,
",arr_int4 INT4[]"
",arr_int8 INT8[]"
",arr_bytea BYTEA[]"
- ",arr_varchar VARCHAR[]"
+ ",arr_text TEXT[]"
",arr_abs_time INT8[]"
",arr_rel_time INT8[]"
",arr_timestamp INT8[]"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: pq: aligment fixes and oid adjustments,
gnunet <=