diff options
author | bustico | 2011-01-26 15:29:29 +0000 |
---|---|---|
committer | bustico | 2011-01-26 15:29:29 +0000 |
commit | 8fda9a9ea3493a32983935daf634e05e4cc81355 (patch) | |
tree | cca7e390f604225e9fc5b09580428164f22f8d5b | |
parent | 018db51fa49c2761516f4377a4958a2ce5b91fe3 (diff) | |
download | ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.zip ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.gz ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.bz2 ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.xz |
- remove arbitrary limit of size on the send buffer
-rw-r--r-- | Ivy.cxx | 13 | ||||
-rw-r--r-- | Ivycpp.h | 3 |
2 files changed, 10 insertions, 6 deletions
@@ -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); } @@ -24,6 +24,7 @@ namespace IvyC #include <Ivy/ivysocket.h> #include <Ivy/ivy.h> + #include <Ivy/ivybuffer.h> } #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); |