[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Patch: Various constants abuse

From: <Stefan.Fuhrmann_at_etas.com>
Date: Mon, 22 Nov 2010 18:43:17 +0100

Stefan wrote:
> Dmitry <wipedout_at_yandex.ru> wrote:
>
> > Hey.
> >
> > Attached is a patch that addresses constant abuses in TSVN code for
> better maintainability. Also
> > fixes several cases where wrong constant values are passed.
>
> Hi Dmitry,
>
> Thanks for the patch! I think it could be improved, though:
>
> TCHAR buffer[SOME_SIZE];
> _tcscat_s(buffer, SOME_SIZE, source);
>
> should become
>
> TCHAR buffer[SOME_SIZE];
> _tcscat_s(buffer, source);
>
> instead of
>
> TCHAR buffer[SOME_SIZE];
> _tcscat_s(buffer, _countof(buffer), source);
>
> Also, be careful wherever MAX_PATH is being used with strncpy
> (or the like). If we call some OS function with that buffer,
> we might want to limit the path length to MAX_PATH instead of
> the buffer size as the latter might be changed by future commits.
> One solution may be putting a comment in front of the buffer
> declaration.
>
> -- Stefan^2.

See also r20524.

-- Stefan^2.

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2684431

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2010-11-22 18:43:30 CET

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.