[rfc][icedtea-web] Removal of 'magic' numbers and more consistent buffer sizes in C++ side of plugin

Pavel Tisnovsky ptisnovs at redhat.com
Fri May 25 07:28:06 PDT 2012


Hi Adam,

it looks good.

Thank you,
Pavel

Adam Domurad wrote:
> Hey all. This is a response to comments from Pavel on a patch that I
> created earlier. I decided to re-post with [rfc] in the name to be
> clear. This addresses the issue of magic numbers being used for the
> buffer sizes, and the somewhat unclear 'sizeof' usage (that I originally
> used) to get the buffer size. As well it avoids using snprintf for
> emptying a string, opting for the somewhat clearer strcpy.
> 
> Changelog:
> 2012-05-23  Adam Domurad  <adomurad at redhat.com>
>         Removed instances of snprintf where buffer size was not known.
> Added
>         buffer size constant for allocating buffers for numeric
> conversions.
>         * plugin/icedteanp/IcedTeaNPPlugin.cc: Removed usage of snprintf
> for 
>         simple blanking of strings. Buffer size was misguided
> previously. 
>         Used NUM_STR_BUFFER_SIZE constant to replace magic numbers.
>         * plugin/icedteanp/IcedTeaPluginUtils.cc: Made 
>         NPVariantToString(NPVariant variant, std::string* result) use
> space 
>         indentation. Used NUM_STR_BUFFER_SIZE constant to replace magic 
>         numbers.
>         * plugin/icedteanp/IcedTeaPluginUtils.h: Added constant, 
>         NUM_STR_BUFFER_SIZE.
> 
> 
> 
> 
> 
> 
> 




More information about the distro-pkg-dev mailing list