[Asterisk-code-review] iostream: Fix ast iostream printf declaration. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Mon Nov 20 11:54:07 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7280 )

Change subject: iostream: Fix ast_iostream_printf declaration.
......................................................................

iostream: Fix ast_iostream_printf declaration.

This adds the printf attribute and changes 'fmt' from 'const void *' to
'const char *'.  This resolves a warning from some compiler for
vsnprintf needing a literal string for format.

Change-Id: I71c33a8262590042ee451e1146760c10bb22fb78
---
M include/asterisk/iostream.h
M main/iostream.c
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h
index c641ffb..e9816ac 100644
--- a/include/asterisk/iostream.h
+++ b/include/asterisk/iostream.h
@@ -109,7 +109,8 @@
 ssize_t ast_iostream_gets(struct ast_iostream *stream, char *buf, size_t count);
 ssize_t ast_iostream_discard(struct ast_iostream *stream, size_t count);
 ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t count);
-ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...);
+ssize_t __attribute__((format(printf, 2, 3))) ast_iostream_printf(
+	struct ast_iostream *stream, const char *fmt, ...);
 
 struct ast_iostream* ast_iostream_from_fd(int *fd);
 int ast_iostream_start_tls(struct ast_iostream **stream, SSL_CTX *ctx, int client);
diff --git a/main/iostream.c b/main/iostream.c
index 2a2601d..d918633 100644
--- a/main/iostream.c
+++ b/main/iostream.c
@@ -443,7 +443,7 @@
 	}
 }
 
-ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...)
+ssize_t ast_iostream_printf(struct ast_iostream *stream, const char *fmt, ...)
 {
 	char sbuf[512], *buf = sbuf;
 	int len, len2, ret = -1;

-- 
To view, visit https://gerrit.asterisk.org/7280
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I71c33a8262590042ee451e1146760c10bb22fb78
Gerrit-Change-Number: 7280
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171120/568e9289/attachment.html>


More information about the asterisk-code-review mailing list