Hello Mr. Andreas,
First, I would like to congratulate you for the excellent library you provide.
I used your library in one of my projects and made few patches to fix some small issues. I hope they are valuable to you if you are still maintaining this project.
Patch 1: memleak.patch
- Removed the warning: type qualifiers ignored on function return type. It is
not required to qualify the return of enumerations and integers as const,
once they are returned by value.
- One of the network_array::get was using scoped_ptr as an array, which causes
memory leak when deleted ( calling delete instead of delete[] ). Replaced by
scoped_array
- boost::net::dns::debug::dump_a6 was catching by value, changed to catch by
reference.
Patch 2: warning-fix.patch
- Using the prefix version of ++ operator, it is more efficient once it does
not create temporary object
- Assignment operator must not return const
- Removed the extra qualification 'dns_hasher::', because static methods can
call just other static methods. Some compilers even consider this as an
error.
- Some member variables were not initialized in constructor, or the
initialization was in the constructor body instead of initialize list.
- Some parameters were shadowing other identifiers.
- Commented unused parameter.
- Explicit cast between uint16 and int literals and variables.
Patch 3: network_array.patch
- The boost::net::network_array class is no longer a subclass of boost::array,
because the later has neither a public virtual, nor a non-public non-virtual,
destructor. This leads to undefined behavior when deleting network_array
polymorphically. Now the boost::array is a member, even if the previous
hierarchy was valid according to the Liskov Substitution Principle.
- Uncommented the array initialization line at constructor. Have no clue why it
was commented, but it was emmiting an error in valgrind due uninitialized data
sent to socket.
Patch 4: type-punning-fix.patch
- Re declaring message::header as a opaque_header instead of an uint8_t pointer.
This avoids the type-punning and enforces better type checking. Also allow
optimization -O2 on GCC with strict-aliasing warning. Still requires to be
done in network_array.hpp.
Kind regards,
File Attachment: File Name:
patches.gzFile Size: 8576