diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-05 21:00:43 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-05 21:00:43 +0000 |
commit | 83d2ed0a8630e0295c3bd9db54e15074c68ff783 (patch) | |
tree | a279969102c954c138b4bc0b7d18f35a10f1dda4 /src/scalarproduct/gnunet-scalarproduct.c | |
parent | 709c048dc1e24f0b1cde544c41d60f898a698304 (diff) | |
download | gnunet-83d2ed0a8630e0295c3bd9db54e15074c68ff783.tar.gz gnunet-83d2ed0a8630e0295c3bd9db54e15074c68ff783.zip |
-fixing indentation
Diffstat (limited to 'src/scalarproduct/gnunet-scalarproduct.c')
-rw-r--r-- | src/scalarproduct/gnunet-scalarproduct.c | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 2c966ef15..f81a56c66 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -55,22 +55,22 @@ struct ScalarProductCallbackClosure | |||
55 | /** | 55 | /** |
56 | * Option -p: destination peer identity for checking message-ids with | 56 | * Option -p: destination peer identity for checking message-ids with |
57 | */ | 57 | */ |
58 | static char *input_peer_id = NULL; | 58 | static char *input_peer_id; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Option -p: destination peer identity for checking message-ids with | 61 | * Option -p: destination peer identity for checking message-ids with |
62 | */ | 62 | */ |
63 | static char *input_key = NULL; | 63 | static char *input_key; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Option -e: vector to calculate a scalarproduct with | 66 | * Option -e: vector to calculate a scalarproduct with |
67 | */ | 67 | */ |
68 | static char *input_elements = NULL; | 68 | static char *input_elements; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Option -m: message-ids to calculate a scalarproduct with | 71 | * Option -m: message-ids to calculate a scalarproduct with |
72 | */ | 72 | */ |
73 | static char *input_mask = NULL; | 73 | static char *input_mask; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Global return value | 76 | * Global return value |
@@ -179,11 +179,11 @@ run (void *cls, | |||
179 | const char *cfgfile, | 179 | const char *cfgfile, |
180 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 180 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
181 | { | 181 | { |
182 | char * begin = input_elements; | 182 | char *begin = input_elements; |
183 | char * end; | 183 | char *end; |
184 | int32_t element; | 184 | int32_t element; |
185 | int i; | 185 | int i; |
186 | int32_t * elements; | 186 | int32_t *elements; |
187 | unsigned char * mask; | 187 | unsigned char * mask; |
188 | uint32_t mask_bytes; | 188 | uint32_t mask_bytes; |
189 | uint32_t element_count = 0; | 189 | uint32_t element_count = 0; |
@@ -191,29 +191,35 @@ run (void *cls, | |||
191 | 191 | ||
192 | if (NULL == input_elements) | 192 | if (NULL == input_elements) |
193 | { | 193 | { |
194 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("You must specify at least one message ID to check!\n")); | 194 | LOG (GNUNET_ERROR_TYPE_ERROR, |
195 | _ ("You must specify at least one message ID to check!\n")); | ||
195 | return; | 196 | return; |
196 | } | 197 | } |
197 | 198 | ||
198 | if (NULL == input_key) | 199 | if (NULL == input_key) |
199 | { | 200 | { |
200 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("This program needs a session identifier for comparing vectors.\n")); | 201 | LOG (GNUNET_ERROR_TYPE_ERROR, |
202 | _ ("This program needs a session identifier for comparing vectors.\n")); | ||
201 | return; | 203 | return; |
202 | } | 204 | } |
203 | 205 | ||
204 | if (1 > strnlen (input_key, sizeof (struct GNUNET_HashCode))) | 206 | if (1 > strnlen (input_key, sizeof (struct GNUNET_HashCode))) |
205 | { | 207 | { |
206 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Please give a session key for --input_key!\n")); | 208 | LOG (GNUNET_ERROR_TYPE_ERROR, |
209 | _ ("Please give a session key for --input_key!\n")); | ||
207 | return; | 210 | return; |
208 | } | 211 | } |
209 | closure = GNUNET_new (struct ScalarProductCallbackClosure); | 212 | closure = GNUNET_new (struct ScalarProductCallbackClosure); |
210 | GNUNET_CRYPTO_hash (input_key, strlen (input_key), &closure->key); | 213 | GNUNET_CRYPTO_hash (input_key, strlen (input_key), &closure->key); |
211 | 214 | ||
212 | if (input_peer_id && GNUNET_OK != GNUNET_CRYPTO_hash_from_string (input_peer_id, | 215 | if (input_peer_id && |
213 | (struct GNUNET_HashCode *) &closure->peer)) | 216 | (GNUNET_OK != |
217 | GNUNET_CRYPTO_hash_from_string (input_peer_id, | ||
218 | (struct GNUNET_HashCode *) &closure->peer))) | ||
214 | { | 219 | { |
215 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Tried to set initiator mode, as peer ID was given. " | 220 | LOG (GNUNET_ERROR_TYPE_ERROR, |
216 | "However, `%s' is not a valid peer identifier.\n"), | 221 | _ ("Tried to set initiator mode, as peer ID was given. " |
222 | "However, `%s' is not a valid peer identifier.\n"), | ||
217 | input_peer_id); | 223 | input_peer_id); |
218 | return; | 224 | return; |
219 | } | 225 | } |
@@ -236,14 +242,16 @@ run (void *cls, | |||
236 | } | 242 | } |
237 | else | 243 | else |
238 | { | 244 | { |
239 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Could not convert `%s' to int32_t.\n"), begin); | 245 | LOG (GNUNET_ERROR_TYPE_ERROR, |
246 | _ ("Could not convert `%s' to int32_t.\n"), begin); | ||
240 | return; | 247 | return; |
241 | } | 248 | } |
242 | } | 249 | } |
243 | while (1); | 250 | while (1); |
244 | if (0 == element_count) | 251 | if (0 == element_count) |
245 | { | 252 | { |
246 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the vectorproduct, got none.\n")); | 253 | LOG (GNUNET_ERROR_TYPE_ERROR, |
254 | _ ("Need elements to compute the vectorproduct, got none.\n")); | ||
247 | return; | 255 | return; |
248 | } | 256 | } |
249 | 257 | ||
@@ -294,7 +302,8 @@ run (void *cls, | |||
294 | } | 302 | } |
295 | else | 303 | else |
296 | { | 304 | { |
297 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Could not convert `%s' to int32_t.\n"), begin); | 305 | LOG (GNUNET_ERROR_TYPE_ERROR, |
306 | _ ("Could not convert `%s' to integer.\n"), begin); | ||
298 | return; | 307 | return; |
299 | } | 308 | } |
300 | 309 | ||
@@ -308,22 +317,23 @@ run (void *cls, | |||
308 | for (i = 0; i <= mask_bytes; i++) | 317 | for (i = 0; i <= mask_bytes; i++) |
309 | mask[i] = UCHAR_MAX; // all 1's | 318 | mask[i] = UCHAR_MAX; // all 1's |
310 | 319 | ||
311 | if (input_peer_id && (NULL == GNUNET_SCALARPRODUCT_request (cfg, | 320 | if (input_peer_id && |
312 | &closure->key, | 321 | (NULL == GNUNET_SCALARPRODUCT_request (cfg, |
313 | &closure->peer, | 322 | &closure->key, |
314 | elements, element_count, | 323 | &closure->peer, |
315 | mask, mask_bytes, | 324 | elements, element_count, |
316 | &requester_callback, | 325 | mask, mask_bytes, |
317 | (void *) &closure))) | 326 | &requester_callback, |
327 | (void *) &closure))) | ||
318 | return; | 328 | return; |
319 | 329 | ||
320 | if ((NULL == input_peer_id) && (NULL == GNUNET_SCALARPRODUCT_response (cfg, | 330 | if ((NULL == input_peer_id) && |
321 | &closure->key, | 331 | (NULL == GNUNET_SCALARPRODUCT_response (cfg, |
322 | elements, element_count, | 332 | &closure->key, |
323 | &responder_callback, | 333 | elements, element_count, |
324 | (void *) &closure))) | 334 | &responder_callback, |
335 | (void *) &closure))) | ||
325 | return; | 336 | return; |
326 | |||
327 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 337 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
328 | &shutdown_task, | 338 | &shutdown_task, |
329 | NULL); | 339 | NULL); |