babelouest / rhonabwy

Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
https://babelouest.github.io/rhonabwy/
GNU Lesser General Public License v2.1
45 stars 21 forks source link

Fix several -Werror=sign-conversion warnings #22

Closed drok closed 1 year ago

drok commented 1 year ago

In several places, jwe.c stores a (signed int) gnutls returned value into an unsigned size_t. This would cause warning like the following:

jwe.c:1872:53: error: conversion to 'size_t {aka long unsigned int}' from 'int' may change the sign of the result [-Werror=sign-conversion]

I have reviewed each location, and the gnutls lib returns the size of something, in every case, and never a negative number. This means it's safe to cast these return values to (unsigned). The functions returning int are:

This commit adds a cast of (unsigned) to the return value from these function, which avoids the -Werror=sign-conversion warnings

drok commented 1 year ago

I re-pushed the commit to include GPG signature

babelouest commented 1 year ago

Thanks @drok !