<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>interesting question. No easy answer as it is highly driver
dependent. I believe that all drivers make sure that the content
of the buffer before and after the call is the same, but some
drivers might temporarily modify it, to do byte swapping. For
example the HFA driver does that when run on big-endian hosts for
non-Byte data type. I wouldn't exclude that for formats with
MSB-byte ordering, a similar situation would happen for little
endian hosts. So it is definitely not safe to use WriteBlock()
with a buffer that would come from a read-only section of the
calling program. Doc updated to reflect that in
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/commit/ea321723dfc69ef3a422b1e3fe4dc9ee0832861d">https://github.com/OSGeo/gdal/commit/ea321723dfc69ef3a422b1e3fe4dc9ee0832861d</a><br>
</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 17/12/2023 à 23:09, Fitch, Simeon
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAAsstvG0Weg859GaiwZnvV1JQDNsidPhaeMBfrun3j_jaNSKkw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>The last argument to function `CPLErr
GDALWriteBlock(GDALRasterBandH, int, int, void*)`,
pointing to the block array, is not `const`. I can't find
anything in the documentation discussing ownership, etc.
but need to know what kind of invariants can be assumed
here.</div>
<div><br>
</div>
<div>Are there (driver dependent?) circumstances where
`GDALWriteBlock` will mutate the given array, or can
callers assume it's effectively `const void*`?<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Simeon</div>
</div>
</div>
</div>
<br>
<font size="1" face="Verdana" color="#808080">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>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>