Skip to content

cbortojson: adapt to work with picolibc's variant of funopen - #341

Merged
thiagomacieira merged 1 commit into
intel:mainfrom
thiagomacieira:cbortojson_adapt_to_work_with_picolibc_s_variant_of_funopen_
Oct 19, 2026
Merged

thiagomacieira merged 1 commit into
intel:mainfrom
thiagomacieira:cbortojson_adapt_to_work_with_picolibc_s_variant_of_funopen_

Conversation

@thiagomacieira

Copy link
Copy Markdown
Member

Instead of matching the API first introduced by 4.4BSD, picolibc decided to be different.

tinycbor/src/open_memstream.c:103:29: error: passing argument 3 of 'funopen' from incompatible pointer type [-Wincompatible-pointer-types]
  103 |     return funopen(b, NULL, write_to_buffer, NULL, close_buffer);
      |                             ^~~~~~~~~~~~~~~
      |                             |
      |                             RetType (*)(void *, const char *, LenType) {aka int (*)(void *, const char *, int)}

In file included from tinycbor/src/open_memstream.c:31:
picolibc/include/stdio.h:429:28: note: expected '_ssize_t (*)(void *, const void *, size_t)' {aka 'int (*)(void *, const void *, unsigned int)'} but argument is of type 'RetType (*)(void *, const char *, LenType)' {aka 'int (*)(void *, const char *, int)'}
  429 |                 _ssize_t (*writefn)(void *cookie, const void *buf, size_t n),
      |

Instead of matching the API first introduced by 4.4BSD, picolibc decided
to be different.

```
tinycbor/src/open_memstream.c:103:29: error: passing argument 3 of 'funopen' from incompatible pointer type [-Wincompatible-pointer-types]
  103 |     return funopen(b, NULL, write_to_buffer, NULL, close_buffer);
      |                             ^~~~~~~~~~~~~~~
      |                             |
      |                             RetType (*)(void *, const char *, LenType) {aka int (*)(void *, const char *, int)}

In file included from tinycbor/src/open_memstream.c:31:
picolibc/include/stdio.h:429:28: note: expected '_ssize_t (*)(void *, const void *, size_t)' {aka 'int (*)(void *, const void *, unsigned int)'} but argument is of type 'RetType (*)(void *, const char *, LenType)' {aka 'int (*)(void *, const char *, int)'}
  429 |                 _ssize_t (*writefn)(void *cookie, const void *buf, size_t n),
      |
```

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
@thiagomacieira
thiagomacieira merged commit 3076486 into intel:main Oct 19, 2026
9 checks passed
@thiagomacieira
thiagomacieira deleted the cbortojson_adapt_to_work_with_picolibc_s_variant_of_funopen_ branch October 19, 2026 18:55
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