Compare commits

..

5 Commits

Author SHA1 Message Date
28a3d42ad1 Bump to 2.14.1 2018-03-13 22:26:31 -04:00
eb942fc274 Revert "xtext: Always use Pango to get correct glyph width on Unix"
This reverts commit d3f1ab7813.

The performance even on Linux is just too poor in many cases.
2018-03-13 21:18:16 -04:00
27acca0f5b fix typo in comment
Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
2018-03-13 23:38:36 +00:00
ececf2f640 Fix fscanf() usage without size limit
Closes #2137
2018-03-11 19:08:26 -04:00
d72249d91f build: Remove -pie from global ldflags
According to `hardening-check` the cflag is enough for `hexchat`
and this was causing breakage in plugins

Closes #2132
2018-03-10 20:49:35 -05:00
5 changed files with 13 additions and 29 deletions

View File

@ -27,6 +27,14 @@
<id>hexchat.desktop</id>
</provides>
<releases>
<release date="2018-03-13" version="2.14.1">
<description>
<p>This is a very minor bug-fix release:</p>
<ul>
<li>Fix performance regression</li>
</ul>
</description>
</release>
<release date="2018-03-10" version="2.14.0">
<description>
<p>This is largely a bug fix release though it has some large behind the scenes changes:</p>

View File

@ -1,5 +1,5 @@
project('hexchat', 'c',
version: '2.14.0',
version: '2.14.1',
meson_version: '>= 0.38.0',
default_options: [
'c_std=gnu89',
@ -131,7 +131,6 @@ global_ldflags = []
test_ldflags = [
'-Wl,-z,relro',
'-Wl,-z,now',
'-Wl,-pie',
# mingw
'-Wl,--dynamicbase',
'-Wl,--nxcompat',

View File

@ -51,7 +51,7 @@ sub get_context;
sub HexChat::Internal::context_info;
sub HexChat::Internal::print;
#keep compability with Xchat scripts
#keep compatibility with Xchat scripts
sub EAT_XCHAT ();
BEGIN {
*Xchat:: = *HexChat::;

View File

@ -2010,7 +2010,7 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
else /* existing config file, get list of settings */
{
strcpy (dest, ""); /* clean up garbage */
while (fscanf (fpIn, " %[^\n]", bufp) != EOF) /* read whole lines including whitespaces */
while (fscanf (fpIn, " %511[^\n]", bufp) != EOF) /* read whole lines including whitespaces */
{
token = strtok (buffer, "=");
g_strlcat (dest, g_strchomp (token), 4096); /* Dest must not be smaller than this */

View File

@ -157,10 +157,7 @@ static char * gtk_xtext_get_word (GtkXText * xtext, int x, int y, textentry ** r
#define EMPH_BOLD 2
#define EMPH_HIDDEN 4
static PangoAttrList *attr_lists[4];
#ifdef G_OS_WIN32
/* the fontwidths variable is used on Windows only. */
static int fontwidths[4][128];
#endif
static PangoAttribute *
xtext_pango_attr (PangoAttribute *attr)
@ -173,10 +170,7 @@ xtext_pango_attr (PangoAttribute *attr)
static void
xtext_pango_init (GtkXText *xtext)
{
int i;
#ifdef G_OS_WIN32
int j;
#endif
int i, j;
char buf[2] = "\000";
if (attr_lists[0])
@ -208,7 +202,6 @@ xtext_pango_init (GtkXText *xtext)
break;
}
#ifdef G_OS_WIN32
/* Now initialize fontwidths[i] */
pango_layout_set_attributes (xtext->layout, attr_lists[i]);
for (j = 0; j < 128; j++)
@ -217,14 +210,8 @@ xtext_pango_init (GtkXText *xtext)
pango_layout_set_text (xtext->layout, buf, 1);
pango_layout_get_pixel_size (xtext->layout, &fontwidths[i][j], NULL);
}
#endif
}
/* re-compute space_width without using fontwidths */
pango_layout_set_attributes (xtext->layout, attr_lists[0]);
buf[0] = ' ';
pango_layout_set_text (xtext->layout, buf, 1);
pango_layout_get_pixel_size (xtext->layout, &(xtext->space_width), NULL);
xtext->space_width = fontwidths[0][' '];
}
static void
@ -302,10 +289,8 @@ static int
backend_get_text_width_emph (GtkXText *xtext, guchar *str, int len, int emphasis)
{
int width;
#ifdef G_OS_WIN32
int deltaw;
int mbl;
#endif
if (*str == 0)
return 0;
@ -316,8 +301,6 @@ backend_get_text_width_emph (GtkXText *xtext, guchar *str, int len, int emphasis
width = 0;
pango_layout_set_attributes (xtext->layout, attr_lists[emphasis]);
#ifdef G_OS_WIN32
while (len > 0)
{
mbl = charlen(str);
@ -332,12 +315,6 @@ backend_get_text_width_emph (GtkXText *xtext, guchar *str, int len, int emphasis
str += mbl;
len -= mbl;
}
#else
/* This code is slow on Windows,
but it will get the correct width from pango on Linux. */
pango_layout_set_text (xtext->layout, str, len);
pango_layout_get_pixel_size (xtext->layout, &width, NULL);
#endif
return width;
}