[MPlayer-dev-eng] [PATCH] fix signed/unsigned comparison in m_option.c
Dominik 'Rathann' Mierzejewski
dominik at rangers.eu.org
Sun Oct 8 20:07:42 CEST 2006
On Sunday, 08 October 2006 at 19:35, Dominik 'Rathann' Mierzejewski wrote:
> On Sunday, 08 October 2006 at 17:06, Dominik 'Rathann' Mierzejewski wrote:
> > strlen/strcspn return type is size_t, hence optlen should be size_t as well
> > (or ther should be a cast).
> >
> > Fixes
> > m_option.c: In function ‘parse_subconf’:
> > m_option.c:928: warning: comparison between signed and unsigned
>
> Updated patch attached.
And another try, avoiding size_t in printf pitfalls.
--
MPlayer developer and RPMs maintainer: http://rpm.greysector.net/mplayer/
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
-- from "Collected Sayings of Muad'Dib" by the Princess Irulan
-------------- next part --------------
--- MPlayer-20114/m_option.c.mopt 2006-10-08 16:11:54.000000000 +0200
+++ MPlayer-20114/m_option.c 2006-10-08 19:34:02.000000000 +0200
@@ -904,7 +904,7 @@
while(p[0])
{
int sscanf_ret = 1;
- int optlen = strcspn(p, ":=");
+ unsigned optlen = strcspn(p, ":=");
/* clear out */
subopt[0] = subparam[0] = 0;
strlcpy(subopt, p, optlen + 1);
@@ -924,9 +924,9 @@
p = &p[1];
} else if (p[0] == '%') {
p = &p[1];
- optlen = (int)strtol(p, &p, 0);
+ optlen = (unsigned)strtol(p, &p, 0);
if (!p || p[0] != '%' || (optlen > strlen(p) - 1)) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Invalid length %i for '%s'\n", optlen, subopt);
+ mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Invalid length %u for '%s'\n", optlen, subopt);
return M_OPT_INVALID;
}
p = &p[1];
More information about the MPlayer-dev-eng
mailing list