* msdos_format_name() bug?
@ 2009-02-02 14:28 Roel Kluin
2009-02-02 16:09 ` OGAWA Hirofumi
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-02 14:28 UTC (permalink / raw)
To: hirofumi; +Cc: lkml
in msdos_format_name(const unsigned char *name, int len, ...)
name is the proposed name, len is its length.
while (c != '.' && len--)
c = *name++;
if (c == '.') {
while (walk - res < 8)
*walk++ = ' ';
while (len > 0 && walk - res < MSDOS_NAME) {
Is the postfix decrement in the first loop correct, or should it be
prefix? (isn't that one character too many?)
If not, note that if the proposed name ends with a dot: e.g.
'myfile.' the first while loop iterates until the dot which ends
the loop, but because of the postfix decrement len already is 0,
so the third while loop won't start. Is that correct?
Roel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: msdos_format_name() bug?
2009-02-02 14:28 msdos_format_name() bug? Roel Kluin
@ 2009-02-02 16:09 ` OGAWA Hirofumi
0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2009-02-02 16:09 UTC (permalink / raw)
To: Roel Kluin; +Cc: lkml
Roel Kluin <roel.kluin@gmail.com> writes:
> in msdos_format_name(const unsigned char *name, int len, ...)
>
> name is the proposed name, len is its length.
>
> while (c != '.' && len--)
> c = *name++;
> if (c == '.') {
> while (walk - res < 8)
> *walk++ = ' ';
> while (len > 0 && walk - res < MSDOS_NAME) {
>
> Is the postfix decrement in the first loop correct, or should it be
> prefix? (isn't that one character too many?)
>
> If not, note that if the proposed name ends with a dot: e.g.
> 'myfile.' the first while loop iterates until the dot which ends
> the loop, but because of the postfix decrement len already is 0,
> so the third while loop won't start. Is that correct?
In the "myfile." case, it seems correct. It will provide "MYFILE ".
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-02 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-02 14:28 msdos_format_name() bug? Roel Kluin
2009-02-02 16:09 ` OGAWA Hirofumi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.