summaryrefslogtreecommitdiffstats
path: root/pb_encode.h
diff options
context:
space:
mode:
Diffstat (limited to 'pb_encode.h')
-rw-r--r--pb_encode.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/pb_encode.h b/pb_encode.h
index 85a82973..69b88e86 100644
--- a/pb_encode.h
+++ b/pb_encode.h
@@ -32,7 +32,17 @@ extern "C" {
*/
struct _pb_ostream_t
{
+#ifdef PB_BUFFER_ONLY
+ /* Callback pointer is not used in buffer-only configuration.
+ * Having an int pointer here allows binary compatibility but
+ * gives an error if someone tries to assign callback function.
+ * Also, NULL pointer marks a 'sizing stream' that does not
+ * write anything.
+ */
+ int *callback;
+#else
bool (*callback)(pb_ostream_t *stream, const uint8_t *buf, size_t count);
+#endif
void *state; /* Free field for use by callback implementation */
size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */
size_t bytes_written;