summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/message.cc
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-12-27 18:45:11 -0600
committerJesse Luehrs <doy@tozt.net>2009-12-27 18:45:47 -0600
commit585dab9ccd0db72c6b76bddc3003f6f504fe9c3a (patch)
treefee30c3330bdd8bb70754540e137cbdc62956469 /crawl-ref/source/message.cc
parent892714e8a99eb74424a3a06ad69f45f84ac9e4ca (diff)
downloadcrawl-ref-585dab9ccd0db72c6b76bddc3003f6f504fe9c3a.tar.gz
crawl-ref-585dab9ccd0db72c6b76bddc3003f6f504fe9c3a.zip
remove mpr message length limitation
Diffstat (limited to 'crawl-ref/source/message.cc')
-rw-r--r--crawl-ref/source/message.cc15
1 files changed, 10 insertions, 5 deletions
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, ... )