From 585dab9ccd0db72c6b76bddc3003f6f504fe9c3a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 27 Dec 2009 18:45:11 -0600 Subject: remove mpr message length limitation --- crawl-ref/source/message.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/message.cc') diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 6a3d36c487..a6adba6847 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -413,12 +413,17 @@ int channel_to_colour( msg_channel_type channel, int param ) static void do_message_print( msg_channel_type channel, int param, const char *format, va_list argp ) { - // Is this limit intentional? char buff[200]; - vsnprintf( buff, sizeof( buff ), format, argp ); - buff[199] = 0; - - mpr(buff, channel, param); + size_t len = vsnprintf( buff, sizeof( buff ), format, argp ); + if (len < sizeof( buff )) { + mpr( buff, channel, param ); + } + else { + char *heapbuf = (char*)malloc( len + 1 ); + vsnprintf( heapbuf, len + 1, format, argp ); + mpr( heapbuf, channel, param ); + free( heapbuf ); + } } void mprf( msg_channel_type channel, int param, const char *format, ... ) -- cgit v1.2.3-54-g00ecf