<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 27, 2016 at 2:59 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">Le mardi 27 septembre 2016 14:09:30, Sean Gillies a écrit :<br>
> Hi all,<br>
><br>
> I've got code in Rasterio that calls VSIGetMemFileBuffer to get PNG or JPEG<br>
> image bytes. With GDAL 1.11, I found that I had to fix the resulting byte<br>
> array by moving the last byte to the head of the array. With GDAL 2.1.0 and<br>
> 2.1.1 this is no longer needed and we can return an unshifted array (see<br>
> the changeset below).<br>
><br>
> <a href="https://github.com/mapbox/rio-mbtiles/compare/master...brendan-ward:bad_byt" rel="noreferrer" target="_blank">https://github.com/mapbox/rio-<wbr>mbtiles/compare/master...<wbr>brendan-ward:bad_byt</a><br>
> es?expand=1#diff-<wbr>cfcb7125bae0f25564785b33fa38d6<wbr>a1L45<br>
><br>
> I haven't been able to find the change in the change log or tracker. Can<br>
> anyone point me to the commit that changed this so I can pin down the<br>
> versions when it changed?<br>
<br>
</span>Sean,<br>
<br>
This is super weird and I'm pretty sure nothing has changed in that area.<br>
VSIGetMemFileBuffer() has been used for long by a number of drivers in GDAL and<br>
none of them has ever had to do such weird things, so I'm quite skeptical<br>
there's a bug in that area, or it is something more subtle. Did you check that<br>
the issue is in GDAL itself, by breaking with the debugger or adding debug<br>
traces in VSIGetMemFileBuffer to check the buffer values ?<br>
<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>I have looked more closely and ruled out GDAL and then combed through the Cython and CPython trackers, eventually finding the culprit:</div><div><br></div><div>  <a href="https://bugs.python.org/issue12834">https://bugs.python.org/issue12834</a><br></div><div><br></div><div>It's been fixed in Python 3.3+ for several years but not fixed in 2.7 until version 2.7.10. I'm happy to report that it's specific to Cython memoryviews and not a problem for GDAL Python users.</div><div><br></div><div>Thanks for the quick response, Even, and apologies for the false alarm.</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Sean Gillies</div></div>
</div></div>