Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
need an int cast around the subtraction.
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.
In some cases, that will still raise warnings. We have a
PTRDIFF_T
incrypto/evp/evp_enc.c
that we probably should make wider use of for these kinds of things.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.
No, it has to be an int because slen is an int.
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.
Apparently there are no gcc and no clang warnings with --strict-warnings about this.
Only visual studio builds have one warning here.
However there are already many similar warnings all over in this function.
Sigh, it feels somehow wrong to defeat a warning here with a type-cast.
A type cast is just not checked at all, and even
slen -= (int)p; would no longer give me any warning.
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.
Never mind my previous (now removed) comment... d2i_SSL_SESSION() will of course change
p
...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.
The diff between two pointers will invariably cause a warning on VMS when building with 64-bit pointers, because the result is coerced to a 32-bit value, which may lose data. Not a risk in this case, but still an annoying warning. We've taken quite a bit of effort in other parts of our source to avoid this...
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.
well then, what do folks want to do? @bernd-edlinger is right, it compiles without warning (my mistake). @levitte can VMS live with this PR?
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.
Worst case scenario, you'll see me adding pragmas in a day or two ;-)
Fine with me.
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.
Yes, I see, this makes it even worse...
Maybe it would be better to have a function that does the pointer-difference thing
in a clean way, and returns the remaining bytes in the input stream, so I could
use that directly as argument of the next d2i-function.
To resolve this issue, I will add a comment, what this statement is meant to do,
so it will hopefully be more clear, and add a type-cast to int.
The reason why I hate type-casts is: once the interfaces are cleaned up
the type-casts usually remain forever :-(
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.
It turns out that VMS has no issues here... to my surprise, but I'm not complaining!