Blame SOURCES/0017-Remove-the-unused-encoding-and-language-code-from-Ye.patch

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