From 5c61f80c4165392e8db6b18d72a3be1f2e042cc4 Mon Sep 17 00:00:00 2001 From: Philip Kovacs Date: Thu, 9 Nov 2006 00:33:46 +0000 Subject: [PATCH] add new config item - max_user_text - to allow for large config files git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@741 7f574dfc-610e-0410-a909-a81674777703 --- ChangeLog | 12 +++++++++--- src/conky.c | 11 ++++++++++- src/conky.h | 3 +++ syntax/vim/syntax/conkyrc.vim | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d48f159..6b0267d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,23 @@ # $Id$ -2006-11-07 pkovacs +2006-11-08 + * Added new config item 'max_user_text' with default 16384, + twice as large as previous hard-coded default of 8192 bytes. + Increase as needed to accomodate large config files with a + great deal of text. This closes SF bug #1574523. + +2006-11-07 * Changes to configure.ac for pkg-config on x11/xext/xdamage, with fallback to conventional checks. * Fixed segmentation fault on SUGUSR1 bug. * Commented out Imlib2 from configure.ac since it's only partially implemented. -2006-11-04 pkovacs +2006-11-04 * Removed broken mldonkey and seti support. * Added Hellf[i]re's nano syntax coloring script to svn. -2006-11-03 pkovacs +2006-11-03 * Removed support for Xmms, BMP and Infopipe from conky. The Xmms and Bmp players are projects are dead and distros such as Gentoo are slating them for removal. diff --git a/src/conky.c b/src/conky.c index ed447761..a95cd9a0 100644 --- a/src/conky.c +++ b/src/conky.c @@ -311,6 +311,9 @@ static int background_colour = 0; static int fixed_size = 0, fixed_pos = 0; #endif +/* maximum size of config TEXT buffer, i.e. below TEXT line. */ +static unsigned int max_user_text = MAX_USER_TEXT_DEFAULT; + static int minimum_width, minimum_height; static int maximum_width; @@ -6579,6 +6582,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) CONF("uppercase") { stuff_in_upper_case = string_to_bool(value); } + CONF("max_user_text") { + if (value) + max_user_text = atoi(value); + else + CONF_ERR; + } CONF("text") { if (text != original_text) free(text); @@ -6598,7 +6607,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) + 1); strcat(text, buf); - if (strlen(text) > 1024 * 8) + if (strlen(text) > max_user_text) break; } fclose(fp); diff --git a/src/conky.h b/src/conky.h index 31e32688..b8625bae 100644 --- a/src/conky.h +++ b/src/conky.h @@ -48,6 +48,9 @@ #define TEXT_BUFFER_SIZE 1280 #define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2) +/* maximum size of config TEXT buffer, i.e. below TEXT line. */ +#define MAX_USER_TEXT_DEFAULT 16384 + #include #define ERR(s, varargs...) \ diff --git a/syntax/vim/syntax/conkyrc.vim b/syntax/vim/syntax/conkyrc.vim index e4fcc6c2..1a000714 100644 --- a/syntax/vim/syntax/conkyrc.vim +++ b/syntax/vim/syntax/conkyrc.vim @@ -31,6 +31,7 @@ syn keyword ConkyrcSetting \ gap_x \ gap_y \ mail_spool + \ max_user_text \ maximum_width \ minimum_size \ min_port_monitor_connections