-
-
Notifications
You must be signed in to change notification settings - Fork 258
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 compiler warning (clang, cxx17) #290
Conversation
For the linters there's a command you can run :) https://github.com/Thalhammer/jwt-cpp/actions/runs/4939213168/jobs/8838847109?pr=290 its just a copy paste from the logs |
Found this gem doing some research on the issue 🤣
https://isocpp.org/files/papers/D2139R3.html#3.21 Seems like there's no replacement but the tests are passing so 🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, except a small nitpick and a question.
Given that the vast majority of data going through this function will be ascii, all three of str
, wide
and out
will usually have the same size and it might be a good idea to call reserve
on wide
and out
with the input size to prevent reallocations. With reserve worst case we overallocate a bit (on wide
) or have to reallocate once (for out
).
The other, bigger thing I am worried about is whether its really a good idea to replace the old/deprecated wstring_convert
with the even older mbrtowc
C api (which by the way is defined in cwchar
, not in cstring
. While I agree that we shouldn't use deprecated functions if it can be avoided, the wstring_convert
code is just so much cleaner and I just can't see them removing it before there's an usable replacement.
EDIT: Oh and linting. you can just apply the patch command thats in the details of the failed ci run.
Would it make sense to drop the the C++11 ifdef? Or have a seperate >= C++17 section? |
If we go with this solution we can certainly drop the ifdef because the c-style functions should be available in all C++ versions. |
Hey guys, sorry for being late. Thank you both for the hint regarding the patch command.
@prince-chrismc Good point, I will drop it. Thank you both for your feedback! |
@laoshanxi Do you still need support for GCC 4.8 ? |
Let me have a try. |
I tried build jwt-cpp in gcc 4.8 works, sorry I can not trigger whole app-mesh which used jwt-cpp due to other dependency can not pass this compiler.
For me, I am not using this compiler now, Thanks for asking. |
warnings:
'wstring_convert<std::codecvt_utf8<wchar_t, 1114111, 0>>' is deprecated
'wstring_convert<std::codecvt_utf8<wchar_t, 1114111, 0>>' has been explicitly marked deprecated here