Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in C-example #78

Closed
vixentael opened this issue Oct 30, 2017 · 1 comment
Closed

Fix warnings in C-example #78

vixentael opened this issue Oct 30, 2017 · 1 comment

Comments

@vixentael
Copy link
Contributor

This is not crucial, but I believe that it's better to fix warnings during compiling of C example.

Just follow C-tutorial step-by-step.

My current configuration:

  • MacOS 10.12.6,
  • clang Apple LLVM version 9.0.0 (clang-900.0.37)

docs/examples/c/mid_hermes/credential_store_service

main.c:69:39: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
          credential_store_id, strlen(credential_store_id),
                                      ^~~~~~~~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);

docs/examples/c/mid_hermes/data_store_service

main.c:61:35: warning: passing 'const uint8_t [18]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
            data_store_id, strlen(data_store_id), data_store_private_key, sizeof(data_store_private_key),
                                  ^~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
main.c:63:41: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
            credential_store_id, strlen(credential_store_id), raw_credential_store_transport, false);
                                        ^~~~~~~~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
main.c:80:35: warning: passing 'const uint8_t [18]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
            data_store_id, strlen(data_store_id),data_store_private_key, sizeof(data_store_private_key),
                                  ^~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);

docs/examples/c/mid_hermes/key_store_service

main.c:60:32: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
          key_store_id, strlen(key_store_id), key_store_private_key, sizeof(key_store_private_key),
                               ^~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
main.c:62:39: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
          credential_store_id, strlen(credential_store_id), raw_credential_store_transport, false);
                                      ^~~~~~~~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
main.c:78:32: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
          key_store_id, strlen(key_store_id),key_store_private_key, sizeof(key_store_private_key),
                               ^~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);

docs/examples/c/mid_hermes/client

hermes_client.c:44:12: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
const char const* HELP = "usage: client <command> <user id> <base64 encoded user private key>  <name of file for proceed> <meta> <for user>.\n"
           ^
hermes_client.c:100:25: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stdout, HELP);
                        ^~~~
hermes_client.c:100:25: note: treat the string as an argument to avoid this
        fprintf(stdout, HELP);
                        ^
                        "%s", 
hermes_client.c:124:41: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
            credential_store_id, strlen(credential_store_id), container.raw_credential_store_transport, false);
                                        ^~~~~~~~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
hermes_client.c:123:13: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            argv[2], strlen(argv[2]), sk, sk_length, credential_store_pk, sizeof(credential_store_pk),
            ^~~~~~~
../../../../../include/hermes/secure_transport/transport.h:32:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, size_t user_id_length,
                       ^
hermes_client.c:139:34: warning: passing 'const uint8_t [17]' to parameter of type 'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
            key_store_id, strlen(key_store_id), container.raw_key_store_transport, false);
                                 ^~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
hermes_client.c:138:13: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            argv[2], strlen(argv[2]), sk, sk_length, key_store_pk, sizeof(key_store_pk),
            ^~~~~~~
../../../../../include/hermes/secure_transport/transport.h:32:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, size_t user_id_length,
                       ^
hermes_client.c:154:35: warning: passing 'const uint8_t [18]' to parameter of type 'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
            data_store_id, strlen(data_store_id), container.raw_data_store_transport, false);
                                  ^~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
hermes_client.c:153:13: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            argv[2], strlen(argv[2]), sk, sk_length, data_store_pk, sizeof(data_store_pk),
            ^~~~~~~
../../../../../include/hermes/secure_transport/transport.h:32:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, size_t user_id_length,
                       ^
hermes_client.c:161:13: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            argv[2], strlen(argv[2]), sk, sk_length, container.key_store_transport, container.data_store_transport,
            ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:35:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, const size_t user_id_length,
                       ^
hermes_client.c:175:93: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || (0 != mid_hermes_create_block(mh, &idBuffer, &idLength, block, block_length, argv[5], strlen(argv[5])))) {
                                                                                            ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:47:24: note: passing argument to parameter 'meta' here
        const uint8_t *meta, const size_t meta_length);
                       ^
hermes_client.c:191:44: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            0 != mid_hermes_read_block(mh, argv[4], strlen(argv[4]), &data, &data_length, &meta, &meta_length)) {
                                           ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:51:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t block_id_length,
                       ^
hermes_client.c:205:49: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_delete_block(mh, argv[4], strlen(argv[4]))) {
                                                ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:62:50: note: passing argument to parameter 'block_id' here
        mid_hermes_t *mid_hermes, const uint8_t *block_id, const size_t block_id_length);
                                                 ^
hermes_client.c:215:50: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || (0 != mid_hermes_update_block(mh, argv[4], strlen(argv[4]), block, block_length, argv[5], strlen(argv[5])))) {
                                                 ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:57:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t block_id_length,
                       ^
hermes_client.c:215:97: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || (0 != mid_hermes_update_block(mh, argv[4], strlen(argv[4]), block, block_length, argv[5], strlen(argv[5])))) {
                                                                                                ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:59:24: note: passing argument to parameter 'meta' here
        const uint8_t *meta, const size_t meta_length);
                       ^
hermes_client.c:224:54: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_grant_read_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                     ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:69:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t bloc_id_length,
                       ^
hermes_client.c:224:80: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_grant_read_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                                               ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:70:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, const size_t user_id_length);
                       ^
hermes_client.c:231:56: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_grant_update_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                       ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:74:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t bloc_id_length,
                       ^
hermes_client.c:231:82: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_grant_update_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                                                 ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:75:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, const size_t user_id_length);
                       ^
hermes_client.c:238:53: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_deny_read_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                    ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:79:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t bloc_id_length,
                       ^
hermes_client.c:238:79: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_deny_read_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                                              ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:80:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, const size_t user_id_length);
                       ^
hermes_client.c:245:55: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_deny_update_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                      ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:84:24: note: passing argument to parameter 'block_id' here
        const uint8_t *block_id, const size_t bloc_id_length,
                       ^
hermes_client.c:245:81: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_deny_update_access(mh, argv[4], strlen(argv[4]), argv[5], strlen(argv[5]))) {
                                                                                ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:85:24: note: passing argument to parameter 'user_id' here
        const uint8_t *user_id, const size_t user_id_length);
                       ^
hermes_client.c:253:49: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
            || 0 != mid_hermes_rotate_block(mh, argv[4], strlen(argv[4]))) {
                                                ^~~~~~~
../../../../../include/hermes/mid_hermes/mid_hermes.h:65:50: note: passing argument to parameter 'block_id' here
        mid_hermes_t *mid_hermes, const uint8_t *block_id, const size_t block_id_length);
@vixentael vixentael changed the title Fix warnings in C Fix warnings in C-example Oct 30, 2017
@Lagovas Lagovas mentioned this issue Nov 16, 2017
@Lagovas
Copy link
Contributor

Lagovas commented Nov 16, 2017

fixed by #100

@Lagovas Lagovas closed this as completed Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants