[FFmpeg-devel] [PATCH] Remove two 'comparison always false' warnings in libavformat
Michael Niedermayer
michaelni
Fri May 2 19:22:28 CEST 2008
On Fri, May 02, 2008 at 06:12:12PM +0200, Diego 'Flameeyes' Petten? wrote:
> Avoid two warnings about comparison always false.
>
> From: Diego 'Flameeyes' Petten? <flameeyes at gmail.com>
>
> ffmpeg/libavformat/nutdec.c:428: warning: comparison of unsigned expression < 0 is always false
> ffmpeg/libavformat/udp.c:299: warning: comparison of unsigned expression < 0 is always false
> ---
>
> libavformat/nutdec.c | 2 +-
> libavformat/udp.c | 9 +++------
> 2 files changed, 4 insertions(+), 7 deletions(-)
>
>
> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
> index 186e308..03c684d 100644
> --- a/libavformat/nutdec.c
> +++ b/libavformat/nutdec.c
> @@ -425,7 +425,7 @@ static int decode_info_header(NUTContext *nut){
> type= "v";
> }
>
> - if (stream_id_plus1 < 0 || stream_id_plus1 > s->nb_streams) {
> + if (stream_id_plus1 > s->nb_streams) {
> av_log(s, AV_LOG_ERROR, "invalid stream id for info packet\n");
> continue;
> }
ok
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index aadda98..7de4463 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -158,9 +158,9 @@ static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, in
> return res;
> }
>
> -static int udp_set_url(struct sockaddr_storage *addr, const char *hostname, int port) {
> +static size_t udp_set_url(struct sockaddr_storage *addr, const char *hostname, int port) {
> struct addrinfo *res0;
> - int addr_len;
> + size_t addr_len;
>
> res0 = udp_ipv6_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
> if (res0 == 0) return AVERROR(EIO);
> @@ -232,7 +232,7 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
>
> #else
>
> -static int udp_set_url(struct sockaddr_in *addr, const char *hostname, int port)
> +static size_t udp_set_url(struct sockaddr_in *addr, const char *hostname, int port)
> {
> /* set the destination address */
> if (resolve_host(&addr->sin_addr, hostname) < 0)
> @@ -296,9 +296,6 @@ int udp_set_remote_url(URLContext *h, const char *uri)
>
> /* set the destination address */
> s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
> - if (s->dest_addr_len < 0) {
> - return AVERROR(EIO);
> - }
> s->is_multicast = is_multicast_address(&s->dest_addr);
>
> return 0;
This does not look correct, you are fixing th warning but nit the bug to
which the warning pointed.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080502/4b85b2d0/attachment.pgp>
More information about the ffmpeg-devel
mailing list