diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-13 11:40:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-13 11:40:29 +0000 |
commit | 0cf4193a34c4445b99b94c3c315d6a1361835cb6 (patch) | |
tree | 3bd216a81a7e0f33860c68a0905d90d363a37e4a /src/my/test_my.c | |
parent | e290fbfbeae0a3bccf2c2dc68f5d37bc1f3c4f81 (diff) | |
download | gnunet-0cf4193a34c4445b99b94c3c315d6a1361835cb6.tar.gz gnunet-0cf4193a34c4445b99b94c3c315d6a1361835cb6.zip |
fix indentation, bad stack allocation of buf
Diffstat (limited to 'src/my/test_my.c')
-rw-r--r-- | src/my/test_my.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/src/my/test_my.c b/src/my/test_my.c index 3e051e467..4bea101ca 100644 --- a/src/my/test_my.c +++ b/src/my/test_my.c | |||
@@ -75,29 +75,30 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
75 | pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); | 75 | pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); |
76 | memset (&hmsg, 42, sizeof(hmsg)); | 76 | memset (&hmsg, 42, sizeof(hmsg)); |
77 | sig = GNUNET_CRYPTO_rsa_sign_fdh (priv, | 77 | sig = GNUNET_CRYPTO_rsa_sign_fdh (priv, |
78 | &hmsg); | 78 | &hmsg); |
79 | u16 = 16; | 79 | u16 = 16; |
80 | u32 = 32; | 80 | u32 = 32; |
81 | u64 = 64; | 81 | u64 = UINT64_MAX; |
82 | 82 | ||
83 | memset (&hc, 0, sizeof(hc)); | 83 | memset (&hc, 0, sizeof(hc)); |
84 | memset (&hc2, 0, sizeof(hc2)); | 84 | memset (&hc2, 0, sizeof(hc2)); |
85 | 85 | ||
86 | statements_handle_insert = GNUNET_MYSQL_statement_prepare (context, | 86 | statements_handle_insert |
87 | "INSERT INTO test_my2 (" | 87 | = GNUNET_MYSQL_statement_prepare (context, |
88 | " pub" | 88 | "INSERT INTO test_my2 (" |
89 | ",sig" | 89 | " pub" |
90 | ",abs_time" | 90 | ",sig" |
91 | ",forever" | 91 | ",abs_time" |
92 | ",abs_time_nbo" | 92 | ",forever" |
93 | ",hash" | 93 | ",abs_time_nbo" |
94 | ",vsize" | 94 | ",hash" |
95 | ",str" | 95 | ",vsize" |
96 | ",u16" | 96 | ",str" |
97 | ",u32" | 97 | ",u16" |
98 | ",u64" | 98 | ",u32" |
99 | ") VALUES " | 99 | ",u64" |
100 | "( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); | 100 | ") VALUES " |
101 | "( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); | ||
101 | 102 | ||
102 | if (NULL == statements_handle_insert) | 103 | if (NULL == statements_handle_insert) |
103 | { | 104 | { |
@@ -128,19 +129,20 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
128 | return 1; | 129 | return 1; |
129 | } | 130 | } |
130 | 131 | ||
131 | statements_handle_select = GNUNET_MYSQL_statement_prepare (context, | 132 | statements_handle_select |
132 | "SELECT" | 133 | = GNUNET_MYSQL_statement_prepare (context, |
133 | " pub" | 134 | "SELECT" |
134 | ",sig" | 135 | " pub" |
135 | ",abs_time" | 136 | ",sig" |
136 | ",forever" | 137 | ",abs_time" |
137 | ",hash" | 138 | ",forever" |
138 | ",vsize" | 139 | ",hash" |
139 | ",str" | 140 | ",vsize" |
140 | ",u16" | 141 | ",str" |
141 | ",u32" | 142 | ",u16" |
142 | ",u64" | 143 | ",u32" |
143 | " FROM test_my2"); | 144 | ",u64" |
145 | " FROM test_my2"); | ||
144 | 146 | ||
145 | if (NULL == statements_handle_select) | 147 | if (NULL == statements_handle_select) |
146 | { | 148 | { |
@@ -200,21 +202,21 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
200 | msg2, | 202 | msg2, |
201 | msg2_len)); | 203 | msg2_len)); |
202 | 204 | ||
203 | GNUNET_break (strlen (msg3) == strlen(msg4)); | 205 | GNUNET_break (strlen (msg3) == strlen(msg4)); |
204 | GNUNET_break (0 == | 206 | GNUNET_break (0 == |
205 | strcmp (msg3, | 207 | strcmp (msg3, |
206 | msg4)); | 208 | msg4)); |
207 | 209 | ||
208 | GNUNET_break (16 == u162); | 210 | GNUNET_break (16 == u162); |
209 | GNUNET_break (32 == u322); | 211 | GNUNET_break (32 == u322); |
210 | GNUNET_break (64 == u642); | 212 | GNUNET_break (UINT64_MAX == u642); |
211 | 213 | ||
212 | GNUNET_MY_cleanup_result (results_select); | 214 | GNUNET_MY_cleanup_result (results_select); |
213 | 215 | ||
214 | GNUNET_CRYPTO_rsa_signature_free (sig); | 216 | GNUNET_CRYPTO_rsa_signature_free (sig); |
215 | GNUNET_CRYPTO_rsa_private_key_free (priv); | 217 | GNUNET_CRYPTO_rsa_private_key_free (priv); |
216 | GNUNET_CRYPTO_rsa_public_key_free (pub); | 218 | GNUNET_CRYPTO_rsa_public_key_free (pub); |
217 | 219 | ||
218 | if (GNUNET_OK != ret) | 220 | if (GNUNET_OK != ret) |
219 | return 1; | 221 | return 1; |
220 | 222 | ||
@@ -225,8 +227,8 @@ GNUNET_break (0 == | |||
225 | int | 227 | int |
226 | main (int argc, const char * const argv[]) | 228 | main (int argc, const char * const argv[]) |
227 | { | 229 | { |
228 | struct GNUNET_CONFIGURATION_Handle *config = NULL; | 230 | struct GNUNET_CONFIGURATION_Handle *config; |
229 | struct GNUNET_MYSQL_Context *context = NULL; | 231 | struct GNUNET_MYSQL_Context *context; |
230 | int ret; | 232 | int ret; |
231 | 233 | ||
232 | GNUNET_log_setup ("test-my", | 234 | GNUNET_log_setup ("test-my", |