[epiphany] Silence -Wstring-op-truncation warning
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Silence -Wstring-op-truncation warning
- Date: Tue, 22 May 2018 03:30:41 +0000 (UTC)
commit 149921299dd5a0e480a802a23abd0ee9b42a1f29
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon May 21 22:29:07 2018 -0500
Silence -Wstring-op-truncation warning
It's a false positive, because we add the NUL on the next line, but
better to just fix the strncpy.
lib/ephy-string.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index a1ea6d4..2bd71a9 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -119,8 +119,7 @@ ephy_string_shorten (char *str,
new_str = g_new (gchar, bytes + strlen (ELLIPSIS) + 1);
strncpy (new_str, str, bytes);
- strncpy (new_str + bytes, ELLIPSIS, strlen (ELLIPSIS));
- new_str[bytes + strlen (ELLIPSIS)] = '\0';
+ strncpy (new_str + bytes, ELLIPSIS, strlen (ELLIPSIS) + 1);
g_free (str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]