This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients alexandre.vassalotti, christian.heimes, gvanrossum
Date 2007-10-14.01:00:41
SpamBayes Score 0.00056162686
Marked as misclassified No
Message-id <ca471dc20710131800h4b56d399i121dfaf85cb85aaf@mail.gmail.com>
In-reply-to <47116966.7040402@cheimes.de>
Content
Well, you could ensure that by checking that you haven't reached the
end of the mangling buffer. That will have the added advantage that
when the input is something silly like 32 spaces followed by "utf-8"
it will be still be mangled correctly. The slight extra cost of the
check (could be a single pointer compare) is offset by saving a call
to strncpy().

--Guido

On 10/13/07, Christian Heimes <report@bugs.python.org> wrote:
>
> Christian Heimes added the comment:
>
> Guido van Rossum wrote:
> > - Why copy the default encoding before mangling it?  With a little extra
> > care you will only have to copy it once.
>
> Now I remember why I added the strncpy() call plus encoding[31] = '\0'.
> I wanted to make sure that the code doesn't break even if the encoding
> name is longer than 31 + 1 chars long. I'm aware that it's very unlikely
> but I didn't want to take chances. You are allowed to call me paranoid. *g*
>
> Christian
>
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1272>
> __________________________________
>
History
Date User Action Args
2007-10-14 01:00:42gvanrossumsetspambayes_score: 0.000561627 -> 0.00056162686
recipients: + gvanrossum, christian.heimes, alexandre.vassalotti
2007-10-14 01:00:41gvanrossumlinkissue1272 messages
2007-10-14 01:00:41gvanrossumcreate