aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-07-30 19:17:29 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2023-07-30 19:17:29 +0200
commit61b8b8e67633a4c87f7c4662002eefa774d31845 (patch)
tree2d8b640542225b3a7aa2d19745d4efc0d03e1796
parentdd857b8d9654a0c3fd5a6c97929646bcd7ddf66d (diff)
parentfe61fe517f8e3359869f5ae37b0a921400aaaf05 (diff)
downloadgnunet-61b8b8e67633a4c87f7c4662002eefa774d31845.tar.gz
gnunet-61b8b8e67633a4c87f7c4662002eefa774d31845.zip
Merge branch 'master' of git+ssh://git.gnunet.org/gnunet
NEWS: -
-rw-r--r--src/include/gnunet_pq_lib.h4
-rw-r--r--src/pq/pq_query_helper.c16
-rw-r--r--src/pq/pq_result_helper.c2
-rw-r--r--src/pq/test_pq.c8
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 (
382struct GNUNET_PQ_QueryParam 382struct GNUNET_PQ_QueryParam
383GNUNET_PQ_query_param_array_ptrs_string ( 383GNUNET_PQ_query_param_array_ptrs_string (
384 unsigned int num, 384 unsigned int num,
385 const char *elements[static num], 385 const char *elements[],
386 const struct GNUNET_PQ_Context *db); 386 struct GNUNET_PQ_Context *db);
387 387
388 388
389/** 389/**
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 (
768 for (unsigned int i = 0; i < num; i++) 768 for (unsigned int i = 0; i < num; i++)
769 { 769 {
770 size_t sz = same_sized ? meta->same_size : sizes[i]; 770 size_t sz = same_sized ? meta->same_size : sizes[i];
771 size_t hsz = htonl (sz);
771 772
772 *(uint32_t *) out = htonl (sz); 773 GNUNET_memcpy (out,
774 &hsz,
775 sizeof(hsz));
773 out += sizeof(uint32_t); 776 out += sizeof(uint32_t);
774 777
775 switch (meta->typ) 778 switch (meta->typ)
@@ -790,8 +793,13 @@ qconv_array (
790 } 793 }
791 case array_of_uint32: 794 case array_of_uint32:
792 { 795 {
796 uint32_t v;
793 GNUNET_assert (sizeof(uint32_t) == sz); 797 GNUNET_assert (sizeof(uint32_t) == sz);
794 *(uint32_t *) out = htonl (*(uint32_t *) in); 798
799 v = htonl (*(uint32_t *) in);
800 GNUNET_memcpy (out,
801 &v,
802 sizeof(v));
795 in += sz; 803 in += sz;
796 break; 804 break;
797 } 805 }
@@ -1166,8 +1174,8 @@ GNUNET_PQ_query_param_array_string (
1166struct GNUNET_PQ_QueryParam 1174struct GNUNET_PQ_QueryParam
1167GNUNET_PQ_query_param_array_ptrs_string ( 1175GNUNET_PQ_query_param_array_ptrs_string (
1168 unsigned int num, 1176 unsigned int num,
1169 const char *elements[static num], 1177 const char *elements[],
1170 const struct GNUNET_PQ_Context *db) 1178 struct GNUNET_PQ_Context *db)
1171{ 1179{
1172 Oid oid; 1180 Oid oid;
1173 1181
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 (
1697 info->typ = array_of_string; 1697 info->typ = array_of_string;
1698 GNUNET_assert (GNUNET_OK == 1698 GNUNET_assert (GNUNET_OK ==
1699 GNUNET_PQ_get_oid_by_name (db, 1699 GNUNET_PQ_get_oid_by_name (db,
1700 "varchar", 1700 "text",
1701 &info->oid)); 1701 &info->oid));
1702 1702
1703 struct GNUNET_PQ_ResultSpec res = { 1703 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)
76 ",arr_int4" 76 ",arr_int4"
77 ",arr_int8" 77 ",arr_int8"
78 ",arr_bytea" 78 ",arr_bytea"
79 ",arr_varchar" 79 ",arr_text"
80 ",arr_abs_time" 80 ",arr_abs_time"
81 ",arr_rel_time" 81 ",arr_rel_time"
82 ",arr_timestamp" 82 ",arr_timestamp"
@@ -102,7 +102,7 @@ postgres_prepare (struct GNUNET_PQ_Context *db)
102 ",arr_int4" 102 ",arr_int4"
103 ",arr_int8" 103 ",arr_int8"
104 ",arr_bytea" 104 ",arr_bytea"
105 ",arr_varchar" 105 ",arr_text"
106 ",arr_abs_time" 106 ",arr_abs_time"
107 ",arr_rel_time" 107 ",arr_rel_time"
108 ",arr_timestamp" 108 ",arr_timestamp"
@@ -280,7 +280,7 @@ run_queries (struct GNUNET_PQ_Context *db)
280 &sz_buf, 280 &sz_buf,
281 &arr_buf), 281 &arr_buf),
282 GNUNET_PQ_result_spec_array_string (db, 282 GNUNET_PQ_result_spec_array_string (db,
283 "arr_varchar", 283 "arr_text",
284 &num_str, 284 &num_str,
285 &arr_str), 285 &arr_str),
286 GNUNET_PQ_result_spec_end 286 GNUNET_PQ_result_spec_end
@@ -510,7 +510,7 @@ main (int argc,
510 ",arr_int4 INT4[]" 510 ",arr_int4 INT4[]"
511 ",arr_int8 INT8[]" 511 ",arr_int8 INT8[]"
512 ",arr_bytea BYTEA[]" 512 ",arr_bytea BYTEA[]"
513 ",arr_varchar VARCHAR[]" 513 ",arr_text TEXT[]"
514 ",arr_abs_time INT8[]" 514 ",arr_abs_time INT8[]"
515 ",arr_rel_time INT8[]" 515 ",arr_rel_time INT8[]"
516 ",arr_timestamp INT8[]" 516 ",arr_timestamp INT8[]"