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

tls-gnutls: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result #5532

Closed
paulmenzel opened this issue Feb 25, 2019 · 4 comments
Assignees

Comments

@paulmenzel
Copy link
Contributor

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609 gives the error below.

Making all in cups...
[…]
Compiling tls.c...
In file included from tls.c:39:0:
tls-gnutls.c: In function ‘httpCredentialsAreValidForName’:
tls-gnutls.c:420:56: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
           if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &r
                                                        ^
cc1: all warnings being treated as errors
paulmenzel added a commit to paulmenzel/cups that referenced this issue Feb 25, 2019
Fix the error below (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
20160609):

    Compiling tls.c...
    In file included from tls.c:39:0:
    tls-gnutls.c: In function ‘httpCredentialsAreValidForName’:
    tls-gnutls.c:420:56: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
               if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &r
                                                            ^

Fixes: apple#5532
paulmenzel added a commit to paulmenzel/cups that referenced this issue Feb 25, 2019
Fix the error below (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
20160609):

    Compiling tls.c...
    In file included from tls.c:39:0:
    tls-gnutls.c: In function ‘httpCredentialsAreValidForName’:
    tls-gnutls.c:420:56: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
               if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &r
                                                            ^

Fixes: apple#5532
paulmenzel added a commit to paulmenzel/cups that referenced this issue Feb 25, 2019
Fix the error below (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
20160609):

    Compiling tls.c...
    In file included from tls.c:39:0:
    tls-gnutls.c: In function ‘httpCredentialsAreValidForName’:
    tls-gnutls.c:420:56: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
               if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &r
                                                            ^

Revert commit 163a773 (Fix compiler warning.).

Fixes: apple#5532
@paulmenzel
Copy link
Contributor Author

It looks like, commit 163a773 (Fix compiler warning.) should be reverted.

@michaelrsweet
Copy link
Collaborator

Depending on the version of GNU TLS you are using, the prototype for this function is different (!). I will investigate whether we can come up with a more bullet-proof solution for this...

@michaelrsweet
Copy link
Collaborator

Looks like using an iterator will solve this particular issue, and also be faster if the CRL is long.

@michaelrsweet
Copy link
Collaborator

[master 2a06fe6] Use iterator for CRL (Issue #5532)

[branch-2.2 74dece9] Use iterator for CRL (Issue #5532)

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