Bug Summary

File:backend/djvu/djvu-links.c
Warning:line 331, column 2
Value stored to 'iter' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name djvu-links.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/rootdir/backend/djvu -fcoverage-compilation-dir=/rootdir/backend/djvu -resource-dir /usr/lib/llvm-21/lib/clang/21 -D HAVE_CONFIG_H -I . -I ../.. -I ../.. -I ../../libdocument -D CAFEICONDIR="/usr//pixmaps" -D CAFELOCALEDIR="/usr/share/locale" -D LECTOR_COMPILATION -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/cairo -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glycin-2 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/atk-1.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/fribidi -I /usr/include/pixman-1 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/gio-unix-2.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/sysprof-6 -D CDK_MULTIHEAD_SAFE -D CTK_MULTIHEAD_SAFE -D PIC -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-checker deadcode.DeadStores -analyzer-checker security.ArrayBound -analyzer-checker unix.cstring.NotNullTerminated -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2026-04-10-085057-53008-1 -x c djvu-links.c
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2/*
3 * Implements hyperlink functionality for Djvu files.
4 * Copyright (C) 2006 Pauli Virtanen <pav@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#include <config.h>
22#include <string.h>
23#include <glib.h>
24#include <libdjvu/miniexp.h>
25#include "djvu-document.h"
26#include "djvu-links.h"
27#include "djvu-document-private.h"
28#include "ev-document-links.h"
29#include "ev-mapping-list.h"
30
31static gboolean number_from_miniexp(miniexp_t sexp, int *number)
32{
33 if (miniexp_numberp (sexp)) {
34 *number = miniexp_to_int (sexp);
35 return TRUE(!(0));
36 } else {
37 return FALSE(0);
38 }
39}
40
41static gboolean string_from_miniexp(miniexp_t sexp, const char **str)
42{
43 if (miniexp_stringp (sexp)) {
44 *str = miniexp_to_str (sexp);
45 return TRUE(!(0));
46 } else {
47 return FALSE(0);
48 }
49}
50
51static gboolean number_from_string_10(const gchar *str, guint64 *number)
52{
53 gchar *end_ptr;
54
55 *number = g_ascii_strtoull(str, &end_ptr, 10);
56 if (*end_ptr == '\0') {
57 return TRUE(!(0));
58 } else {
59 return FALSE(0);
60 }
61}
62
63static guint64
64get_djvu_link_page (const DjvuDocument *djvu_document G_GNUC_UNUSED__attribute__ ((__unused__)),
65 const gchar *link_name,
66 int base_page)
67{
68 guint64 page_num = 0;
69
70 /* #pagenum, #+pageoffset, #-pageoffset */
71 if (g_str_has_prefix (link_name, "#")(__builtin_constant_p ("#")? __extension__ ({ const char * const
__str = (link_name); const char * const __prefix = ("#"); gboolean
__result = (0); if (__str == ((void*)0) || __prefix == ((void
*)0)) __result = (g_str_has_prefix) (__str, __prefix); else {
const size_t __str_len = strlen (((__str) + !(__str))); const
size_t __prefix_len = strlen (((__prefix) + !(__prefix))); if
(__str_len >= __prefix_len) __result = memcmp (((__str) +
!(__str)), ((__prefix) + !(__prefix)), __prefix_len) == 0; }
__result; }) : (g_str_has_prefix) (link_name, "#") )
) {
72 if (base_page > 0 && g_str_has_prefix (link_name+1, "+")(__builtin_constant_p ("+")? __extension__ ({ const char * const
__str = (link_name+1); const char * const __prefix = ("+"); gboolean
__result = (0); if (__str == ((void*)0) || __prefix == ((void
*)0)) __result = (g_str_has_prefix) (__str, __prefix); else {
const size_t __str_len = strlen (((__str) + !(__str))); const
size_t __prefix_len = strlen (((__prefix) + !(__prefix))); if
(__str_len >= __prefix_len) __result = memcmp (((__str) +
!(__str)), ((__prefix) + !(__prefix)), __prefix_len) == 0; }
__result; }) : (g_str_has_prefix) (link_name+1, "+") )
) {
73 if (number_from_string_10 (link_name + 2, &page_num)) {
74 return base_page + page_num;
75 }
76 } else if (base_page > 0 && g_str_has_prefix (link_name+1, "-")(__builtin_constant_p ("-")? __extension__ ({ const char * const
__str = (link_name+1); const char * const __prefix = ("-"); gboolean
__result = (0); if (__str == ((void*)0) || __prefix == ((void
*)0)) __result = (g_str_has_prefix) (__str, __prefix); else {
const size_t __str_len = strlen (((__str) + !(__str))); const
size_t __prefix_len = strlen (((__prefix) + !(__prefix))); if
(__str_len >= __prefix_len) __result = memcmp (((__str) +
!(__str)), ((__prefix) + !(__prefix)), __prefix_len) == 0; }
__result; }) : (g_str_has_prefix) (link_name+1, "-") )
) {
77 if (number_from_string_10 (link_name + 2, &page_num)) {
78 return base_page - page_num;
79 }
80 } else {
81 if (number_from_string_10 (link_name + 1, &page_num)) {
82 return page_num - 1;
83 }
84 }
85 } else {
86 /* FIXME: component file identifiers */
87 }
88
89 return page_num;
90}
91
92static EvLinkDest *
93get_djvu_link_dest (const DjvuDocument *djvu_document, const gchar *link_name, int base_page)
94{
95 return ev_link_dest_new_page (get_djvu_link_page (djvu_document, link_name, base_page));
96}
97
98static EvLinkAction *
99get_djvu_link_action (const DjvuDocument *djvu_document, const gchar *link_name, int base_page)
100{
101 EvLinkDest *ev_dest = NULL((void*)0);
102 EvLinkAction *ev_action = NULL((void*)0);
103
104 ev_dest = get_djvu_link_dest (djvu_document, link_name, base_page);
105
106 if (ev_dest) {
107 ev_action = ev_link_action_new_dest (ev_dest);
108 } else if (strstr(link_name, "://") != NULL((void*)0)) {
109 /* It's probably an URI */
110 ev_action = ev_link_action_new_external_uri (link_name);
111 } else {
112 /* FIXME: component file identifiers */
113 }
114
115 return ev_action;
116}
117
118static gchar *
119str_to_utf8 (const gchar *text)
120{
121 static const gchar *encodings_to_try[2];
122 static gint n_encodings_to_try = 0;
123 gchar *utf8_text = NULL((void*)0);
124 gint i;
125
126 if (n_encodings_to_try == 0) {
127 const gchar *charset;
128 gboolean charset_is_utf8;
129
130 charset_is_utf8 = g_get_charset (&charset);
131 if (!charset_is_utf8) {
132 encodings_to_try[n_encodings_to_try++] = charset;
133 }
134
135 if (g_ascii_strcasecmp (charset, "ISO-8859-1") != 0) {
136 encodings_to_try[n_encodings_to_try++] = "ISO-8859-1";
137 }
138 }
139
140 for (i = 0; i < n_encodings_to_try; i++) {
141 utf8_text = g_convert (text, -1, "UTF-8",
142 encodings_to_try[i],
143 NULL((void*)0), NULL((void*)0), NULL((void*)0));
144 if (utf8_text)
145 break;
146 }
147
148 return utf8_text;
149}
150
151/**
152 * Builds the index CtkTreeModel from DjVu s-expr
153 *
154 * (bookmarks
155 * ("title1" "dest1"
156 * ("title12" "dest12"
157 * ... )
158 * ... )
159 * ("title2" "dest2"
160 * ... )
161 * ... )
162 */
163static void
164build_tree (const DjvuDocument *djvu_document,
165 CtkTreeModel *model,
166 CtkTreeIter *parent,
167 miniexp_t iter)
168{
169 const char *title, *link_dest;
170 char *title_markup;
171
172 EvLinkAction *ev_action = NULL((void*)0);
173 EvLink *ev_link = NULL((void*)0);
174 CtkTreeIter tree_iter;
175
176 if (miniexp_car (iter) == miniexp_symbol ("bookmarks")) {
177 /* The (bookmarks) cons */
178 iter = miniexp_cdr (iter);
179 } else if ( miniexp_length (iter) >= 2 ) {
180 gchar *utf8_title = NULL((void*)0);
181
182 /* An entry */
183 if (!string_from_miniexp (miniexp_car (iter), &title)) goto unknown_entry;
184 if (!string_from_miniexp (miniexp_cadr (iter), &link_dest)) goto unknown_entry;
185
186
187 if (!g_utf8_validate (title, -1, NULL((void*)0))) {
188 utf8_title = str_to_utf8 (title);
189 title_markup = g_markup_escape_text (utf8_title, -1);
190 } else {
191 title_markup = g_markup_escape_text (title, -1);
192 }
193
194 ev_action = get_djvu_link_action (djvu_document, link_dest, -1);
195
196 if (g_str_has_suffix (link_dest, ".djvu")(__builtin_constant_p (".djvu")? __extension__ ({ const char *
const __str = (link_dest); const char * const __suffix = (".djvu"
); gboolean __result = (0); if (__str == ((void*)0) || __suffix
== ((void*)0)) __result = (g_str_has_suffix) (__str, __suffix
); else { const size_t __str_len = strlen (((__str) + !(__str
))); const size_t __suffix_len = strlen (((__suffix) + !(__suffix
))); if (__str_len >= __suffix_len) __result = memcmp (__str
+ __str_len - __suffix_len, ((__suffix) + !(__suffix)), __suffix_len
) == 0; } __result; }) : (g_str_has_suffix) (link_dest, ".djvu"
) )
) {
197 /* FIXME: component file identifiers */
198 } else if (ev_action) {
199 ev_link = ev_link_new (utf8_title ? utf8_title : title, ev_action);
200 ctk_tree_store_append (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_store_get_type ()))))))
, &tree_iter, parent);
201 ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_store_get_type ()))))))
, &tree_iter,
202 EV_DOCUMENT_LINKS_COLUMN_MARKUP, title_markup,
203 EV_DOCUMENT_LINKS_COLUMN_LINK, ev_link,
204 EV_DOCUMENT_LINKS_COLUMN_EXPAND, FALSE(0),
205 -1);
206 g_object_unref (ev_link);
207 } else {
208 ctk_tree_store_append (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_store_get_type ()))))))
, &tree_iter, parent);
209 ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_store_get_type ()))))))
, &tree_iter,
210 EV_DOCUMENT_LINKS_COLUMN_MARKUP, title_markup,
211 EV_DOCUMENT_LINKS_COLUMN_EXPAND, FALSE(0),
212 -1);
213 }
214
215 g_free (title_markup);
216 g_free (utf8_title);
217 iter = miniexp_cddr (iter);
218 parent = &tree_iter;
219 } else {
220 goto unknown_entry;
221 }
222
223 for (; iter != miniexp_nil((miniexp_t)(size_t)0); iter = miniexp_cdr (iter)) {
224 build_tree (djvu_document, model, parent, miniexp_car (iter));
225 }
226 return;
227
228 unknown_entry:
229 g_warning ("DjvuLibre error: Unknown entry in bookmarks");
230 return;
231}
232
233static gboolean
234get_djvu_hyperlink_area (ddjvu_pageinfo_t *page_info,
235 miniexp_t sexp,
236 EvMapping *ev_link_mapping)
237{
238 miniexp_t iter;
239
240 iter = sexp;
241
242 if ((miniexp_car (iter) == miniexp_symbol ("rect") || miniexp_car (iter) == miniexp_symbol ("oval"))
243 && miniexp_length (iter) == 5) {
244 /* FIXME: get bounding box for (oval) since Lector doesn't support shaped links */
245 int minx, miny, width, height;
246
247 iter = miniexp_cdr (iter);
248 if (!number_from_miniexp (miniexp_car (iter), &minx)) goto unknown_link;
249 iter = miniexp_cdr (iter);
250 if (!number_from_miniexp (miniexp_car (iter), &miny)) goto unknown_link;
251 iter = miniexp_cdr (iter);
252 if (!number_from_miniexp (miniexp_car (iter), &width)) goto unknown_link;
253 iter = miniexp_cdr (iter);
254 if (!number_from_miniexp (miniexp_car (iter), &height)) goto unknown_link;
255
256 ev_link_mapping->area.x1 = minx;
257 ev_link_mapping->area.x2 = (minx + width);
258 ev_link_mapping->area.y1 = (page_info->height - (miny + height));
259 ev_link_mapping->area.y2 = (page_info->height - miny);
260 } else if (miniexp_car (iter) == miniexp_symbol ("poly")
261 && miniexp_length (iter) >= 5 && miniexp_length (iter) % 2 == 1) {
262
263 /* FIXME: get bounding box since Lector doesn't support shaped links */
264 int minx = G_MAXINT2147483647, miny = G_MAXINT2147483647;
265 int maxx = G_MININT(-2147483647 -1), maxy = G_MININT(-2147483647 -1);
266
267 iter = miniexp_cdr(iter);
268 while (iter != miniexp_nil((miniexp_t)(size_t)0)) {
269 int x, y;
270
271 if (!number_from_miniexp (miniexp_car(iter), &x)) goto unknown_link;
272 iter = miniexp_cdr (iter);
273 if (!number_from_miniexp (miniexp_car(iter), &y)) goto unknown_link;
274 iter = miniexp_cdr (iter);
275
276 minx = MIN (minx, x)(((minx) < (x)) ? (minx) : (x));
277 miny = MIN (miny, y)(((miny) < (y)) ? (miny) : (y));
278 maxx = MAX (maxx, x)(((maxx) > (x)) ? (maxx) : (x));
279 maxy = MAX (maxy, y)(((maxy) > (y)) ? (maxy) : (y));
280 }
281
282 ev_link_mapping->area.x1 = minx;
283 ev_link_mapping->area.x2 = maxx;
284 ev_link_mapping->area.y1 = (page_info->height - maxy);
285 ev_link_mapping->area.y2 = (page_info->height - miny);
286 } else {
287 /* unknown */
288 goto unknown_link;
289 }
290
291 return TRUE(!(0));
292
293 unknown_link:
294 g_warning("DjvuLibre error: Unknown hyperlink area %s", miniexp_to_name(miniexp_car(sexp)));
295 return FALSE(0);
296}
297
298static EvMapping *
299get_djvu_hyperlink_mapping (DjvuDocument *djvu_document,
300 int page,
301 ddjvu_pageinfo_t *page_info,
302 miniexp_t sexp)
303{
304 EvMapping *ev_link_mapping = NULL((void*)0);
305 EvLinkAction *ev_action = NULL((void*)0);
306 miniexp_t iter;
307 const char *url, *url_target, *comment;
308
309 ev_link_mapping = g_new (EvMapping, 1)((EvMapping *) g_malloc_n ((1), sizeof (EvMapping)));
310
311 iter = sexp;
312
313 if (miniexp_car (iter) != miniexp_symbol ("maparea")) goto unknown_mapping;
314
315 iter = miniexp_cdr(iter);
316
317 if (miniexp_caar(iter) == miniexp_symbol("url")) {
318 if (!string_from_miniexp (miniexp_cadr (miniexp_car (iter)), &url)) goto unknown_mapping;
319 if (!string_from_miniexp (miniexp_caddr (miniexp_car (iter)), &url_target)) goto unknown_mapping;
320 } else {
321 if (!string_from_miniexp (miniexp_car(iter), &url)) goto unknown_mapping;
322 url_target = NULL((void*)0);
323 }
324
325 iter = miniexp_cdr (iter);
326 if (!string_from_miniexp (miniexp_car(iter), &comment)) goto unknown_mapping;
327
328 iter = miniexp_cdr (iter);
329 if (!get_djvu_hyperlink_area (page_info, miniexp_car(iter), ev_link_mapping)) goto unknown_mapping;
330
331 iter = miniexp_cdr (iter);
Value stored to 'iter' is never read
332 /* FIXME: DjVu hyperlink attributes are ignored */
333
334 ev_action = get_djvu_link_action (djvu_document, url, page);
335 if (!ev_action) goto unknown_mapping;
336
337 ev_link_mapping->data = ev_link_new (comment, ev_action);
338
339 return ev_link_mapping;
340
341 unknown_mapping:
342 if (ev_link_mapping) g_free(ev_link_mapping);
343 g_warning("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp)));
344 return NULL((void*)0);
345}
346
347
348gboolean
349djvu_links_has_document_links (EvDocumentLinks *document_links)
350{
351 DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links)((((DjvuDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((document_links)), ((djvu_document_get_type ()))))))
;
352 miniexp_t outline;
353
354 while ((outline = ddjvu_document_get_outline (djvu_document->d_document)) == miniexp_dummy((miniexp_t)(size_t)2))
355 djvu_handle_events (djvu_document, TRUE(!(0)), NULL((void*)0));
356
357 if (outline) {
358 ddjvu_miniexp_release (djvu_document->d_document, outline);
359 return TRUE(!(0));
360 }
361
362 return FALSE(0);
363}
364
365EvMappingList *
366djvu_links_get_links (EvDocumentLinks *document_links,
367 gint page,
368 double scale_factor)
369{
370 DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links)((((DjvuDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((document_links)), ((djvu_document_get_type ()))))))
;
371 GList *retval = NULL((void*)0);
372 miniexp_t page_annotations = miniexp_nil((miniexp_t)(size_t)0);
373 miniexp_t *hyperlinks = NULL((void*)0), *iter = NULL((void*)0);
374 EvMapping *ev_link_mapping;
375 ddjvu_pageinfo_t page_info;
376
377 while ((page_annotations = ddjvu_document_get_pageanno (djvu_document->d_document, page)) == miniexp_dummy((miniexp_t)(size_t)2))
378 djvu_handle_events (djvu_document, TRUE(!(0)), NULL((void*)0));
379
380 while (ddjvu_document_get_pageinfo (djvu_document->d_document, page, &page_info)ddjvu_document_get_pageinfo_imp(djvu_document->d_document,
page,&page_info,sizeof(ddjvu_pageinfo_t))
< DDJVU_JOB_OK)
381 djvu_handle_events(djvu_document, TRUE(!(0)), NULL((void*)0));
382
383 if (page_annotations) {
384 hyperlinks = ddjvu_anno_get_hyperlinks (page_annotations);
385 if (hyperlinks) {
386 for (iter = hyperlinks; *iter; ++iter) {
387 ev_link_mapping = get_djvu_hyperlink_mapping (djvu_document, page, &page_info, *iter);
388 if (ev_link_mapping) {
389 ev_link_mapping->area.x1 *= scale_factor;
390 ev_link_mapping->area.x2 *= scale_factor;
391 ev_link_mapping->area.y1 *= scale_factor;
392 ev_link_mapping->area.y2 *= scale_factor;
393 retval = g_list_prepend (retval, ev_link_mapping);
394 }
395 }
396 free (hyperlinks);
397 }
398 ddjvu_miniexp_release (djvu_document->d_document, page_annotations);
399 }
400
401 return ev_mapping_list_new (page, retval, (GDestroyNotify)g_object_unref);
402}
403
404EvLinkDest *
405djvu_links_find_link_dest (EvDocumentLinks *document_links,
406 const gchar *link_name)
407{
408 DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links)((((DjvuDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((document_links)), ((djvu_document_get_type ()))))))
;
409 EvLinkDest *ev_dest = NULL((void*)0);
410
411 ev_dest = get_djvu_link_dest (djvu_document, link_name, -1);
412
413 if (!ev_dest) {
414 g_warning ("DjvuLibre error: unknown link destination %s", link_name);
415 }
416
417 return ev_dest;
418}
419
420gint
421djvu_links_find_link_page (EvDocumentLinks *document_links,
422 const gchar *link_name)
423{
424 DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links)((((DjvuDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((document_links)), ((djvu_document_get_type ()))))))
;
425 gint page;
426
427 page = get_djvu_link_page (djvu_document, link_name, -1);
428
429 if (page == -1) {
430 g_warning ("DjvuLibre error: unknown link destination %s", link_name);
431 }
432
433 return page;
434}
435
436CtkTreeModel *
437djvu_links_get_links_model (EvDocumentLinks *document_links)
438{
439 DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links)((((DjvuDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((document_links)), ((djvu_document_get_type ()))))))
;
440 CtkTreeModel *model = NULL((void*)0);
441 miniexp_t outline = miniexp_nil((miniexp_t)(size_t)0);
442
443 while ((outline = ddjvu_document_get_outline (djvu_document->d_document)) == miniexp_dummy((miniexp_t)(size_t)2))
444 djvu_handle_events (djvu_document, TRUE(!(0)), NULL((void*)0));
445
446 if (outline) {
447 model = (CtkTreeModel *) ctk_tree_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS,
448 G_TYPE_STRING((GType) ((16) << (2))),
449 G_TYPE_OBJECT((GType) ((20) << (2))),
450 G_TYPE_BOOLEAN((GType) ((5) << (2))),
451 G_TYPE_STRING((GType) ((16) << (2))));
452 build_tree (djvu_document, model, NULL((void*)0), outline);
453
454 ddjvu_miniexp_release (djvu_document->d_document, outline);
455 }
456
457 return model;
458}