From 8b979454d891b84da727a329906c4293fadc5f3c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 18 Mar 2018 12:46:31 -0700 Subject: fixes #295 boolean options should use C99 bool type fixes #275 nng_pipe_getopt_ptr() missing? fixes #285 nng_setopt_ptr MIS fixes #297 nng_listener/dialer_close does not validate mode This change adds some missing APIs, and changes others. In particular, certain options are now of type bool, with size of just one. This is a *breaking* change for code that uses those options -- NNG_OPT_RAW, NNG_OPT_PAIR1_POLY, NNG_OPT_TLS_VERIFIED. --- src/protocol/pair0/pair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/protocol/pair0') diff --git a/src/protocol/pair0/pair.c b/src/protocol/pair0/pair.c index d3591df9..9e9dfe10 100644 --- a/src/protocol/pair0/pair.c +++ b/src/protocol/pair0/pair.c @@ -36,7 +36,7 @@ struct pair0_sock { pair0_pipe *ppipe; nni_msgq * uwq; nni_msgq * urq; - int raw; + bool raw; nni_mtx mtx; }; @@ -63,7 +63,7 @@ pair0_sock_init(void **sp, nni_sock *nsock) } nni_mtx_init(&s->mtx); s->ppipe = NULL; - s->raw = 0; + s->raw = false; s->uwq = nni_sock_sendq(nsock); s->urq = nni_sock_recvq(nsock); *sp = s; @@ -235,14 +235,14 @@ static int pair0_sock_setopt_raw(void *arg, const void *buf, size_t sz) { pair0_sock *s = arg; - return (nni_setopt_int(&s->raw, buf, sz, 0, 1)); + return (nni_setopt_bool(&s->raw, buf, sz)); } static int pair0_sock_getopt_raw(void *arg, void *buf, size_t *szp) { pair0_sock *s = arg; - return (nni_getopt_int(s->raw, buf, szp)); + return (nni_getopt_bool(s->raw, buf, szp)); } static void -- cgit v1.2.3-70-g09d2