From 7c9450084f17c235f0f5c7e5af5fe7e0f1e11cd2 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sat, 23 Jan 2016 18:42:50 +0100 Subject: [PATCH] fix some compile errors --- demos/demo_crypt_constants.c | 4 ++-- demos/demo_crypt_sizes.c | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/demos/demo_crypt_constants.c b/demos/demo_crypt_constants.c index 9c41cf7..c55d6df 100644 --- a/demos/demo_crypt_constants.c +++ b/demos/demo_crypt_constants.c @@ -31,11 +31,11 @@ int main(void) { // get and print the length of the names (and values) list char *names_list; - unsigned long names_list_len; + unsigned int names_list_len; if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE); - printf(" need to allocate %lu bytes \n\n", names_list_len); + printf(" need to allocate %u bytes \n\n", names_list_len); // get and print the names (and values) list if ((names_list = malloc(names_list_len)) == NULL) diff --git a/demos/demo_crypt_sizes.c b/demos/demo_crypt_sizes.c index ea1cef1..a2da0a7 100644 --- a/demos/demo_crypt_sizes.c +++ b/demos/demo_crypt_sizes.c @@ -19,24 +19,27 @@ int main(void) { - int rc; // given a specific size name, get and print its size char name[] = "ecc_key"; - int size; - rc = crypt_get_size(name, &size); - printf("\n size of '%s' is %d \n\n", name, size); + unsigned int size; + if(crypt_get_size(name, &size) != 0) + exit(EXIT_FAILURE); + printf("\n size of '%s' is %u \n\n", name, size); // get and print the length of the names (and sizes) list char *sizes_list; - unsigned long sizes_list_len; - rc = crypt_list_all_sizes(NULL, &sizes_list_len); - printf(" need to allocate %lu bytes \n\n", sizes_list_len); + unsigned int sizes_list_len; + if(crypt_list_all_sizes(NULL, &sizes_list_len) != 0) + exit(EXIT_FAILURE); + printf(" need to allocate %u bytes \n\n", sizes_list_len); // get and print the names (and sizes) list sizes_list = malloc(sizes_list_len); - rc = crypt_list_all_sizes(sizes_list, &sizes_list_len); + if(crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0) + exit(EXIT_FAILURE); printf(" supported sizes:\n\n%s\n\n", sizes_list); + return 0; }