aviad rozenhek <avia...@gmail.com> writes:

>>
>> unary minus operator applied to unsigned type, result still unsigned
>
> I get this compiler warning when using any if the specialized AVERROR_XXX
> macros, like AVERROR_BSF_NOT_FOUND or AVERROR_DECODER_NOT_FOUND.
>
> the reason is because
>
>> #define AVERROR_BSF_NOT_FOUND      (-MKTAG(0xF8,'B','S','F')) ///<
>> Bitstream filter not found
>
> and the result from MKTAG is *unsigned* .

Well, that's bad.

> therefore I suggest to change the code thusly:
>
> #define DEFINE_AVERROR(a, b, c, d)  (-(int32_t)MKTAG(a, b, c, d))

That conversion is undefined, so it's no good.  The correct solution is
to define the error code in such a way that it is properly signed from
the start.  MKTAG(-7,'B','S','F') might do it.

-- 
Måns Rullgård
m...@mansr.com
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to