Allow many large messages

This commit is contained in:
Felix Brucker 2018-10-02 21:08:13 +02:00 committed by Jan Vidar Krey
parent e43aea35cc
commit 99711a5c6e
2 changed files with 5 additions and 4 deletions

View File

@ -26,7 +26,7 @@
#include "util/list.h" #include "util/list.h"
#include "util/cbuffer.h" #include "util/cbuffer.h"
#define MAX_HISTORY_SIZE 16384 #define MAX_HISTORY_SIZE 614400
struct chat_history_data struct chat_history_data
{ {

View File

@ -20,6 +20,7 @@
#include "uhub.h" #include "uhub.h"
#define CBUF_FLAG_CONST_BUFFER 0x01 #define CBUF_FLAG_CONST_BUFFER 0x01
#define MAX_MSG_LEN 16384
struct cbuffer struct cbuffer
{ {
@ -86,19 +87,19 @@ void cbuf_append(struct cbuffer* buf, const char* msg)
void cbuf_append_format(struct cbuffer* buf, const char* format, ...) void cbuf_append_format(struct cbuffer* buf, const char* format, ...)
{ {
static char tmp[1024]; static char tmp[MAX_MSG_LEN];
va_list args; va_list args;
int bytes; int bytes;
uhub_assert(buf->flags == 0); uhub_assert(buf->flags == 0);
va_start(args, format); va_start(args, format);
bytes = vsnprintf(tmp, 1024, format, args); bytes = vsnprintf(tmp, sizeof(tmp), format, args);
va_end(args); va_end(args);
cbuf_append_bytes(buf, tmp, bytes); cbuf_append_bytes(buf, tmp, bytes);
} }
void cbuf_append_strftime(struct cbuffer* buf, const char* format, const struct tm* tm) void cbuf_append_strftime(struct cbuffer* buf, const char* format, const struct tm* tm)
{ {
static char tmp[1024]; static char tmp[MAX_MSG_LEN];
int bytes; int bytes;
uhub_assert(buf->flags == 0); uhub_assert(buf->flags == 0);
bytes = strftime(tmp, sizeof(tmp), format, tm); bytes = strftime(tmp, sizeof(tmp), format, tm);