From 8fda9a9ea3493a32983935daf634e05e4cc81355 Mon Sep 17 00:00:00 2001 From: bustico Date: Wed, 26 Jan 2011 15:29:29 +0000 Subject: - remove arbitrary limit of size on the send buffer --- Ivy.cxx | 13 ++++++++----- Ivycpp.h | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Ivy.cxx b/Ivy.cxx index f737c4a..b4150c6 100644 --- a/Ivy.cxx +++ b/Ivy.cxx @@ -231,15 +231,18 @@ void Ivy::BindDirectMsg(IvyDirectMessageCallback *callback) # .____) | | __/ | | | | | (_| | | | | | \__ \ __/ | # \_____/ \___| |_| |_| \__,_| |_| |_| |___/ |___/ */ -int Ivy::SendMsg(const char * message, ... ) +int Ivy::SendMsg(const char *fmt, ... ) { - char buffer[4096]; + static IvyC::IvyBuffer buffer = { NULL, 0, 0}; /* Use static mem to eliminate multiple call + to malloc/free */ va_list args; - va_start( args, message ); /* Initialize variable arguments. */ - vsnprintf( buffer, sizeof (buffer), message, args ); + va_start( args, fmt ); /* Initialize variable arguments. */ + buffer.offset = 0; + make_message( &buffer, fmt, args ); va_end( args); - return IvyC::IvySendMsg (buffer); + + return IvyC::IvySendMsg (buffer.data); } diff --git a/Ivycpp.h b/Ivycpp.h index c78f19e..55a429d 100644 --- a/Ivycpp.h +++ b/Ivycpp.h @@ -24,6 +24,7 @@ namespace IvyC #include #include + #include } #include "IvyCallback.h" @@ -49,7 +50,7 @@ public: __attribute__((format(printf,2,3))); static void UnbindMsg( int id ); - static int SendMsg(const char * message, ... ) + static int SendMsg(const char *fmt, ... ) __attribute__((format(printf,1,2))) ; static void SendDirectMsg( IvyApplication *app, int id, const char *message); -- cgit v1.1