[Development] Bug in qtimageformats WBMP plugin
Samuel Gaist
samuel.gaist at edeltech.ch
Wed Mar 15 10:15:46 CET 2017
> On 15 Mar 2017, at 10:04, Michał 'Khorne' Lowas-Rzechonek <michalrz at socialbicycles.com> wrote:
>
> Hi,
>
> I know that WBMP is not a popular format since WAP is long dead, but in our application it's useful for transferring small bitmaps over a serial bus.
>
> I've noticed there is a bug in the implementation when the bitmap dimensions are multiples of 128. In such cases, variable-length integer should be encoded as 2 bytes, not 1.
>
> I've never contributed to Qt so I don't know where am I supposed to send the patch... It's actually very simple:
>
>
> diff --git a/src/plugins/imageformats/wbmp/qwbmphandler.cpp b/src/plugins/imageformats/wbmp/qwbmphandler.cpp
> index cd9b04a..d2dec87 100644
> --- a/src/plugins/imageformats/wbmp/qwbmphandler.cpp
> +++ b/src/plugins/imageformats/wbmp/qwbmphandler.cpp
> @@ -81,6 +81,7 @@ static bool readMultiByteInt(QIODevice *iodev, quint32 *num)
>
> static bool writeMultiByteInt(QIODevice *iodev, quint32 num)
> {
> + quint8 width = 1;
> quint64 tmp = num & 0x7F;
> num >>= 7;
>
> @@ -88,13 +89,15 @@ static bool writeMultiByteInt(QIODevice *iodev, quint32 num)
> quint8 c = num & 0x7F;
> num = num >> 7;
> tmp = (tmp << 8) | (c | 0x80);
> + width += 1;
> }
>
> - while (tmp) {
> + while (width) {
> quint8 c = tmp & 0xFF;
> if (!iodev->putChar(c))
> return false;
> tmp >>= 8;
> + width -= 1;
> }
> return true;
> }
>
> cheers
> --
> Michał 'Khorne' Lowas-Rzechonek
> Social Bicycles Inc.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
Hi and thanks for contributing !
You can find the documentation here:
https://wiki.qt.io/Gerrit_Introduction
on how to get up and running with code contributions.
Cheers
Samuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170315/5a40a998/attachment.sig>
More information about the Development
mailing list