Replace ULONG_MAX usage with numeric_limits<uint32_t>::max() to avoid a compilation warning.
Compilation warning fixes.
Fix a crash where the custom handler was used even though a) we parsed a known message, and b) no custom handlers were installed.
Fixed potential crash when setting custom elements (thanks Marco Nilsson!); various cosmetic and integer sign/size fixes