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

Adam Domurad adomurad at redhat.com
Thu May 24 07:59:18 PDT 2012


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.






-------------- next part --------------
A non-text attachment was scrubbed...
Name: revised.patch
Type: text/x-patch
Size: 5816 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120524/6fbaf8ac/revised.patch 


More information about the distro-pkg-dev mailing list