[Qgis-developer] QgsRasterBlock.setColor(size_t, QRgb) in SIP
Radim Blazek
radim.blazek at gmail.com
Wed Oct 23 11:32:27 PDT 2013
On Wed, Oct 23, 2013 at 7:07 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> Hi Radim
>
> On Wed, Oct 23, 2013 at 10:02 PM, Radim Blazek <radim.blazek at gmail.com> wrote:
>> I have a strange problem,
>> block = QgsRasterBlock ( QGis.ARGB32_Premultiplied, 10, 10, 0 )
>> block.setColor( 0, QColor ().rgb() )
>> prints warning when run in QGIS Python shell (in QGIS debug output,
>> not in shell):
>> qgsrasterblock.cpp: 378: (setColor) index 140703128616960 out of range
Thanks for test,
> When I enter those two lines into QGIS python console, it work fine
> (no debug output, result of setColor() call is True). Tested on linux
> 64bit, QGIS master (debug), SIP v4.15.2.
could you also test if you get the right value from block back
block.color( index )
and with indexes > 0
> Otherwise I do not really have an idea what goes wrong there (btw. the
> index is an interesting number - in hex it is 0x7ff800000000
it does not seem to be really correct
> - maybe it is not handling size_t type correctly?
yes, size_t seems to be the problem, it is not defined in qgsrasterblock.sip,
probably the definition from qgsgeometry.sip is used:
%If (WS_MACX)
typedef unsigned long size_t;
%End
%If (WS_X11 || WS_WIN)
typedef unsigned int size_t;
%End
which does not seem to be very robust. BTW, how to define such things
correctly, in each sip file or globally in another sip file for all?
> what if you change that
> "size_t" argument in .sip file to something else?)
With int it works.
Radim
> Martin
More information about the Qgis-developer
mailing list