<div dir="ltr">Thanks very much for the help on this!  Greatly appreciated!<div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 18, 2023 at 10:38 AM Even Rouault via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Le 18/12/2023 à 16:18, Andrew C Aitchison via gdal-dev a écrit :<br>
> On Mon, 18 Dec 2023, Even Rouault via gdal-dev wrote:<br>
><br>
>> Hi,<br>
>><br>
>> interesting question. No easy answer as it is highly driver <br>
>> dependent. I believe that all drivers make sure that the content of <br>
>> the buffer before and after the call is the same, but some drivers <br>
>> might temporarily modify it, to do byte swapping. For example the HFA <br>
>> driver does that when run on big-endian hosts for non-Byte data type. <br>
>> I wouldn't exclude that for formats with MSB-byte ordering, a similar <br>
>> situation would happen for little endian hosts. So it is definitely <br>
>> not safe to use WriteBlock() with a buffer that would come from a <br>
>> read-only section of the calling program. Doc updated to reflect that <br>
>> in <br>
>> <a href="https://github.com/OSGeo/gdal/commit/ea321723dfc69ef3a422b1e3fe4dc9ee0832861d" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/commit/ea321723dfc69ef3a422b1e3fe4dc9ee0832861d</a><br>
><br>
> Did you mean to say<br>
>   Note that even with eRWFlag==GF_Write, the content of the buffer<br>
>   might be temporarily modified during the execution of this method<br>
>   (and eventually restored back to its original content), so it is not<br>
>   safe to use a buffer stored in a read-only section of the calling<br>
>   program.<br>
<br>
Yes I meant that. I've less evidence in the RasterIO(GF_Write, ...) case <br>
than in the WriteBlock() case, but without checking all drivers, it is <br>
more prudent to assume that the buffer might be touched during <br>
RasterIO(GF_Write) by some drivers.<br>
<br>
<br>
-- <br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
My software is free, but my time generally not.<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>

<br>
<font face="Verdana" color="#808080" size="1">The content of this email is intended for the person or entity to which it is addressed only. This email may contain confidential information. If you are not the person to whom this message is addressed, be aware that any use, reproduction, or distribution of this message is strictly prohibited. If you received this in error, please contact the sender and immediately delete this email and any attachments.</font><br>