[patch] 1.11.0.svn: compiler warnings when building for i386 arch
Denys Vlasenko
vda.linux at googlemail.com
Sat May 17 15:45:55 PDT 2008
On Saturday 17 May 2008 09:42, Cristian Ionescu-Idbohrn wrote:
> On Sat, 17 May 2008, Denys Vlasenko wrote:
>
> > On Friday 16 May 2008 23:39, Cristian Ionescu-Idbohrn wrote:
> > > On Fri, 16 May 2008, Denys Vlasenko wrote:
> > >
> > > > Of course. If sizeof(int) != sizeof(size_t), it will fail.
> > >
> > > I may be too dense here, but I'd be greatful if you would care to
> > > explain why sizeof(int) != sizeof(unsigned int).
> >
> > size_t can be unsigned long on some architectires.
>
> Yes.
>
> But I still wonder how would in that case "%d" fit better than "%u"?
> "%ld" or (even better) "%lu" use would be required then.
I dont understand you.
Yor patch was:
> - int i, lineno;
> + size_t i, lineno;
>
> for (i = 0; i < KWS_WITH_DEFAULTS; i++)
> keywords[i].handler(keywords[i].def, keywords[i].var);
> @@ -344,7 +344,7 @@
> for (i = 0; i < ARRAY_SIZE(keywords); i++) {
> if (!strcasecmp(token, keywords[i].keyword)) {
> if (!keywords[i].handler(line, keywords[i].var)) {
> - bb_error_msg("can't parse line %d in %s at '%s'",
> + bb_error_msg("can't parse line %u in %s at '%s'",
> lineno, file, line);
lineno was int and you changed it into size_t, which potentially has
different WIDTH. printf will fetch garbage from the stack.
--
vda
More information about the busybox
mailing list