|
|
ad2f2b |
From 2b2fde7b980985c45ddbd77c935ce43350006810 Mon Sep 17 00:00:00 2001
|
|
|
ad2f2b |
From: Tomas Popela <tpopela@redhat.com>
|
|
|
ad2f2b |
Date: Fri, 12 Oct 2018 12:53:43 +0200
|
|
|
ad2f2b |
Subject: [PATCH 17/17] Remove the unused encoding and language code from
|
|
|
ad2f2b |
YelpManDocument
|
|
|
ad2f2b |
|
|
|
ad2f2b |
Error: UNUSED_VALUE (CWE-563): [#def25]
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:422: value_overwrite: Overwriting previous write to "encoding" with value from "langmap[i].encoding".
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:416: assigned_pointer: Assigning value from ""ISO-8859-1"" to "encoding" here, but that stored value is overwritten before it can be used.
|
|
|
ad2f2b |
414| encoding = g_getenv("MAN_ENCODING");
|
|
|
ad2f2b |
415| if (encoding == NULL)
|
|
|
ad2f2b |
416|-> encoding = "ISO-8859-1";
|
|
|
ad2f2b |
417|
|
|
|
ad2f2b |
418| if (language != NULL) {
|
|
|
ad2f2b |
|
|
|
ad2f2b |
Error: CLANG_WARNING: [#def26]
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:416:2: warning: Value stored to 'encoding' is never read
|
|
|
ad2f2b |
encoding = "ISO-8859-1";
|
|
|
ad2f2b |
^ ~~~~~~~~~~~~
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:416:2: note: Value stored to 'encoding' is never read
|
|
|
ad2f2b |
encoding = "ISO-8859-1";
|
|
|
ad2f2b |
^ ~~~~~~~~~~~~
|
|
|
ad2f2b |
414| encoding = g_getenv("MAN_ENCODING");
|
|
|
ad2f2b |
415| if (encoding == NULL)
|
|
|
ad2f2b |
416|-> encoding = "ISO-8859-1";
|
|
|
ad2f2b |
417|
|
|
|
ad2f2b |
418| if (language != NULL) {
|
|
|
ad2f2b |
|
|
|
ad2f2b |
Error: CLANG_WARNING: [#def27]
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:422:3: warning: Value stored to 'encoding' is never read
|
|
|
ad2f2b |
encoding = langmap[i].encoding;
|
|
|
ad2f2b |
^ ~~~~~~~~~~~~~~~~~~~
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-document.c:422:3: note: Value stored to 'encoding' is never read
|
|
|
ad2f2b |
encoding = langmap[i].encoding;
|
|
|
ad2f2b |
^ ~~~~~~~~~~~~~~~~~~~
|
|
|
ad2f2b |
420| for (i = 0; langmap[i].language != NULL; i++) {
|
|
|
ad2f2b |
421| if (g_str_equal (language, langmap[i].language)) {
|
|
|
ad2f2b |
422|-> encoding = langmap[i].encoding;
|
|
|
ad2f2b |
423| break;
|
|
|
ad2f2b |
424| }
|
|
|
ad2f2b |
---
|
|
|
ad2f2b |
libyelp/yelp-man-document.c | 75 -------------------------------------
|
|
|
ad2f2b |
1 file changed, 75 deletions(-)
|
|
|
ad2f2b |
|
|
|
ad2f2b |
diff --git a/libyelp/yelp-man-document.c b/libyelp/yelp-man-document.c
|
|
|
ad2f2b |
index ad7fab4f..a18248ca 100644
|
|
|
ad2f2b |
--- a/libyelp/yelp-man-document.c
|
|
|
ad2f2b |
+++ b/libyelp/yelp-man-document.c
|
|
|
ad2f2b |
@@ -61,62 +61,6 @@ struct _YelpManDocumentPrivate {
|
|
|
ad2f2b |
guint error;
|
|
|
ad2f2b |
};
|
|
|
ad2f2b |
|
|
|
ad2f2b |
-typedef struct _YelpLangEncodings YelpLangEncodings;
|
|
|
ad2f2b |
-struct _YelpLangEncodings {
|
|
|
ad2f2b |
- const gchar *language;
|
|
|
ad2f2b |
- const gchar *encoding;
|
|
|
ad2f2b |
-};
|
|
|
ad2f2b |
-/* http://www.w3.org/International/O-charset-lang.html */
|
|
|
ad2f2b |
-static const YelpLangEncodings langmap[] = {
|
|
|
ad2f2b |
- { "C", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "af", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "ar", "ISO-8859-6" },
|
|
|
ad2f2b |
- { "bg", "ISO-8859-5" },
|
|
|
ad2f2b |
- { "be", "ISO-8859-5" },
|
|
|
ad2f2b |
- { "ca", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "cs", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "da", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "de", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "el", "ISO-8859-7" },
|
|
|
ad2f2b |
- { "en", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "eo", "ISO-8859-3" },
|
|
|
ad2f2b |
- { "es", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "et", "ISO-8859-15" },
|
|
|
ad2f2b |
- { "eu", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "fi", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "fo", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "fr", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "ga", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "gd", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "gl", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "hu", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "id", "ISO-8859-1" }, /* is this right */
|
|
|
ad2f2b |
- { "mt", "ISO-8859-3" },
|
|
|
ad2f2b |
- { "is", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "it", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "iw", "ISO-8859-8" },
|
|
|
ad2f2b |
- { "ja", "EUC-JP" },
|
|
|
ad2f2b |
- { "ko", "EUC-KR" },
|
|
|
ad2f2b |
- { "lt", "ISO-8859-13" },
|
|
|
ad2f2b |
- { "lv", "ISO-8859-13" },
|
|
|
ad2f2b |
- { "mk", "ISO-8859-5" },
|
|
|
ad2f2b |
- { "mt", "ISO-8859-3" },
|
|
|
ad2f2b |
- { "no", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "pl", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "pt_BR", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "ro", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "ru", "KOI8-R" },
|
|
|
ad2f2b |
- { "sl", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "sr", "ISO-8859-2" }, /* Latin, not cyrillic */
|
|
|
ad2f2b |
- { "sk", "ISO-8859-2" },
|
|
|
ad2f2b |
- { "sv", "ISO-8859-1" },
|
|
|
ad2f2b |
- { "tr", "ISO-8859-9" },
|
|
|
ad2f2b |
- { "uk", "ISO-8859-5" },
|
|
|
ad2f2b |
- { "zh_CN", "BIG5" },
|
|
|
ad2f2b |
- { "zh_TW", "BIG5" },
|
|
|
ad2f2b |
- { NULL, NULL },
|
|
|
ad2f2b |
-};
|
|
|
ad2f2b |
-
|
|
|
ad2f2b |
static void yelp_man_document_finalize (GObject *object);
|
|
|
ad2f2b |
|
|
|
ad2f2b |
/* YelpDocument */
|
|
|
ad2f2b |
@@ -385,7 +329,6 @@ man_document_process (YelpManDocument *man)
|
|
|
ad2f2b |
gint params_i = 0;
|
|
|
ad2f2b |
gchar **params = NULL;
|
|
|
ad2f2b |
YelpManParser *parser;
|
|
|
ad2f2b |
- const gchar *language, *encoding;
|
|
|
ad2f2b |
|
|
|
ad2f2b |
file = yelp_uri_get_file (yelp_document_get_uri ((YelpDocument *) man));
|
|
|
ad2f2b |
if (file == NULL) {
|
|
|
ad2f2b |
@@ -407,24 +350,6 @@ man_document_process (YelpManDocument *man)
|
|
|
ad2f2b |
goto done;
|
|
|
ad2f2b |
}
|
|
|
ad2f2b |
|
|
|
ad2f2b |
- /* FIXME: get the language */
|
|
|
ad2f2b |
- language = "C";
|
|
|
ad2f2b |
-
|
|
|
ad2f2b |
- /* default encoding if the language doesn't match below */
|
|
|
ad2f2b |
- encoding = g_getenv("MAN_ENCODING");
|
|
|
ad2f2b |
- if (encoding == NULL)
|
|
|
ad2f2b |
- encoding = "ISO-8859-1";
|
|
|
ad2f2b |
-
|
|
|
ad2f2b |
- if (language != NULL) {
|
|
|
ad2f2b |
- gint i;
|
|
|
ad2f2b |
- for (i = 0; langmap[i].language != NULL; i++) {
|
|
|
ad2f2b |
- if (g_str_equal (language, langmap[i].language)) {
|
|
|
ad2f2b |
- encoding = langmap[i].encoding;
|
|
|
ad2f2b |
- break;
|
|
|
ad2f2b |
- }
|
|
|
ad2f2b |
- }
|
|
|
ad2f2b |
- }
|
|
|
ad2f2b |
-
|
|
|
ad2f2b |
parser = yelp_man_parser_new ();
|
|
|
ad2f2b |
priv->xmldoc = yelp_man_parser_parse_file (parser, filepath, &error);
|
|
|
ad2f2b |
yelp_man_parser_free (parser);
|
|
|
ad2f2b |
--
|
|
|
ad2f2b |
2.19.1
|
|
|
ad2f2b |
|