Skip to content

Commit 1516d47

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
fix: Get*Vector returns int32 size instead of error
The C API returns size in bytes (>=0) or KEY_NOT_FOUND (-1). Callers need the size for the two-call pattern (first call with nil buffer to get required size). The previous error mapping discarded this value.
1 parent bd5cee3 commit 1516d47

2 files changed

Lines changed: 32 additions & 12 deletions

File tree

persistablebundle/persistable_bundle.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/overlays/persistablebundle.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ functions:
3636
output_params:
3737
outBundle: "*PersistableBundle"
3838

39+
# Get*Vector functions return size in bytes (>=0) or APERSISTABLEBUNDLE_KEY_NOT_FOUND (-1).
40+
# Use pure:true so callers get the size back (needed for the two-call pattern:
41+
# first call with nil buffer to get required size, second call to fill buffer).
42+
APersistableBundle_getBooleanVector:
43+
receiver: PersistableBundle
44+
go_name: GetBooleanVector
45+
pure: true
46+
APersistableBundle_getIntVector:
47+
receiver: PersistableBundle
48+
go_name: GetIntVector
49+
pure: true
50+
APersistableBundle_getLongVector:
51+
receiver: PersistableBundle
52+
go_name: GetLongVector
53+
pure: true
54+
APersistableBundle_getDoubleVector:
55+
receiver: PersistableBundle
56+
go_name: GetDoubleVector
57+
pure: true
58+
3959
# Skip: takes const char* const* which is complex to wrap idiomatically
4060
APersistableBundle_putStringVector:
4161
skip: true

0 commit comments

Comments
 (0)