| 1 | |
| 2 | /* |
| 3 | * Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | * |
| 20 | * Authors: |
| 21 | * Lukas Kuklinek <[email protected]> |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | * text.c |
| 26 | * |
| 27 | * Created on: Jan 14, 2010 |
| 28 | * Author: david.niemoller |
| 29 | */ |
| 30 | |
| 31 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 32 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 33 | #endif |
| 34 | |
| 35 | #include <string.h> |
| 36 | #include <stdio.h> |
| 37 | |
| 38 | #include "text_priv.h"cxx . . $ `<file>/src/common/text_priv.h`/ |
| 39 | #include "util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 40 | #include "list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 41 | #include "oscap_helpers.h"cxx . . $ `<file>/src/common/public/oscap_helpers.h`/ |
| 42 | |
| 43 | const char * const OSCAP_LANG_ENGLISHcxx . . $ OSCAP_LANG_ENGLISH. = "en"; |
| 44 | const char * const OSCAP_LANG_ENGLISH_UScxx . . $ OSCAP_LANG_ENGLISH_US. = "en-US"; |
| 45 | const char * const OSCAP_LANG_DEFAULTcxx . . $ OSCAP_LANG_DEFAULT. = "en-US"; |
| 46 | |
| 47 | const struct oscap_text_traitscxx . . $ oscap_text_traits# OSCAP_TEXT_TRAITS_PLAINcxx . . $ OSCAP_TEXT_TRAITS_PLAIN. = { .html = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! }; |
| 48 | const struct oscap_text_traitscxx . . $ oscap_text_traits# OSCAP_TEXT_TRAITS_HTMLcxx . . $ OSCAP_TEXT_TRAITS_HTML. = { .html = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }; |
| 49 | |
| 50 | |
| 51 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(oscap_text, text) |
| 52 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(oscap_text, lang) |
| 53 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, oscap_text, is_html, traits.html) |
| 54 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, oscap_text, can_substitute, traits.can_substitute) |
| 55 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, oscap_text, can_override, traits.can_override) |
| 56 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, oscap_text, overrides, traits.overrides) |
| 57 | OSCAP_ITERATOR_GEN_Tcxx . . $ `src/common/util.h:122:9`!(struct oscap_text *, oscap_text) |
| 58 | /*OSCAP_ITERATOR_RESET(oscap_text)*/ |
| 59 | OSCAP_ITERATOR_REMOVE_Tcxx . . $ `src/common/util.h:125:9`!(struct oscap_text *, oscap_text, oscap_text_free) |
| 60 | |
| 61 | |
| 62 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_set_overridescxx . . $ oscap_text_set_overrides(bd5be5ab3abf8282).(struct oscap_textcxx . . $ oscap_text# *text, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! overrides) |
| 63 | { |
| 64 | text->traitscxx . . $ oscap_text#traits..overridescxx . . $ oscap_text_traits#overrides. = overrides; |
| 65 | return text->traitscxx . . $ oscap_text#traits..can_overridecxx . . $ oscap_text_traits#can_override.; |
| 66 | } |
| 67 | |
| 68 | void oscap_text_freecxx . . $ oscap_text_free(c2630df24779e845).(struct oscap_textcxx . . $ oscap_text# *text) |
| 69 | { |
| 70 | if (text != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 71 | freecxx . . $ free(5d22bdacc48458e8).(text->langcxx . . $ oscap_text#lang.); |
| 72 | freecxx . . $ free(5d22bdacc48458e8).(text->textcxx . . $ oscap_text#text.); |
| 73 | freecxx . . $ free(5d22bdacc48458e8).(text); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | struct oscap_textcxx . . $ oscap_text# *oscap_text_new_fullcxx . . $ oscap_text_new_full(c8482059268dd5a5).(struct oscap_text_traitscxx . . $ oscap_text_traits# traits, const char *string, const char *lang) |
| 78 | { |
| 79 | struct oscap_textcxx . . $ oscap_text# *text = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct oscap_textcxx . . $ oscap_text#)); |
| 80 | text->traitscxx . . $ oscap_text#traits. = traits; |
| 81 | text->textcxx . . $ oscap_text#text. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(string); |
| 82 | text->langcxx . . $ oscap_text#lang. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(lang); |
| 83 | return text; |
| 84 | } |
| 85 | |
| 86 | |
| 87 | struct oscap_textcxx . . $ oscap_text# *oscap_text_newcxx . . $ oscap_text_new(b563511806f9674e).(void) |
| 88 | { |
| 89 | return oscap_text_new_fullcxx . . $ oscap_text_new_full(c8482059268dd5a5).(OSCAP_TEXT_TRAITS_PLAINcxx . . $ OSCAP_TEXT_TRAITS_PLAIN., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 90 | } |
| 91 | |
| 92 | struct oscap_textcxx . . $ oscap_text# * oscap_text_clonecxx . . $ oscap_text_clone(ca1982dd7fd7b6b0).(const struct oscap_textcxx . . $ oscap_text# * text) |
| 93 | { |
| 94 | return oscap_text_new_fullcxx . . $ oscap_text_new_full(c8482059268dd5a5).(text->traitscxx . . $ oscap_text#traits., text->textcxx . . $ oscap_text#text., text->langcxx . . $ oscap_text#lang.); |
| 95 | } |
| 96 | |
| 97 | struct oscap_textcxx . . $ oscap_text# *oscap_text_new_htmlcxx . . $ oscap_text_new_html(b563511806f9674e).(void) |
| 98 | { |
| 99 | //assert(false); // TODO implement |
| 100 | return oscap_text_new_fullcxx . . $ oscap_text_new_full(c8482059268dd5a5).(OSCAP_TEXT_TRAITS_HTMLcxx . . $ OSCAP_TEXT_TRAITS_HTML., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 101 | } |
| 102 | |
| 103 | struct oscap_textcxx . . $ oscap_text# *oscap_text_new_parsecxx . . $ oscap_text_new_parse(fc91cb6a8c9d272a).(struct oscap_text_traitscxx . . $ oscap_text_traits# traits, xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 104 | { |
| 105 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(reader != NULL); |
| 106 | |
| 107 | // new text |
| 108 | struct oscap_textcxx . . $ oscap_text# *text = oscap_text_new_fullcxx . . $ oscap_text_new_full(c8482059268dd5a5).(traits, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 109 | |
| 110 | // extract 'override' attribute |
| 111 | if (text->traitscxx . . $ oscap_text#traits..can_overridecxx . . $ oscap_text_traits#can_override.) { |
| 112 | xmlTextReaderMoveToAttributecxx . . $ xmlTextReaderMoveToAttribute(2924e7fbde4400b4).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "override"); |
| 113 | text->traitscxx . . $ oscap_text#traits..overridescxx . . $ oscap_text_traits#overrides. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(OSCAP_BOOL_MAPcxx . . $ OSCAP_BOOL_MAP., (const char *) xmlTextReaderConstValuecxx . . $ xmlTextReaderConstValue(60a5affeeceb06fd).(reader)); |
| 114 | if (xmlTextReaderConstValuecxx . . $ xmlTextReaderConstValue(60a5affeeceb06fd).(reader) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) text->traitscxx . . $ oscap_text#traits..override_givencxx . . $ oscap_text_traits#override_given. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 115 | } |
| 116 | |
| 117 | // extract language |
| 118 | text->langcxx . . $ oscap_text#lang. = (char *) xmlTextReaderXmlLangcxx . . $ xmlTextReaderXmlLang(3322afb275581432).(reader); |
| 119 | |
| 120 | xmlTextReaderMoveToElementcxx . . $ xmlTextReaderMoveToElement(82a242a19623f75).(reader); |
| 121 | |
| 122 | // extract content |
| 123 | if (text->traitscxx . . $ oscap_text#traits..htmlcxx . . $ oscap_text_traits#html. || text->traitscxx . . $ oscap_text#traits..can_substitutecxx . . $ oscap_text_traits#can_substitute.) |
| 124 | text->textcxx . . $ oscap_text#text. = oscap_get_xmlcxx . . $ oscap_get_xml(93c99f8009311dd0).(reader); |
| 125 | else text->textcxx . . $ oscap_text#text. = oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader); |
| 126 | |
| 127 | return text; |
| 128 | } |
| 129 | |
| 130 | xmlNodecxx . . $ xmlNode# *oscap_text_to_domcxx . . $ oscap_text_to_dom(884e3243567ea9a2).(struct oscap_textcxx . . $ oscap_text# *text, xmlNodecxx . . $ xmlNode# *parent, const char *elname) |
| 131 | { |
| 132 | if (!text) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 133 | |
| 134 | xmlNodecxx . . $ xmlNode# *text_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 135 | |
| 136 | if (text->traitscxx . . $ oscap_text#traits..htmlcxx . . $ oscap_text_traits#html. || text->traitscxx . . $ oscap_text#traits..can_substitutecxx . . $ oscap_text_traits#can_substitute.) { |
| 137 | text_node = oscap_xmlstr_to_domcxx . . $ oscap_xmlstr_to_dom(5514c3fae3f75267).(parent, elname, text->textcxx . . $ oscap_text#text.); |
| 138 | // make sure we use parent's namespace |
| 139 | xmlSetNscxx . . $ xmlSetNs(cd680be8abdf9ad3).(text_node, parent->nscxx . . $ _xmlNode#ns.); |
| 140 | } |
| 141 | else { |
| 142 | // NULL as ns here means that namespace is inherited from parent |
| 143 | text_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! elname, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text->textcxx . . $ oscap_text#text.); |
| 144 | } |
| 145 | |
| 146 | if (text_node == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 147 | |
| 148 | if (text->langcxx . . $ oscap_text#lang.) |
| 149 | xmlNodeSetLangcxx . . $ xmlNodeSetLang(fbf30e8d041579ec).(text_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text->langcxx . . $ oscap_text#lang.); |
| 150 | if (text->traitscxx . . $ oscap_text#traits..can_overridecxx . . $ oscap_text_traits#can_override. && text->traitscxx . . $ oscap_text#traits..overridescxx . . $ oscap_text_traits#overrides.) |
| 151 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(text_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "override", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 152 | |
| 153 | |
| 154 | return text_node; |
| 155 | } |
| 156 | |
| 157 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_exportcxx . . $ oscap_text_export(fbf191e55686259b).(struct oscap_textcxx . . $ oscap_text# *text, xmlTextWritercxx . . $ xmlTextWriter# *writer, const char *elname) |
| 158 | { |
| 159 | if (text == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || writer == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 160 | |
| 161 | if (elname) xmlTextWriterStartElementcxx . . $ xmlTextWriterStartElement(bf445c147f693955).(writer, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! elname); |
| 162 | |
| 163 | if (text->langcxx . . $ oscap_text#lang.) |
| 164 | xmlTextWriterWriteAttributecxx . . $ xmlTextWriterWriteAttribute(ea634d2c1b0a45f7).(writer, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "xml:lang", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text->langcxx . . $ oscap_text#lang.); |
| 165 | if (text->traitscxx . . $ oscap_text#traits..can_overridecxx . . $ oscap_text_traits#can_override. && text->traitscxx . . $ oscap_text#traits..overridescxx . . $ oscap_text_traits#overrides.) |
| 166 | xmlTextWriterWriteAttributecxx . . $ xmlTextWriterWriteAttribute(ea634d2c1b0a45f7).(writer, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "override", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 167 | |
| 168 | if (text->traitscxx . . $ oscap_text#traits..htmlcxx . . $ oscap_text_traits#html. || text->traitscxx . . $ oscap_text#traits..can_substitutecxx . . $ oscap_text_traits#can_substitute.) |
| 169 | xmlTextWriterWriteRawcxx . . $ xmlTextWriterWriteRaw(bf445c147f693955).(writer, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text->textcxx . . $ oscap_text#text.); |
| 170 | else xmlTextWriterWriteStringcxx . . $ xmlTextWriterWriteString(bf445c147f693955).(writer, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text->textcxx . . $ oscap_text#text.); |
| 171 | |
| 172 | if (elname) xmlTextWriterEndElementcxx . . $ xmlTextWriterEndElement(7e81f973a4eb6684).(writer); |
| 173 | |
| 174 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 175 | } |
| 176 | |
| 177 | char *_xhtml_to_plaintextcxx . . $ _xhtml_to_plaintext(a8b8e32347182212).(const char *xhtml_in) |
| 178 | { |
| 179 | char *out = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 180 | char *str = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("<x xmlns='http://www.w3.org/1999/xhtml'>%s</x>", xhtml_in); |
| 181 | xmlDoccxx . . $ xmlDoc# *doc = xmlParseMemorycxx . . $ xmlParseMemory(48704c96f88d9177).(str, strlencxx . . $ strlen(751346f8406fd082).(str)); |
| 182 | if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 183 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 184 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 185 | } |
| 186 | xmlNodecxx . . $ xmlNode# *root = xmlDocGetRootElementcxx . . $ xmlDocGetRootElement(53aa9a676bd496f2).(doc); |
| 187 | if (root == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 188 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 189 | return out; |
| 190 | } |
| 191 | |
| 192 | // TODO: better HTML -> plaintext conversion |
| 193 | // (perhaps use xml_iterate) |
| 194 | out = (char*) xmlNodeGetContentcxx . . $ xmlNodeGetContent(cadd6f62b3cc3aeb).(root); |
| 195 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(doc); |
| 196 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 197 | return out; |
| 198 | } |
| 199 | |
| 200 | char *oscap_text_get_plaintextcxx . . $ oscap_text_get_plaintext(b919ca79285e5f6a).(const struct oscap_textcxx . . $ oscap_text# *text) |
| 201 | { |
| 202 | if (text == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 203 | |
| 204 | if (!text->traitscxx . . $ oscap_text#traits..htmlcxx . . $ oscap_text_traits#html.) return oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(text->textcxx . . $ oscap_text#text.); |
| 205 | |
| 206 | return _xhtml_to_plaintextcxx . . $ _xhtml_to_plaintext(a8b8e32347182212).(text->textcxx . . $ oscap_text#text.); |
| 207 | } |
| 208 | |
| 209 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_textlist_exportcxx . . $ oscap_textlist_export(2181939542e556de).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *texts, xmlTextWritercxx . . $ xmlTextWriter# *writer, const char *elname) |
| 210 | { |
| 211 | if (texts == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || writer == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || elname == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 212 | |
| 213 | OSCAP_FORcxx . . $ `src/common/list.h:155:9`!(oscap_text, text, texts) |
| 214 | oscap_text_exportcxx . . $ oscap_text_export(fbf191e55686259b).(text, writer, elname); |
| 215 | |
| 216 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 217 | } |
| 218 | |
| 219 | struct oscap_textcxx . . $ oscap_text# *oscap_textlist_get_preferred_textcxx . . $ oscap_textlist_get_preferred_text(92eab71fd95a04a7).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *texts, const char *preferred_lang) |
| 220 | { |
| 221 | if (preferred_lang == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 222 | preferred_lang = OSCAP_LANG_DEFAULTcxx . . $ OSCAP_LANG_DEFAULT.; |
| 223 | |
| 224 | oscap_text_iterator_resetcxx . . $ oscap_text_iterator_reset(f60c6cfdbf1f29d7).(texts); |
| 225 | |
| 226 | while (oscap_text_iterator_has_morecxx . . $ oscap_text_iterator_has_more(7616e6c9867966c1).(texts)) { |
| 227 | struct oscap_textcxx . . $ oscap_text# *text = oscap_text_iterator_nextcxx . . $ oscap_text_iterator_next(fef5008d25b58ff).(texts); |
| 228 | const char *lang = oscap_text_get_langcxx . . $ oscap_text_get_lang(ba0993cb6b641422).(text); |
| 229 | if (lang && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(lang, preferred_lang) == 0) |
| 230 | return text; |
| 231 | } |
| 232 | |
| 233 | // not found as exact match in preferred language, try to find implicit match |
| 234 | oscap_text_iterator_resetcxx . . $ oscap_text_iterator_reset(f60c6cfdbf1f29d7).(texts); |
| 235 | while (oscap_text_iterator_has_morecxx . . $ oscap_text_iterator_has_more(7616e6c9867966c1).(texts)) { |
| 236 | struct oscap_textcxx . . $ oscap_text# *text = oscap_text_iterator_nextcxx . . $ oscap_text_iterator_next(fef5008d25b58ff).(texts); |
| 237 | const char *lang = oscap_text_get_langcxx . . $ oscap_text_get_lang(ba0993cb6b641422).(text); |
| 238 | if (lang == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 239 | return text; |
| 240 | } |
| 241 | |
| 242 | // fallback to any language |
| 243 | oscap_text_iterator_resetcxx . . $ oscap_text_iterator_reset(f60c6cfdbf1f29d7).(texts); |
| 244 | while (oscap_text_iterator_has_morecxx . . $ oscap_text_iterator_has_more(7616e6c9867966c1).(texts)) { |
| 245 | struct oscap_textcxx . . $ oscap_text# *text = oscap_text_iterator_nextcxx . . $ oscap_text_iterator_next(fef5008d25b58ff).(texts); |
| 246 | return text; |
| 247 | } |
| 248 | |
| 249 | // nothing found |
| 250 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 251 | } |
| 252 | |
| 253 | char *oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *texts, const char *preferred_lang) |
| 254 | { |
| 255 | struct oscap_textcxx . . $ oscap_text# *text = oscap_textlist_get_preferred_textcxx . . $ oscap_textlist_get_preferred_text(92eab71fd95a04a7).(texts, preferred_lang); |
| 256 | return (text != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ? oscap_text_get_plaintextcxx . . $ oscap_text_get_plaintext(b919ca79285e5f6a).(text) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 257 | } |