Update QRingBuffer by recent version from qtbase

Fix some issues. Optimized for size and speed.

Change-Id: Ie7b55e3f01fb088999d3a5b10d0d941934fda162
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>