On Mon, Aug 13, 2012 at 12:33 PM, aviad rozenhek <avia...@gmail.com> wrote:
> 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* . > > therefore I suggest to change the code thusly: > > #define DEFINE_AVERROR(a, b, c, d) (-(int32_t)MKTAG(a, b, c, d)) > > #define AVERROR_BSF_NOT_FOUND ( DEFINE_AVERROR ('B','S','F')) ///< > Bitstream filter not found > #define AVERROR_DECODER_NOT_FOUND ( DEFINE_AVERROR ('D','E','C')) ///< > Decoder not found > #define AVERROR_DEMUXER_NOT_FOUND ( DEFINE_AVERROR ('D','E','M')) ///< > Demuxer not found > #define AVERROR_ENCODER_NOT_FOUND ( DEFINE_AVERROR ('E','N','C')) ///< > Encoder not found > #define AVERROR_EOF ( DEFINE_AVERROR ( 'E','O','F')) ///< > End of file > #define AVERROR_EXIT ( DEFINE_AVERROR ( 'E','X','T')) ///< > Immediate exit was requested; the called function should not be restarted > #define AVERROR_FILTER_NOT_FOUND ( DEFINE_AVERROR ('F','I','L')) ///< > Filter not found > #define AVERROR_INVALIDDATA ( DEFINE_AVERROR ( 'I','N','D')) ///< > Invalid data found when processing input > #define AVERROR_MUXER_NOT_FOUND ( DEFINE_AVERROR ('M','U','X')) ///< > Muxer not found > #define AVERROR_OPTION_NOT_FOUND ( DEFINE_AVERROR ('O','P','T')) ///< > Option not found > #define AVERROR_PATCHWELCOME ( DEFINE_AVERROR ( 'P','A','W')) ///< > Not yet implemented in Libav, patches welcome > #define AVERROR_PROTOCOL_NOT_FOUND ( DEFINE_AVERROR ('P','R','O')) ///< > Protocol not found > #define AVERROR_STREAM_NOT_FOUND ( DEFINE_AVERROR ('S','T','R')) ///< > Stream not found > #define AVERROR_BUG ( DEFINE_AVERROR ( 'B','U','G')) ///< > Bug detected, please report the issue > > > > -- > Aviad Rozenhek > how about we stop using the high byte [which contains the sign, thus making the tag convertible to signed, like so, would this work? #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((*unsigned*)(d) > << 24)) #define DEFINE_AVERROR_3CC_TAG(a, b, c) (-(int32_t)MKTAG(a, b, c, 0)) #define AVERROR_BSF_NOT_FOUND ( DEFINE_AVERROR (0xF8,'B','S','F')) ///< Bitstream filter not found #define AVERROR_DECODER_NOT_FOUND ( DEFINE_AVERROR (0xF8,'D','E','C')) ///< Decoder not found #define AVERROR_DEMUXER_NOT_FOUND ( DEFINE_AVERROR (0xF8,'D','E','M')) ///< Demuxer not found #define AVERROR_ENCODER_NOT_FOUND ( DEFINE_AVERROR (0xF8,'E','N','C')) ///< Encoder not found #define AVERROR_EOF ( DEFINE_AVERROR ( 'E','O','F',' ')) ///< End of file #define AVERROR_EXIT ( DEFINE_AVERROR ( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted #define AVERROR_FILTER_NOT_FOUND ( DEFINE_AVERROR (0xF8,'F','I','L')) ///< Filter not found #define AVERROR_INVALIDDATA ( DEFINE_AVERROR ( 'I','N','D','A')) ///< Invalid data found when processing input #define AVERROR_MUXER_NOT_FOUND ( DEFINE_AVERROR (0xF8,'M','U','X')) ///< Muxer not found #define AVERROR_OPTION_NOT_FOUND ( DEFINE_AVERROR (0xF8,'O','P','T')) ///< Option not found #define AVERROR_PATCHWELCOME ( DEFINE_AVERROR ( 'P','A','W','E')) ///< Not yet implemented in Libav, patches welcome #define AVERROR_PROTOCOL_NOT_FOUND ( DEFINE_AVERROR (0xF8,'P','R','O')) ///< Protocol not found #define AVERROR_STREAM_NOT_FOUND ( DEFINE_AVERROR (0xF8,'S','T','R')) ///< Stream not found #define AVERROR_BUG ( DEFINE_AVERROR ( 'B','U','G',' ')) ///< Bug detected, please report the issue -- Aviad Rozenhek
_______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel