Skip to content

Answer the extended WKB of a geometry as the buffer it is - #40

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/the-ewkb-buffer-states-its-own-length
Sep 3, 2026
Merged

Answer the extended WKB of a geometry as the buffer it is#40
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/the-ewkb-buffer-states-its-own-length

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The catalog states size as the parameter MEOS writes the length of
geo_as_ewkb's buffer into, so the method reads it: AsEWKB(string endian)
answers a byte[] exactly as long as the data, joining the twenty-eight other
buffers the layer already folds that way. The length is the whole of it — an
extended WKB buffer carries no terminator and no length of its own, so a caller
holding the pointer without it has no way to say where the geometry ends.

The layer emits 1353 methods over 115 classes with 7 deferred. Its own test
reads the hex form of the same geometry as an independent statement of the same
length: AsHexewkb answers a string of exactly twice as many characters, and
hex-encoding the buffer reproduces it character for character, so a buffer of
the wrong length fails on the count before it fails on the content. The second
test round-trips the bytes back through FromEWKB to the value they came from.

The catalog states `size` as the parameter MEOS writes the length of
`geo_as_ewkb`'s buffer into, so the method reads it: `AsEWKB(string endian)`
answers a `byte[]` exactly as long as the data, joining the twenty-eight other
buffers the layer already folds that way. The length is the whole of it — an
extended WKB buffer carries no terminator and no length of its own, so a caller
holding the pointer without it has no way to say where the geometry ends.

The layer emits 1353 methods over 115 classes with 7 deferred. Its own test
reads the hex form of the same geometry as an independent statement of the same
length: `AsHexewkb` answers a string of exactly twice as many characters, and
hex-encoding the buffer reproduces it character for character, so a buffer of
the wrong length fails on the count before it fails on the content. The second
test round-trips the bytes back through `FromEWKB` to the value they came from.
@estebanzimanyi
estebanzimanyi merged commit 9e2a92b into MobilityDB:main Sep 3, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the feat/the-ewkb-buffer-states-its-own-length branch September 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant