From 8defbe3b01dc847e77944a68756c0292520d8cec Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Fri, 16 Aug 2024 19:21:00 +0000 Subject: Deploy mate-desktop/engrampa to github.com/mate-desktop/engrampa.git:gh-pages --- .../0.html | 1113 ++ .../1.html | 339 + .../10.html | 381 + .../100.html | 3077 ++++ .../101.html | 18063 +++++++++++++++++++ .../102.html | 2985 +++ .../103.html | 1297 ++ .../104.html | 1379 ++ .../105.html | 1119 ++ .../106.html | 953 + .../107.html | 403 + .../108.html | 377 + .../109.html | 503 + .../11.html | 2261 +++ .../110.html | 1189 ++ .../111.html | 749 + .../12.html | 665 + .../13.html | 877 + .../14.html | 481 + .../15.html | 665 + .../16.html | 511 + .../17.html | 691 + .../18.html | 381 + .../19.html | 297 + .../2.html | 343 + .../20.html | 297 + .../21.html | 353 + .../22.html | 407 + .../23.html | 301 + .../24.html | 379 + .../25.html | 475 + .../26.html | 397 + .../27.html | 415 + .../28.html | 571 + .../29.html | 1693 ++ .../3.html | 541 + .../30.html | 551 + .../31.html | 1377 ++ .../32.html | 579 + .../33.html | 1029 ++ .../34.html | 1153 ++ .../35.html | 447 + .../36.html | 903 + .../37.html | 479 + .../38.html | 587 + .../39.html | 1005 ++ .../4.html | 3385 ++++ .../40.html | 305 + .../41.html | 333 + .../42.html | 543 + .../43.html | 2647 +++ .../44.html | 1175 ++ .../45.html | 385 + .../46.html | 613 + .../47.html | 2597 +++ .../48.html | 6941 +++++++ .../49.html | 513 + .../5.html | 3055 ++++ .../50.html | 299 + .../51.html | 357 + .../52.html | 1773 ++ .../53.html | 347 + .../54.html | 899 + .../55.html | 361 + .../56.html | 1013 ++ .../57.html | 351 + .../58.html | 863 + .../59.html | 341 + .../6.html | 453 + .../60.html | 1083 ++ .../61.html | 351 + .../62.html | 1647 ++ .../63.html | 349 + .../64.html | 875 + .../65.html | 343 + .../66.html | 851 + .../67.html | 343 + .../68.html | 851 + .../69.html | 345 + .../7.html | 327 + .../70.html | 815 + .../71.html | 343 + .../72.html | 339 + .../73.html | 1067 ++ .../74.html | 341 + .../75.html | 755 + .../76.html | 311 + .../77.html | 851 + .../78.html | 345 + .../79.html | 1891 ++ .../8.html | 1523 ++ .../80.html | 367 + .../81.html | 879 + .../82.html | 343 + .../83.html | 2711 +++ .../84.html | 359 + .../85.html | 951 + .../86.html | 347 + .../87.html | 991 + .../88.html | 349 + .../89.html | 1269 ++ .../9.html | 1071 ++ .../90.html | 1061 ++ .../91.html | 343 + .../92.html | 1861 ++ .../93.html | 277 + .../94.html | 1593 ++ .../95.html | 593 + .../96.html | 329 + .../97.html | 559 + .../98.html | 341 + .../99.html | 2431 +++ .../index.html | 908 + .../stats.html | 200 + .../style.css | 177 + 115 files changed, 120843 insertions(+) create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/0.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/1.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/10.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/100.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/101.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/102.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/103.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/104.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/105.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/106.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/107.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/108.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/109.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/11.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/110.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/111.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/12.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/13.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/14.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/15.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/16.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/17.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/18.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/19.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/2.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/20.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/21.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/22.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/23.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/24.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/25.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/26.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/27.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/28.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/29.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/3.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/30.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/31.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/32.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/33.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/34.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/35.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/36.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/37.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/38.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/39.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/4.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/40.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/41.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/42.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/43.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/44.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/45.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/46.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/47.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/48.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/49.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/5.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/50.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/51.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/52.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/53.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/54.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/55.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/56.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/57.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/58.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/59.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/6.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/60.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/61.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/62.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/63.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/64.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/65.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/66.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/67.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/68.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/69.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/7.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/70.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/71.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/72.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/73.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/74.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/75.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/76.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/77.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/78.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/79.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/8.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/80.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/81.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/82.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/83.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/84.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/85.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/86.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/87.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/88.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/89.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/9.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/90.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/91.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/92.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/93.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/94.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/95.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/96.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/97.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/98.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/99.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/index.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/stats.html create mode 100644 2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/style.css (limited to '2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master') diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/0.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/0.html new file mode 100644 index 0000000..1ccb21d --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/0.html @@ -0,0 +1,1113 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Paolo Bacchilega <paobac@cvs.mate.org>
+ *
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libcaja-extension/caja-extension-types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libcaja-extension/caja-file-info.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libcaja-extension/caja-menu-provider.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "caja-engrampa.h"
+
+static GObjectClass *parent_class;
+
+static void
+extract_to_callback (CajaMenuItem *item,
+		     gpointer          user_data)
+{
+	GList            *files, *scan;
+	char             *default_dir;
+	char             *quoted_default_dir;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+	default_dir = caja_file_info_get_parent_uri (files->data);
+	quoted_default_dir = g_shell_quote (default_dir);
+
+	cmd = g_string_new ("engrampa");
+	g_string_append_printf(cmd," --default-dir=%s --extract", quoted_default_dir);
+
+	for (scan = files; scan; scan = scan->next) {
+		char *uri, *quoted_uri;
+
+		uri = caja_file_info_get_uri (scan->data);
+		quoted_uri = g_shell_quote (uri);
+		g_string_append_printf (cmd, " %s", quoted_uri);
+		g_free (uri);
+		g_free (quoted_uri);
+	}
+
+#ifdef MATE_ENABLE_DEBUG
+	g_print ("EXEC: %s\n", cmd->str);
+#endif
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+	g_free (default_dir);
+	g_free (quoted_default_dir);
+}
+
+static void
+extract_here_callback (CajaMenuItem *item,
+		       gpointer          user_data)
+{
+	GList            *files, *scan;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("engrampa --extract-here");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+		char *uri, *quoted_uri;
+
+		uri = caja_file_info_get_uri (file);
+		quoted_uri = g_shell_quote (uri);
+		g_string_append_printf (cmd, " %s", quoted_uri);
+		g_free (uri);
+		g_free (quoted_uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+#ifdef MATE_ENABLE_DEBUG
+	g_print ("EXEC: %s\n", cmd->str);
+#endif
+
+	g_string_free (cmd, TRUE);
+}
+
+static void
+add_callback (CajaMenuItem *item,
+              gpointer      user_data)
+{
+	GList     *files, *scan;
+	char      *uri, *dir;
+	char      *quoted_dir;
+	GString   *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+	uri = caja_file_info_get_uri (files->data);
+	dir = g_path_get_dirname (uri);
+	quoted_dir = g_shell_quote (dir);
+
+	cmd = g_string_new ("engrampa");
+	g_string_append_printf (cmd," --default-dir=%s --add", quoted_dir);
+
+	g_free (uri);
+	g_free (dir);
+	g_free (quoted_dir);
+
+	for (scan = files; scan; scan = scan->next) {
+		char *quoted_uri;
+
+		uri = caja_file_info_get_uri (scan->data);
+		quoted_uri = g_shell_quote (uri);
+		g_string_append_printf (cmd, " %s", quoted_uri);
+		g_free (uri);
+		g_free (quoted_uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static struct {
+	const char *mime_type;
+	gboolean    is_compressed;
+} archive_mime_types[] = {
+		{ "application/vnd.debian.binary-package", TRUE },
+		{ "application/vnd.ms-cab-compressed", TRUE },
+		{ "application/epub+zip", TRUE },
+		{ "application/x-7z-compressed", TRUE },
+		{ "application/x-7z-compressed-tar", TRUE },
+		{ "application/x-ace", TRUE },
+		{ "application/x-alz", TRUE },
+		{ "application/x-arc", TRUE },
+		{ "application/x-archive", TRUE },
+		{ "application/x-arj", TRUE },
+		{ "application/x-brotli", TRUE },
+		{ "application/x-brotli-compressed-tar", TRUE },
+		{ "application/x-bzip", TRUE },
+		{ "application/x-bzip-compressed-tar", TRUE },
+		{ "application/x-bzip1", TRUE },
+		{ "application/x-bzip1-compressed-tar", TRUE },
+		{ "application/x-cbr", TRUE },
+		{ "application/x-cbz", TRUE },
+		{ "application/x-cd-image", FALSE },
+		{ "application/x-compress", TRUE },
+		{ "application/x-compressed-tar", TRUE },
+		{ "application/x-cpio", TRUE },
+		{ "application/x-ear", TRUE },
+		{ "application/x-gtar", FALSE },
+		{ "application/x-gzip", TRUE },
+		{ "application/x-gzpostscript", TRUE },
+		{ "application/x-java-archive", TRUE },
+		{ "application/x-lha", TRUE },
+		{ "application/x-lzh-compressed", TRUE },
+		{ "application/x-lzip", TRUE },
+		{ "application/x-lzip-compressed-tar", TRUE },
+		{ "application/x-lzma", TRUE },
+		{ "application/x-lzma-compressed-tar", TRUE },
+		{ "application/x-lzop", TRUE },
+		{ "application/x-lzop-compressed-tar", TRUE },
+		{ "application/x-ms-dos-executable", FALSE },
+		{ "application/x-ms-wim", TRUE },
+		{ "application/x-rar", TRUE },
+		{ "application/x-rar-compressed", TRUE },
+		{ "application/x-rpm", TRUE },
+		{ "application/x-rzip", TRUE },
+		{ "application/x-stuffit", TRUE },
+		{ "application/x-tar", FALSE },
+		{ "application/x-tarz", TRUE },
+		{ "application/x-war", TRUE },
+		{ "application/x-xz", TRUE },
+		{ "application/x-xz-compressed-tar", TRUE },
+		{ "application/x-zip", TRUE },
+		{ "application/x-zip-compressed", TRUE },
+		{ "application/x-zoo", TRUE },
+		{ "application/zstd", TRUE },
+		{ "application/x-zstd", TRUE },
+		{ "application/x-zstd-compressed-tar", TRUE },
+		{ "application/zip", TRUE },
+		{ "multipart/x-zip", TRUE },
+		{ NULL, FALSE }
+};
+
+typedef struct {
+      gboolean is_archive;
+      gboolean is_derived_archive;
+      gboolean is_compressed_archive;
+} FileMimeInfo;
+
+static FileMimeInfo
+get_file_mime_info (CajaFileInfo *file)
+{
+	FileMimeInfo file_mime_info;
+	int          i;
+
+	file_mime_info.is_archive = FALSE;
+	file_mime_info.is_derived_archive = FALSE;
+	file_mime_info.is_compressed_archive = FALSE;
+
+	for (i = 0; archive_mime_types[i].mime_type != NULL; i++)
+		if (caja_file_info_is_mime_type (file, archive_mime_types[i].mime_type)) {
+			char *mime_type;
+			char *content_type_mime_file;
+			char *content_type_mime_compare;
+
+			mime_type = caja_file_info_get_mime_type (file);
+
+			content_type_mime_file = g_content_type_from_mime_type (mime_type);
+			content_type_mime_compare = g_content_type_from_mime_type (archive_mime_types[i].mime_type);
+
+			file_mime_info.is_archive = TRUE;
+			file_mime_info.is_compressed_archive = archive_mime_types[i].is_compressed;
+			if ((content_type_mime_file != NULL) && (content_type_mime_compare != NULL))
+				file_mime_info.is_derived_archive = ! g_content_type_equals (content_type_mime_file, content_type_mime_compare);
+
+			g_free (mime_type);
+			g_free (content_type_mime_file);
+			g_free (content_type_mime_compare);
+
+			return file_mime_info;
+		}
+
+	return file_mime_info;
+}
+
+static gboolean
+unsupported_scheme (CajaFileInfo *file)
+{
+	gboolean  result = FALSE;
+	GFile    *location;
+	char     *scheme;
+
+	location = caja_file_info_get_location (file);
+	scheme = g_file_get_uri_scheme (location);
+
+	if (scheme != NULL) {
+		const char *unsupported[] = { "trash", "computer", NULL };
+		int         i;
+
+		for (i = 0; unsupported[i] != NULL; i++)
+			if (strcmp (scheme, unsupported[i]) == 0)
+				result = TRUE;
+	}
+
+	g_free (scheme);
+	g_object_unref (location);
+
+	return result;
+}
+
+static GList *
+caja_fr_get_file_items (CajaMenuProvider *provider,
+			    GtkWidget            *window,
+			    GList                *files)
+{
+	GList    *items = NULL;
+	GList    *scan;
+	gboolean  can_write = TRUE;
+	gboolean  one_item;
+	gboolean  one_archive = FALSE;
+	gboolean  one_derived_archive = FALSE;
+	gboolean  one_compressed_archive = FALSE;
+	gboolean  all_archives = TRUE;
+	gboolean  all_archives_derived = TRUE;
+	gboolean  all_archives_compressed = TRUE;
+
+	if (files == NULL)
+		return NULL;
+
+	if (unsupported_scheme ((CajaFileInfo *) files->data))
+		return NULL;
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+		FileMimeInfo file_mime_info;
+
+		file_mime_info = get_file_mime_info (file);
+
+		if (all_archives && ! file_mime_info.is_archive)
+			all_archives = FALSE;
+
+		if (all_archives_compressed && file_mime_info.is_archive && ! file_mime_info.is_compressed_archive)
+			all_archives_compressed = FALSE;
+
+		if (all_archives_derived && file_mime_info.is_archive && ! file_mime_info.is_derived_archive)
+			all_archives_derived = FALSE;
+
+		if (can_write) {
+			CajaFileInfo *parent;
+
+			parent = caja_file_info_get_parent_info (file);
+ 			can_write = caja_file_info_can_write (parent);
+			g_object_unref (parent);
+		}
+	}
+
+	/**/
+
+	one_item = (files != NULL) && (files->next == NULL);
+	one_archive = one_item && all_archives;
+	one_derived_archive = one_archive && all_archives_derived;
+	one_compressed_archive = one_archive && all_archives_compressed;
+
+	if (all_archives && can_write) {
+		CajaMenuItem *item;
+
+		item = caja_menu_item_new ("CajaFr::extract_here",
+					       _("Extract Here"),
+					       /* Translators: the current position is the current folder */
+					       _("Extract the selected archive to the current position"),
+					       "drive-harddisk");
+		g_signal_connect (item,
+				  "activate",
+				  G_CALLBACK (extract_here_callback),
+				  provider);
+		g_object_set_data_full (G_OBJECT (item),
+					"files",
+					caja_file_info_list_copy (files),
+					(GDestroyNotify) caja_file_info_list_free);
+
+		items = g_list_append (items, item);
+	}
+	if (all_archives) {
+		CajaMenuItem *item;
+
+		item = caja_menu_item_new ("CajaFr::extract_to",
+					       _("Extract To..."),
+					       _("Extract the selected archive"),
+					       "drive-harddisk");
+		g_signal_connect (item,
+				  "activate",
+				  G_CALLBACK (extract_to_callback),
+				  provider);
+		g_object_set_data_full (G_OBJECT (item),
+					"files",
+					caja_file_info_list_copy (files),
+					(GDestroyNotify) caja_file_info_list_free);
+
+		items = g_list_append (items, item);
+
+	}
+
+	if (! one_compressed_archive || one_derived_archive) {
+		CajaMenuItem *item;
+
+		item = caja_menu_item_new ("CajaFr::add",
+					       _("Compress..."),
+					       _("Create a compressed archive with the selected objects"),
+					       "package-x-generic");
+		g_signal_connect (item,
+				  "activate",
+				  G_CALLBACK (add_callback),
+				  provider);
+		g_object_set_data_full (G_OBJECT (item),
+					"files",
+					caja_file_info_list_copy (files),
+					(GDestroyNotify) caja_file_info_list_free);
+
+		items = g_list_append (items, item);
+	}
+
+	return items;
+}
+
+static void
+caja_fr_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_fr_get_file_items;
+}
+
+static void
+caja_fr_instance_init (CajaFr *fr)
+{
+}
+
+static void
+caja_fr_class_init (CajaFrClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+static GType fr_type = 0;
+
+GType
+caja_fr_get_type (void)
+{
+	return fr_type;
+}
+
+void
+caja_fr_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaFrClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_fr_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaFr),
+		0,
+		(GInstanceInitFunc) caja_fr_instance_init,
+		NULL
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_fr_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	fr_type = g_type_module_register_type (module,
+					       G_TYPE_OBJECT,
+					       "CajaEngrampa",
+					       &info, 0);
+
+	g_type_module_add_interface (module,
+				     fr_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/1.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/1.html new file mode 100644 index 0000000..6fa2697 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/1.html @@ -0,0 +1,339 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Paolo Bacchilega <paobac@cvs.mate.org>
+ *
+ */
+
+#ifndef CAJA_RNGRAMPA_H
+#define CAJA_RNGRAMPA_H
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define CAJA_TYPE_FR  (caja_fr_get_type ())
+#define CAJA_FR(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), CAJA_TYPE_FR, CajaFr))
+#define CAJA_IS_FR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAJA_TYPE_FR))
+
+typedef struct _CajaFr      CajaFr;
+typedef struct _CajaFrClass CajaFrClass;
+
+struct _CajaFr {
+	GObject __parent;
+};
+
+struct _CajaFrClass {
+	GObjectClass __parent;
+};
+
+GType caja_fr_get_type      (void);
+void  caja_fr_register_type (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* CAJA_RNGRAMPA_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/10.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/10.html new file mode 100644 index 0000000..a77eec9 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/10.html @@ -0,0 +1,381 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
/* eggtreednd.h
+ * Copyright (C) 2001  Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_TREE_MULTI_DND_H__
+#define __EGG_TREE_MULTI_DND_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_TREE_MULTI_DRAG_SOURCE            (egg_tree_multi_drag_source_get_type ())
+#define EGG_TREE_MULTI_DRAG_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSource))
+#define EGG_IS_TREE_MULTI_DRAG_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE))
+#define EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSourceIface))
+
+typedef struct _EggTreeMultiDragSource      EggTreeMultiDragSource; /* Dummy typedef */
+typedef struct _EggTreeMultiDragSourceIface EggTreeMultiDragSourceIface;
+
+struct _EggTreeMultiDragSourceIface
+{
+    GTypeInterface g_iface;
+
+    /* VTable - not signals */
+    gboolean     (* row_draggable)        (EggTreeMultiDragSource   *drag_source,
+                                           GList                    *path_list);
+
+    gboolean     (* drag_data_get)        (EggTreeMultiDragSource   *drag_source,
+                                           GList                    *path_list,
+                                           GtkSelectionData         *selection_data);
+
+    gboolean     (* drag_data_delete)     (EggTreeMultiDragSource *drag_source,
+                                           GList                  *path_list);
+};
+
+GType    egg_tree_multi_drag_source_get_type         (void) G_GNUC_CONST;
+
+/* Returns whether the given row can be dragged */
+gboolean egg_tree_multi_drag_source_row_draggable    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list);
+
+/* Deletes the given row, or returns FALSE if it can't */
+gboolean egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list);
+
+
+/* Fills in selection_data with type selection_data->target based on the row
+ * denoted by path, returns TRUE if it does anything
+ */
+gboolean egg_tree_multi_drag_source_drag_data_get    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list,
+        GtkSelectionData       *selection_data);
+void     egg_tree_multi_drag_add_drag_support        (GtkTreeView            *tree_view);
+
+G_END_DECLS
+
+#endif /* __EGG_TREE_MULTI_DND_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/100.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/100.html new file mode 100644 index 0000000..286d65e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/100.html @@ -0,0 +1,3077 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.fr"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[19409]; const double alignment; void * const ptr;}  fr_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0030, 0002, 0000, 0000, 0000, 0000, 0000, 0050, 0022, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 
+  0010, 0000, 0000, 0000, 0012, 0000, 0000, 0000, 0013, 0000, 0000, 0000, 0015, 0000, 0000, 0000, 
+  0020, 0000, 0000, 0000, 0021, 0000, 0000, 0000, 0310, 0072, 0225, 0265, 0012, 0000, 0000, 0000, 
+  0030, 0002, 0000, 0000, 0003, 0000, 0114, 0000, 0034, 0002, 0000, 0000, 0120, 0002, 0000, 0000, 
+  0363, 0170, 0255, 0112, 0000, 0000, 0000, 0000, 0120, 0002, 0000, 0000, 0016, 0000, 0166, 0000, 
+  0140, 0002, 0000, 0000, 0242, 0010, 0000, 0000, 0113, 0120, 0220, 0013, 0014, 0000, 0000, 0000, 
+  0242, 0010, 0000, 0000, 0004, 0000, 0114, 0000, 0250, 0010, 0000, 0000, 0254, 0010, 0000, 0000, 
+  0307, 0365, 0202, 0176, 0000, 0000, 0000, 0000, 0254, 0010, 0000, 0000, 0011, 0000, 0166, 0000, 
+  0270, 0010, 0000, 0000, 0275, 0014, 0000, 0000, 0334, 0020, 0134, 0300, 0000, 0000, 0000, 0000, 
+  0275, 0014, 0000, 0000, 0016, 0000, 0166, 0000, 0320, 0014, 0000, 0000, 0277, 0017, 0000, 0000, 
+  0036, 0145, 0225, 0256, 0000, 0000, 0000, 0000, 0277, 0017, 0000, 0000, 0006, 0000, 0166, 0000, 
+  0310, 0017, 0000, 0000, 0171, 0026, 0000, 0000, 0367, 0023, 0164, 0360, 0000, 0000, 0000, 0000, 
+  0171, 0026, 0000, 0000, 0011, 0000, 0166, 0000, 0210, 0026, 0000, 0000, 0102, 0034, 0000, 0000, 
+  0257, 0316, 0054, 0315, 0000, 0000, 0000, 0000, 0102, 0034, 0000, 0000, 0021, 0000, 0166, 0000, 
+  0130, 0034, 0000, 0000, 0232, 0046, 0000, 0000, 0026, 0152, 0355, 0367, 0000, 0000, 0000, 0000, 
+  0232, 0046, 0000, 0000, 0021, 0000, 0166, 0000, 0260, 0046, 0000, 0000, 0173, 0053, 0000, 0000, 
+  0212, 0352, 0110, 0033, 0000, 0000, 0000, 0000, 0173, 0053, 0000, 0000, 0021, 0000, 0166, 0000, 
+  0220, 0053, 0000, 0000, 0166, 0061, 0000, 0000, 0073, 0201, 0166, 0372, 0021, 0000, 0000, 0000, 
+  0166, 0061, 0000, 0000, 0011, 0000, 0114, 0000, 0200, 0061, 0000, 0000, 0204, 0061, 0000, 0000, 
+  0126, 0042, 0103, 0174, 0000, 0000, 0000, 0000, 0204, 0061, 0000, 0000, 0016, 0000, 0166, 0000, 
+  0230, 0061, 0000, 0000, 0360, 0065, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0360, 0065, 0000, 0000, 0001, 0000, 0114, 0000, 0364, 0065, 0000, 0000, 0370, 0065, 0000, 0000, 
+  0107, 0012, 0115, 0171, 0000, 0000, 0000, 0000, 0370, 0065, 0000, 0000, 0013, 0000, 0166, 0000, 
+  0010, 0066, 0000, 0000, 0044, 0073, 0000, 0000, 0301, 0163, 0324, 0134, 0000, 0000, 0000, 0000, 
+  0044, 0073, 0000, 0000, 0015, 0000, 0166, 0000, 0070, 0073, 0000, 0000, 0007, 0100, 0000, 0000, 
+  0041, 0353, 0016, 0063, 0000, 0000, 0000, 0000, 0007, 0100, 0000, 0000, 0020, 0000, 0166, 0000, 
+  0030, 0100, 0000, 0000, 0200, 0103, 0000, 0000, 0014, 0054, 0304, 0004, 0000, 0000, 0000, 0000, 
+  0200, 0103, 0000, 0000, 0022, 0000, 0166, 0000, 0230, 0103, 0000, 0000, 0306, 0113, 0000, 0000, 
+  0201, 0321, 0040, 0031, 0002, 0000, 0000, 0000, 0306, 0113, 0000, 0000, 0005, 0000, 0114, 0000, 
+  0314, 0113, 0000, 0000, 0320, 0113, 0000, 0000, 0165, 0151, 0057, 0000, 0013, 0000, 0000, 0000, 
+  0020, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0017, 0000, 0000, 0000, 
+  0011, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0005, 0000, 0000, 0000, 0015, 0000, 0000, 0000, 0016, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0144, 0154, 0147, 0055, 0145, 0170, 0164, 0162, 0141, 0143, 0164, 0056, 0165, 0151, 0000, 0000, 
+  0260, 0112, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0121, 0163, 0333, 0066, 
+  0014, 0176, 0357, 0257, 0340, 0370, 0270, 0235, 0222, 0332, 0331, 0172, 0273, 0056, 0166, 0257, 
+  0153, 0233, 0156, 0167, 0273, 0333, 0135, 0327, 0075, 0363, 0150, 0011, 0226, 0271, 0322, 0244, 
+  0106, 0322, 0261, 0375, 0053, 0366, 0270, 0377, 0267, 0137, 0062, 0110, 0262, 0123, 0053, 0246, 
+  0054, 0051, 0222, 0153, 0247, 0321, 0123, 0325, 0030, 0000, 0011, 0020, 0370, 0010, 0002, 0224, 
+  0256, 0137, 0255, 0346, 0222, 0334, 0202, 0261, 0102, 0253, 0021, 0035, 0134, 0074, 0247, 0004, 
+  0124, 0250, 0043, 0241, 0342, 0021, 0375, 0363, 0343, 0115, 0360, 0043, 0175, 0065, 0176, 0166, 
+  0375, 0115, 0020, 0220, 0367, 0240, 0300, 0160, 0007, 0021, 0131, 0012, 0067, 0043, 0261, 0344, 
+  0021, 0220, 0253, 0213, 0341, 0360, 0142, 0100, 0202, 0000, 0211, 0204, 0162, 0140, 0246, 0074, 
+  0204, 0361, 0063, 0102, 0256, 0015, 0374, 0275, 0020, 0006, 0054, 0221, 0142, 0062, 0242, 0261, 
+  0373, 0364, 0035, 0375, 0074, 0120, 0312, 0106, 0057, 0063, 0072, 0075, 0371, 0013, 0102, 0107, 
+  0102, 0311, 0255, 0035, 0321, 0367, 0356, 0323, 0257, 0163, 0036, 0003, 0045, 0042, 0032, 0121, 
+  0221, 0076, 0016, 0150, 0112, 0207, 0224, 0211, 0321, 0011, 0030, 0267, 0046, 0212, 0317, 0141, 
+  0104, 0157, 0205, 0025, 0023, 0011, 0164, 0374, 0321, 0054, 0340, 0372, 0162, 0373, 0253, 0237, 
+  0070, 0344, 0212, 0115, 0165, 0270, 0260, 0164, 0174, 0303, 0245, 0255, 0244, 0027, 0241, 0126, 
+  0054, 0175, 0244, 0343, 0031, 0310, 0044, 0230, 0030, 0275, 0264, 0140, 0212, 0154, 0327, 0227, 
+  0371, 0344, 0353, 0351, 0061, 0074, 0261, 0036, 0370, 0113, 0010, 0326, 0006, 0326, 0351, 0244, 
+  0215, 0036, 0127, 0047, 0326, 0003, 0126, 0316, 0360, 0320, 0005, 0334, 0204, 0063, 0161, 0013, 
+  0115, 0124, 0271, 0021, 0022, 0336, 0314, 0264, 0306, 0225, 0174, 0053, 0270, 0324, 0161, 0256, 
+  0126, 0224, 0075, 0263, 0215, 0140, 0332, 0315, 0214, 0235, 0160, 0150, 0014, 0202, 0042, 0225, 
+  0225, 0334, 0161, 0064, 0315, 0210, 0256, 0001, 0331, 0337, 0345, 0343, 0124, 0012, 0130, 0047, 
+  0300, 0146, 0030, 0124, 0164, 0234, 0117, 0260, 0212, 0001, 0145, 0142, 0160, 0321, 0261, 0005, 
+  0211, 0152, 0007, 0123, 0055, 0243, 0373, 0036, 0273, 0317, 0044, 0165, 0310, 0045, 0323, 0112, 
+  0256, 0313, 0364, 0262, 0042, 0126, 0134, 0156, 0310, 0043, 0260, 0316, 0350, 0065, 0045, 0063, 
+  0256, 0042, 0011, 0146, 0104, 0161, 0135, 0212, 0366, 0143, 0167, 0064, 0166, 0311, 0223, 0004, 
+  0320, 0300, 0112, 0347, 0301, 0176, 0137, 0032, 0302, 0103, 0242, 0225, 0205, 0203, 0342, 0076, 
+  0023, 0371, 0344, 0241, 0017, 0310, 0050, 0177, 0116, 0225, 0223, 0010, 0077, 0263, 0114, 0361, 
+  0055, 0301, 0345, 0016, 0105, 0116, 0115, 0062, 0240, 0302, 0131, 0004, 0331, 0177, 0321, 0163, 
+  0047, 0172, 0105, 0357, 0144, 0354, 0171, 0315, 0317, 0073, 0277, 0066, 0367, 0013, 0037, 0217, 
+  0066, 0002, 0224, 0343, 0371, 0162, 0041, 0050, 0072, 0201, 0213, 0340, 0145, 0364, 0117, 0070, 
+  0137, 0151, 0306, 0015, 0360, 0235, 0231, 0171, 0347, 0276, 0160, 0116, 0253, 0242, 0006, 0017, 
+  0325, 0302, 0353, 0076, 0174, 0255, 0027, 0216, 0131, 0267, 0116, 0043, 0037, 0124, 0124, 0312, 
+  0130, 0130, 0250, 0252, 0011, 0347, 0161, 0071, 0311, 0236, 0207, 0364, 0076, 0227, 0157, 0032, 
+  0023, 0220, 0336, 0140, 0143, 0277, 0040, 0174, 0227, 0115, 0252, 0061, 0214, 0325, 0064, 0141, 
+  0123, 0126, 0003, 0041, 0040, 0224, 0131, 0014, 0235, 0051, 0137, 0110, 0327, 0134, 0102, 0206, 
+  0314, 0164, 0234, 0157, 0230, 0115, 0030, 0027, 0026, 0330, 0102, 0141, 0274, 0110, 0241, 0052, 
+  0225, 0336, 0105, 0327, 0242, 0120, 0036, 0176, 0302, 0224, 0241, 0172, 0070, 0130, 0045, 0030, 
+  0351, 0315, 0365, 0233, 0012, 0051, 0233, 0163, 0045, 0332, 0212, 0074, 0310, 0236, 0037, 0122, 
+  0312, 0073, 0373, 0002, 0160, 0264, 0367, 0342, 0101, 0073, 0057, 0176, 0303, 0125, 0010, 0362, 
+  0151, 0371, 0361, 0260, 0367, 0343, 0075, 0077, 0036, 0234, 0332, 0217, 0257, 0332, 0371, 0161, 
+  0111, 0356, 0163, 0156, 0216, 0234, 0262, 0076, 0330, 0207, 0147, 0274, 0105, 0000, 0164, 0033, 
+  0102, 0127, 0175, 0010, 0355, 0205, 0320, 0260, 0213, 0020, 0362, 0251, 0357, 0127, 0275, 0114, 
+  0355, 0106, 0151, 0126, 0256, 0163, 0043, 0226, 0312, 0275, 0317, 0243, 0354, 0236, 0242, 0373, 
+  0070, 0341, 0117, 0217, 0063, 0200, 0310, 0022, 0166, 0266, 0024, 0121, 0014, 0256, 0042, 0335, 
+  0254, 0025, 0323, 0135, 0345, 0250, 0163, 0156, 0142, 0241, 0230, 0204, 0051, 0116, 0353, 0105, 
+  0103, 0056, 0043, 0342, 0331, 0003, 0330, 0360, 0214, 0335, 0234, 0151, 0242, 0021, 0141, 0347, 
+  0015, 0370, 0054, 0256, 0040, 0056, 0340, 0041, 0216, 0232, 0100, 0177, 0143, 0262, 0263, 0365, 
+  0027, 0001, 0343, 0203, 0213, 0127, 0272, 0237, 0260, 0025, 0227, 0170, 0166, 0074, 0230, 0312, 
+  0171, 0054, 0064, 0343, 0221, 0136, 0262, 0364, 0054, 0115, 0307, 0112, 0253, 0303, 0343, 0172, 
+  0215, 0345, 0067, 0330, 0353, 0164, 0062, 0163, 0120, 0216, 0372, 0350, 0133, 0030, 0256, 0255, 
+  0361, 0274, 0006, 0104, 0327, 0147, 0011, 0217, 0242, 0314, 0131, 0006, 0303, 0112, 0376, 0122, 
+  0103, 0124, 0100, 0000, 0036, 0244, 0257, 0150, 0031, 0137, 0113, 0243, 0164, 0141, 0230, 0007, 
+  0107, 0354, 0041, 0001, 0265, 0117, 0363, 0225, 0316, 0132, 0031, 0316, 0365, 0027, 0311, 0277, 
+  0120, 0037, 0170, 0044, 0364, 0156, 0122, 0307, 0245, 0144, 0270, 0271, 0140, 0276, 0141, 0322, 
+  0237, 0362, 0034, 0217, 0036, 0022, 0332, 0050, 0335, 0173, 0055, 0045, 0311, 0304, 0327, 0121, 
+  0250, 0023, 0017, 0151, 0231, 0010, 0066, 0113, 0315, 0152, 0373, 0234, 0077, 0115, 0314, 0361, 
+  0314, 0072, 0156, 0334, 0103, 0205, 0064, 0312, 0331, 0016, 0213, 0112, 0213, 0112, 0267, 0055, 
+  0145, 0104, 0206, 0057, 0231, 0120, 0021, 0106, 0200, 0323, 0246, 0211, 0254, 0262, 0174, 0262, 
+  0136, 0156, 0331, 0072, 0341, 0352, 0046, 0351, 0154, 0135, 0213, 0250, 0221, 0214, 0126, 0236, 
+  0355, 0072, 0307, 0210, 0274, 0236, 0014, 0321, 0061, 0201, 0342, 0217, 0315, 0030, 0075, 0132, 
+  0074, 0022, 0264, 0170, 0170, 0244, 0357, 0313, 0212, 0215, 0136, 0340, 0346, 0353, 0335, 0213, 
+  0172, 0364, 0250, 0137, 0001, 0072, 0007, 0364, 0330, 0115, 0005, 0277, 0247, 0247, 0015, 0337, 
+  0126, 0153, 0326, 0054, 0031, 0253, 0147, 0256, 0232, 0200, 0233, 0006, 0001, 0246, 0353, 0056, 
+  0155, 0372, 0064, 0200, 0333, 0206, 0220, 0233, 0066, 0103, 0355, 0313, 0272, 0312, 0165, 0266, 
+  0136, 0035, 0102, 0356, 0021, 0140, 0267, 0063, 0350, 0355, 0030, 0176, 0273, 0206, 0340, 0343, 
+  0300, 0360, 0106, 0056, 0017, 0323, 0213, 0006, 0142, 0042, 0244, 0250, 0103, 0237, 0135, 0026, 
+  0221, 0331, 0371, 0211, 0244, 0007, 0365, 0215, 0327, 0006, 0123, 0124, 0212, 0240, 0315, 0143, 
+  0160, 0367, 0142, 0002, 0217, 0133, 0146, 0275, 0155, 0001, 0037, 0024, 0174, 0331, 0150, 0056, 
+  0165, 0266, 0221, 0372, 0133, 0111, 0147, 0333, 0111, 0067, 0133, 0112, 0047, 0111, 0151, 0315, 
+  0255, 0245, 0326, 0366, 0322, 0006, 0063, 0337, 0145, 0036, 0260, 0217, 0226, 0271, 0147, 0174, 
+  0035, 0120, 0346, 0264, 0226, 0116, 0044, 0314, 0301, 0312, 0171, 0041, 0034, 0126, 0174, 0236, 
+  0110, 0170, 0111, 0276, 0275, 0160, 0053, 0367, 0023, 0376, 0023, 0351, 0260, 0315, 0210, 0102, 
+  0155, 0354, 0300, 0302, 0031, 0107, 0104, 0371, 0357, 0337, 0177, 0032, 0211, 0053, 0134, 0356, 
+  0100, 0021, 0052, 0206, 0250, 0170, 0267, 0143, 0177, 0261, 0330, 0035, 0235, 0347, 0172, 0307, 
+  0027, 0200, 0031, 0011, 0121, 0060, 0131, 0227, 0000, 0315, 0356, 0346, 0333, 0303, 0115, 0207, 
+  0160, 0063, 0070, 0005, 0334, 0074, 0241, 0123, 0302, 0360, 0113, 0235, 0022, 0016, 0333, 0364, 
+  0000, 0163, 0071, 0143, 0051, 0323, 0346, 0066, 0324, 0116, 0360, 0322, 0172, 0305, 0372, 0337, 
+  0112, 0151, 0317, 0255, 0120, 0137, 0232, 0256, 0327, 0150, 0234, 0347, 0240, 0350, 0234, 0021, 
+  0210, 0130, 0140, 0113, 0127, 0354, 0216, 0144, 0063, 0350, 0022, 0262, 0036, 0027, 0271, 0345, 
+  0162, 0001, 0351, 0301, 0115, 0106, 0145, 0140, 0207, 0000, 0167, 0120, 0176, 0343, 0105, 0355, 
+  0256, 0215, 0334, 0270, 0253, 0364, 0310, 0256, 0024, 0365, 0035, 0272, 0276, 0103, 0327, 0115, 
+  0207, 0356, 0105, 0337, 0241, 0073, 0337, 0016, 0335, 0233, 0031, 0204, 0205, 0153, 0127, 0006, 
+  0102, 0003, 0334, 0001, 0213, 0204, 0301, 0134, 0031, 0177, 0355, 0270, 0366, 0376, 0001, 0202, 
+  0164, 0004, 0074, 0146, 0220, 0374, 0312, 0170, 0137, 0176, 0377, 0232, 0313, 0357, 0175, 0243, 
+  0355, 0134, 0112, 0345, 0173, 0241, 0256, 0021, 0232, 0226, 0106, 0070, 0070, 0112, 0234, 0377, 
+  0216, 0322, 0131, 0046, 0236, 0300, 0112, 0130, 0207, 0012, 0367, 0335, 0266, 0247, 0320, 0155, 
+  0053, 0124, 0145, 0234, 0216, 0143, 0171, 0277, 0052, 0343, 0165, 0074, 0166, 0107, 0132, 0273, 
+  0060, 0323, 0267, 0341, 0316, 0026, 0133, 0224, 0166, 0114, 0301, 0022, 0216, 0223, 0103, 0274, 
+  0325, 0004, 0007, 0040, 0300, 0362, 0123, 0052, 0311, 0362, 0210, 0036, 0135, 0372, 0144, 0242, 
+  0257, 0250, 0235, 0052, 0340, 0103, 0251, 0055, 0154, 0337, 0245, 0074, 0106, 0314, 0147, 0003, 
+  0220, 0174, 0000, 0302, 0247, 0016, 0003, 0076, 0202, 0120, 0317, 0023, 0223, 0126, 0300, 0353, 
+  0267, 0014, 0373, 0300, 0357, 0003, 0277, 0017, 0374, 0016, 0003, 0077, 0057, 0027, 0330, 0305, 
+  0344, 0130, 0025, 0203, 0115, 0055, 0232, 0070, 0115, 0054, 0313, 0206, 0301, 0051, 0151, 0263, 
+  0356, 0043, 0276, 0217, 0370, 0076, 0267, 0367, 0105, 0074, 0351, 0273, 0147, 0047, 0355, 0236, 
+  0275, 0316, 0076, 0230, 0140, 0373, 0356, 0331, 0331, 0164, 0317, 0006, 0217, 0366, 0055, 0314, 
+  0046, 0257, 0054, 0126, 0146, 0021, 0325, 0057, 0141, 0026, 0165, 0054, 0176, 0316, 0044, 0377, 
+  0016, 0110, 0220, 0277, 0162, 0171, 0347, 0122, 0305, 0077, 0223, 0355, 0367, 0123, 0106, 0064, 
+  0030, 0014, 0350, 0170, 0363, 0121, 0215, 0364, 0252, 0312, 0016, 0125, 0065, 0357, 0213, 0055, 
+  0353, 0240, 0061, 0353, 0017, 0133, 0326, 0053, 0057, 0353, 0275, 0077, 0332, 0342, 0167, 0174, 
+  0256, 0057, 0167, 0276, 0053, 0365, 0077, 0115, 0332, 0110, 0023, 0000, 0050, 0165, 0165, 0141, 
+  0171, 0051, 0157, 0162, 0147, 0057, 0000, 0000, 0021, 0000, 0000, 0000, 0144, 0145, 0154, 0145, 
+  0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0270, 0035, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0321, 0162, 0342, 0066, 0024, 0175, 0337, 0257, 0120, 0365, 0330, 0216, 
+  0041, 0220, 0166, 0247, 0263, 0065, 0354, 0264, 0335, 0046, 0323, 0327, 0355, 0366, 0131, 0043, 
+  0244, 0013, 0126, 0021, 0222, 0053, 0311, 0001, 0372, 0365, 0275, 0266, 0011, 0140, 0120, 0002, 
+  0366, 0222, 0055, 0323, 0315, 0123, 0210, 0174, 0217, 0244, 0173, 0244, 0163, 0164, 0145, 0247, 
+  0357, 0127, 0013, 0115, 0036, 0300, 0171, 0145, 0315, 0210, 0016, 0172, 0067, 0224, 0200, 0021, 
+  0126, 0052, 0063, 0033, 0321, 0077, 0077, 0335, 0045, 0077, 0322, 0367, 0343, 0067, 0351, 0067, 
+  0111, 0102, 0356, 0301, 0200, 0343, 0001, 0044, 0131, 0252, 0220, 0221, 0231, 0346, 0022, 0310, 
+  0155, 0357, 0366, 0155, 0357, 0206, 0044, 0011, 0006, 0051, 0023, 0300, 0115, 0271, 0200, 0361, 
+  0033, 0102, 0122, 0007, 0177, 0027, 0312, 0201, 0047, 0132, 0115, 0106, 0164, 0026, 0346, 0337, 
+  0321, 0335, 0100, 0267, 0275, 0341, 0220, 0366, 0253, 0070, 0073, 0371, 0013, 0104, 0040, 0102, 
+  0163, 0357, 0107, 0364, 0076, 0314, 0177, 0137, 0360, 0031, 0120, 0242, 0344, 0210, 0112, 0046, 
+  0270, 0021, 0240, 0231, 0252, 0332, 0312, 0170, 0104, 0344, 0316, 0346, 0340, 0302, 0232, 0030, 
+  0276, 0200, 0021, 0175, 0120, 0136, 0115, 0064, 0076, 0375, 0344, 0012, 0110, 0373, 0217, 0117, 
+  0343, 0301, 0330, 0037, 0233, 0132, 0121, 0170, 0072, 0276, 0343, 0332, 0237, 0214, 0127, 0302, 
+  0032, 0126, 0376, 0244, 0143, 0174, 0042, 0300, 0373, 0304, 0007, 0233, 0067, 0141, 0151, 0277, 
+  0116, 0342, 0214, 0174, 0354, 0374, 0052, 0162, 0001, 0251, 0102, 0042, 0101, 0103, 0200, 0066, 
+  0251, 0174, 0120, 0134, 0333, 0331, 0046, 0227, 0012, 0315, 0144, 0335, 0164, 0231, 0031, 0116, 
+  0254, 0223, 0340, 0330, 0122, 0311, 0220, 0321, 0361, 0017, 0247, 0302, 0203, 0012, 0310, 0025, 
+  0011, 0216, 0033, 0257, 0171, 0340, 0310, 0334, 0210, 0256, 0001, 0107, 0373, 0020, 0111, 0355, 
+  0030, 0217, 0273, 0123, 0375, 0303, 0053, 0276, 0317, 0232, 0336, 0122, 0031, 0151, 0227, 0054, 
+  0267, 0136, 0005, 0334, 0306, 0164, 0054, 0240, 0334, 0362, 0211, 0065, 0111, 0316, 0035, 0376, 
+  0076, 0071, 0341, 0165, 0016, 0054, 0103, 0235, 0320, 0161, 0315, 0333, 0021, 0300, 0253, 0231, 
+  0341, 0172, 0023, 0056, 0301, 0007, 0147, 0327, 0224, 0144, 0334, 0110, 0015, 0156, 0104, 0161, 
+  0001, 0033, 0274, 0263, 0155, 0210, 0137, 0362, 0074, 0007, 0134, 0027, 0143, 0153, 0141, 0141, 
+  0147, 0042, 0123, 0132, 0222, 0112, 0226, 0330, 0151, 0122, 0375, 0213, 0173, 0154, 0142, 0127, 
+  0233, 0365, 0212, 0255, 0361, 0057, 0370, 0264, 0136, 0340, 0152, 0204, 0244, 0014, 0037, 0174, 
+  0277, 0005, 0264, 0334, 0263, 0135, 0166, 0105, 0014, 0143, 0235, 0102, 0176, 0171, 0115, 0073, 
+  0332, 0110, 0120, 0202, 0353, 0163, 0200, 0076, 0347, 0002, 0315, 0214, 0216, 0207, 0321, 0350, 
+  0070, 0105, 0134, 0224, 0003, 0061, 0134, 0123, 0276, 0227, 0170, 0224, 0255, 0042, 0004, 0153, 
+  0016, 0071, 0333, 0303, 0067, 0250, 0353, 0104, 0137, 0127, 0012, 0143, 0070, 0315, 0327, 0266, 
+  0010, 0314, 0207, 0165, 0071, 0042, 0030, 0371, 0044, 0260, 0142, 0242, 0331, 0366, 0164, 0376, 
+  0007, 0156, 0075, 0251, 0033, 0017, 0321, 0261, 0351, 0114, 0100, 0107, 0005, 0314, 0176, 0255, 
+  0272, 0172, 0152, 0172, 0235, 0211, 0074, 0101, 0146, 0133, 0250, 0003, 0001, 0352, 0001, 0074, 
+  0352, 0160, 0312, 0013, 0035, 0116, 0054, 0107, 0324, 0225, 0353, 0343, 0240, 0171, 0324, 0265, 
+  0351, 0240, 0360, 0300, 0012, 0203, 0276, 0251, 0225, 0351, 0220, 0075, 0327, 0113, 0276, 0366, 
+  0314, 0147, 0350, 0154, 0233, 0271, 0074, 0337, 0305, 0376, 0021, 0321, 0354, 0230, 0213, 0071, 
+  0112, 0355, 0364, 0220, 0260, 0312, 0321, 0320, 0072, 0160, 0065, 0125, 0132, 0167, 0200, 0355, 
+  0014, 0373, 0346, 0271, 0264, 0242, 0363, 0117, 0373, 0021, 0045, 0164, 0123, 0007, 0236, 0375, 
+  0227, 0120, 0106, 0374, 0154, 0273, 0066, 0145, 0224, 0320, 0255, 0050, 0332, 0202, 0063, 0356, 
+  0273, 0203, 0057, 0251, 0311, 0307, 0162, 0355, 0232, 0365, 0170, 0130, 0065, 0010, 0255, 0304, 
+  0034, 0344, 0101, 0325, 0260, 0333, 0175, 0154, 0033, 0020, 0251, 0031, 0376, 0037, 0062, 0037, 
+  0134, 0102, 0346, 0061, 0002, 0342, 0311, 0167, 0112, 0074, 0236, 0164, 0233, 0042, 0240, 0234, 
+  0013, 0053, 0113, 0312, 0347, 0117, 0362, 0266, 0146, 0030, 0141, 0350, 0210, 0235, 0143, 0003, 
+  0074, 0066, 0277, 0173, 0247, 0144, 0155, 0175, 0225, 0175, 0015, 0257, 0251, 0016, 0072, 0161, 
+  0321, 0170, 0322, 0132, 0120, 0223, 0333, 0202, 0362, 0355, 0331, 0223, 0264, 0272, 0130, 0230, 
+  0035, 0160, 0060, 0374, 0334, 0252, 0353, 0043, 0227, 0312, 0066, 0017, 0027, 0256, 0065, 0303, 
+  0055, 0204, 0266, 0347, 0312, 0207, 0237, 0167, 0304, 0374, 0254, 0065, 0251, 0072, 0373, 0012, 
+  0352, 0257, 0214, 0153, 0164, 0117, 0072, 0366, 0201, 0273, 0360, 0005, 0175, 0136, 0072, 0216, 
+  0006, 0157, 0044, 0136, 0144, 0202, 0165, 0355, 0361, 0063, 0147, 0213, 0274, 0074, 0243, 0366, 
+  0126, 0375, 0045, 0213, 0066, 0015, 0323, 0300, 0170, 0010, 0134, 0144, 0317, 0326, 0121, 0221, 
+  0133, 0257, 0315, 0273, 0001, 0067, 0362, 0034, 0176, 0331, 0242, 0055, 0042, 0056, 0217, 0045, 
+  0227, 0010, 0040, 0057, 0247, 0260, 0077, 0066, 0075, 0276, 0312, 0354, 0125, 0146, 0057, 0040, 
+  0263, 0301, 0365, 0313, 0354, 0067, 0023, 0334, 0372, 0121, 0140, 0065, 0271, 0120, 0065, 0135, 
+  0247, 0004, 0202, 0265, 0072, 0250, 0234, 0005, 0130, 0205, 0250, 0244, 0141, 0305, 0027, 0271, 
+  0206, 0167, 0344, 0333, 0136, 0130, 0205, 0237, 0360, 0217, 0264, 0242, 0225, 0102, 0036, 0313, 
+  0306, 0226, 0345, 0076, 0226, 0371, 0263, 0343, 0162, 0177, 0217, 0121, 0266, 0015, 0171, 0341, 
+  0202, 0277, 0261, 0167, 0007, 0135, 0367, 0356, 0177, 0157, 0367, 0027, 0163, 0371, 0273, 0262, 
+  0243, 0167, 0257, 0356, 0176, 0045, 0356, 0176, 0055, 0356, 0074, 0374, 0072, 0256, 0247, 0247, 
+  0256, 0343, 0247, 0057, 0232, 0315, 0034, 0033, 0017, 0323, 0372, 0035, 0173, 0202, 0207, 0327, 
+  0014, 0202, 0337, 0042, 0032, 0315, 0304, 0201, 0317, 0255, 0361, 0070, 0233, 0233, 0275, 0127, 
+  0254, 0365, 0173, 0220, 0264, 0337, 0210, 0075, 0257, 0207, 0355, 0133, 0224, 0050, 0372, 0240, 
+  0321, 0067, 0276, 0303, 0224, 0067, 0365, 0315, 0067, 0253, 0011, 0167, 0273, 0057, 0060, 0271, 
+  0346, 0002, 0062, 0253, 0121, 0004, 0375, 0243, 0104, 0167, 0014, 0244, 0375, 0275, 0357, 0253, 
+  0377, 0002, 0227, 0042, 0355, 0310, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0156, 0147, 
+  0162, 0141, 0155, 0160, 0141, 0056, 0141, 0142, 0157, 0165, 0164, 0000, 0000, 0000, 0000, 0000, 
+  0065, 0005, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0155, 0224, 0315, 0156, 0333, 0106, 
+  0020, 0200, 0357, 0171, 0212, 0275, 0354, 0321, 0164, 0044, 0327, 0005, 0132, 0062, 0002, 0144, 
+  0070, 0010, 0322, 0046, 0212, 0121, 0045, 0161, 0352, 0242, 0207, 0041, 0071, 0132, 0256, 0271, 
+  0334, 0141, 0146, 0167, 0145, 0111, 0367, 0076, 0121, 0200, 0274, 0100, 0372, 0140, 0035, 0122, 
+  0202, 0055, 0243, 0072, 0161, 0166, 0346, 0343, 0374, 0357, 0376, 0065, 0057, 0051, 0305, 0277, 
+  0137, 0314, 0123, 0154, 0210, 0303, 0253, 0171, 0015, 0235, 0172, 0315, 0165, 0007, 0136, 0025, 
+  0015, 0266, 0350, 0064, 0160, 0325, 0070, 0353, 0323, 0046, 0263, 0176, 0105, 0263, 0174, 0356, 
+  0160, 0003, 0276, 0106, 0126, 0153, 0362, 0352, 0215, 0113, 0125, 0253, 0336, 0176, 0126, 0105, 
+  0013, 0316, 0331, 0020, 0355, 0245, 0116, 0336, 0156, 0166, 0350, 0263, 0212, 0272, 0131, 0176, 
+  0045, 0352, 0037, 0337, 0324, 0233, 0355, 0217, 0357, 0154, 0266, 0252, 0050, 0345, 0114, 0146, 
+  0113, 0254, 0115, 0007, 0326, 0355, 0241, 0353, 0316, 0106, 0336, 0252, 0367, 0266, 0155, 0054, 
+  0343, 0132, 0065, 0061, 0366, 0341, 0327, 0363, 0163, 0143, 0143, 0223, 0312, 0201, 0071, 0357, 
+  0016, 0266, 0374, 0265, 0263, 0020, 0324, 0034, 0113, 0253, 0212, 0024, 0220, 0047, 0077, 0115, 
+  0165, 0103, 0361, 0311, 0331, 0133, 0260, 0136, 0055, 0154, 0105, 0116, 0025, 0126, 0144, 0257, 
+  0003, 0127, 0231, 0361, 0324, 0141, 0106, 0154, 0004, 0360, 0206, 0324, 0022, 0154, 0334, 0251, 
+  0142, 0220, 0263, 0121, 0326, 0041, 0246, 0072, 0223, 0334, 0317, 0032, 0360, 0236, 0326, 0310, 
+  0131, 0215, 0263, 0374, 0067, 0010, 0275, 0324, 0372, 0316, 0342, 0332, 0206, 0200, 0152, 0136, 
+  0263, 0005, 0360, 0042, 0025, 0367, 0243, 0111, 0067, 0251, 0353, 0173, 0310, 0274, 0233, 0345, 
+  0357, 0040, 0061, 0372, 0250, 0026, 0320, 0017, 0111, 0026, 0021, 0272, 0336, 0201, 0327, 0053, 
+  0106, 0314, 0126, 0054, 0000, 0132, 0323, 0250, 0145, 0105, 0061, 0252, 0302, 0015, 0207, 0311, 
+  0364, 0142, 0354, 0256, 0066, 0104, 0306, 0341, 0123, 0031, 0357, 0201, 0243, 0024, 0162, 0153, 
+  0273, 0236, 0061, 0210, 0263, 0156, 0124, 0144, 0017, 0007, 0205, 0256, 0300, 0223, 0267, 0025, 
+  0034, 0370, 0005, 0272, 0040, 0003, 0221, 0337, 0276, 0046, 0024, 0334, 0167, 0224, 0165, 0373, 
+  0303, 0161, 0253, 0077, 0354, 0324, 0102, 0175, 0264, 0054, 0163, 0056, 0074, 0110, 0356, 0264, 
+  0073, 0066, 0337, 0100, 0351, 0110, 0135, 0311, 0320, 0055, 0072, 0120, 0105, 0250, 0350, 0101, 
+  0263, 0015, 0230, 0372, 0314, 0143, 0034, 0000, 0032, 0201, 0252, 0152, 0254, 0103, 0043, 0110, 
+  0017, 0124, 0102, 0245, 0217, 0032, 0174, 0203, 0134, 0042, 0223, 0044, 0321, 0037, 0244, 0147, 
+  0041, 0054, 0105, 0126, 0327, 0374, 0357, 0077, 0106, 0200, 0341, 0120, 0063, 0230, 0143, 0342, 
+  0017, 0222, 0237, 0242, 0272, 0112, 0367, 0252, 0340, 0121, 0316, 0312, 0164, 0177, 0114, 0054, 
+  0367, 0033, 0270, 0174, 0100, 0144, 0011, 0043, 0233, 0151, 0331, 0306, 0147, 0304, 0330, 0143, 
+  0331, 0076, 0217, 0260, 0036, 0372, 0021, 0312, 0275, 0254, 0301, 0225, 0211, 0315, 0276, 0232, 
+  0045, 0262, 0301, 0255, 0272, 0041, 0111, 0036, 0206, 0315, 0053, 0102, 0244, 0326, 0106, 0172, 
+  0346, 0052, 0342, 0112, 0172, 0255, 0176, 0007, 0206, 0036, 0143, 0030, 0046, 0033, 0366, 0072, 
+  0335, 0076, 0352, 0036, 0331, 0065, 0252, 0073, 0014, 0125, 0063, 0102, 0153, 0334, 0015, 0362, 
+  0364, 0330, 0337, 0147, 0133, 0105, 0342, 0301, 0035, 0012, 0264, 0156, 0207, 0257, 0146, 0254, 
+  0033, 0210, 0007, 0300, 0101, 0255, 0076, 0260, 0043, 0311, 0247, 0043, 0037, 0042, 0150, 0353, 
+  0113, 0332, 0144, 0234, 0146, 0371, 0055, 0271, 0225, 0001, 0157, 0324, 0047, 0127, 0262, 0035, 
+  0302, 0164, 0020, 0121, 0263, 0124, 0151, 0343, 0270, 0262, 0267, 0111, 0175, 0261, 0100, 0321, 
+  0016, 0227, 0170, 0213, 0121, 0156, 0345, 0161, 0370, 0073, 0364, 0267, 0340, 0132, 0151, 0337, 
+  0377, 0247, 0173, 0307, 0213, 0263, 0166, 0276, 0275, 0376, 0372, 0347, 0251, 0073, 0370, 0144, 
+  0315, 0301, 0155, 0172, 0167, 0212, 0031, 0015, 0171, 0353, 0137, 0276, 0214, 0225, 0077, 0005, 
+  0034, 0114, 0071, 0111, 0023, 0114, 0103, 0041, 0236, 0202, 0036, 0215, 0171, 0350, 0217, 0146, 
+  0363, 0050, 0353, 0050, 0027, 0173, 0137, 0116, 0220, 0147, 0210, 0232, 0241, 0030, 0054, 0041, 
+  0014, 0105, 0147, 0242, 0311, 0104, 0065, 0074, 0104, 0147, 0344, 0152, 0364, 0343, 0300, 0207, 
+  0326, 0034, 0056, 0344, 0251, 0220, 0007, 0123, 0276, 0153, 0322, 0026, 0344, 0215, 0221, 0016, 
+  0027, 0223, 0313, 0311, 0305, 0164, 0072, 0231, 0114, 0176, 0271, 0324, 0223, 0237, 0057, 0366, 
+  0001, 0137, 0374, 0007, 0242, 0310, 0344, 0221, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0156, 
+  0145, 0167, 0056, 0165, 0151, 0000, 0000, 0000, 0252, 0071, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0313, 0216, 0333, 0066, 0360, 0236, 0257, 0120, 0165, 0055, 0264, 0176, 
+  0154, 0033, 0024, 0201, 0355, 0040, 0273, 0115, 0322, 0002, 0015, 0122, 0040, 0351, 0231, 0240, 
+  0245, 0261, 0305, 0054, 0115, 0252, 0044, 0155, 0257, 0277, 0242, 0307, 0376, 0137, 0277, 0244, 
+  0103, 0311, 0366, 0132, 0326, 0233, 0166, 0262, 0336, 0044, 0071, 0154, 0154, 0151, 0146, 0070, 
+  0063, 0344, 0074, 0071, 0036, 0275, 0274, 0137, 0160, 0157, 0005, 0112, 0063, 0051, 0306, 0376, 
+  0340, 0252, 0357, 0173, 0040, 0102, 0031, 0061, 0061, 0037, 0373, 0177, 0175, 0174, 0023, 0374, 
+  0342, 0277, 0234, 0074, 0033, 0375, 0020, 0004, 0336, 0133, 0020, 0240, 0250, 0201, 0310, 0133, 
+  0063, 0023, 0173, 0163, 0116, 0043, 0360, 0256, 0257, 0206, 0303, 0253, 0201, 0027, 0004, 0010, 
+  0304, 0204, 0001, 0065, 0243, 0041, 0114, 0236, 0171, 0336, 0110, 0301, 0337, 0113, 0246, 0100, 
+  0173, 0234, 0115, 0307, 0376, 0334, 0334, 0375, 0350, 0077, 0054, 0144, 0321, 0374, 0136, 0012, 
+  0047, 0247, 0237, 0040, 0064, 0136, 0310, 0251, 0326, 0143, 0377, 0255, 0271, 0373, 0175, 0101, 
+  0347, 0340, 0173, 0054, 0032, 0373, 0314, 0176, 0034, 0370, 0026, 0016, 0041, 0023, 0045, 0023, 
+  0120, 0146, 0343, 0011, 0272, 0200, 0261, 0277, 0142, 0232, 0115, 0071, 0370, 0223, 0217, 0152, 
+  0011, 0243, 0336, 0356, 0155, 0071, 0160, 0110, 0005, 0231, 0311, 0160, 0251, 0375, 0311, 0033, 
+  0312, 0165, 0043, 0074, 0013, 0245, 0040, 0366, 0243, 0077, 0301, 0067, 0041, 0150, 0035, 0150, 
+  0043, 0223, 0074, 0332, 0250, 0227, 0061, 0337, 0116, 0216, 0341, 0043, 0313, 0021, 0003, 0117, 
+  0202, 0251, 0222, 0153, 0015, 0352, 0024, 0071, 0256, 0037, 0131, 0016, 0032, 0105, 0301, 0214, 
+  0161, 0320, 0201, 0221, 0001, 0125, 0141, 0314, 0126, 0320, 0105, 0236, 0127, 0321, 0247, 0245, 
+  0066, 0013, 0020, 0046, 0023, 0152, 0045, 0371, 0162, 0001, 0204, 0076, 0074, 0056, 0147, 0201, 
+  0313, 0065, 0050, 0177, 0322, 0277, 0032, 0364, 0363, 0377, 0006, 0115, 0314, 0057, 0223, 0304, 
+  0142, 0132, 0274, 0046, 0320, 0025, 0345, 0113, 0260, 0240, 0115, 0200, 0332, 0100, 0102, 0230, 
+  0010, 0025, 0144, 0054, 0073, 0260, 0225, 0340, 0146, 0036, 0222, 0070, 0136, 0264, 0136, 0215, 
+  0067, 0362, 0076, 0323, 0037, 0334, 0033, 0105, 0311, 0232, 0105, 0163, 0060, 0217, 0161, 0064, 
+  0244, 0142, 0310, 0076, 0065, 0350, 0130, 0374, 0011, 0172, 0030, 0303, 0102, 0312, 0033, 0325, 
+  0227, 0320, 0020, 0175, 0034, 0012, 0075, 0054, 0200, 0342, 0211, 0342, 0121, 0366, 0271, 0126, 
+  0360, 0231, 0124, 0013, 0152, 0110, 0030, 0113, 0211, 0046, 0105, 0246, 0370, 0174, 0207, 0325, 
+  0121, 0005, 0056, 0152, 0160, 0126, 0105, 0121, 0306, 0214, 0024, 0107, 0317, 0035, 0113, 0036, 
+  0201, 0352, 0035, 0000, 0366, 0362, 0332, 0070, 0070, 0022, 0031, 0026, 0015, 0357, 0120, 0217, 
+  0325, 0054, 0301, 0175, 0102, 0105, 0324, 0136, 0154, 0264, 0154, 0336, 0036, 0072, 0221, 0232, 
+  0145, 0322, 0366, 0213, 0340, 0370, 0344, 0220, 0273, 0234, 0050, 0115, 0233, 0374, 0072, 0145, 
+  0033, 0255, 0066, 0335, 0151, 0101, 0244, 0211, 0161, 0213, 0145, 0142, 0027, 0323, 0004, 0166, 
+  0157, 0077, 0317, 0176, 0267, 0105, 0331, 0262, 0121, 0247, 0335, 0342, 0076, 0027, 0375, 0041, 
+  0147, 0163, 0361, 0340, 0016, 0167, 0222, 0252, 0114, 0124, 0272, 0177, 0173, 0110, 0305, 0101, 
+  0136, 0327, 0063, 0136, 0206, 0207, 0221, 0230, 0044, 0030, 0007, 0122, 0013, 0176, 0136, 0211, 
+  0125, 0020, 0276, 0301, 0240, 0127, 0150, 0302, 0103, 0377, 0030, 0301, 0121, 0326, 0123, 0344, 
+  0075, 0311, 0266, 0253, 0010, 0354, 0135, 0336, 0363, 0132, 0254, 0122, 0245, 0065, 0050, 0056, 
+  0256, 0120, 0334, 0111, 0312, 0073, 0125, 0201, 0365, 0322, 0224, 0113, 0364, 0126, 0261, 0050, 
+  0023, 0311, 0120, 0144, 0162, 0340, 0127, 0241, 0236, 0050, 0327, 0071, 0144, 0053, 0243, 0201, 
+  0331, 0035, 0151, 0267, 0317, 0225, 0134, 0330, 0154, 0110, 0220, 0232, 0370, 0330, 0135, 0317, 
+  0025, 0056, 0126, 0030, 0265, 0331, 0371, 0327, 0004, 0237, 0256, 0245, 0212, 0010, 0244, 0117, 
+  0353, 0050, 0025, 0171, 0306, 0334, 0303, 0304, 0304, 0026, 0034, 0240, 0321, 0117, 0135, 0367, 
+  0373, 0155, 0170, 0076, 0313, 0046, 0072, 0172, 0362, 0326, 0274, 0060, 0316, 0314, 0246, 0303, 
+  0201, 0050, 0315, 0235, 0305, 0126, 0054, 0114, 0125, 0050, 0306, 0254, 0377, 0376, 0375, 0247, 
+  0065, 0051, 0215, 0336, 0237, 0362, 0235, 0140, 0061, 0025, 0163, 0014, 0067, 0036, 0376, 0037, 
+  0161, 0120, 0350, 0224, 0060, 0051, 0077, 0332, 0073, 0262, 0207, 0322, 0153, 0212, 0211, 0257, 
+  0335, 0136, 0351, 0367, 0152, 0317, 0306, 0121, 0126, 0121, 0056, 0324, 0161, 0246, 0321, 0106, 
+  0164, 0016, 0063, 0103, 0250, 0061, 0064, 0214, 0361, 0050, 0273, 0052, 0320, 0206, 0233, 0035, 
+  0221, 0226, 0107, 0353, 0050, 0367, 0050, 0007, 0151, 0060, 0032, 0027, 0243, 0372, 0203, 0116, 
+  0201, 0027, 0214, 0212, 0247, 0117, 0037, 0327, 0024, 0116, 0072, 0302, 0161, 0232, 0206, 0370, 
+  0023, 0155, 0250, 0062, 0256, 0104, 0062, 0055, 0170, 0130, 0255, 0010, 0315, 0151, 0352, 0340, 
+  0307, 0376, 0006, 0220, 0067, 0362, 0347, 0126, 0123, 0057, 0134, 0151, 0057, 0065, 0220, 0245, 
+  0115, 0011, 0071, 0023, 0047, 0352, 0154, 0041, 0140, 0041, 0005, 0013, 0367, 0045, 0325, 0261, 
+  0205, 0265, 0075, 0201, 0137, 0304, 0250, 0372, 0337, 0200, 0121, 0335, 0306, 0020, 0336, 0335, 
+  0054, 0215, 0301, 0324, 0153, 0153, 0132, 0200, 0145, 0363, 0046, 0061, 0044, 0006, 0212, 0233, 
+  0216, 0076, 0017, 0041, 0246, 0031, 0304, 0331, 0016, 0345, 0353, 0154, 0015, 0017, 0023, 0162, 
+  0317, 0066, 0074, 0074, 0316, 0064, 0176, 0223, 0362, 0153, 0210, 0156, 0012, 0102, 0140, 0053, 
+  0320, 0044, 0202, 0031, 0135, 0162, 0163, 0011, 0016, 0342, 0214, 0106, 0034, 0051, 0272, 0046, 
+  0114, 0104, 0230, 0244, 0033, 0251, 0272, 0320, 0172, 0112, 0301, 0160, 0160, 0121, 0166, 0133, 
+  0336, 0301, 0350, 0270, 0122, 0223, 0372, 0233, 0125, 0137, 0325, 0001, 0161, 0116, 0352, 0263, 
+  0226, 0210, 0063, 0172, 0155, 0217, 0244, 0343, 0126, 0325, 0050, 0257, 0116, 0161, 0365, 0112, 
+  0353, 0332, 0062, 0152, 0326, 0225, 0013, 0146, 0153, 0065, 0325, 0250, 0250, 0122, 0075, 0116, 
+  0125, 0265, 0040, 0333, 0326, 0164, 0276, 0263, 0170, 0071, 0305, 0265, 0123, 0203, 0301, 0245, 
+  0054, 0057, 0011, 0300, 0133, 0325, 0264, 0013, 0274, 0355, 0203, 0356, 0207, 0004, 0013, 0056, 
+  0217, 0011, 0043, 0275, 0355, 0022, 0332, 0223, 0063, 0027, 0263, 0073, 0147, 0077, 0300, 0225, 
+  0304, 0011, 0101, 0366, 0114, 0261, 0361, 0134, 0161, 0061, 0137, 0210, 0032, 0071, 0237, 0363, 
+  0142, 0041, 0132, 0074, 0023, 0144, 0017, 0331, 0252, 0030, 0275, 0130, 0347, 0357, 0252, 0356, 
+  0057, 0344, 0373, 0273, 0133, 0364, 0207, 0204, 0211, 0122, 0203, 0326, 0370, 0242, 0263, 0075, 
+  0137, 0202, 0255, 0071, 0166, 0131, 0216, 0311, 0034, 0136, 0103, 0026, 0156, 0046, 0235, 0104, 
+  0343, 0154, 0061, 0045, 0366, 0342, 0276, 0145, 0276, 0126, 0060, 0131, 0066, 0147, 0106, 0073, 
+  0042, 0013, 0024, 0100, 0261, 0260, 0203, 0132, 0323, 0203, 0344, 0245, 0263, 0004, 0150, 0360, 
+  0101, 0372, 0025, 0325, 0022, 0332, 0073, 0370, 0154, 0223, 0333, 0327, 0156, 0257, 0314, 0335, 
+  0373, 0364, 0101, 0307, 0242, 0154, 0217, 0367, 0342, 0305, 0303, 0302, 0101, 0172, 0375, 0134, 
+  0022, 0064, 0274, 0120, 0056, 0354, 0356, 0340, 0202, 0357, 0156, 0274, 0005, 0340, 0173, 0374, 
+  0073, 0247, 0323, 0215, 0261, 0041, 0345, 0335, 0315, 0271, 0022, 0377, 0247, 0232, 0272, 0236, 
+  0356, 0275, 0006, 0227, 0345, 0275, 0016, 0272, 0154, 0151, 0052, 0361, 0323, 0123, 0273, 0047, 
+  0250, 0114, 0200, 0316, 0160, 0226, 0277, 0342, 0143, 0070, 0374, 0136, 0100, 0235, 0301, 0132, 
+  0273, 0027, 0120, 0345, 0252, 0051, 0001, 0056, 0002, 0026, 0200, 0266, 0001, 0306, 0154, 0222, 
+  0275, 0035, 0324, 0337, 0217, 0037, 0033, 0373, 0360, 0222, 0156, 0302, 0153, 0332, 0207, 0357, 
+  0355, 0105, 0276, 0367, 0076, 0033, 0131, 0150, 0113, 0257, 0165, 0232, 0337, 0250, 0151, 0367, 
+  0121, 0221, 0326, 0343, 0056, 0256, 0263, 0042, 0203, 0056, 0263, 0042, 0365, 0123, 0120, 0157, 
+  0030, 0207, 0333, 0154, 0000, 0350, 0127, 0106, 0271, 0234, 0147, 0007, 0045, 0312, 0076, 0237, 
+  0147, 0300, 0151, 0041, 0043, 0312, 0333, 0315, 0116, 0255, 0261, 0264, 0222, 0153, 0362, 0040, 
+  0152, 0010, 0066, 0221, 0012, 0244, 0010, 0022, 0252, 0112, 0062, 0310, 0102, 0167, 0017, 0315, 
+  0202, 0304, 0314, 0146, 0237, 0302, 0216, 0067, 0065, 0016, 0122, 0321, 0060, 0133, 0110, 0323, 
+  0125, 0043, 0167, 0221, 0044, 0162, 0005, 0152, 0255, 0230, 0301, 0054, 0131, 0212, 0031, 0263, 
+  0003, 0124, 0051, 0172, 0033, 0341, 0362, 0203, 0146, 0207, 0337, 0012, 0230, 0271, 0152, 0061, 
+  0002, 0155, 0224, 0334, 0344, 0253, 0305, 0154, 0207, 0310, 0376, 0135, 0111, 0175, 0170, 0064, 
+  0043, 0124, 0154, 0057, 0226, 0114, 0024, 0025, 0022, 0327, 0325, 0141, 0363, 0246, 0246, 0331, 
+  0223, 0361, 0023, 0130, 0360, 0301, 0323, 0031, 0043, 0253, 0352, 0000, 0015, 0253, 0207, 0221, 
+  0112, 0122, 0173, 0273, 0020, 0301, 0343, 0111, 0033, 0074, 0161, 0126, 0060, 0036, 0253, 0354, 
+  0000, 0177, 0160, 0131, 0256, 0171, 0043, 0227, 0206, 0150, 0263, 0261, 0053, 0202, 0210, 0116, 
+  0236, 0123, 0312, 0325, 0313, 0310, 0126, 0010, 0234, 0124, 0326, 0312, 0035, 0042, 0305, 0155, 
+  0112, 0252, 0313, 0054, 0321, 0071, 0046, 0240, 0272, 0242, 0072, 0064, 0263, 0012, 0065, 0172, 
+  0072, 0312, 0074, 0311, 0306, 0312, 0273, 0040, 0166, 0354, 0176, 0025, 0234, 0044, 0137, 0323, 
+  0215, 0046, 0072, 0106, 0337, 0274, 0345, 0241, 0236, 0104, 0125, 0056, 0130, 0235, 0007, 0072, 
+  0347, 0314, 0216, 0267, 0015, 0116, 0235, 0246, 0212, 0314, 0257, 0064, 0353, 0163, 0263, 0012, 
+  0001, 0353, 0163, 0230, 0304, 0055, 0101, 0157, 0142, 0340, 0322, 0115, 0302, 0242, 0356, 0255, 
+  0341, 0221, 0355, 0351, 0372, 0273, 0075, 0175, 0036, 0173, 0032, 0074, 0246, 0075, 0331, 0037, 
+  0215, 0234, 0045, 0306, 0374, 0206, 0204, 0276, 0261, 0010, 0063, 0374, 0156, 0021, 0237, 0307, 
+  0042, 0072, 0051, 0126, 0003, 0126, 0032, 0021, 0265, 0103, 0245, 0115, 0032, 0151, 0153, 0114, 
+  0145, 0272, 0053, 0327, 0233, 0223, 0316, 0272, 0267, 0144, 0212, 0277, 0354, 0011, 0357, 0210, 
+  0055, 0345, 0352, 0363, 0316, 0256, 0041, 0274, 0104, 0103, 0025, 0355, 0225, 0123, 0177, 0131, 
+  0222, 0257, 0254, 0262, 0014, 0077, 0310, 0152, 0075, 0275, 0307, 0310, 0075, 0366, 0024, 0350, 
+  0104, 0012, 0215, 0162, 0004, 0317, 0355, 0314, 0134, 0056, 0077, 0036, 0365, 0162, 0300, 0315, 
+  0044, 0176, 0266, 0044, 0036, 0222, 0211, 0316, 0370, 0203, 0201, 0045, 0160, 0340, 0075, 0113, 
+  0051, 0034, 0075, 0324, 0371, 0176, 0303, 0250, 0167, 0360, 0213, 0312, 0377, 0001, 0311, 0355, 
+  0135, 0066, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0165, 0160, 0144, 0141, 0164, 0145, 0056, 
+  0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0360, 0104, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0134, 0115, 0163, 0333, 0066, 0020, 0275, 0347, 0127, 0240, 0270, 0364, 0320, 
+  0112, 0262, 0024, 0333, 0165, 0073, 0222, 0062, 0323, 0166, 0222, 0311, 0114, 0157, 0166, 0332, 
+  0043, 0007, 0042, 0127, 0042, 0152, 0010, 0140, 0261, 0220, 0145, 0345, 0327, 0167, 0105, 0132, 
+  0262, 0076, 0370, 0041, 0222, 0262, 0055, 0333, 0274, 0051, 0044, 0166, 0211, 0175, 0304, 0076, 
+  0054, 0366, 0321, 0351, 0177, 0272, 0237, 0052, 0166, 0007, 0026, 0245, 0321, 0003, 0336, 0155, 
+  0237, 0161, 0006, 0332, 0067, 0201, 0324, 0223, 0001, 0377, 0166, 0363, 0271, 0165, 0305, 0077, 
+  0015, 0077, 0364, 0177, 0150, 0265, 0330, 0027, 0320, 0140, 0205, 0203, 0200, 0315, 0245, 0013, 
+  0331, 0104, 0211, 0000, 0330, 0307, 0366, 0307, 0313, 0366, 0031, 0153, 0265, 0150, 0220, 0324, 
+  0016, 0354, 0130, 0370, 0060, 0374, 0300, 0130, 0337, 0302, 0177, 0063, 0151, 0001, 0231, 0222, 
+  0243, 0001, 0237, 0270, 0333, 0237, 0370, 0343, 0203, 0076, 0266, 0173, 0075, 0336, 0211, 0307, 
+  0231, 0321, 0277, 0340, 0073, 0346, 0053, 0201, 0070, 0340, 0137, 0334, 0355, 0327, 0251, 0230, 
+  0000, 0147, 0062, 0030, 0360, 0131, 0024, 0320, 0003, 0275, 0261, 0124, 0340, 0371, 0102, 0373, 
+  0240, 0074, 0031, 0337, 0135, 0132, 0222, 0155, 0144, 0115, 0004, 0326, 0055, 0230, 0026, 0123, 
+  0030, 0360, 0073, 0211, 0162, 0244, 0350, 0356, 0215, 0235, 0101, 0277, 0263, 0272, 0233, 0076, 
+  0230, 0374, 0171, 0143, 0343, 0317, 0220, 0017, 0077, 0013, 0205, 0205, 0343, 0245, 0157, 0264, 
+  0267, 0374, 0311, 0207, 0164, 0307, 0007, 0304, 0026, 0072, 0023, 0155, 0233, 0365, 0073, 0111, 
+  0070, 0245, 0042, 0063, 0267, 0047, 0021, 0125, 0100, 0146, 0123, 0320, 0256, 0205, 0342, 0016, 
+  0312, 0204, 0365, 0247, 0024, 0312, 0114, 0366, 0343, 0012, 0222, 0353, 0307, 0231, 0350, 0310, 
+  0330, 0000, 0254, 0067, 0227, 0201, 0013, 0371, 0360, 0242, 0150, 0270, 0133, 0104, 0340, 0205, 
+  0264, 0042, 0051, 0256, 0170, 0032, 0173, 0006, 0050, 0047, 0132, 0250, 0207, 0341, 0001, 0240, 
+  0263, 0146, 0301, 0131, 0050, 0164, 0240, 0300, 0016, 0070, 0301, 0262, 0037, 0213, 0267, 0036, 
+  0207, 0163, 0021, 0105, 0100, 0001, 0153, 0223, 0254, 0143, 0362, 0350, 0207, 0122, 0005, 0054, 
+  0316, 0002, 0362, 0334, 0212, 0377, 0111, 0257, 0157, 0144, 0356, 0037, 0060, 0110, 0003, 0357, 
+  0167, 0272, 0033, 0043, 0227, 0074, 0241, 0265, 0034, 0336, 0135, 0217, 0057, 0271, 0032, 0252, 
+  0000, 0235, 0146, 0143, 0254, 0244, 0205, 0040, 0034, 0345, 0052, 0037, 0122, 0322, 0072, 0351, 
+  0013, 0165, 0210, 0041, 0106, 0302, 0047, 0352, 0340, 0303, 0356, 0171, 0352, 0360, 0164, 0210, 
+  0204, 0277, 0174, 0222, 0047, 0054, 0210, 0215, 0310, 0123, 0321, 0232, 0071, 0147, 0364, 0056, 
+  0146, 0033, 0366, 0335, 0055, 0007, 0025, 0340, 0253, 0012, 0141, 0232, 0235, 0022, 0013, 0063, 
+  0163, 0036, 0272, 0305, 0362, 0211, 0240, 0203, 0114, 0303, 0030, 0210, 0355, 0153, 0331, 0341, 
+  0147, 0162, 0343, 0050, 0271, 0275, 0353, 0047, 0155, 0142, 0043, 0120, 0234, 0071, 0053, 0064, 
+  0052, 0341, 0004, 0041, 0062, 0340, 0013, 0240, 0370, 0274, 0077, 0142, 0127, 0131, 0023, 0255, 
+  0014, 0151, 0001, 0254, 0125, 0114, 0003, 0030, 0213, 0231, 0162, 0345, 0215, 0055, 0370, 0040, 
+  0357, 0000, 0037, 0075, 0344, 0276, 0325, 0124, 0332, 0114, 0370, 0072, 0153, 0177, 0052, 0343, 
+  0152, 0206, 0340, 0315, 0064, 0161, 0233, 0222, 0272, 0002, 0210, 0102, 0315, 0305, 0002, 0075, 
+  0014, 0315, 0174, 0265, 0213, 0344, 0273, 0330, 0344, 0362, 0155, 0307, 0302, 0277, 0245, 0334, 
+  0055, 0176, 0044, 0334, 0107, 0304, 0222, 0025, 0120, 0043, 0234, 0124, 0005, 0263, 0310, 0240, 
+  0114, 0250, 0350, 0054, 0057, 0254, 0324, 0371, 0367, 0073, 0051, 0251, 0125, 0067, 0335, 0150, 
+  0303, 0076, 0106, 0252, 0175, 0213, 0135, 0236, 0172, 0252, 0355, 0147, 0113, 0131, 0017, 0051, 
+  0311, 0262, 0052, 0171, 0116, 0071, 0121, 0166, 0153, 0004, 0137, 0111, 0377, 0026, 0202, 0354, 
+  0032, 0141, 0275, 0054, 0274, 0365, 0320, 0224, 0062, 0341, 0051, 0062, 0261, 0054, 0026, 0111, 
+  0042, 0226, 0265, 0172, 0314, 0303, 0356, 0061, 0362, 0060, 0055, 0374, 0364, 0320, 0053, 0021, 
+  0120, 0371, 0230, 0367, 0342, 0245, 0271, 0170, 0313, 0102, 0062, 0177, 0357, 0056, 0313, 0126, 
+  0051, 0010, 0355, 0241, 0263, 0317, 0120, 0071, 0225, 0143, 0110, 0045, 0143, 0357, 0224, 0352, 
+  0236, 0202, 0132, 0275, 0270, 0170, 0274, 0252, 0135, 0050, 0255, 0260, 0331, 0055, 0247, 0237, 
+  0222, 0131, 0113, 0157, 0154, 0007, 0227, 0331, 0371, 0341, 0247, 0103, 0260, 0161, 0330, 0214, 
+  0351, 0256, 0307, 0323, 0354, 0152, 0040, 0121, 0027, 0215, 0242, 0343, 0150, 0122, 0333, 0317, 
+  0205, 0325, 0264, 0050, 0052, 0071, 0102, 0371, 0235, 0034, 0135, 0346, 0333, 0146, 0261, 0160, 
+  0076, 0023, 0327, 0252, 0213, 0252, 0123, 0162, 0345, 0362, 0050, 0207, 0232, 0063, 0313, 0244, 
+  0327, 0274, 0103, 0075, 0167, 0245, 0270, 0311, 0067, 0347, 0157, 0207, 0157, 0062, 0031, 0272, 
+  0167, 0054, 0232, 0372, 0053, 0251, 0217, 0167, 0113, 0354, 0310, 0022, 0151, 0331, 0205, 0347, 
+  0340, 0336, 0171, 0111, 0015, 0375, 0012, 0350, 0053, 0024, 0212, 0052, 0106, 0076, 0104, 0047, 
+  0254, 0053, 0153, 0274, 0254, 0157, 0051, 0346, 0333, 0131, 0124, 0155, 0362, 0163, 0053, 0016, 
+  0262, 0074, 0051, 0302, 0253, 0144, 0372, 0204, 0214, 0167, 0224, 0305, 0213, 0100, 0273, 0117, 
+  0360, 0316, 0226, 0157, 0366, 0101, 0367, 0046, 0004, 0266, 0304, 0205, 0016, 0116, 0310, 0106, 
+  0000, 0232, 0115, 0115, 0040, 0307, 0162, 0245, 0044, 0010, 0315, 0010, 0246, 0270, 0043, 0310, 
+  0350, 0270, 0104, 0147, 0247, 0230, 0242, 0332, 0354, 0353, 0230, 0055, 0314, 0214, 0005, 0106, 
+  0377, 0350, 0130, 0002, 0060, 0163, 0053, 0147, 0122, 0307, 0277, 0205, 0245, 0367, 0165, 0007, 
+  0077, 0063, 0241, 0024, 0063, 0261, 0201, 0145, 0076, 0035, 0321, 0046, 0200, 0344, 0236, 0056, 
+  0216, 0200, 0051, 0203, 0256, 0335, 0344, 0123, 0255, 0203, 0335, 0173, 0253, 0040, 0116, 0344, 
+  0214, 0133, 0346, 0274, 0126, 0341, 0210, 0133, 0024, 0156, 0361, 0141, 0165, 0073, 0304, 0255, 
+  0233, 0375, 0244, 0061, 0337, 0242, 0203, 0340, 0004, 0034, 0256, 0055, 0266, 0056, 0063, 0013, 
+  0030, 0031, 0215, 0064, 0233, 0326, 0145, 0152, 0113, 0065, 0151, 0252, 0364, 0073, 0133, 0146, 
+  0305, 0316, 0056, 0366, 0132, 0116, 0071, 0216, 0166, 0056, 0342, 0226, 0244, 0263, 0354, 0001, 
+  0014, 0270, 0223, 0116, 0301, 0110, 0330, 0107, 0061, 0047, 0122, 0302, 0207, 0320, 0050, 0072, 
+  0354, 0166, 0366, 0302, 0257, 0042, 0005, 0342, 0333, 0125, 0071, 0361, 0255, 0312, 0234, 0370, 
+  0226, 0164, 0116, 0174, 0006, 0241, 0163, 0071, 0356, 0242, 0121, 0070, 0017, 0123, 0070, 0303, 
+  0204, 0263, 0122, 0272, 0130, 0357, 0102, 0331, 0304, 0106, 0332, 0174, 0171, 0151, 0023, 0033, 
+  0155, 0363, 0335, 0150, 0233, 0330, 0210, 0233, 0263, 0332, 0351, 0362, 0026, 0325, 0115, 0154, 
+  0344, 0315, 0106, 0336, 0174, 0061, 0171, 0363, 0274, 0221, 0067, 0063, 0153, 0351, 0313, 0106, 
+  0336, 0244, 0237, 0347, 0215, 0274, 0331, 0310, 0233, 0215, 0274, 0371, 0014, 0362, 0346, 0057, 
+  0215, 0274, 0131, 0127, 0041, 0302, 0106, 0337, 0154, 0364, 0315, 0127, 0253, 0157, 0342, 0373, 
+  0024, 0070, 0033, 0075, 0360, 0331, 0327, 0337, 0326, 0276, 0163, 0365, 0032, 0126, 0130, 0351, 
+  0075, 0050, 0167, 0037, 0272, 0054, 0264, 0314, 0004, 0263, 0060, 0241, 0343, 0244, 0375, 0225, 
+  0147, 0331, 0326, 0304, 0365, 0030, 0330, 0326, 0316, 0340, 0162, 0055, 0253, 0153, 0017, 0324, 
+  0022, 0255, 0325, 0027, 0006, 0030, 0177, 0174, 0060, 0027, 0232, 0056, 0231, 0207, 0317, 0017, 
+  0176, 0253, 0362, 0310, 0222, 0255, 0235, 0054, 0067, 0123, 0015, 0123, 0243, 0245, 0357, 0045, 
+  0022, 0345, 0116, 0317, 0311, 0131, 0200, 0073, 0011, 0363, 0142, 0317, 0171, 0374, 0124, 0314, 
+  0121, 0265, 0171, 0252, 0046, 0127, 0325, 0332, 0057, 0013, 0070, 0053, 0227, 0267, 0252, 0244, 
+  0333, 0265, 0157, 0215, 0122, 0020, 0374, 0043, 0165, 0140, 0346, 0111, 0336, 0341, 0303, 0265, 
+  0171, 0174, 0255, 0127, 0042, 0001, 0343, 0206, 0203, 0267, 0374, 0273, 0132, 0100, 0172, 0375, 
+  0347, 0147, 0147, 0225, 0062, 0010, 0344, 0044, 0164, 0217, 0156, 0272, 0275, 0112, 0156, 0216, 
+  0311, 0006, 0125, 0135, 0204, 0011, 0226, 0043, 0141, 0275, 0310, 0050, 0351, 0057, 0370, 0120, 
+  0003, 0221, 0156, 0025, 0137, 0030, 0012, 0172, 0035, 0017, 0375, 0060, 0251, 0017, 0162, 0221, 
+  0273, 0032, 0322, 0127, 0304, 0015, 0245, 0351, 0337, 0224, 0246, 0051, 0105, 0325, 0052, 0203, 
+  0171, 0236, 0307, 0043, 0274, 0210, 0043, 0275, 0214, 0364, 0265, 0045, 0210, 0346, 0320, 0133, 
+  0317, 0351, 0340, 0224, 0316, 0321, 0116, 0061, 0246, 0145, 0231, 0052, 0110, 0034, 0002, 0367, 
+  0365, 0332, 0076, 0306, 0174, 0005, 0163, 0153, 0355, 0267, 0273, 0337, 0273, 0056, 0301, 0011, 
+  0207, 0221, 0152, 0241, 0223, 0247, 0143, 0345, 0252, 0331, 0165, 0170, 0313, 0246, 0126, 0015, 
+  0131, 0217, 0223, 0217, 0137, 0154, 0127, 0251, 0032, 0217, 0321, 0335, 0352, 0065, 0335, 0255, 
+  0167, 0246, 0277, 0234, 0362, 0267, 0167, 0170, 0324, 0217, 0357, 0360, 0005, 0277, 0276, 0353, 
+  0167, 0066, 0376, 0137, 0222, 0377, 0001, 0376, 0375, 0336, 0352, 0000, 0050, 0165, 0165, 0141, 
+  0171, 0051, 0155, 0145, 0156, 0165, 0163, 0055, 0164, 0157, 0157, 0154, 0142, 0141, 0162, 0163, 
+  0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0313, 0264, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0315, 0162, 0333, 0066, 0020, 0276, 0347, 0051, 0060, 0272, 0364, 0304, 
+  0246, 0242, 0156, 0031, 0333, 0063, 0216, 0023, 0245, 0231, 0111, 0233, 0114, 0234, 0266, 0107, 
+  0016, 0104, 0102, 0022, 0033, 0212, 0340, 0000, 0240, 0025, 0337, 0372, 0064, 0175, 0260, 0076, 
+  0111, 0361, 0103, 0311, 0222, 0110, 0212, 0244, 0000, 0022, 0064, 0315, 0233, 0055, 0211, 0313, 
+  0375, 0026, 0337, 0002, 0330, 0305, 0162, 0171, 0025, 0306, 0014, 0221, 0045, 0364, 0321, 0315, 
+  0053, 0000, 0256, 0360, 0342, 0157, 0344, 0063, 0340, 0107, 0220, 0322, 0353, 0311, 0007, 0366, 
+  0375, 0343, 0006, 0256, 0320, 0004, 0204, 0301, 0365, 0144, 0203, 0342, 0324, 0013, 0175, 0034, 
+  0173, 0061, 0332, 0116, 0304, 0317, 0371, 0005, 0011, 0301, 0011, 0042, 0354, 0021, 0304, 0160, 
+  0203, 0256, 0047, 0017, 0041, 0015, 0027, 0021, 0232, 0334, 0174, 0043, 0051, 0272, 0172, 0275, 
+  0373, 0266, 0370, 0307, 0076, 0214, 0275, 0045, 0366, 0123, 0072, 0271, 0231, 0303, 0210, 0126, 
+  0376, 0136, 0334, 0333, 0021, 0177, 0116, 0156, 0002, 0176, 0031, 0327, 0207, 0071, 0134, 0225, 
+  0343, 0313, 0256, 0136, 0053, 0014, 0015, 0340, 0360, 0213, 0343, 0276, 0340, 0021, 0272, 0030, 
+  0001, 0064, 0035, 0034, 0042, 0167, 0160, 0210, 0146, 0203, 0103, 0344, 0021, 0344, 0163, 0201, 
+  0226, 0161, 0255, 0330, 0167, 0063, 0220, 0050, 0174, 0100, 0036, 0244, 0175, 0031, 0046, 0241, 
+  0216, 0003, 0251, 0066, 0054, 0364, 0203, 0021, 0350, 0333, 0036, 0245, 0114, 0013, 0007, 0022, 
+  0177, 0035, 0076, 0040, 0123, 0250, 0246, 0303, 0204, 0345, 0016, 0023, 0326, 0154, 0140, 0260, 
+  0262, 0313, 0103, 0324, 0233, 0111, 0343, 0111, 0043, 0155, 0160, 0176, 0204, 0051, 0262, 0214, 
+  0153, 0033, 0306, 0001, 0336, 0072, 0122, 0025, 0175, 0100, 0070, 0171, 0264, 0115, 0300, 0040, 
+  0144, 0216, 0320, 0303, 0010, 0230, 0351, 0240, 0320, 0270, 0203, 0102, 0063, 0033, 0016, 0232, 
+  0224, 0365, 0002, 0113, 0312, 0114, 0100, 0231, 0016, 0010, 0213, 0073, 0040, 0054, 0263, 0241, 
+  0140, 0111, 0040, 0145, 0250, 0017, 0140, 0244, 0042, 0146, 0340, 0114, 0007, 0206, 0307, 0035, 
+  0030, 0236, 0331, 0160, 0360, 0004, 0050, 0102, 0375, 0360, 0037, 0245, 0211, 0041, 0100, 0323, 
+  0301, 0041, 0162, 0007, 0207, 0150, 0066, 0040, 0104, 0224, 0213, 0361, 0231, 0007, 0243, 0250, 
+  0017, 0240, 0224, 0066, 0016, 0327, 0106, 0033, 0330, 0222, 0107, 0204, 0175, 0200, 0044, 0364, 
+  0320, 0006, 0003, 0203, 0200, 0003, 0212, 0254, 0247, 0017, 0270, 0036, 0216, 0324, 0303, 0141, 
+  0330, 0130, 0162, 0104, 0202, 0303, 0121, 0200, 0110, 0037, 0320, 0111, 0105, 0114, 0302, 0243, 
+  0014, 0047, 0226, 0201, 0361, 0157, 0174, 0104, 0251, 0043, 0124, 0321, 0306, 0103, 0120, 0204, 
+  0241, 0155, 0327, 0172, 0010, 0321, 0326, 0041, 0150, 0111, 0020, 0135, 0153, 0043, 0132, 0243, 
+  0310, 0366, 0010, 0011, 0025, 0234, 0005, 0301, 0133, 0212, 0210, 0276, 0103, 0055, 0260, 0365, 
+  0120, 0134, 0002, 0222, 0212, 0224, 0301, 0051, 0304, 0363, 0033, 0007, 0361, 0026, 0022, 0205, 
+  0010, 0305, 0053, 0002, 0067, 0011, 0024, 0310, 0026, 0260, 0162, 0166, 0230, 0346, 0324, 0343, 
+  0016, 0034, 0005, 0100, 0236, 0145, 0307, 0060, 0162, 0344, 0277, 0327, 0023, 0350, 0013, 0147, 
+  0120, 0327, 0310, 0337, 0345, 0024, 0271, 0145, 0337, 0077, 0313, 0017, 0224, 0036, 0160, 0072, 
+  0175, 0164, 0216, 0225, 0050, 0122, 0144, 0177, 0325, 0233, 0067, 0117, 0267, 0310, 0314, 0361, 
+  0155, 0215, 0100, 0046, 0341, 0124, 0313, 0343, 0041, 0026, 0377, 0111, 0075, 0017, 0041, 0224, 
+  0250, 0231, 0331, 0353, 0043, 0103, 0233, 0063, 0152, 0225, 0333, 0247, 0350, 0327, 0021, 0134, 
+  0240, 0150, 0002, 0030, 0201, 0061, 0215, 0040, 0203, 0374, 0312, 0353, 0311, 0243, 0130, 0170, 
+  0274, 0333, 0242, 0011, 0261, 0130, 0112, 0112, 0221, 0223, 0306, 0174, 0042, 0215, 0302, 0270, 
+  0364, 0316, 0152, 0164, 0330, 0143, 0302, 0057, 0240, 0351, 0102, 0230, 0347, 0000, 0106, 0031, 
+  0132, 0065, 0044, 0142, 0021, 0362, 0162, 0127, 0234, 0332, 0253, 0134, 0222, 0364, 0233, 0275, 
+  0361, 0244, 0310, 0030, 0155, 0275, 0360, 0330, 0224, 0227, 0231, 0264, 0271, 0151, 0177, 0107, 
+  0333, 0377, 0376, 0371, 0267, 0211, 0054, 0206, 0161, 0304, 0302, 0304, 0141, 0350, 0007, 0053, 
+  0024, 0171, 0107, 0020, 0144, 0010, 0100, 0300, 0141, 0001, 0130, 0076, 0162, 0072, 0043, 0270, 
+  0277, 0226, 0206, 0053, 0356, 0137, 0331, 0225, 0152, 0017, 0067, 0001, 0153, 0030, 0007, 0021, 
+  0042, 0273, 0211, 0211, 0133, 0166, 0267, 0331, 0364, 0027, 0023, 0100, 0267, 0060, 0111, 0220, 
+  0060, 0073, 0236, 0274, 0256, 0022, 0031, 0240, 0063, 0102, 0167, 0137, 0326, 0022, 0173, 0072, 
+  0141, 0311, 0351, 0363, 0346, 0250, 0206, 0245, 0211, 0225, 0240, 0317, 0302, 0303, 0063, 0210, 
+  0237, 0177, 0077, 0167, 0375, 0261, 0237, 0077, 0175, 0132, 0300, 0131, 0015, 0036, 0313, 0003, 
+  0167, 0113, 0104, 0376, 0314, 0357, 0155, 0232, 0311, 0102, 0346, 0310, 0340, 0332, 0014, 0316, 
+  0127, 0070, 0064, 0244, 0360, 0347, 0263, 0002, 0072, 0344, 0260, 0052, 0032, 0261, 0111, 0145, 
+  0340, 0175, 0225, 0072, 0264, 0300, 0147, 0240, 0320, 0105, 0217, 0200, 0363, 0064, 0150, 0235, 
+  0337, 0165, 0130, 0223, 0031, 0174, 0010, 0176, 0322, 0041, 0113, 0105, 0365, 0015, 0244, 0266, 
+  0130, 0172, 0317, 0357, 0016, 0156, 0251, 0351, 0071, 0127, 0212, 0145, 0174, 0317, 0352, 0247, 
+  0204, 0160, 0116, 0354, 0370, 0011, 0266, 0041, 0133, 0163, 0362, 0006, 0341, 0162, 0211, 0344, 
+  0027, 0102, 0240, 0065, 0326, 0146, 0205, 0130, 0132, 0323, 0235, 0200, 0172, 0113, 0107, 0322, 
+  0027, 0222, 0376, 0036, 0045, 0220, 0100, 0206, 0111, 0101, 0234, 0241, 0103, 0361, 0156, 0374, 
+  0063, 0253, 0342, 0261, 0345, 0233, 0336, 0173, 0165, 0177, 0323, 0316, 0231, 0211, 0005, 0062, 
+  0021, 0007, 0226, 0004, 0157, 0244, 0253, 0332, 0136, 0102, 0062, 0153, 0153, 0071, 0343, 0373, 
+  0032, 0062, 0136, 0256, 0067, 0036, 0263, 0233, 0041, 0312, 0251, 0035, 0063, 0264, 0042, 0041, 
+  0173, 0264, 0106, 0362, 0157, 0134, 0015, 0360, 0161, 0247, 0206, 0121, 0242, 0113, 0321, 0333, 
+  0065, 0342, 0354, 0046, 0207, 0024, 0007, 0234, 0156, 0014, 0206, 0061, 0005, 0210, 0020, 0114, 
+  0150, 0127, 0224, 0317, 0321, 0125, 0050, 0170, 0133, 0303, 0355, 0306, 0005, 0344, 0171, 0056, 
+  0040, 0117, 0105, 0222, 0326, 0334, 0353, 0113, 0111, 0235, 0246, 0356, 0006, 0157, 0215, 0367, 
+  0151, 0041, 0220, 0134, 0164, 0017, 0243, 0213, 0307, 0145, 0052, 0344, 0034, 0262, 0246, 0265, 
+  0106, 0177, 0174, 0236, 0376, 0050, 0313, 0173, 0255, 0271, 0342, 0135, 0276, 0270, 0130, 0067, 
+  0111, 0053, 0044, 0026, 0305, 0131, 0326, 0374, 0320, 0157, 0212, 0061, 0347, 0202, 0325, 0126, 
+  0032, 0232, 0367, 0345, 0177, 0170, 0362, 0243, 0147, 0162, 0276, 0363, 0076, 0010, 0231, 0355, 
+  0303, 0035, 0163, 0123, 0005, 0116, 0354, 0355, 0211, 0357, 0162, 0345, 0324, 0272, 0023, 0005, 
+  0027, 0050, 0347, 0011, 0105, 0136, 0356, 0161, 0366, 0146, 0210, 0206, 0330, 0362, 0023, 0104, 
+  0225, 0200, 0061, 0307, 0170, 0310, 0343, 0324, 0132, 0376, 0342, 0056, 0365, 0314, 0146, 0276, 
+  0357, 0122, 0326, 0027, 0022, 0247, 0172, 0171, 0212, 0273, 0164, 0314, 0121, 0324, 0217, 0242, 
+  0104, 0275, 0257, 0275, 0000, 0052, 0137, 0155, 0254, 0111, 0143, 0051, 0121, 0355, 0332, 0242, 
+  0060, 0131, 0140, 0110, 0002, 0173, 0161, 0123, 0123, 0164, 0371, 0220, 0251, 0122, 0302, 0230, 
+  0160, 0123, 0074, 0346, 0033, 0164, 0256, 0257, 0065, 0042, 0177, 0225, 0267, 0067, 0235, 0114, 
+  0126, 0122, 0355, 0114, 0313, 0071, 0056, 0052, 0145, 0106, 0062, 0326, 0235, 0131, 0125, 0015, 
+  0270, 0065, 0106, 0276, 0053, 0050, 0101, 0327, 0244, 0243, 0022, 0171, 0114, 0307, 0376, 0034, 
+  0161, 0004, 0215, 0001, 0347, 0050, 0136, 0303, 0146, 0143, 0166, 0352, 0171, 0146, 0247, 0236, 
+  0036, 0245, 0260, 0126, 0015, 0040, 0065, 0000, 0336, 0355, 0351, 0363, 0023, 0272, 0331, 0142, 
+  0045, 0227, 0043, 0123, 0207, 0216, 0366, 0016, 0374, 0367, 0046, 0326, 0073, 0363, 0227, 0142, 
+  0252, 0254, 0064, 0356, 0173, 0166, 0253, 0214, 0175, 0146, 0277, 0343, 0072, 0170, 0222, 0204, 
+  0246, 0271, 0375, 0056, 0103, 0327, 0075, 0273, 0013, 0326, 0006, 0072, 0022, 0163, 0300, 0013, 
+  0204, 0170, 0024, 0314, 0226, 0003, 0315, 0371, 0275, 0033, 0306, 0016, 0106, 0147, 0356, 0374, 
+  0143, 0160, 0015, 0235, 0143, 0176, 0126, 0300, 0310, 0265, 0023, 0256, 0355, 0237, 0030, 0264, 
+  0026, 0035, 0334, 0006, 0001, 0230, 0013, 0015, 0114, 0207, 0254, 0102, 0260, 0252, 0175, 0142, 
+  0270, 0027, 0141, 0301, 0336, 0326, 0132, 0004, 0347, 0260, 0346, 0225, 0102, 0306, 0360, 0367, 
+  0224, 0343, 0362, 0171, 0115, 0133, 0044, 0027, 0124, 0204, 0300, 0233, 0113, 0045, 0332, 0340, 
+  0071, 0004, 0012, 0140, 0257, 0250, 0056, 0065, 0322, 0346, 0172, 0265, 0224, 0161, 0237, 0363, 
+  0014, 0326, 0236, 0134, 0256, 0237, 0156, 0061, 0261, 0266, 0315, 0371, 0302, 0357, 0357, 0011, 
+  0005, 0214, 0127, 0304, 0047, 0310, 0017, 0227, 0217, 0334, 0041, 0167, 0020, 0271, 0147, 0212, 
+  0252, 0304, 0220, 0166, 0355, 0224, 0105, 0051, 0174, 0251, 0321, 0130, 0165, 0361, 0014, 0253, 
+  0056, 0376, 0014, 0213, 0037, 0031, 0354, 0177, 0325, 0305, 0335, 0032, 0371, 0247, 0065, 0311, 
+  0334, 0215, 0026, 0220, 0330, 0053, 0106, 0126, 0367, 0067, 0352, 0371, 0142, 0200, 0344, 0332, 
+  0273, 0201, 0141, 0014, 0130, 0363, 0073, 0030, 0365, 0165, 0241, 0115, 0035, 0224, 0057, 0167, 
+  0355, 0054, 0240, 0045, 0145, 0220, 0245, 0366, 0236, 0321, 0342, 0167, 0367, 0122, 0332, 0032, 
+  0057, 0025, 0072, 0333, 0244, 0274, 0257, 0245, 0305, 0110, 0313, 0003, 0132, 0212, 0046, 0046, 
+  0226, 0003, 0230, 0054, 0164, 0241, 0355, 0060, 0123, 0141, 0243, 0174, 0313, 0024, 0043, 0253, 
+  0344, 0254, 0203, 0162, 0214, 0066, 0114, 0107, 0033, 0205, 0003, 0353, 0251, 0001, 0362, 0004, 
+  0104, 0176, 0327, 0330, 0347, 0062, 0176, 0351, 0064, 0142, 0371, 0012, 0203, 0020, 0027, 0170, 
+  0242, 0070, 0336, 0260, 0232, 0062, 0223, 0176, 0163, 0033, 0105, 0300, 0233, 0137, 0222, 0115, 
+  0172, 0050, 0351, 0352, 0323, 0251, 0247, 0161, 0365, 0347, 0027, 0246, 0302, 0030, 0044, 0053, 
+  0304, 0046, 0067, 0077, 0311, 0101, 0370, 0251, 0037, 0234, 0240, 0226, 0047, 0150, 0311, 0011, 
+  0310, 0143, 0114, 0060, 0367, 0032, 0347, 0135, 0164, 0106, 0167, 0105, 0160, 0232, 0250, 0106, 
+  0133, 0047, 0236, 0321, 0005, 0057, 0333, 0343, 0226, 0064, 0142, 0103, 0162, 0215, 0263, 0353, 
+  0245, 0371, 0040, 0376, 0061, 0363, 0160, 0312, 0022, 0173, 0145, 0314, 0336, 0047, 0256, 0003, 
+  0370, 0054, 0165, 0150, 0147, 0233, 0243, 0360, 0211, 0307, 0350, 0202, 0324, 0107, 0001, 0130, 
+  0250, 0132, 0175, 0201, 0035, 0240, 0037, 0310, 0117, 0031, 0377, 0320, 0307, 0233, 0015, 0214, 
+  0003, 0153, 0223, 0263, 0260, 0102, 0015, 0043, 0214, 0273, 0240, 0027, 0342, 0247, 0105, 0005, 
+  0114, 0014, 0047, 0326, 0274, 0364, 0076, 0327, 0233, 0122, 0067, 0143, 0313, 0005, 0356, 0237, 
+  0253, 0023, 0227, 0102, 0253, 0217, 0034, 0320, 0206, 0370, 0362, 0105, 0113, 0125, 0002, 0306, 
+  0263, 0301, 0243, 0142, 0155, 0321, 0245, 0324, 0142, 0261, 0166, 0101, 0153, 0122, 0355, 0122, 
+  0155, 0001, 0251, 0067, 0217, 0212, 0052, 0013, 0153, 0326, 0173, 0127, 0212, 0030, 0217, 0055, 
+  0372, 0171, 0154, 0361, 0053, 0212, 0222, 0301, 0074, 0054, 0052, 0232, 0325, 0132, 0173, 0312, 
+  0016, 0307, 0214, 0273, 0263, 0331, 0014, 0334, 0273, 0220, 0172, 0111, 0004, 0325, 0076, 0364, 
+  0175, 0326, 0106, 0027, 0374, 0006, 0343, 0024, 0106, 0326, 0046, 0214, 0165, 0011, 0145, 0032, 
+  0074, 0071, 0132, 0303, 0124, 0343, 0052, 0170, 0130, 0041, 0043, 0032, 0060, 0333, 0253, 0000, 
+  0313, 0267, 0177, 0326, 0344, 0365, 0307, 0170, 0211, 0311, 0106, 0156, 0344, 0200, 0304, 0046, 
+  0011, 0316, 0245, 0010, 0206, 0333, 0053, 0212, 0151, 0212, 0063, 0137, 0017, 0123, 0051, 0141, 
+  0134, 0007, 0325, 0227, 0347, 0333, 0241, 0147, 0047, 0243, 0307, 0355, 0303, 0263, 0043, 0133, 
+  0273, 0355, 0303, 0217, 0225, 0050, 0122, 0244, 0252, 0175, 0170, 0351, 0251, 0257, 0306, 0216, 
+  0101, 0310, 0174, 0233, 0062, 0206, 0343, 0247, 0363, 0173, 0257, 0240, 0021, 0266, 0336, 0066, 
+  0242, 0326, 0033, 0272, 0153, 0172, 0112, 0141, 0203, 0145, 0315, 0075, 0123, 0241, 0025, 0316, 
+  0264, 0240, 0155, 0153, 0123, 0125, 0326, 0171, 0367, 0262, 0167, 0065, 0227, 0134, 0113, 0235, 
+  0160, 0223, 0140, 0302, 0240, 0170, 0037, 0163, 0055, 0205, 0215, 0167, 0264, 0255, 0325, 0202, 
+  0130, 0165, 0336, 0365, 0332, 0140, 0375, 0076, 0323, 0043, 0204, 0153, 0154, 0230, 0115, 0073, 
+  0136, 0111, 0277, 0312, 0266, 0350, 0166, 0246, 0331, 0342, 0245, 0257, 0306, 0275, 0220, 0100, 
+  0315, 0073, 0132, 0326, 0355, 0044, 0371, 0222, 0350, 0123, 0132, 0362, 0157, 0154, 0366, 0256, 
+  0176, 0375, 0117, 0007, 0045, 0375, 0265, 0013, 0351, 0073, 0133, 0060, 0313, 0353, 0320, 0315, 
+  0132, 0376, 0374, 0253, 0211, 0272, 0251, 0062, 0257, 0137, 0332, 0375, 0222, 0134, 0257, 0050, 
+  0163, 0156, 0154, 0354, 0313, 0337, 0336, 0324, 0172, 0146, 0374, 0302, 0244, 0164, 0251, 0171, 
+  0033, 0354, 0336, 0043, 0354, 0113, 0265, 0154, 0356, 0334, 0167, 0072, 0030, 0330, 0275, 0177, 
+  0312, 0104, 0165, 0267, 0215, 0137, 0341, 0005, 0364, 0277, 0267, 0306, 0312, 0025, 0166, 0022, 
+  0202, 0036, 0102, 0234, 0122, 0043, 0244, 0374, 0200, 0167, 0263, 0317, 0116, 0054, 0020, 0272, 
+  0211, 0243, 0323, 0335, 0060, 0134, 0304, 0320, 0017, 0370, 0055, 0067, 0103, 0027, 0346, 0216, 
+  0071, 0264, 0066, 0315, 0055, 0344, 0033, 0066, 0265, 0020, 0151, 0312, 0314, 0163, 0114, 0266, 
+  0205, 0255, 0220, 0314, 0133, 0072, 0115, 0332, 0264, 0163, 0232, 0230, 0262, 0162, 0232, 0000, 
+  0316, 0012, 0020, 0241, 0007, 0024, 0135, 0150, 0325, 0077, 0222, 0056, 0014, 0272, 0306, 0371, 
+  0306, 0106, 0046, 0115, 0052, 0344, 0033, 0246, 0256, 0020, 0251, 0113, 0331, 0137, 0013, 0325, 
+  0252, 0261, 0172, 0275, 0072, 0377, 0166, 0062, 0261, 0375, 0374, 0202, 0223, 0064, 0071, 0070, 
+  0246, 0150, 0272, 0172, 0225, 0217, 0141, 0121, 0213, 0065, 0161, 0063, 0257, 0350, 0315, 0117, 
+  0255, 0035, 0000, 0325, 0115, 0126, 0324, 0313, 0036, 0074, 0065, 0374, 0101, 0052, 0022, 0250, 
+  0171, 0266, 0344, 0125, 0236, 0055, 0325, 0171, 0363, 0115, 0305, 0016, 0361, 0262, 0103, 0270, 
+  0323, 0201, 0311, 0122, 0250, 0135, 0216, 0017, 0370, 0053, 0144, 0353, 0222, 0047, 0341, 0056, 
+  0033, 0247, 0243, 0061, 0242, 0331, 0353, 0140, 0142, 0000, 0223, 0044, 0012, 0353, 0273, 0142, 
+  0365, 0300, 0135, 0154, 0376, 0163, 0125, 0074, 0227, 0106, 0010, 0215, 0024, 0050, 0365, 0316, 
+  0216, 0263, 0073, 0025, 0157, 0037, 0261, 0220, 0243, 0061, 0342, 0256, 0231, 0025, 0373, 0116, 
+  0031, 0123, 0244, 0051, 0150, 0377, 0332, 0026, 0141, 0312, 0332, 0275, 0266, 0323, 0346, 0265, 
+  0025, 0162, 0160, 0153, 0165, 0065, 0056, 0005, 0355, 0245, 0133, 0363, 0344, 0262, 0216, 0311, 
+  0055, 0265, 0221, 0156, 0147, 0150, 0370, 0255, 0073, 0032, 0233, 0302, 0176, 0263, 0255, 0015, 
+  0116, 0151, 0377, 0324, 0266, 0372, 0312, 0266, 0062, 0074, 0322, 0146, 0323, 0166, 0136, 0115, 
+  0174, 0060, 0064, 0305, 0055, 0124, 0133, 0033, 0233, 0263, 0055, 0123, 0133, 0153, 0225, 0252, 
+  0267, 0333, 0061, 0345, 0005, 0305, 0275, 0101, 0133, 0063, 0165, 0171, 0137, 0313, 0356, 0172, 
+  0200, 0266, 0342, 0031, 0312, 0216, 0365, 0007, 0355, 0174, 0212, 0363, 0040, 0106, 0224, 0111, 
+  0162, 0233, 0121, 0342, 0364, 0271, 0207, 0211, 0245, 0317, 0103, 0265, 0026, 0050, 0272, 0355, 
+  0234, 0146, 0364, 0160, 0343, 0171, 0030, 0255, 0114, 0237, 0163, 0270, 0242, 0016, 0266, 0154, 
+  0307, 0053, 0057, 0207, 0070, 0273, 0210, 0145, 0072, 0206, 0054, 0065, 0103, 0026, 0267, 0343, 
+  0220, 0145, 0072, 0306, 0054, 0365, 0143, 0026, 0267, 0353, 0230, 0145, 0072, 0006, 0055, 0215, 
+  0202, 0026, 0267, 0313, 0240, 0145, 0072, 0106, 0055, 0235, 0105, 0055, 0323, 0061, 0154, 0321, 
+  0016, 0133, 0134, 0143, 0265, 0031, 0117, 0201, 0313, 0175, 0030, 0240, 0005, 0044, 0366, 0343, 
+  0027, 0167, 0214, 0137, 0232, 0306, 0057, 0263, 0027, 0031, 0277, 0270, 0143, 0374, 0242, 0033, 
+  0277, 0314, 0136, 0134, 0374, 0342, 0216, 0361, 0113, 0315, 0370, 0145, 0326, 0161, 0374, 0342, 
+  0216, 0361, 0113, 0375, 0370, 0145, 0326, 0165, 0374, 0342, 0216, 0361, 0113, 0243, 0370, 0145, 
+  0326, 0145, 0374, 0342, 0216, 0361, 0113, 0147, 0361, 0213, 0073, 0306, 0057, 0332, 0361, 0313, 
+  0354, 0242, 0370, 0345, 0352, 0265, 0254, 0374, 0136, 0102, 0037, 0335, 0274, 0372, 0037, 0107, 
+  0107, 0302, 0133, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0142, 0141, 0164, 0143, 0150, 0055, 
+  0160, 0141, 0163, 0163, 0167, 0157, 0162, 0144, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 
+  0273, 0047, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0132, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0034, 0162, 0351, 0320, 0262, 0344, 0330, 0165, 0033, 0221, 0231, 
+  0351, 0117, 0062, 0235, 0146, 0246, 0075, 0244, 0147, 0016, 0104, 0256, 0111, 0124, 0020, 0300, 
+  0002, 0220, 0145, 0365, 0045, 0172, 0354, 0373, 0365, 0111, 0002, 0220, 0372, 0243, 0004, 0361, 
+  0337, 0211, 0072, 0351, 0115, 0002, 0260, 0013, 0354, 0207, 0335, 0157, 0027, 0000, 0247, 0157, 
+  0236, 0026, 0014, 0075, 0202, 0124, 0124, 0160, 0037, 0217, 0257, 0256, 0061, 0002, 0036, 0211, 
+  0230, 0362, 0304, 0307, 0277, 0177, 0170, 0353, 0335, 0343, 0067, 0301, 0213, 0351, 0127, 0236, 
+  0207, 0336, 0001, 0007, 0111, 0064, 0304, 0150, 0105, 0165, 0212, 0022, 0106, 0142, 0100, 0067, 
+  0127, 0067, 0167, 0127, 0327, 0310, 0363, 0314, 0040, 0312, 0065, 0310, 0007, 0022, 0101, 0360, 
+  0002, 0241, 0251, 0204, 0077, 0227, 0124, 0202, 0102, 0214, 0316, 0174, 0234, 0350, 0371, 0327, 
+  0170, 0077, 0321, 0315, 0325, 0144, 0202, 0107, 0371, 0070, 0061, 0373, 0003, 0042, 0215, 0042, 
+  0106, 0224, 0362, 0361, 0073, 0075, 0377, 0171, 0101, 0022, 0300, 0210, 0306, 0076, 0316, 0126, 
+  0141, 0104, 0170, 0004, 0054, 0244, 0171, 0243, 0025, 0060, 0042, 0231, 0024, 0031, 0110, 0275, 
+  0106, 0234, 0054, 0300, 0307, 0217, 0124, 0321, 0031, 0063, 0275, 0037, 0344, 0022, 0246, 0243, 
+  0155, 0257, 0173, 0260, 0321, 0027, 0076, 0210, 0150, 0251, 0160, 0360, 0226, 0060, 0125, 0073, 
+  0236, 0106, 0202, 0207, 0366, 0047, 0016, 0114, 0117, 0004, 0112, 0171, 0112, 0213, 0254, 0054, 
+  0066, 0035, 0025, 0126, 0064, 0061, 0110, 0314, 0057, 0302, 0030, 0263, 0041, 0236, 0230, 0267, 
+  0061, 0343, 0107, 0112, 0230, 0110, 0066, 0166, 0230, 0306, 0225, 0220, 0161, 0030, 0027, 0215, 
+  0303, 0054, 0157, 0146, 0064, 0202, 0014, 0127, 0064, 0326, 0051, 0016, 0156, 0353, 0206, 0033, 
+  0347, 0242, 0177, 0221, 0034, 0254, 0106, 0352, 0127, 0224, 0307, 0142, 0025, 0146, 0102, 0121, 
+  0155, 0274, 0020, 0007, 0021, 0130, 0217, 0365, 0004, 0367, 0062, 0042, 0315, 0357, 0072, 0005, 
+  0172, 0235, 0101, 0230, 0032, 0067, 0307, 0101, 0141, 0367, 0211, 0200, 0242, 0011, 0047, 0154, 
+  0063, 0074, 0006, 0245, 0245, 0130, 0143, 0224, 0022, 0036, 0063, 0220, 0076, 0066, 0350, 0037, 
+  0041, 0027, 0356, 0006, 0251, 0025, 0311, 0062, 0060, 0330, 0162, 0121, 0104, 0306, 0261, 0072, 
+  0143, 0156, 0046, 0270, 0202, 0152, 0175, 0373, 0121, 0056, 0205, 0121, 0112, 0131, 0214, 0362, 
+  0100, 0065, 0212, 0275, 0374, 0257, 0361, 0271, 0231, 0170, 0332, 0154, 0241, 0153, 0343, 0277, 
+  0067, 0275, 0371, 0256, 0027, 0123, 0170, 0166, 0370, 0370, 0166, 0047, 0320, 0322, 0207, 0273, 
+  0070, 0212, 0113, 0106, 0110, 0152, 0266, 0214, 0024, 0073, 0151, 0210, 0105, 0323, 0210, 0260, 
+  0046, 0202, 0052, 0043, 0221, 0241, 0067, 0034, 0114, 0234, 0243, 0335, 0020, 0221, 0310, 0116, 
+  0024, 0032, 0067, 0041, 0007, 0206, 0073, 0321, 0132, 0152, 0055, 0370, 0061, 0146, 0007, 0362, 
+  0045, 0350, 0072, 0301, 0327, 0025, 0102, 0227, 0034, 0043, 0153, 0261, 0324, 0241, 0322, 0153, 
+  0073, 0043, 0360, 0370, 0254, 0140, 0216, 0104, 0271, 0355, 0274, 0375, 0307, 0374, 0075, 0053, 
+  0132, 0217, 0305, 0135, 0353, 0231, 0001, 0303, 0110, 0113, 0302, 0025, 0043, 0332, 0206, 0267, 
+  0217, 0327, 0140, 0314, 0012, 0177, 0310, 0125, 0235, 0133, 0137, 0147, 0044, 0153, 0320, 0354, 
+  0042, 0032, 0303, 0003, 0131, 0062, 0335, 0136, 0130, 0102, 0004, 0364, 0021, 0324, 0136, 0103, 
+  0345, 0146, 0072, 0071, 0276, 0110, 0056, 0107, 0251, 0263, 0215, 0206, 0245, 0202, 0160, 0311, 
+  0015, 0023, 0063, 0312, 0073, 0140, 0107, 0330, 0212, 0254, 0125, 0250, 0122, 0303, 0265, 0233, 
+  0305, 0124, 0253, 0070, 0114, 0073, 0145, 0305, 0044, 0232, 0233, 0110, 0255, 0237, 0022, 0236, 
+  0062, 0103, 0211, 0035, 0300, 0172, 0240, 0214, 0165, 0020, 0333, 0247, 0220, 0353, 0052, 0263, 
+  0234, 0353, 0237, 0216, 0034, 0201, 0324, 0061, 0270, 0114, 0055, 0061, 0104, 0140, 0375, 0372, 
+  0313, 0245, 0007, 0125, 0112, 0324, 0147, 0211, 0107, 0073, 0357, 0145, 0004, 0363, 0266, 0154, 
+  0374, 0077, 0220, 0237, 0047, 0220, 0307, 0103, 0004, 0262, 0013, 0000, 0267, 0361, 0235, 0014, 
+  0167, 0033, 0335, 0246, 0112, 0260, 0153, 0011, 0155, 0031, 0133, 0235, 0352, 0333, 0322, 0235, 
+  0003, 0241, 0023, 0164, 0116, 0051, 0256, 0242, 0322, 0314, 0113, 0314, 0361, 0045, 0325, 0111, 
+  0065, 0147, 0223, 0336, 0125, 0152, 0145, 0245, 0072, 0276, 0357, 0135, 0225, 0155, 0221, 0115, 
+  0015, 0262, 0223, 0157, 0361, 0247, 0241, 0371, 0326, 0361, 0270, 0267, 0170, 0122, 0051, 0346, 
+  0264, 0332, 0155, 0371, 0301, 0351, 0073, 0047, 0261, 0011, 0166, 0311, 0365, 0260, 0277, 0057, 
+  0006, 0356, 0274, 0303, 0314, 0321, 0017, 0007, 0112, 0023, 0251, 0333, 0012, 0077, 0366, 0021, 
+  0076, 0270, 0042, 0330, 0034, 0135, 0266, 0047, 0314, 0116, 0232, 0314, 0011, 0335, 0150, 0272, 
+  0253, 0226, 0075, 0227, 0067, 0252, 0163, 0107, 0257, 0374, 0321, 0215, 0116, 0173, 0325, 0203, 
+  0025, 0251, 0344, 0154, 0135, 0330, 0326, 0331, 0313, 0004, 0172, 0377, 0137, 0160, 0365, 0126, 
+  0014, 0331, 0223, 0067, 0252, 0341, 0164, 0103, 0372, 0276, 0250, 0233, 0055, 0250, 0171, 0011, 
+  0375, 0352, 0025, 0076, 0047, 0334, 0023, 0331, 0041, 0320, 0355, 0115, 0046, 0355, 0216, 0016, 
+  0057, 0231, 0176, 0155, 0260, 0347, 0150, 0005, 0064, 0111, 0265, 0115, 0223, 0054, 0306, 0310, 
+  0106, 0275, 0025, 0223, 0011, 0110, 0374, 0062, 0321, 0257, 0177, 0333, 0160, 0010, 0332, 0334, 
+  0012, 0307, 0126, 0160, 0144, 0045, 0155, 0157, 0227, 0065, 0331, 0332, 0166, 0101, 0344, 0174, 
+  0231, 0065, 0005, 0267, 0212, 0145, 0352, 0231, 0246, 0067, 0333, 0364, 0250, 0132, 0173, 0323, 
+  0116, 0015, 0365, 0124, 0322, 0117, 0317, 0230, 0061, 0107, 0227, 0335, 0025, 0145, 0341, 0107, 
+  0137, 0132, 0364, 0054, 0310, 0123, 0121, 0066, 0206, 0121, 0112, 0244, 0131, 0312, 0067, 0327, 
+  0137, 0266, 0263, 0216, 0057, 0313, 0131, 0113, 0245, 0361, 0331, 0234, 0171, 0261, 0376, 0331, 
+  0042, 0365, 0325, 0243, 0323, 0054, 0005, 0336, 0124, 0245, 0300, 0101, 0200, 0032, 0012, 0254, 
+  0226, 0027, 0141, 0333, 0064, 0365, 0135, 0127, 0335, 0055, 0157, 0134, 0052, 0151, 0203, 0303, 
+  0102, 0160, 0032, 0131, 0356, 0110, 0100, 0347, 0227, 0100, 0073, 0046, 0065, 0025, 0223, 0134, 
+  0067, 0323, 0134, 0307, 0044, 0315, 0330, 0144, 0020, 0106, 0031, 0200, 0125, 0172, 0247, 0301, 
+  0006, 0354, 0122, 0313, 0060, 0135, 0343, 0350, 0047, 0273, 0153, 0247, 0151, 0061, 0337, 0314, 
+  0317, 0034, 0121, 0175, 0324, 0344, 0153, 0241, 0214, 0352, 0165, 0317, 0215, 0244, 0174, 0143, 
+  0126, 0236, 0051, 0161, 0360, 0357, 0077, 0177, 0167, 0125, 0145, 0337, 0333, 0036, 0211, 0206, 
+  0026, 0327, 0267, 0237, 0062, 0144, 0372, 0300, 0335, 0374, 0230, 0072, 0110, 0052, 0036, 0046, 
+  0140, 0236, 0257, 0236, 0351, 0232, 0173, 0333, 0301, 0170, 0036, 0302, 0311, 0163, 0126, 0063, 
+  0303, 0337, 0214, 0164, 0071, 0342, 0017, 0161, 0061, 0062, 0036, 0372, 0142, 0144, 0270, 0307, 
+  0206, 0266, 0027, 0234, 0315, 0340, 0170, 0346, 0067, 0303, 0313, 0177, 0152, 0250, 0333, 0372, 
+  0372, 0107, 0203, 0262, 0215, 0245, 0316, 0151, 0361, 0101, 0205, 0127, 0024, 0107, 0152, 0047, 
+  0121, 0152, 0106, 0333, 0217, 0141, 0174, 0354, 0335, 0035, 0076, 0211, 0027, 0217, 0246, 0323, 
+  0121, 0151, 0164, 0275, 0216, 0333, 0355, 0113, 0134, 0205, 0374, 0121, 0243, 0052, 0175, 0170, 
+  0143, 0137, 0136, 0174, 0254, 0251, 0146, 0060, 0263, 0011, 0156, 0073, 0143, 0306, 0110, 0004, 
+  0251, 0140, 0246, 0160, 0034, 0235, 0030, 0273, 0107, 0141, 0072, 0072, 0370, 0304, 0356, 0043, 
+  0027, 0062, 0056, 0312, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0144, 0154, 0147, 0055, 0141, 
+  0144, 0144, 0055, 0146, 0157, 0154, 0144, 0145, 0162, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0141, 0107, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0155, 0157, 0333, 0066, 
+  0020, 0376, 0336, 0137, 0301, 0361, 0343, 0006, 0045, 0265, 0263, 0005, 0105, 0027, 0273, 0330, 
+  0272, 0246, 0053, 0120, 0140, 0300, 0326, 0175, 0046, 0050, 0351, 0154, 0163, 0246, 0111, 0215, 
+  0244, 0223, 0370, 0337, 0367, 0144, 0331, 0251, 0144, 0323, 0226, 0365, 0342, 0330, 0111, 0365, 
+  0245, 0120, 0143, 0336, 0211, 0367, 0362, 0074, 0167, 0244, 0050, 0335, 0274, 0173, 0230, 0111, 
+  0162, 0007, 0306, 0012, 0255, 0006, 0264, 0167, 0361, 0232, 0022, 0120, 0221, 0216, 0205, 0032, 
+  0017, 0350, 0277, 0137, 0156, 0203, 0067, 0364, 0335, 0360, 0325, 0315, 0017, 0101, 0100, 0076, 
+  0202, 0002, 0303, 0035, 0304, 0344, 0136, 0270, 0011, 0031, 0113, 0036, 0003, 0271, 0272, 0350, 
+  0367, 0057, 0172, 0044, 0010, 0160, 0220, 0120, 0016, 0314, 0210, 0107, 0060, 0174, 0105, 0310, 
+  0215, 0201, 0377, 0347, 0302, 0200, 0045, 0122, 0204, 0003, 0072, 0166, 0323, 0237, 0350, 0267, 
+  0033, 0245, 0142, 0364, 0162, 0071, 0116, 0207, 0377, 0101, 0344, 0110, 0044, 0271, 0265, 0003, 
+  0372, 0321, 0115, 0077, 0315, 0370, 0030, 0050, 0021, 0361, 0200, 0212, 0364, 0262, 0107, 0323, 
+  0161, 0070, 0062, 0061, 0072, 0001, 0343, 0026, 0104, 0361, 0031, 0014, 0350, 0235, 0260, 0042, 
+  0224, 0100, 0207, 0137, 0314, 0034, 0156, 0056, 0327, 0277, 0372, 0007, 0107, 0134, 0261, 0221, 
+  0216, 0346, 0226, 0016, 0157, 0271, 0264, 0245, 0343, 0105, 0244, 0025, 0113, 0057, 0351, 0160, 
+  0002, 0062, 0011, 0102, 0243, 0357, 0055, 0230, 0242, 0330, 0315, 0145, 0066, 0371, 0303, 0354, 
+  0350, 0237, 0330, 0016, 0374, 0045, 0002, 0153, 0003, 0353, 0164, 0322, 0304, 0216, 0253, 0023, 
+  0333, 0301, 0343, 0070, 0030, 0151, 0031, 0203, 0011, 0234, 0016, 0270, 0211, 0046, 0342, 0016, 
+  0252, 0030, 0164, 0053, 0044, 0274, 0237, 0150, 0215, 0361, 0374, 0103, 0160, 0251, 0307, 0231, 
+  0161, 0361, 0362, 0232, 0241, 0172, 0226, 0251, 0247, 0355, 0114, 0335, 0011, 0207, 0136, 0041, 
+  0316, 0160, 0145, 0045, 0167, 0034, 0175, 0064, 0240, 0013, 0100, 0361, 0337, 0342, 0230, 0160, 
+  0162, 0273, 0274, 0131, 0251, 0226, 0105, 0002, 0154, 0202, 0020, 0243, 0303, 0154, 0242, 0145, 
+  0002, 0074, 0162, 0010, 0065, 0072, 0264, 0040, 0321, 0374, 0225, 0307, 0112, 0303, 0142, 0000, 
+  0021, 0276, 0262, 0377, 0120, 0003, 0245, 0216, 0270, 0144, 0132, 0311, 0305, 0056, 0001, 0053, 
+  0306, 0212, 0313, 0325, 0360, 0030, 0254, 0063, 0172, 0101, 0311, 0204, 0253, 0130, 0202, 0031, 
+  0120, 0014, 0355, 0226, 0363, 0331, 0343, 0060, 0173, 0317, 0223, 0004, 0060, 0100, 0112, 0147, 
+  0224, 0261, 0251, 0020, 0111, 0046, 0321, 0312, 0102, 0231, 0306, 0157, 0343, 0174, 0052, 0061, 
+  0215, 0144, 0234, 0135, 0247, 0046, 0112, 0344, 0261, 0311, 0122, 0156, 0075, 0340, 0062, 0067, 
+  0042, 0033, 0115, 0226, 0214, 0207, 0023, 0011, 0226, 0377, 0105, 0010, 0204, 0372, 0201, 0076, 
+  0352, 0330, 0112, 0274, 0337, 0163, 0277, 0126, 0317, 0053, 0237, 0214, 0066, 0002, 0224, 0343, 
+  0131, 0244, 0221, 0135, 0235, 0300, 0120, 0170, 0005, 0375, 0023, 0316, 0222, 0204, 0161, 0014, 
+  0173, 0156, 0146, 0336, 0271, 0317, 0235, 0323, 0252, 0150, 0101, 0135, 0053, 0274, 0111, 0304, 
+  0027, 0172, 0356, 0230, 0165, 0213, 0224, 0102, 0100, 0305, 0073, 0005, 0013, 0201, 0052, 0233, 
+  0160, 0006, 0355, 0160, 0171, 0335, 0243, 0233, 0122, 0276, 0151, 0204, 0040, 0275, 0140, 0145, 
+  0177, 0142, 0035, 0330, 0065, 0251, 0312, 0174, 0170, 0240, 0013, 0253, 0212, 0032, 0210, 0000, 
+  0331, 0320, 0042, 0172, 0106, 0174, 0056, 0135, 0165, 0015, 0113, 0212, 0247, 0303, 0254, 0362, 
+  0126, 0021, 0234, 0133, 0140, 0163, 0205, 0170, 0221, 0102, 0225, 0032, 0235, 0047, 0350, 0242, 
+  0122, 0036, 0115, 0261, 0367, 0050, 0277, 0035, 0074, 0044, 0010, 0366, 0352, 0366, 0215, 0204, 
+  0224, 0325, 0245, 0022, 0155, 0105, 0006, 0262, 0327, 0373, 0214, 0362, 0316, 0276, 0100, 0034, 
+  0315, 0263, 0370, 0252, 0131, 0026, 0277, 0347, 0052, 0002, 0371, 0175, 0345, 0161, 0277, 0313, 
+  0343, 0255, 0074, 0356, 0235, 0072, 0217, 0373, 0315, 0362, 0030, 0173, 0247, 0163, 0117, 0342, 
+  0124, 0264, 0166, 0376, 0116, 0170, 0203, 0344, 0157, 0027, 0076, 0127, 0035, 0174, 0266, 0340, 
+  0323, 0157, 0003, 0076, 0076, 0363, 0375, 0246, 0357, 0062, 0273, 0122, 0213, 0225, 0331, 0134, 
+  0111, 0244, 0264, 0356, 0171, 0214, 0335, 0062, 0164, 0233, 0043, 0312, 0132, 0343, 0332, 0010, 
+  0156, 0253, 0033, 0235, 0161, 0063, 0026, 0212, 0111, 0030, 0041, 0166, 0256, 0053, 0112, 0031, 
+  0061, 0236, 0324, 0020, 0303, 0145, 0171, 0165, 0241, 0120, 0043, 0227, 0316, 0052, 0310, 0131, 
+  0214, 0027, 0206, 0013, 0013, 0100, 0277, 0161, 0207, 0275, 0025, 0263, 0143, 0061, 0357, 0336, 
+  0330, 0065, 0132, 0027, 0225, 0272, 0351, 0172, 0257, 0224, 0327, 0123, 0176, 0157, 0275, 0237, 
+  0100, 0124, 0050, 0203, 0102, 0105, 0162, 0036, 0003, 0263, 0363, 0060, 0135, 0240, 0262, 0050, 
+  0035, 0220, 0325, 0106, 0352, 0123, 0131, 0251, 0074, 0176, 0312, 0224, 0223, 0225, 0162, 0134, 
+  0314, 0357, 0263, 0243, 0121, 0334, 0032, 0126, 0315, 0303, 0352, 0127, 0151, 0006, 0370, 0153, 
+  0250, 0024, 0343, 0164, 0013, 0304, 0161, 0343, 0252, 0012, 0127, 0052, 0144, 0176, 0025, 0261, 
+  0341, 0367, 0114, 0250, 0030, 0223, 0317, 0151, 0163, 0240, 0216, 0302, 0326, 0206, 0323, 0343, 
+  0261, 0204, 0270, 0270, 0263, 0261, 0047, 0161, 0330, 0243, 0200, 0147, 0213, 0343, 0260, 0332, 
+  0273, 0277, 0376, 0326, 0056, 0106, 0315, 0012, 0161, 0355, 0065, 0331, 0236, 0202, 0274, 0263, 
+  0247, 0155, 0214, 0154, 0170, 0130, 0005, 0150, 0061, 0303, 0344, 0231, 0332, 0306, 0160, 0376, 
+  0220, 0051, 0044, 0053, 0050, 0023, 0067, 0341, 0216, 0160, 0203, 0360, 0136, 0314, 0102, 0055, 
+  0105, 0104, 0360, 0076, 0154, 0332, 0141, 0274, 0242, 0160, 0241, 0314, 0367, 0372, 0317, 0202, 
+  0042, 0136, 0020, 0156, 0173, 0147, 0206, 0333, 0164, 0257, 0130, 0214, 0230, 0202, 0173, 0060, 
+  0255, 0226, 0343, 0164, 0243, 0077, 0335, 0037, 0047, 0142, 0104, 0062, 0365, 0035, 0122, 0073, 
+  0250, 0075, 0045, 0324, 0372, 0247, 0205, 0232, 0177, 0251, 0160, 0314, 0104, 0257, 0345, 0351, 
+  0307, 0256, 0377, 0115, 0251, 0344, 0116, 0343, 0375, 0016, 0370, 0234, 0161, 0103, 0276, 0357, 
+  0307, 0260, 0002, 0313, 0070, 0143, 0227, 0236, 0206, 0356, 0151, 0303, 0105, 0215, 0221, 0134, 
+  0215, 0051, 0327, 0353, 0226, 0245, 0167, 0354, 0333, 0072, 0312, 0153, 0120, 0205, 0267, 0067, 
+  0120, 0060, 0323, 0112, 0104, 0354, 0136, 0304, 0143, 0100, 0322, 0313, 0307, 0315, 0062, 0134, 
+  0136, 0232, 0305, 0101, 0172, 0171, 0224, 0076, 0166, 0027, 0241, 0220, 0142, 0337, 0270, 0345, 
+  0221, 0011, 0271, 0134, 0262, 0222, 0364, 0141, 0357, 0312, 0113, 0301, 0010, 0271, 0212, 0240, 
+  0243, 0161, 0016, 0305, 0334, 0131, 0315, 0301, 0337, 0335, 0257, 0261, 0173, 0320, 0315, 0367, 
+  0361, 0134, 0071, 0327, 0065, 0346, 0273, 0146, 0234, 0327, 0150, 0151, 0120, 0302, 0175, 0173, 
+  0371, 0257, 0016, 0015, 0174, 0130, 0106, 0154, 0213, 0006, 0326, 0241, 0074, 0015, 0017, 0324, 
+  0125, 0341, 0264, 0226, 0116, 0044, 0314, 0301, 0203, 0363, 0202, 0031, 0036, 0370, 0054, 0221, 
+  0360, 0226, 0374, 0170, 0241, 0177, 0305, 0177, 0102, 0076, 0175, 0002, 0304, 0340, 0362, 0067, 
+  0010, 0027, 0176, 0314, 0254, 0370, 0366, 0234, 0041, 0123, 0067, 0032, 0155, 0041, 0246, 0167, 
+  0114, 0304, 0274, 0240, 0216, 0352, 0252, 0353, 0250, 0316, 0245, 0243, 0132, 0357, 0267, 0144, 
+  0124, 0332, 0265, 0124, 0033, 0233, 0107, 0154, 0275, 0173, 0164, 0166, 0055, 0125, 0061, 0160, 
+  0247, 0151, 0251, 0074, 0163, 0350, 0132, 0252, 0347, 0331, 0122, 0371, 0102, 0331, 0265, 0124, 
+  0107, 0150, 0251, 0174, 0204, 0333, 0365, 0124, 0047, 0352, 0251, 0332, 0051, 0235, 0331, 0223, 
+  0205, 0256, 0170, 0156, 0076, 0110, 0335, 0170, 0364, 0362, 0244, 0345, 0363, 0050, 0145, 0156, 
+  0025, 0350, 0256, 0320, 0065, 0335, 0063, 0075, 0207, 0102, 0127, 0010, 0146, 0127, 0352, 0216, 
+  0131, 0352, 0012, 0004, 0331, 0025, 0273, 0332, 0013, 0343, 0156, 0003, 0141, 0345, 0247, 0237, 
+  0333, 0336, 0100, 0150, 0357, 0064, 0145, 0345, 0363, 0126, 0317, 0362, 0124, 0375, 0031, 0237, 
+  0137, 0073, 0270, 0243, 0331, 0232, 0155, 0135, 0301, 0012, 0107, 0041, 0216, 0167, 0330, 0256, 
+  0322, 0155, 0213, 0157, 0014, 0225, 0033, 0134, 0145, 0163, 0055, 0167, 0050, 0100, 0152, 0036, 
+  0263, 0266, 0216, 0345, 0175, 0106, 0145, 0344, 0257, 0044, 0165, 0325, 0063, 0077, 0254, 0123, 
+  0107, 0113, 0235, 0207, 0370, 0205, 0343, 0160, 0221, 0024, 0321, 0164, 0363, 0070, 0134, 0056, 
+  0100, 0354, 0161, 0300, 0011, 0216, 0277, 0325, 0361, 0310, 0013, 0070, 0375, 0226, 0307, 0212, 
+  0345, 0167, 0320, 0026, 0126, 0376, 0341, 0354, 0016, 0072, 0254, 0264, 0213, 0225, 0134, 0200, 
+  0276, 0113, 0254, 0364, 0316, 0007, 0053, 0221, 0004, 0156, 0132, 0053, 0054, 0177, 0203, 0005, 
+  0327, 0241, 0245, 0135, 0264, 0344, 0103, 0364, 0135, 0302, 0245, 0337, 0055, 0121, 0332, 0175, 
+  0141, 0362, 0044, 0157, 0174, 0125, 0171, 0141, 0252, 0064, 0366, 0345, 0057, 0174, 0025, 0155, 
+  0054, 0176, 0066, 0041, 0373, 0336, 0100, 0220, 0075, 0377, 0263, 0217, 0022, 0205, 0077, 0223, 
+  0365, 0167, 0032, 0006, 0064, 0350, 0365, 0350, 0160, 0365, 0362, 0176, 0272, 0257, 0222, 0033, 
+  0125, 0056, 0173, 0275, 0026, 0275, 0252, 0054, 0372, 0313, 0132, 0264, 0357, 0025, 0335, 0370, 
+  0243, 0055, 0176, 0162, 0344, 0346, 0062, 0367, 0041, 0234, 0257, 0302, 0131, 0006, 0126, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051, 0105, 0156, 0147, 0162, 0141, 0155, 0160, 0141, 0057, 0000, 
+  0000, 0000, 0000, 0000, 0141, 0144, 0144, 0055, 0157, 0160, 0164, 0151, 0157, 0156, 0163, 0056, 
+  0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0157, 0035, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0133, 0157, 0353, 0066, 0014, 0176, 0077, 0277, 0302, 0323, 0353, 0340, 
+  0046, 0151, 0167, 0272, 0016, 0110, 0162, 0260, 0013, 0116, 0061, 0140, 0300, 0200, 0235, 0156, 
+  0173, 0024, 0024, 0211, 0211, 0265, 0050, 0222, 0047, 0051, 0111, 0363, 0357, 0047, 0333, 0251, 
+  0143, 0307, 0362, 0265, 0101, 0033, 0154, 0173, 0113, 0144, 0222, 0042, 0051, 0363, 0373, 0110, 
+  0171, 0372, 0351, 0171, 0043, 0202, 0035, 0150, 0303, 0225, 0234, 0241, 0311, 0315, 0030, 0005, 
+  0040, 0251, 0142, 0134, 0256, 0146, 0350, 0367, 0247, 0317, 0341, 0003, 0372, 0064, 0377, 0060, 
+  0375, 0052, 0014, 0203, 0107, 0220, 0240, 0211, 0005, 0026, 0354, 0271, 0215, 0202, 0225, 0040, 
+  0014, 0202, 0273, 0233, 0273, 0373, 0233, 0161, 0020, 0206, 0116, 0210, 0113, 0013, 0172, 0111, 
+  0050, 0314, 0077, 0004, 0301, 0124, 0303, 0337, 0133, 0256, 0301, 0004, 0202, 0057, 0146, 0150, 
+  0145, 0327, 0137, 0243, 0323, 0106, 0167, 0067, 0267, 0267, 0150, 0224, 0312, 0251, 0305, 0137, 
+  0100, 0155, 0100, 0005, 0061, 0146, 0206, 0036, 0355, 0372, 0347, 0015, 0131, 0001, 0012, 0070, 
+  0233, 0041, 0242, 0030, 0046, 0161, 0054, 0016, 0170, 0261, 0265, 0126, 0111, 0224, 0150, 0070, 
+  0235, 0130, 0253, 0030, 0264, 0075, 0004, 0222, 0154, 0140, 0206, 0166, 0334, 0360, 0205, 0000, 
+  0064, 0177, 0322, 0133, 0230, 0216, 0136, 0236, 0372, 0205, 0051, 0221, 0170, 0251, 0350, 0326, 
+  0240, 0371, 0147, 0042, 0114, 0253, 0074, 0247, 0112, 0342, 0344, 0047, 0232, 0273, 0040, 0302, 
+  0324, 0235, 0262, 0316, 0164, 0224, 0305, 0320, 0051, 0034, 0267, 0075, 0005, 0201, 0171, 0272, 
+  0372, 0276, 0341, 0354, 0271, 0144, 0152, 0037, 0122, 0241, 0316, 0325, 0172, 0105, 0244, 0141, 
+  0243, 0166, 0160, 0025, 0021, 0011, 0156, 0154, 0230, 0371, 0323, 0047, 0240, 0237, 0070, 0021, 
+  0152, 0165, 0214, 0210, 0061, 0254, 0142, 0353, 0336, 0122, 0203, 0131, 0266, 0176, 0031, 0067, 
+  0027, 0112, 0063, 0320, 0170, 0317, 0231, 0215, 0320, 0374, 0143, 0233, 0270, 0345, 0326, 0045, 
+  0054, 0260, 0232, 0110, 0043, 0210, 0045, 0056, 0175, 0063, 0164, 0000, 0267, 0333, 0057, 0212, 
+  0260, 0340, 0327, 0314, 0305, 0066, 0053, 0331, 0021, 0343, 0130, 0031, 0236, 0310, 0243, 0071, 
+  0205, 0244, 0110, 0103, 0045, 0303, 0230, 0150, 0367, 0273, 0325, 0215, 0103, 0014, 0070, 0162, 
+  0225, 0215, 0346, 0131, 0066, 0052, 0012, 0206, 0257, 0044, 0021, 0107, 0161, 0006, 0306, 0152, 
+  0165, 0100, 0101, 0104, 0044, 0023, 0240, 0147, 0310, 0235, 0115, 0065, 0245, 0070, 0227, 0063, 
+  0173, 0127, 0120, 0340, 0362, 0056, 0125, 0206, 0007, 0316, 0042, 0215, 0270, 0140, 0101, 0212, 
+  0046, 0316, 0162, 0230, 0376, 0165, 0357, 0320, 0102, 0075, 0037, 0217, 0302, 0167, 0206, 0077, 
+  0270, 0247, 0351, 0001, 0146, 0073, 0204, 0211, 0370, 0344, 0273, 0134, 0241, 0347, 0073, 0071, 
+  0344, 0300, 0175, 0072, 0112, 0163, 0227, 0144, 0222, 0345, 0336, 0241, 0237, 0345, 0224, 0210, 
+  0056, 0212, 0046, 0046, 0324, 0141, 0060, 0232, 0337, 0172, 0245, 0375, 0051, 0042, 0064, 0331, 
+  0010, 0273, 0203, 0045, 0205, 0300, 0275, 0331, 0112, 0341, 0364, 0074, 0147, 0005, 0375, 0122, 
+  0352, 0006, 0245, 0157, 0150, 0012, 0175, 0172, 0202, 0034, 0324, 0326, 0142, 0143, 0017, 0311, 
+  0216, 0040, 0131, 0255, 0142, 0232, 0211, 0362, 0132, 0175, 0374, 0025, 0124, 0056, 0261, 0114, 
+  0263, 0103, 0013, 0020, 0336, 0352, 0304, 0077, 0126, 0341, 0264, 0331, 0126, 0247, 0114, 0266, 
+  0144, 0163, 0210, 0052, 0203, 0045, 0331, 0012, 0333, 0137, 0131, 0003, 0005, 0276, 0003, 0163, 
+  0262, 0320, 0170, 0230, 0136, 0314, 0316, 0310, 0342, 0234, 0020, 0373, 0230, 0330, 0032, 0300, 
+  0133, 0351, 0040, 0125, 0160, 0071, 0040, 0171, 0104, 0354, 0311, 0301, 0140, 0023, 0071, 0170, 
+  0074, 0172, 0323, 0152, 0242, 0004, 0165, 0124, 0160, 0272, 0006, 0166, 0006, 0165, 0347, 0357, 
+  0022, 0316, 0305, 0074, 0110, 0127, 0060, 0135, 0340, 0247, 0262, 0327, 0204, 0256, 0035, 0016, 
+  0264, 0307, 0003, 0317, 0261, 0363, 0143, 0300, 0121, 0054, 0271, 0020, 0003, 0324, 0116, 0224, 
+  0062, 0256, 0127, 0163, 0117, 0174, 0376, 0117, 0107, 0236, 0062, 0035, 0132, 0272, 0152, 0175, 
+  0221, 0262, 0375, 0276, 0332, 0327, 0375, 0137, 0266, 0015, 0145, 0133, 0154, 0313, 0377, 0025, 
+  0145, 0233, 0277, 0107, 0377, 0201, 0222, 0235, 0134, 0242, 0144, 0175, 0011, 0360, 0007, 0077, 
+  0050, 0160, 0177, 0320, 0175, 0272, 0215, 0304, 0027, 0234, 0064, 0260, 0315, 0055, 0103, 0137, 
+  0140, 0363, 0144, 0250, 0222, 0235, 0052, 0230, 0125, 0201, 0354, 0121, 0163, 0226, 0301, 0130, 
+  0012, 0104, 0337, 0134, 0123, 0303, 0325, 0062, 0254, 0324, 0102, 0214, 0253, 0312, 0274, 0163, 
+  0275, 0357, 0354, 0244, 0022, 0333, 0215, 0354, 0242, 0330, 0225, 0042, 0136, 0372, 0332, 0164, 
+  0010, 0170, 0100, 0157, 0003, 0346, 0275, 0353, 0261, 0363, 0160, 0320, 0072, 0044, 0334, 0067, 
+  0152, 0171, 0263, 0326, 0215, 0134, 0217, 0263, 0175, 0055, 0301, 0366, 0044, 0331, 0337, 0074, 
+  0243, 0171, 0273, 0301, 0316, 0207, 0363, 0112, 0266, 0275, 0020, 0151, 0266, 0020, 0147, 0361, 
+  0272, 0244, 0257, 0231, 0236, 0344, 0171, 0041, 0002, 0255, 0347, 0272, 0146, 0276, 0173, 0025, 
+  0347, 0275, 0202, 0367, 0006, 0267, 0253, 0015, 0374, 0127, 0333, 0266, 0266, 0124, 0130, 0054, 
+  0010, 0205, 0110, 0011, 0167, 0146, 0243, 0167, 0264, 0370, 0372, 0146, 0105, 0300, 0322, 0142, 
+  0142, 0055, 0241, 0121, 0143, 0377, 0340, 0271, 0102, 0122, 0161, 0256, 0370, 0306, 0263, 0302, 
+  0027, 0252, 0225, 0020, 0300, 0376, 0114, 0257, 0301, 0062, 0130, 0063, 0307, 0265, 0354, 0152, 
+  0154, 0062, 0351, 0300, 0016, 0051, 0015, 0342, 0344, 0102, 0033, 0214, 0103, 0200, 0333, 0207, 
+  0161, 0237, 0370, 0043, 0340, 0253, 0310, 0236, 0324, 0047, 0037, 0307, 0327, 0076, 0147, 0230, 
+  0210, 0044, 0327, 0206, 0131, 0357, 0304, 0345, 0245, 0330, 0345, 0111, 0003, 0374, 0301, 0141, 
+  0177, 0342, 0027, 0353, 0126, 0166, 0311, 0312, 0365, 0063, 0101, 0004, 0304, 0225, 0234, 0301, 
+  0271, 0017, 0335, 0160, 0250, 0064, 0174, 0270, 0376, 0050, 0275, 0144, 0333, 0045, 0237, 0121, 
+  0252, 0043, 0310, 0113, 0066, 0160, 0322, 0107, 0025, 0344, 0032, 0347, 0220, 0306, 0033, 0101, 
+  0003, 0002, 0150, 0206, 0173, 0136, 0265, 0272, 0123, 0372, 0222, 0353, 0145, 0015, 0352, 0321, 
+  0261, 0060, 0267, 0067, 0251, 0165, 0144, 0124, 0377, 0102, 0324, 0262, 0310, 0333, 0240, 0326, 
+  0370, 0135, 0121, 0353, 0372, 0307, 0245, 0266, 0361, 0260, 0175, 0360, 0051, 0307, 0130, 0172, 
+  0070, 0315, 0056, 0227, 0103, 0207, 0245, 0053, 0260, 0046, 0327, 0050, 0055, 0007, 0032, 0114, 
+  0254, 0244, 0161, 0336, 0204, 0337, 0226, 0256, 0007, 0137, 0056, 0032, 0112, 0342, 0355, 0106, 
+  0046, 0343, 0314, 0112, 0076, 0334, 0173, 0055, 0234, 0055, 0232, 0322, 0167, 0210, 0004, 0004, 
+  0217, 0237, 0143, 0026, 0104, 0237, 0276, 0100, 0124, 0171, 0270, 0020, 0357, 0051, 0021, 0323, 
+  0121, 0341, 0263, 0350, 0077, 0364, 0102, 0273, 0301, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0160, 0141, 0163, 0163, 0167, 0157, 0162, 0144, 
+  0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0274, 0045, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0132, 0137, 0163, 0343, 0064, 0020, 0177, 0357, 0247, 0020, 0172, 0270, 0027, 
+  0160, 0322, 0264, 0264, 0060, 0167, 0111, 0156, 0206, 0343, 0256, 0163, 0003, 0003, 0074, 0034, 
+  0303, 0243, 0107, 0221, 0067, 0261, 0210, 0042, 0031, 0111, 0156, 0232, 0373, 0022, 0074, 0362, 
+  0375, 0370, 0044, 0254, 0345, 0044, 0115, 0122, 0305, 0216, 0335, 0320, 0246, 0003, 0157, 0266, 
+  0244, 0135, 0355, 0376, 0264, 0377, 0264, 0166, 0377, 0355, 0335, 0114, 0222, 0133, 0060, 0126, 
+  0150, 0065, 0240, 0275, 0316, 0071, 0045, 0240, 0270, 0116, 0204, 0232, 0014, 0350, 0257, 0237, 
+  0076, 0104, 0337, 0322, 0267, 0303, 0263, 0376, 0027, 0121, 0104, 0156, 0100, 0201, 0141, 0016, 
+  0022, 0062, 0027, 0056, 0045, 0023, 0311, 0022, 0040, 0227, 0235, 0313, 0353, 0316, 0071, 0211, 
+  0042, 0134, 0044, 0224, 0003, 0063, 0146, 0034, 0206, 0147, 0204, 0364, 0015, 0374, 0221, 0013, 
+  0003, 0226, 0110, 0061, 0032, 0320, 0211, 0233, 0176, 0111, 0357, 0067, 0272, 0354, 0134, 0134, 
+  0320, 0256, 0137, 0247, 0107, 0277, 0003, 0167, 0204, 0113, 0146, 0355, 0200, 0336, 0270, 0351, 
+  0307, 0031, 0233, 0000, 0045, 0042, 0031, 0320, 0154, 0036, 0163, 0246, 0070, 0310, 0130, 0370, 
+  0301, 0202, 0000, 0111, 0062, 0243, 0063, 0060, 0156, 0101, 0024, 0233, 0301, 0200, 0336, 0012, 
+  0053, 0106, 0022, 0147, 0077, 0231, 0034, 0372, 0335, 0325, 0154, 0170, 0061, 0362, 0213, 0307, 
+  0232, 0347, 0226, 0016, 0077, 0060, 0151, 0153, 0327, 0013, 0256, 0125, 0134, 0074, 0322, 0041, 
+  0316, 0160, 0260, 0066, 0262, 0116, 0147, 0333, 0144, 0375, 0156, 0251, 0305, 0041, 0012, 0351, 
+  0351, 0111, 0050, 0203, 0007, 0022, 0351, 0151, 0023, 0065, 0276, 0027, 0114, 0352, 0311, 0122, 
+  0017, 0034, 0234, 0153, 0223, 0304, 0111, 0071, 0170, 0034, 0361, 0106, 0310, 0021, 0114, 0074, 
+  0027, 0211, 0113, 0351, 0360, 0252, 0156, 0271, 0023, 0016, 0201, 0042, 0316, 0060, 0145, 0045, 
+  0163, 0014, 0141, 0033, 0320, 0005, 0340, 0156, 0277, 0054, 0305, 0253, 0343, 0200, 0346, 0051, 
+  0076, 0063, 0017, 0367, 0101, 0002, 0316, 0205, 0112, 0364, 0074, 0316, 0264, 0025, 0016, 0355, 
+  0230, 0016, 0071, 0024, 0066, 0037, 0151, 0025, 0145, 0314, 0340, 0163, 0255, 0310, 0213, 0014, 
+  0342, 0024, 0035, 0205, 0016, 0113, 0344, 0036, 0020, 0130, 0061, 0121, 0114, 0056, 0227, 0047, 
+  0140, 0235, 0321, 0013, 0112, 0122, 0246, 0022, 0011, 0146, 0100, 0361, 0374, 0166, 0260, 0217, 
+  0327, 0213, 0354, 0234, 0145, 0031, 0340, 0351, 0050, 0135, 0372, 0326, 0056, 0073, 0124, 0067, 
+  0323, 0312, 0102, 0065, 0277, 0373, 0125, 0041, 0206, 0074, 0025, 0062, 0041, 0336, 0325, 0221, 
+  0161, 0344, 0137, 0321, 0152, 0107, 0372, 0156, 0151, 0004, 0041, 0323, 0371, 0016, 0147, 0275, 
+  0335, 0224, 0133, 0104, 0305, 0362, 0336, 0325, 0232, 0240, 0241, 0027, 0264, 0061, 0265, 0020, 
+  0215, 0066, 0002, 0217, 0214, 0225, 0047, 0211, 0241, 0311, 0011, 0316, 0344, 0041, 0204, 0066, 
+  0143, 0034, 0003, 0044, 0035, 0136, 0004, 0127, 0207, 0041, 0142, 0274, 0330, 0050, 0106, 0063, 
+  0141, 0033, 0212, 0007, 0321, 0312, 0235, 0323, 0152, 0027, 0263, 0015, 0372, 0055, 0350, 0132, 
+  0301, 0327, 0026, 0302, 0020, 0235, 0144, 0013, 0235, 0273, 0330, 0272, 0105, 0261, 0043, 0250, 
+  0144, 0057, 0241, 0107, 0142, 0173, 0154, 0277, 0376, 0273, 0031, 0140, 0124, 0216, 0356, 0222, 
+  0207, 0344, 0031, 0201, 0014, 0206, 0205, 0370, 0235, 0147, 0265, 0117, 0276, 0326, 0110, 0326, 
+  0240, 0331, 0206, 0064, 0201, 0061, 0313, 0245, 0153, 0116, 0154, 0200, 0203, 0270, 0005, 0173, 
+  0317, 0241, 0362, 0060, 0203, 0131, 0242, 0114, 0117, 0073, 0311, 0267, 0011, 0207, 0334, 0102, 
+  0234, 0053, 0214, 0345, 0122, 0250, 0026, 0330, 0061, 0071, 0147, 0013, 0033, 0333, 0024, 0143, 
+  0355, 0122, 0230, 0152, 0026, 0233, 0211, 0153, 0233, 0061, 0343, 0123, 0364, 0324, 0372, 0055, 
+  0341, 0056, 0303, 0220, 0330, 0002, 0254, 0261, 0220, 0262, 0005, 0331, 0175, 0012, 0071, 0257, 
+  0122, 0053, 0050, 0177, 0277, 0033, 0160, 0244, 0226, 0316, 0205, 0325, 0310, 0061, 0034, 0353, 
+  0347, 0037, 0116, 0335, 0251, 0122, 0146, 0237, 0305, 0037, 0213, 0175, 0117, 0303, 0231, 0127, 
+  0205, 0347, 0377, 0216, 0374, 0357, 0070, 0162, 0357, 0030, 0216, 0034, 0002, 0040, 0254, 0174, 
+  0053, 0305, 0303, 0112, 0067, 0251, 0022, 0012, 0131, 0342, 0242, 0214, 0255, 0116, 0365, 0115, 
+  0303, 0135, 0000, 0241, 0007, 0350, 0074, 0014, 0161, 0025, 0225, 0246, 0057, 0061, 0173, 0247, 
+  0124, 0047, 0325, 0334, 0156, 0036, 0135, 0245, 0126, 0126, 0252, 0275, 0213, 0307, 0126, 0145, 
+  0067, 0106, 0044, 0045, 0264, 0076, 0362, 0367, 0350, 0323, 0304, 0371, 0306, 0016, 0151, 0060, 
+  0326, 0254, 0325, 0276, 0156, 0264, 0253, 0226, 0371, 0114, 0305, 0007, 0140, 0266, 0037, 0267, 
+  0060, 0166, 0357, 0122, 0340, 0273, 0231, 0027, 0024, 0067, 0213, 0314, 0305, 0051, 0260, 0302, 
+  0054, 0170, 0261, 0144, 0157, 0052, 0156, 0230, 0216, 0337, 0227, 0274, 0211, 0113, 0201, 0240, 
+  0213, 0003, 0221, 0302, 0272, 0052, 0145, 0036, 0165, 0172, 0217, 0314, 0324, 0107, 0112, 0174, 
+  0341, 0344, 0053, 0361, 0376, 0113, 0207, 0326, 0061, 0323, 0130, 0377, 0206, 0271, 0057, 0304, 
+  0042, 0061, 0014, 0023, 0237, 0112, 0320, 0145, 0235, 0066, 0207, 0360, 0330, 0227, 0000, 0253, 
+  0223, 0140, 0320, 0074, 0140, 0354, 0142, 0346, 0034, 0343, 0151, 0145, 0156, 0012, 0123, 0073, 
+  0235, 0035, 0112, 0274, 0047, 0271, 0355, 0255, 0124, 0233, 0072, 0317, 0173, 0345, 0314, 0142, 
+  0355, 0066, 0353, 0156, 0005, 0370, 0341, 0323, 0067, 0345, 0164, 0225, 0230, 0333, 0020, 0173, 
+  0301, 0205, 0024, 0156, 0321, 0322, 0003, 0204, 0132, 0352, 0216, 0001, 0206, 0241, 0005, 0376, 
+  0375, 0327, 0237, 0115, 0131, 0024, 0215, 0207, 0133, 0346, 0240, 0101, 0035, 0173, 0232, 0166, 
+  0174, 0376, 0274, 0166, 0374, 0143, 0031, 0257, 0013, 0073, 0366, 0241, 0373, 0362, 0353, 0047, 
+  0266, 0336, 0247, 0017, 0241, 0025, 0051, 0152, 0325, 0242, 0175, 0375, 0014, 0141, 0171, 0246, 
+  0140, 0246, 0225, 0340, 0105, 0055, 0066, 0001, 0347, 0157, 0107, 0333, 0161, 0345, 0131, 0214, 
+  0373, 0374, 0345, 0030, 0167, 0046, 0031, 0207, 0124, 0113, 0074, 0206, 0356, 0301, 0034, 0217, 
+  0167, 0271, 0153, 0132, 0117, 0326, 0137, 0163, 0116, 0253, 0107, 0263, 0272, 0304, 0240, 0135, 
+  0052, 0355, 0040, 0116, 0067, 0333, 0353, 0047, 0126, 0157, 0037, 0130, 0153, 0067, 0010, 0224, 
+  0033, 0337, 0313, 0174, 0323, 0340, 0342, 0045, 0304, 0311, 0215, 0117, 0153, 0313, 0206, 0275, 
+  0120, 0143, 0155, 0146, 0376, 0342, 0326, 0212, 0231, 0025, 0237, 0241, 0006, 0325, 0143, 0206, 
+  0242, 0203, 0033, 0047, 0217, 0150, 0236, 0264, 0366, 0262, 0147, 0311, 0317, 0227, 0057, 0301, 
+  0356, 0366, 0247, 0330, 0127, 0322, 0275, 0021, 0257, 0046, 0356, 0115, 0361, 0060, 0052, 0036, 
+  0176, 0302, 0130, 0362, 0272, 0170, 0353, 0372, 0127, 0177, 0075, 0134, 0345, 0075, 0062, 0307, 
+  0043, 0044, 0043, 0040, 0230, 0137, 0023, 0342, 0064, 0131, 0336, 0117, 0375, 0375, 0321, 0222, 
+  0205, 0316, 0011, 0113, 0374, 0104, 0101, 0305, 0163, 0123, 0174, 0356, 0044, 0314, 0040, 0300, 
+  0267, 0360, 0025, 0101, 0323, 0051, 0346, 0022, 0330, 0045, 0202, 0073, 0024, 0015, 0161, 0036, 
+  0033, 0075, 0013, 0221, 0166, 0310, 0157, 0051, 0050, 0077, 0263, 0034, 0041, 0302, 0342, 0251, 
+  0150, 0057, 0106, 0110, 0300, 0004, 0044, 0070, 0110, 0072, 0136, 0021, 0257, 0140, 0233, 0022, 
+  0142, 0306, 0314, 0064, 0317, 0332, 0235, 0331, 0334, 0260, 0226, 0224, 0063, 0166, 0127, 0066, 
+  0200, 0174, 0071, 0216, 0207, 0364, 0315, 0371, 0123, 0373, 0167, 0033, 0261, 0017, 0313, 0237, 
+  0255, 0333, 0243, 0355, 0274, 0373, 0345, 0226, 0023, 0377, 0221, 0116, 0161, 0235, 0276, 0365, 
+  0075, 0337, 0155, 0035, 0267, 0046, 0373, 0345, 0367, 0360, 0250, 0054, 0341, 0355, 0232, 0142, 
+  0153, 0230, 0254, 0376, 0145, 0030, 0320, 0350, 0172, 0363, 0213, 0146, 0331, 0150, 0353, 0167, 
+  0267, 0126, 0327, 0363, 0270, 0132, 0175, 0110, 0251, 0240, 0337, 0031, 0264, 0133, 0377, 0115, 
+  0024, 0215, 0363, 0345, 0217, 0053, 0243, 0342, 0072, 0176, 0266, 0267, 0236, 0336, 0120, 0366, 
+  0036, 0205, 0176, 0167, 0343, 0037, 0253, 0177, 0000, 0167, 0133, 0004, 0145, 0000, 0050, 0165, 
+  0165, 0141, 0171, 0051, 0160, 0162, 0157, 0160, 0145, 0162, 0164, 0151, 0145, 0163, 0056, 0165, 
+  0151, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0023, 0073, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0133, 0121, 0163, 0342, 0066, 0020, 0176, 0277, 0137, 0241, 0352, 0265, 0343, 
+  0020, 0240, 0227, 0164, 0072, 0300, 0115, 0233, 0116, 0322, 0316, 0334, 0334, 0123, 0372, 0354, 
+  0021, 0362, 0202, 0165, 0021, 0222, 0053, 0311, 0020, 0372, 0353, 0273, 0266, 0111, 0214, 0203, 
+  0301, 0261, 0341, 0212, 0257, 0370, 0045, 0103, 0344, 0135, 0111, 0373, 0171, 0277, 0157, 0045, 
+  0333, 0032, 0175, 0172, 0136, 0110, 0262, 0004, 0143, 0205, 0126, 0143, 0332, 0277, 0272, 0246, 
+  0004, 0024, 0327, 0201, 0120, 0363, 0061, 0375, 0353, 0361, 0336, 0373, 0231, 0176, 0232, 0174, 
+  0030, 0375, 0340, 0171, 0344, 0001, 0024, 0030, 0346, 0040, 0040, 0053, 0341, 0102, 0062, 0227, 
+  0054, 0000, 0062, 0274, 0032, 0336, 0134, 0135, 0023, 0317, 0103, 0043, 0241, 0034, 0230, 0031, 
+  0343, 0060, 0371, 0100, 0310, 0310, 0300, 0337, 0261, 0060, 0140, 0211, 0024, 0323, 0061, 0235, 
+  0273, 0247, 0037, 0151, 0076, 0320, 0360, 0152, 0060, 0240, 0275, 0324, 0116, 0117, 0277, 0002, 
+  0167, 0204, 0113, 0146, 0355, 0230, 0076, 0270, 0247, 0077, 0027, 0154, 0016, 0224, 0210, 0140, 
+  0114, 0043, 0077, 0004, 0031, 0371, 0042, 0155, 0111, 0254, 0321, 0076, 0062, 0072, 0002, 0343, 
+  0326, 0104, 0261, 0005, 0214, 0351, 0122, 0130, 0061, 0225, 0170, 0365, 0321, 0304, 0060, 0352, 
+  0275, 0134, 0055, 0067, 0346, 0114, 0371, 0063, 0315, 0143, 0113, 0047, 0367, 0114, 0332, 0112, 
+  0173, 0301, 0265, 0362, 0223, 0237, 0164, 0222, 0114, 0304, 0233, 0032, 0275, 0262, 0140, 0212, 
+  0156, 0243, 0136, 0026, 0302, 0073, 0242, 0321, 0117, 0255, 0210, 0145, 0045, 0124, 0240, 0127, 
+  0036, 0227, 0372, 0255, 0333, 0341, 0130, 0176, 0027, 0114, 0352, 0371, 0046, 0030, 0364, 0362, 
+  0203, 0254, 0341, 0064, 0023, 0234, 0152, 0023, 0200, 0361, 0127, 0042, 0160, 0041, 0235, 0174, 
+  0254, 0062, 0317, 0202, 0360, 0043, 0155, 0205, 0303, 0234, 0242, 0023, 0016, 0111, 0376, 0171, 
+  0132, 0171, 0021, 0063, 0370, 0273, 0252, 0003, 0267, 0216, 0300, 0017, 0061, 0151, 0351, 0044, 
+  0213, 0143, 0307, 0301, 0212, 0271, 0142, 0162, 0143, 0036, 0200, 0165, 0106, 0257, 0051, 0011, 
+  0231, 0012, 0044, 0230, 0061, 0105, 0074, 0267, 0120, 0360, 0137, 0015, 0354, 0212, 0105, 0021, 
+  0040, 0106, 0112, 0147, 0071, 0216, 0135, 0361, 0120, 0310, 0200, 0244, 0014, 0301, 0056, 0275, 
+  0364, 0137, 0274, 0341, 0123, 0375, 0274, 0101, 0257, 0014, 0357, 0337, 0360, 0152, 0012, 0166, 
+  0066, 0202, 0227, 0230, 0367, 0007, 0257, 0016, 0065, 0023, 0250, 0311, 0075, 0052, 0363, 0321, 
+  0106, 0040, 0272, 0054, 0003, 0035, 0031, 0355, 0004, 0147, 0362, 0075, 0216, 0066, 0142, 0034, 
+  0165, 0205, 0116, 0006, 0245, 0326, 0345, 0020, 0061, 0236, 0014, 0344, 0343, 0035, 0145, 0133, 
+  0201, 0227, 0242, 0025, 0073, 0247, 0325, 0133, 0314, 0266, 0374, 0013, 0320, 0065, 0202, 0257, 
+  0051, 0204, 0145, 0176, 0222, 0255, 0165, 0354, 0174, 0353, 0326, 0311, 0210, 0240, 0202, 0275, 
+  0216, 0051, 0022, 0305, 0266, 0375, 0361, 0027, 0204, 0163, 0232, 0065, 0275, 0365, 0055, 0233, 
+  0314, 0024, 0044, 0045, 0316, 0060, 0145, 0045, 0163, 0014, 0121, 0030, 0323, 0065, 0140, 0114, 
+  0376, 0037, 0330, 0321, 0276, 0251, 0065, 0006, 0261, 0002, 0310, 0046, 0256, 0001, 0314, 0130, 
+  0054, 0135, 0175, 0147, 0003, 0034, 0304, 0022, 0154, 0336, 0303, 0301, 0373, 0130, 0252, 0255, 
+  0231, 0250, 0157, 0227, 0253, 0072, 0356, 0261, 0005, 0077, 0126, 0050, 0176, 0122, 0250, 0006, 
+  0300, 0061, 0271, 0142, 0153, 0353, 0333, 0020, 0345, 0160, 0063, 0223, 0303, 0135, 0154, 0253, 
+  0174, 0261, 0143, 0306, 0237, 0220, 0241, 0325, 0103, 0302, 0163, 0204, 0052, 0330, 0000, 0251, 
+  0231, 0220, 0262, 0201, 0133, 0256, 0362, 0327, 0165, 0334, 0054, 0140, 0321, 0013, 0230, 0131, 
+  0127, 0043, 0122, 0032, 0372, 0250, 0127, 0302, 0275, 0146, 0174, 0304, 0322, 0177, 0012, 0066, 
+  0336, 0355, 0326, 0354, 0366, 0321, 0061, 0144, 0366, 0054, 0114, 0116, 0306, 0155, 0205, 0014, 
+  0274, 0254, 0363, 0072, 0021, 0370, 0066, 0042, 0320, 0077, 0005, 0223, 0313, 0000, 0050, 0017, 
+  0276, 0121, 0340, 0345, 0101, 0327, 0131, 0131, 0044, 0163, 0361, 0223, 0125, 0352, 0341, 0345, 
+  0101, 0135, 0251, 0054, 0101, 0150, 0007, 0235, 0135, 0215, 0333, 0325, 0267, 0007, 0043, 0202, 
+  0114, 0335, 0122, 0205, 0032, 0266, 0151, 0161, 0125, 0261, 0227, 0330, 0253, 0001, 0110, 0236, 
+  0327, 0125, 0352, 0315, 0273, 0047, 0251, 0145, 0274, 0120, 0271, 0143, 0177, 0160, 0354, 0122, 
+  0356, 0163, 0126, 0000, 0262, 0312, 0221, 0014, 0342, 0247, 0045, 0041, 0373, 0113, 0377, 0033, 
+  0321, 0257, 0115, 0317, 0220, 0111, 0334, 0057, 0321, 0211, 0165, 0314, 0270, 0072, 0216, 0173, 
+  0313, 0035, 0301, 0352, 0355, 0340, 0331, 0215, 0351, 0275, 0110, 0242, 0371, 0202, 0346, 0277, 
+  0324, 0351, 0171, 0241, 0140, 0241, 0225, 0340, 0111, 0042, 0314, 0301, 0045, 0322, 0234, 0243, 
+  0131, 0247, 0243, 0257, 0261, 0165, 0142, 0266, 0176, 0331, 0144, 0036, 0164, 0145, 0316, 0031, 
+  0201, 0265, 0036, 0354, 0356, 0305, 0355, 0313, 0057, 0373, 0130, 0020, 0363, 0320, 0121, 0262, 
+  0144, 0062, 0116, 0063, 0127, 0006, 0057, 0273, 0306, 0242, 0200, 0355, 0357, 0367, 0170, 0051, 
+  0227, 0060, 0163, 0076, 0016, 0300, 0170, 0130, 0163, 0211, 0345, 0160, 0003, 0374, 0016, 0307, 
+  0157, 0261, 0300, 0052, 0260, 0304, 0212, 0177, 0056, 0224, 0045, 0223, 0137, 0015, 0002, 0266, 
+  0004, 0222, 0100, 0160, 0054, 0075, 0162, 0030, 0073, 0172, 0234, 0232, 0036, 0303, 0126, 0320, 
+  0203, 0266, 0165, 0317, 0320, 0220, 0027, 0026, 0044, 0306, 0315, 0336, 0061, 0337, 0023, 0347, 
+  0101, 0377, 0173, 0314, 0003, 0156, 0222, 0007, 0167, 0135, 0046, 0264, 0043, 0023, 0076, 0266, 
+  0044, 0023, 0056, 0256, 0144, 0336, 0351, 0105, 0144, 0300, 0046, 0057, 0243, 0110, 0212, 0303, 
+  0261, 0165, 0163, 0033, 0315, 0256, 0374, 0265, 0056, 0331, 0003, 0346, 0272, 0362, 0327, 0022, 
+  0321, 0033, 0234, 0061, 0017, 0142, 0305, 0221, 0371, 0227, 0274, 0131, 0270, 0113, 0266, 0324, 
+  0312, 0235, 0144, 0263, 0260, 0203, 0146, 0247, 0174, 0245, 0031, 0377, 0123, 0233, 0062, 0276, 
+  0023, 0300, 0163, 0013, 0340, 0071, 0323, 0141, 0046, 0044, 0330, 0056, 0021, 0332, 0221, 0010, 
+  0067, 0355, 0110, 0204, 0213, 0253, 0201, 0137, 0342, 0305, 0024, 0014, 0321, 0063, 0222, 0242, 
+  0160, 0154, 0031, 0334, 0202, 0262, 0173, 0150, 0166, 0352, 0332, 0171, 0116, 0216, 0104, 0314, 
+  0205, 0227, 0256, 0225, 0045, 0157, 0077, 0245, 0024, 0121, 0262, 0236, 0250, 0034, 0267, 0055, 
+  0072, 0333, 0077, 0143, 0016, 0345, 0357, 0233, 0272, 0034, 0372, 0236, 0163, 0350, 0272, 0025, 
+  0072, 0164, 0161, 0245, 0372, 0263, 0346, 0351, 0227, 0246, 0307, 0326, 0350, 0034, 0302, 0256, 
+  0104, 0237, 0272, 0104, 0367, 0133, 0361, 0140, 0357, 0362, 0250, 0301, 0254, 0043, 0013, 0035, 
+  0210, 0231, 0200, 0340, 0130, 0176, 0344, 0070, 0166, 0374, 0070, 0065, 0077, 0316, 0371, 0300, 
+  0163, 0041, 0160, 0371, 0221, 0236, 0164, 0270, 0114, 0222, 0074, 0142, 0350, 0307, 0162, 0343, 
+  0015, 0206, 0035, 0101, 0116, 0115, 0220, 0333, 0366, 0020, 0344, 0177, 0107, 0215, 0313, 0132, 
+  0245, 0337, 0136, 0306, 0207, 0301, 0125, 0037, 0102, 0127, 0177, 0342, 0133, 0214, 0261, 0160, 
+  0161, 0224, 0035, 0231, 0362, 0062, 0001, 0174, 0025, 0215, 0142, 0063, 0061, 0140, 0043, 0255, 
+  0054, 0316, 0306, 0353, 0367, 0137, 0217, 0276, 0144, 0107, 0034, 0120, 0163, 0266, 0155, 0253, 
+  0173, 0270, 0335, 0174, 0064, 0177, 0300, 0375, 0115, 0243, 0055, 0234, 0253, 0113, 0370, 0213, 
+  0211, 0040, 0234, 0204, 0051, 0063, 0371, 0211, 0272, 0110, 0062, 0016, 0041, 0052, 0043, 0230, 
+  0336, 0116, 0244, 0071, 0004, 0243, 0336, 0326, 0321, 0325, 0177, 0001, 0210, 0106, 0023, 0052, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051, 0144, 0154, 0147, 0055, 0141, 0144, 0144, 0055, 0146, 
+  0151, 0154, 0145, 0163, 0056, 0165, 0151, 0000, 0034, 0027, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0130, 0301, 0122, 0333, 0060, 0020, 0275, 0363, 0025, 0252, 0256, 0035, 0023, 
+  0342, 0114, 0231, 0036, 0142, 0063, 0055, 0035, 0150, 0357, 0364, 0354, 0221, 0245, 0215, 0255, 
+  0242, 0110, 0256, 0044, 0023, 0362, 0367, 0135, 0333, 0004, 0142, 0342, 0340, 0070, 0111, 0113, 
+  0073, 0345, 0246, 0304, 0373, 0244, 0175, 0322, 0356, 0133, 0255, 0246, 0027, 0367, 0163, 0105, 
+  0356, 0300, 0072, 0151, 0164, 0104, 0307, 0247, 0147, 0224, 0200, 0346, 0106, 0110, 0235, 0105, 
+  0364, 0373, 0315, 0125, 0360, 0221, 0136, 0304, 0047, 0323, 0167, 0101, 0100, 0256, 0101, 0203, 
+  0145, 0036, 0004, 0131, 0110, 0237, 0223, 0114, 0061, 0001, 0144, 0162, 0032, 0206, 0247, 0143, 
+  0022, 0004, 0150, 0044, 0265, 0007, 0073, 0143, 0034, 0342, 0023, 0102, 0246, 0026, 0176, 0226, 
+  0322, 0202, 0043, 0112, 0246, 0021, 0315, 0374, 0355, 0173, 0372, 0264, 0120, 0005, 0243, 0243, 
+  0332, 0316, 0244, 0077, 0200, 0173, 0302, 0025, 0163, 0056, 0242, 0327, 0376, 0366, 0333, 0234, 
+  0145, 0100, 0211, 0024, 0021, 0225, 0325, 0160, 0114, 0053, 0073, 0264, 0054, 0254, 0051, 0300, 
+  0372, 0045, 0321, 0154, 0016, 0021, 0275, 0223, 0116, 0246, 0012, 0150, 0174, 0143, 0113, 0230, 
+  0216, 0126, 0137, 0273, 0215, 0071, 0323, 0311, 0314, 0360, 0322, 0321, 0370, 0212, 0051, 0327, 
+  0153, 0057, 0271, 0321, 0111, 0065, 0244, 0161, 0016, 0252, 0010, 0122, 0153, 0026, 0016, 0154, 
+  0033, 0066, 0035, 0065, 0316, 0357, 0306, 0043, 0174, 0145, 0036, 0370, 0205, 0203, 0163, 0201, 
+  0363, 0246, 0070, 0204, 0307, 0344, 0225, 0171, 0060, 0041, 0202, 0231, 0124, 0340, 0002, 0157, 
+  0002, 0146, 0171, 0056, 0357, 0140, 0010, 0237, 0053, 0304, 0136, 0346, 0306, 0340, 0161, 0176, 
+  0221, 0114, 0231, 0254, 0341, 0046, 0352, 0161, 0202, 0263, 0047, 0365, 0354, 0364, 0070, 0216, 
+  0373, 0145, 0001, 0111, 0216, 0251, 0101, 0343, 0146, 0205, 0336, 0235, 0261, 0200, 0111, 0206, 
+  0153, 0050, 0201, 0331, 0262, 0343, 0052, 0312, 0160, 0246, 0022, 0243, 0325, 0162, 0107, 0200, 
+  0003, 0205, 0273, 0222, 0314, 0113, 0345, 0145, 0261, 0365, 0320, 0234, 0314, 0064, 0123, 0017, 
+  0020, 0001, 0316, 0133, 0263, 0244, 0044, 0147, 0132, 0050, 0260, 0021, 0305, 0043, 0021, 0152, 
+  0155, 0313, 0222, 0107, 0023, 0267, 0140, 0105, 0001, 0270, 0253, 0332, 0064, 0151, 0376, 0174, 
+  0062, 0024, 0206, 0302, 0150, 0007, 0057, 0315, 0366, 0144, 0323, 0065, 0035, 0236, 0273, 0022, 
+  0315, 0270, 0242, 0247, 0120, 0167, 0362, 0172, 0317, 0126, 0006, 0243, 0065, 0213, 0306, 0232, 
+  0324, 0012, 0205, 0116, 0004, 0365, 0117, 0014, 0331, 0324, 0334, 0323, 0307, 0071, 0066, 0042, 
+  0345, 0363, 0332, 0327, 0341, 0221, 0320, 0205, 0061, 0126, 0202, 0366, 0314, 0243, 0010, 0322, 
+  0030, 0325, 0320, 0113, 0074, 0267, 0116, 0140, 0267, 0303, 0214, 0127, 0320, 0204, 0141, 0214, 
+  0254, 0171, 0326, 0351, 0173, 0351, 0275, 0321, 0155, 0006, 0373, 0262, 0350, 0214, 0070, 0266, 
+  0064, 0245, 0117, 0234, 0137, 0126, 0321, 0003, 0132, 0154, 0005, 0266, 0016, 0252, 0317, 0341, 
+  0046, 0027, 0323, 0172, 0074, 0246, 0317, 0121, 0135, 0156, 0244, 0240, 0050, 0361, 0226, 0151, 
+  0247, 0230, 0147, 0050, 0100, 0021, 0135, 0126, 0331, 0233, 0174, 0105, 0335, 0336, 0346, 0324, 
+  0140, 0375, 0332, 0161, 0013, 0207, 0102, 0055, 0160, 0100, 0371, 0252, 0062, 0147, 0306, 0060, 
+  0027, 0207, 0317, 0120, 0113, 0062, 0215, 0233, 0112, 0071, 0004, 0130, 0072, 0110, 0112, 0215, 
+  0371, 0242, 0244, 0356, 0045, 0275, 0256, 0250, 0355, 0111, 0031, 0277, 0305, 0273, 0102, 0377, 
+  0162, 0160, 0137, 0140, 0242, 0017, 0347, 0207, 0122, 0240, 0206, 0243, 0012, 0343, 0144, 0223, 
+  0144, 0147, 0057, 0221, 0352, 0364, 0276, 0045, 0034, 0207, 0107, 0161, 0170, 0130, 0024, 0137, 
+  0062, 0315, 0101, 0375, 0137, 0161, 0034, 0276, 0305, 0361, 0106, 0034, 0217, 0137, 0073, 0216, 
+  0047, 0207, 0305, 0361, 0047, 0041, 0376, 0366, 0040, 0256, 0240, 0173, 0307, 0157, 0316, 0016, 
+  0010, 0376, 0343, 0246, 0317, 0344, 0055, 0175, 0066, 0322, 0047, 0074, 0106, 0372, 0164, 0321, 
+  0357, 0246, 0276, 0215, 0366, 0240, 0053, 0126, 0303, 0171, 0020, 0244, 0267, 0356, 0165, 0220, 
+  0335, 0040, 0272, 0251, 0021, 0175, 0127, 0343, 0275, 0063, 0370, 0130, 0267, 0321, 0071, 0263, 
+  0231, 0324, 0211, 0202, 0031, 0346, 0316, 0371, 0100, 0224, 0225, 0131, 0276, 0007, 0014, 0333, 
+  0350, 0341, 0240, 0324, 0240, 0226, 0316, 0007, 0340, 0166, 0356, 0030, 0072, 0273, 0074, 0074, 
+  0154, 0074, 0153, 0254, 0036, 0341, 0241, 0327, 0363, 0313, 0034, 0170, 0253, 0052, 0124, 0175, 
+  0232, 0234, 0045, 0032, 0026, 0140, 0023, 0136, 0175, 0155, 0352, 0304, 0101, 0145, 0002, 0253, 
+  0004, 0251, 0272, 0130, 0042, 0147, 0244, 0231, 0372, 0337, 0273, 0371, 0274, 0030, 0270, 0335, 
+  0245, 0103, 0141, 0153, 0114, 0143, 0347, 0231, 0365, 0277, 0115, 0273, 0067, 0341, 0302, 0262, 
+  0105, 0042, 0265, 0300, 0210, 0362, 0306, 0376, 0071, 0355, 0037, 0274, 0101, 0177, 0105, 0017, 
+  0360, 0052, 0342, 0077, 0104, 0073, 0173, 0213, 0135, 0277, 0366, 0267, 0071, 0266, 0137, 0120, 
+  0232, 0247, 0207, 0140, 0041, 0105, 0006, 0336, 0075, 0042, 0132, 0177, 0223, 0325, 0223, 0115, 
+  0104, 0203, 0061, 0266, 0357, 0017, 0175, 0374, 0164, 0324, 0262, 0352, 0307, 0236, 0257, 0240, 
+  0341, 0140, 0350, 0207, 0025, 0164, 0322, 0011, 0175, 0366, 0247, 0153, 0077, 0027, 0116, 0107, 
+  0153, 0157, 0330, 0277, 0000, 0106, 0324, 0373, 0332, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 
+  0142, 0141, 0164, 0143, 0150, 0055, 0141, 0144, 0144, 0055, 0146, 0151, 0154, 0145, 0163, 0056, 
+  0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0104, 0125, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0134, 0333, 0162, 0333, 0066, 0020, 0175, 0317, 0127, 0240, 0174, 0350, 0113, 
+  0043, 0353, 0342, 0330, 0343, 0246, 0222, 0062, 0211, 0233, 0270, 0235, 0111, 0046, 0235, 0111, 
+  0372, 0314, 0201, 0110, 0110, 0104, 0014, 0022, 0014, 0000, 0131, 0126, 0176, 0242, 0217, 0375, 
+  0277, 0176, 0111, 0027, 0244, 0056, 0244, 0004, 0336, 0151, 0131, 0276, 0144, 0362, 0140, 0221, 
+  0330, 0005, 0160, 0200, 0135, 0234, 0135, 0000, 0034, 0276, 0271, 0365, 0031, 0272, 0041, 0102, 
+  0122, 0036, 0214, 0254, 0376, 0111, 0317, 0102, 0044, 0160, 0270, 0113, 0203, 0331, 0310, 0372, 
+  0373, 0353, 0207, 0316, 0205, 0365, 0146, 0374, 0142, 0370, 0123, 0247, 0203, 0256, 0110, 0100, 
+  0004, 0126, 0304, 0105, 0013, 0252, 0074, 0064, 0143, 0330, 0045, 0350, 0364, 0344, 0364, 0374, 
+  0244, 0207, 0072, 0035, 0050, 0104, 0003, 0105, 0304, 0024, 0073, 0144, 0374, 0002, 0241, 0241, 
+  0040, 0337, 0347, 0124, 0020, 0211, 0030, 0235, 0214, 0254, 0231, 0272, 0376, 0305, 0332, 0126, 
+  0164, 0172, 0062, 0030, 0130, 0335, 0250, 0034, 0237, 0174, 0043, 0216, 0102, 0016, 0303, 0122, 
+  0216, 0254, 0053, 0165, 0375, 0247, 0217, 0147, 0304, 0102, 0324, 0035, 0131, 0330, 0306, 0256, 
+  0153, 0323, 0350, 0201, 0056, 0014, 0305, 0103, 0301, 0103, 0042, 0324, 0022, 0005, 0330, 0047, 
+  0043, 0353, 0206, 0112, 0072, 0141, 0360, 0366, 0253, 0230, 0223, 0141, 0167, 0375, 0326, 0134, 
+  0330, 0301, 0201, 0075, 0345, 0316, 0134, 0132, 0343, 0017, 0230, 0311, 0302, 0362, 0324, 0341, 
+  0201, 0255, 0377, 0264, 0306, 0320, 0216, 0316, 0224, 0062, 0042, 0073, 0212, 0167, 0260, 0160, 
+  0074, 0172, 0263, 0043, 0076, 0354, 0306, 0075, 0051, 0321, 0051, 0150, 0207, 0103, 0330, 0121, 
+  0364, 0013, 0336, 0070, 0104, 0312, 0216, 0124, 0074, 0254, 0335, 0037, 0217, 0260, 0360, 0050, 
+  0172, 0243, 0033, 0322, 0231, 0010, 0276, 0220, 0104, 0124, 0351, 0315, 0133, 0367, 0333, 0134, 
+  0052, 0237, 0004, 0052, 0356, 0322, 0015, 0147, 0163, 0237, 0300, 0344, 0333, 0074, 0066, 0127, 
+  0075, 0017, 0341, 0227, 0065, 0376, 0165, 0363, 0257, 0250, 0255, 0067, 0230, 0315, 0241, 0235, 
+  0375, 0136, 0121, 0301, 0020, 0300, 0264, 0151, 0340, 0010, 0022, 0127, 0277, 0053, 0221, 0337, 
+  0237, 0337, 0051, 0146, 0174, 0026, 0367, 0305, 0215, 0377, 0156, 0007, 0353, 0011, 0027, 0056, 
+  0021, 0366, 0202, 0272, 0312, 0263, 0306, 0147, 0105, 0305, 0025, 0125, 0060, 0352, 0110, 0011, 
+  0034, 0110, 0206, 0025, 0206, 0071, 0060, 0262, 0226, 0004, 0152, 0273, 0344, 0176, 0010, 0316, 
+  0101, 0026, 0151, 0200, 0062, 0364, 0007, 0216, 0346, 0116, 0251, 0006, 0056, 0150, 0340, 0362, 
+  0205, 0035, 0162, 0111, 0025, 0170, 0032, 0153, 0354, 0020, 0355, 0225, 0012, 0033, 0272, 0014, 
+  0211, 0355, 0121, 0215, 0164, 0300, 0205, 0217, 0331, 0236, 0200, 0244, 0263, 0000, 0263, 0125, 
+  0161, 0227, 0110, 0045, 0370, 0322, 0102, 0036, 0016, 0134, 0106, 0304, 0310, 0202, 0051, 0030, 
+  0003, 0155, 0157, 0336, 0311, 0005, 0206, 0351, 0001, 0043, 0020, 0360, 0330, 0325, 0201, 0026, 
+  0360, 0033, 0314, 0105, 0221, 0243, 0004, 0155, 0235, 0350, 0047, 0314, 0212, 0011, 0277, 0135, 
+  0015, 0220, 0151, 0064, 0337, 0301, 0333, 0304, 0120, 0166, 0164, 0361, 0176, 0177, 0043, 0120, 
+  0321, 0334, 0352, 0114, 0003, 0223, 0014, 0027, 0024, 0240, 0305, 0061, 0312, 0340, 0330, 0025, 
+  0165, 0366, 0141, 0063, 0011, 0312, 0020, 0073, 0260, 0274, 0130, 0343, 0201, 0261, 0264, 0031, 
+  0042, 0354, 0350, 0212, 0154, 0054, 0010, 0116, 0164, 0334, 0210, 0326, 0134, 0051, 0036, 0354, 
+  0142, 0226, 0220, 0117, 0101, 0127, 0013, 0276, 0272, 0020, 0232, 0344, 0030, 0136, 0362, 0271, 
+  0262, 0245, 0132, 0352, 0032, 0111, 0340, 0146, 0012, 0106, 0110, 0244, 0237, 0145, 0367, 0177, 
+  0147, 0251, 0231, 0304, 0017, 0167, 0245, 0115, 0315, 0231, 0020, 0146, 0264, 0130, 0373, 0062, 
+  0122, 0225, 0325, 0274, 0332, 0100, 0026, 0200, 0131, 0125, 0124, 0020, 0207, 0300, 0332, 0054, 
+  0301, 0016, 0247, 0170, 0316, 0124, 0301, 0160, 0030, 0027, 0224, 0170, 0045, 0113, 0257, 0323, 
+  0125, 0024, 0314, 0045, 0261, 0347, 0001, 0070, 0112, 0106, 0203, 0032, 0275, 0307, 0154, 0201, 
+  0227, 0322, 0226, 0036, 0070, 0262, 0125, 0133, 0362, 0125, 0044, 0027, 0203, 0264, 0142, 0354, 
+  0134, 0203, 0251, 0025, 0127, 0111, 0156, 0103, 0360, 0144, 0065, 0260, 0002, 0116, 0304, 0152, 
+  0210, 0155, 0375, 0163, 0057, 0257, 0133, 0306, 0366, 0017, 0273, 0006, 0113, 0250, 0147, 0035, 
+  0232, 0135, 0266, 0140, 0032, 0227, 0066, 0270, 0025, 0105, 0216, 0335, 0064, 0074, 0054, 0353, 
+  0212, 0352, 0132, 0067, 0006, 0125, 0247, 0336, 0332, 0302, 0155, 0332, 0363, 0046, 0230, 0270, 
+  0113, 0143, 0116, 0021, 0005, 0207, 0121, 0347, 0232, 0270, 0151, 0242, 0220, 0234, 0167, 0366, 
+  0246, 0204, 0201, 0056, 0074, 0016, 0013, 0357, 0337, 0247, 0205, 0107, 0241, 0111, 0033, 0253, 
+  0337, 0037, 0240, 0350, 0330, 0015, 0274, 0221, 0225, 0266, 0151, 0150, 0333, 0200, 0360, 0171, 
+  0331, 0274, 0033, 0243, 0032, 0124, 0021, 0223, 0004, 0102, 0144, 0027, 0213, 0145, 0061, 0042, 
+  0145, 0355, 0321, 0204, 0235, 0031, 0267, 0132, 0230, 0231, 0361, 0252, 0302, 0307, 0165, 0133, 
+  0154, 0035, 0326, 0345, 0223, 0352, 0252, 0274, 0304, 0200, 0320, 0036, 0072, 0373, 0236, 0052, 
+  0047, 0246, 0363, 0040, 0230, 0033, 0134, 0034, 0123, 0104, 0122, 0020, 0343, 0027, 0206, 0165, 
+  0375, 0213, 0246, 0041, 0114, 0062, 0271, 0024, 0247, 0332, 0354, 0050, 0311, 0223, 0114, 0061, 
+  0345, 0065, 0045, 0152, 0272, 0255, 0023, 0220, 0020, 0213, 0133, 0343, 0363, 0127, 0225, 0330, 
+  0012, 0241, 0063, 0117, 0325, 0225, 0156, 0303, 0355, 0127, 0166, 0013, 0067, 0230, 0001, 0351, 
+  0260, 0306, 0122, 0141, 0241, 0236, 0303, 0204, 0066, 0110, 0304, 0332, 0074, 0165, 0256, 0345, 
+  0302, 0072, 0322, 0161, 0057, 0235, 0202, 0051, 0264, 0331, 0363, 0134, 0051, 0043, 0150, 0146, 
+  0340, 0256, 0004, 0165, 0143, 0344, 0042, 0366, 0164, 0146, 0231, 0304, 0032, 0300, 0327, 0024, 
+  0102, 0043, 0363, 0001, 0302, 0120, 0016, 0011, 0143, 0355, 0072, 0127, 0034, 0154, 0025, 0364, 
+  0007, 0205, 0032, 0062, 0361, 0064, 0143, 0372, 0061, 0146, 0245, 0253, 0220, 0165, 0345, 0020, 
+  0143, 0252, 0232, 0245, 0244, 0041, 0302, 0155, 0240, 0154, 0216, 0004, 0113, 0071, 0252, 0132, 
+  0004, 0375, 0003, 0145, 0104, 0027, 0172, 0135, 0107, 0157, 0105, 0352, 0231, 0245, 0106, 0157, 
+  0027, 0320, 0351, 0062, 0053, 0353, 0134, 0106, 0205, 0037, 0020, 0237, 0007, 0324, 0321, 0353, 
+  0357, 0214, 0250, 0165, 0330, 0252, 0270, 0015, 0052, 0305, 0262, 0130, 0145, 0226, 0227, 0057, 
+  0366, 0366, 0231, 0240, 0223, 0251, 0262, 0261, 0122, 0330, 0361, 0162, 0035, 0161, 0266, 0006, 
+  0305, 0303, 0052, 0012, 0062, 0074, 0172, 0256, 0147, 0257, 0153, 0134, 0172, 0332, 0134, 0172, 
+  0234, 0113, 0042, 0322, 0221, 0043, 0343, 0116, 0344, 0131, 0155, 0275, 0355, 0347, 0304, 0045, 
+  0062, 0003, 0311, 0243, 0266, 0272, 0070, 0367, 0015, 0126, 0107, 0240, 0043, 0252, 0063, 0345, 
+  0314, 0255, 0067, 0067, 0065, 0044, 0314, 0346, 0001, 0133, 0066, 0150, 0115, 0366, 0236, 0320, 
+  0307, 0025, 0342, 0165, 0264, 0306, 0224, 0317, 0361, 0260, 0000, 0105, 0375, 0263, 0173, 0067, 
+  0223, 0176, 0123, 0063, 0351, 0037, 0227, 0231, 0244, 0342, 0225, 0323, 0336, 0103, 0063, 0201, 
+  0362, 0313, 0173, 0061, 0070, 0146, 0200, 0336, 0153, 0357, 0234, 0314, 0053, 0257, 0075, 0266, 
+  0225, 0247, 0247, 0005, 0270, 0032, 0346, 0220, 0212, 0034, 0307, 0015, 0126, 0244, 0102, 0372, 
+  0266, 0264, 0215, 0236, 0236, 0225, 0123, 0123, 0144, 0247, 0345, 0154, 0065, 0057, 0230, 0151, 
+  0322, 0245, 0342, 0274, 0104, 0053, 0041, 0116, 0005, 0253, 0057, 0264, 0374, 0272, 0023, 0174, 
+  0343, 0001, 0266, 0034, 0064, 0332, 0065, 0117, 0356, 0135, 0337, 0317, 0024, 0057, 0355, 0025, 
+  0312, 0165, 0075, 0256, 0215, 0141, 0207, 0170, 0321, 0112, 0331, 0055, 0120, 0330, 0055, 0006, 
+  0363, 0311, 0314, 0341, 0376, 0241, 0346, 0360, 0261, 0057, 0337, 0107, 0306, 0162, 0123, 0041, 
+  0344, 0206, 0331, 0076, 0307, 0220, 0073, 0061, 0344, 0232, 0201, 0336, 0147, 0014, 0151, 0010, 
+  0000, 0263, 0103, 0221, 0207, 0037, 0016, 0336, 0051, 0317, 0315, 0353, 0174, 0176, 0307, 0153, 
+  0147, 0076, 0033, 0144, 0077, 0033, 0321, 0203, 0034, 0220, 0062, 0001, 0252, 0222, 0330, 0173, 
+  0037, 0001, 0100, 0304, 0332, 0211, 0160, 0345, 0021, 0141, 0363, 0120, 0067, 0116, 0332, 0144, 
+  0375, 0366, 0260, 0351, 0276, 0072, 0342, 0076, 0026, 0063, 0032, 0000, 0075, 0017, 0153, 0044, 
+  0373, 0126, 0302, 0023, 0016, 0306, 0347, 0327, 0220, 0137, 0341, 0124, 0162, 0305, 0256, 0352, 
+  0345, 0337, 0152, 0317, 0270, 0075, 0305, 0212, 0327, 0077, 0007, 0017, 0315, 0307, 0153, 0007, 
+  0021, 0102, 0020, 0125, 0041, 0144, 0063, 0071, 0251, 0215, 0212, 0342, 0234, 0154, 0135, 0126, 
+  0274, 0223, 0357, 0076, 0177, 0120, 0124, 0270, 0121, 0036, 0274, 0275, 0174, 0170, 0105, 0152, 
+  0276, 0067, 0006, 0227, 0036, 0161, 0166, 0216, 0175, 0220, 0300, 0021, 0313, 0120, 0331, 0036, 
+  0301, 0172, 0057, 0323, 0321, 0045, 0012, 0223, 0167, 0065, 0010, 0303, 0373, 0270, 0036, 0004, 
+  0316, 0020, 0351, 0305, 0031, 0061, 0052, 0341, 0027, 0347, 0145, 0373, 0334, 0332, 0244, 0150, 
+  0061, 0015, 0320, 0322, 0351, 0220, 0326, 0211, 0134, 0313, 0304, 0053, 0113, 0235, 0053, 0360, 
+  0302, 0246, 0201, 0113, 0201, 0164, 0161, 0121, 0125, 0137, 0231, 0130, 0257, 0174, 0274, 0327, 
+  0016, 0377, 0152, 0211, 0207, 0125, 0210, 0336, 0112, 0006, 0306, 0255, 0332, 0374, 0352, 0322, 
+  0306, 0035, 0331, 0072, 0162, 0270, 0257, 0327, 0122, 0250, 0136, 0171, 0124, 0042, 0370, 0037, 
+  0302, 0274, 0105, 0174, 0212, 0060, 0222, 0172, 0273, 0047, 0160, 0310, 0113, 0064, 0345, 0002, 
+  0221, 0133, 0354, 0207, 0340, 0013, 0176, 0376, 0076, 0347, 0352, 0067, 0031, 0062, 0252, 0364, 
+  0171, 0166, 0216, 0342, 0026, 0112, 0055, 0323, 0357, 0235, 0364, 0320, 0247, 0167, 0161, 0221, 
+  0227, 0150, 0001, 0144, 0212, 0300, 0157, 0004, 0306, 0020, 0270, 0062, 0122, 0343, 0223, 0031, 
+  0236, 0054, 0025, 0071, 0261, 0306, 0137, 0266, 0072, 0354, 0255, 0222, 0147, 0037, 0363, 0104, 
+  0175, 0314, 0356, 0051, 0123, 0305, 0147, 0063, 0266, 0177, 0312, 0164, 0337, 0040, 0354, 0115, 
+  0311, 0334, 0323, 0246, 0217, 0305, 0247, 0015, 0036, 0226, 0117, 0113, 0144, 0130, 0127, 0103, 
+  0127, 0234, 0133, 0075, 0224, 0155, 0067, 0266, 0304, 0352, 0304, 0262, 0074, 0224, 0146, 0070, 
+  0277, 0204, 0064, 0060, 0256, 0020, 0022, 0136, 0224, 0136, 0040, 0132, 0005, 0270, 0145, 0007, 
+  0132, 0270, 0311, 0162, 0336, 0124, 0133, 0362, 0006, 0344, 0336, 0245, 0310, 0306, 0075, 0147, 
+  0324, 0237, 0330, 0372, 0112, 0161, 0045, 0372, 0221, 0341, 0121, 0351, 0214, 0052, 0331, 0202, 
+  0242, 0000, 0072, 0051, 0250, 0123, 0147, 0064, 0312, 0372, 0311, 0152, 0276, 0262, 0161, 0072, 
+  0252, 0375, 0015, 0200, 0326, 0066, 0263, 0052, 0272, 0337, 0322, 0056, 0270, 0251, 0357, 0110, 
+  0344, 0313, 0043, 0106, 0170, 0326, 0073, 0062, 0127, 0321, 0312, 0300, 0227, 0041, 0273, 0300, 
+  0111, 0175, 0002, 0357, 0067, 0164, 0024, 0052, 0377, 0364, 0356, 0011, 0331, 0105, 0053, 0252, 
+  0052, 0357, 0220, 0335, 0235, 0141, 0034, 0230, 0314, 0365, 0237, 0060, 0231, 0173, 0154, 0324, 
+  0255, 0077, 0070, 0024, 0167, 0113, 0355, 0127, 0206, 0360, 0164, 0301, 0205, 0133, 0270, 0137, 
+  0371, 0140, 0035, 0161, 0355, 0060, 0265, 0142, 0272, 0362, 0257, 0025, 0222, 0257, 0233, 0326, 
+  0141, 0330, 0244, 0334, 0214, 0122, 0311, 0163, 0252, 0167, 0032, 0157, 0077, 0163, 0261, 0307, 
+  0303, 0305, 0122, 0047, 0353, 0322, 0263, 0354, 0021, 0306, 0157, 0136, 0235, 0043, 0075, 0271, 
+  0035, 0245, 0214, 0252, 0145, 0113, 0323, 0223, 0006, 0053, 0354, 0242, 0010, 0323, 0032, 0377, 
+  0367, 0357, 0077, 0317, 0146, 0371, 0314, 0004, 0017, 0233, 0326, 0153, 0244, 0150, 0165, 0255, 
+  0361, 0270, 0331, 0344, 0201, 0117, 0037, 0066, 0072, 0153, 0127, 0342, 0234, 0032, 0322, 0007, 
+  0105, 0327, 0304, 0244, 0326, 0241, 0265, 0110, 0364, 0325, 0305, 0103, 0073, 0307, 0220, 0103, 
+  0305, 0076, 0353, 0363, 0063, 0350, 0163, 0174, 0176, 0346, 0140, 0307, 0315, 0152, 0017, 0345, 
+  0143, 0072, 0111, 0325, 0157, 0373, 0044, 0125, 0173, 0027, 0153, 0253, 0336, 0036, 0055, 0267, 
+  0056, 0335, 0361, 0267, 0071, 0232, 0177, 0013, 0240, 0312, 0265, 0366, 0032, 0237, 0002, 0050, 
+  0352, 0156, 0361, 0245, 0376, 0164, 0027, 0123, 0057, 0207, 0361, 0365, 0252, 0116, 0034, 0011, 
+  0311, 0215, 0104, 0352, 0061, 0022, 0104, 0206, 0140, 0350, 0320, 0232, 0136, 0342, 0313, 0122, 
+  0353, 0103, 0234, 0251, 0262, 0345, 0064, 0154, 0077, 0041, 0123, 0125, 0274, 0243, 0077, 0200, 
+  0226, 0372, 0062, 0212, 0121, 0303, 0316, 0103, 0231, 0372, 0202, 0135, 0354, 0320, 0243, 0253, 
+  0134, 0023, 0274, 0075, 0365, 0147, 0130, 0270, 0022, 0130, 0345, 0177, 0263, 0360, 0013, 0375, 
+  0101, 0256, 0004, 0237, 0207, 0353, 0117, 0025, 0356, 0002, 0272, 0352, 0310, 0152, 0143, 0142, 
+  0347, 0042, 0154, 0067, 0253, 0330, 0316, 0141, 0347, 0314, 0162, 0073, 0111, 0206, 0115, 0353, 
+  0023, 0255, 0330, 0266, 0177, 0330, 0115, 0174, 0353, 0364, 0177, 0265, 0203, 0315, 0010, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 0057, 0000, 0012, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { fr_resource_data.data, sizeof (fr_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *fr_get_resource (void);
+GResource *fr_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(frresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(frresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(frresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(frresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void frresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void frresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/101.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/101.html new file mode 100644 index 0000000..0fc87da --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/101.html @@ -0,0 +1,18063 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
+3353
+3354
+3355
+3356
+3357
+3358
+3359
+3360
+3361
+3362
+3363
+3364
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
+3373
+3374
+3375
+3376
+3377
+3378
+3379
+3380
+3381
+3382
+3383
+3384
+3385
+3386
+3387
+3388
+3389
+3390
+3391
+3392
+3393
+3394
+3395
+3396
+3397
+3398
+3399
+3400
+3401
+3402
+3403
+3404
+3405
+3406
+3407
+3408
+3409
+3410
+3411
+3412
+3413
+3414
+3415
+3416
+3417
+3418
+3419
+3420
+3421
+3422
+3423
+3424
+3425
+3426
+3427
+3428
+3429
+3430
+3431
+3432
+3433
+3434
+3435
+3436
+3437
+3438
+3439
+3440
+3441
+3442
+3443
+3444
+3445
+3446
+3447
+3448
+3449
+3450
+3451
+3452
+3453
+3454
+3455
+3456
+3457
+3458
+3459
+3460
+3461
+3462
+3463
+3464
+3465
+3466
+3467
+3468
+3469
+3470
+3471
+3472
+3473
+3474
+3475
+3476
+3477
+3478
+3479
+3480
+3481
+3482
+3483
+3484
+3485
+3486
+3487
+3488
+3489
+3490
+3491
+3492
+3493
+3494
+3495
+3496
+3497
+3498
+3499
+3500
+3501
+3502
+3503
+3504
+3505
+3506
+3507
+3508
+3509
+3510
+3511
+3512
+3513
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
+3522
+3523
+3524
+3525
+3526
+3527
+3528
+3529
+3530
+3531
+3532
+3533
+3534
+3535
+3536
+3537
+3538
+3539
+3540
+3541
+3542
+3543
+3544
+3545
+3546
+3547
+3548
+3549
+3550
+3551
+3552
+3553
+3554
+3555
+3556
+3557
+3558
+3559
+3560
+3561
+3562
+3563
+3564
+3565
+3566
+3567
+3568
+3569
+3570
+3571
+3572
+3573
+3574
+3575
+3576
+3577
+3578
+3579
+3580
+3581
+3582
+3583
+3584
+3585
+3586
+3587
+3588
+3589
+3590
+3591
+3592
+3593
+3594
+3595
+3596
+3597
+3598
+3599
+3600
+3601
+3602
+3603
+3604
+3605
+3606
+3607
+3608
+3609
+3610
+3611
+3612
+3613
+3614
+3615
+3616
+3617
+3618
+3619
+3620
+3621
+3622
+3623
+3624
+3625
+3626
+3627
+3628
+3629
+3630
+3631
+3632
+3633
+3634
+3635
+3636
+3637
+3638
+3639
+3640
+3641
+3642
+3643
+3644
+3645
+3646
+3647
+3648
+3649
+3650
+3651
+3652
+3653
+3654
+3655
+3656
+3657
+3658
+3659
+3660
+3661
+3662
+3663
+3664
+3665
+3666
+3667
+3668
+3669
+3670
+3671
+3672
+3673
+3674
+3675
+3676
+3677
+3678
+3679
+3680
+3681
+3682
+3683
+3684
+3685
+3686
+3687
+3688
+3689
+3690
+3691
+3692
+3693
+3694
+3695
+3696
+3697
+3698
+3699
+3700
+3701
+3702
+3703
+3704
+3705
+3706
+3707
+3708
+3709
+3710
+3711
+3712
+3713
+3714
+3715
+3716
+3717
+3718
+3719
+3720
+3721
+3722
+3723
+3724
+3725
+3726
+3727
+3728
+3729
+3730
+3731
+3732
+3733
+3734
+3735
+3736
+3737
+3738
+3739
+3740
+3741
+3742
+3743
+3744
+3745
+3746
+3747
+3748
+3749
+3750
+3751
+3752
+3753
+3754
+3755
+3756
+3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
+3803
+3804
+3805
+3806
+3807
+3808
+3809
+3810
+3811
+3812
+3813
+3814
+3815
+3816
+3817
+3818
+3819
+3820
+3821
+3822
+3823
+3824
+3825
+3826
+3827
+3828
+3829
+3830
+3831
+3832
+3833
+3834
+3835
+3836
+3837
+3838
+3839
+3840
+3841
+3842
+3843
+3844
+3845
+3846
+3847
+3848
+3849
+3850
+3851
+3852
+3853
+3854
+3855
+3856
+3857
+3858
+3859
+3860
+3861
+3862
+3863
+3864
+3865
+3866
+3867
+3868
+3869
+3870
+3871
+3872
+3873
+3874
+3875
+3876
+3877
+3878
+3879
+3880
+3881
+3882
+3883
+3884
+3885
+3886
+3887
+3888
+3889
+3890
+3891
+3892
+3893
+3894
+3895
+3896
+3897
+3898
+3899
+3900
+3901
+3902
+3903
+3904
+3905
+3906
+3907
+3908
+3909
+3910
+3911
+3912
+3913
+3914
+3915
+3916
+3917
+3918
+3919
+3920
+3921
+3922
+3923
+3924
+3925
+3926
+3927
+3928
+3929
+3930
+3931
+3932
+3933
+3934
+3935
+3936
+3937
+3938
+3939
+3940
+3941
+3942
+3943
+3944
+3945
+3946
+3947
+3948
+3949
+3950
+3951
+3952
+3953
+3954
+3955
+3956
+3957
+3958
+3959
+3960
+3961
+3962
+3963
+3964
+3965
+3966
+3967
+3968
+3969
+3970
+3971
+3972
+3973
+3974
+3975
+3976
+3977
+3978
+3979
+3980
+3981
+3982
+3983
+3984
+3985
+3986
+3987
+3988
+3989
+3990
+3991
+3992
+3993
+3994
+3995
+3996
+3997
+3998
+3999
+4000
+4001
+4002
+4003
+4004
+4005
+4006
+4007
+4008
+4009
+4010
+4011
+4012
+4013
+4014
+4015
+4016
+4017
+4018
+4019
+4020
+4021
+4022
+4023
+4024
+4025
+4026
+4027
+4028
+4029
+4030
+4031
+4032
+4033
+4034
+4035
+4036
+4037
+4038
+4039
+4040
+4041
+4042
+4043
+4044
+4045
+4046
+4047
+4048
+4049
+4050
+4051
+4052
+4053
+4054
+4055
+4056
+4057
+4058
+4059
+4060
+4061
+4062
+4063
+4064
+4065
+4066
+4067
+4068
+4069
+4070
+4071
+4072
+4073
+4074
+4075
+4076
+4077
+4078
+4079
+4080
+4081
+4082
+4083
+4084
+4085
+4086
+4087
+4088
+4089
+4090
+4091
+4092
+4093
+4094
+4095
+4096
+4097
+4098
+4099
+4100
+4101
+4102
+4103
+4104
+4105
+4106
+4107
+4108
+4109
+4110
+4111
+4112
+4113
+4114
+4115
+4116
+4117
+4118
+4119
+4120
+4121
+4122
+4123
+4124
+4125
+4126
+4127
+4128
+4129
+4130
+4131
+4132
+4133
+4134
+4135
+4136
+4137
+4138
+4139
+4140
+4141
+4142
+4143
+4144
+4145
+4146
+4147
+4148
+4149
+4150
+4151
+4152
+4153
+4154
+4155
+4156
+4157
+4158
+4159
+4160
+4161
+4162
+4163
+4164
+4165
+4166
+4167
+4168
+4169
+4170
+4171
+4172
+4173
+4174
+4175
+4176
+4177
+4178
+4179
+4180
+4181
+4182
+4183
+4184
+4185
+4186
+4187
+4188
+4189
+4190
+4191
+4192
+4193
+4194
+4195
+4196
+4197
+4198
+4199
+4200
+4201
+4202
+4203
+4204
+4205
+4206
+4207
+4208
+4209
+4210
+4211
+4212
+4213
+4214
+4215
+4216
+4217
+4218
+4219
+4220
+4221
+4222
+4223
+4224
+4225
+4226
+4227
+4228
+4229
+4230
+4231
+4232
+4233
+4234
+4235
+4236
+4237
+4238
+4239
+4240
+4241
+4242
+4243
+4244
+4245
+4246
+4247
+4248
+4249
+4250
+4251
+4252
+4253
+4254
+4255
+4256
+4257
+4258
+4259
+4260
+4261
+4262
+4263
+4264
+4265
+4266
+4267
+4268
+4269
+4270
+4271
+4272
+4273
+4274
+4275
+4276
+4277
+4278
+4279
+4280
+4281
+4282
+4283
+4284
+4285
+4286
+4287
+4288
+4289
+4290
+4291
+4292
+4293
+4294
+4295
+4296
+4297
+4298
+4299
+4300
+4301
+4302
+4303
+4304
+4305
+4306
+4307
+4308
+4309
+4310
+4311
+4312
+4313
+4314
+4315
+4316
+4317
+4318
+4319
+4320
+4321
+4322
+4323
+4324
+4325
+4326
+4327
+4328
+4329
+4330
+4331
+4332
+4333
+4334
+4335
+4336
+4337
+4338
+4339
+4340
+4341
+4342
+4343
+4344
+4345
+4346
+4347
+4348
+4349
+4350
+4351
+4352
+4353
+4354
+4355
+4356
+4357
+4358
+4359
+4360
+4361
+4362
+4363
+4364
+4365
+4366
+4367
+4368
+4369
+4370
+4371
+4372
+4373
+4374
+4375
+4376
+4377
+4378
+4379
+4380
+4381
+4382
+4383
+4384
+4385
+4386
+4387
+4388
+4389
+4390
+4391
+4392
+4393
+4394
+4395
+4396
+4397
+4398
+4399
+4400
+4401
+4402
+4403
+4404
+4405
+4406
+4407
+4408
+4409
+4410
+4411
+4412
+4413
+4414
+4415
+4416
+4417
+4418
+4419
+4420
+4421
+4422
+4423
+4424
+4425
+4426
+4427
+4428
+4429
+4430
+4431
+4432
+4433
+4434
+4435
+4436
+4437
+4438
+4439
+4440
+4441
+4442
+4443
+4444
+4445
+4446
+4447
+4448
+4449
+4450
+4451
+4452
+4453
+4454
+4455
+4456
+4457
+4458
+4459
+4460
+4461
+4462
+4463
+4464
+4465
+4466
+4467
+4468
+4469
+4470
+4471
+4472
+4473
+4474
+4475
+4476
+4477
+4478
+4479
+4480
+4481
+4482
+4483
+4484
+4485
+4486
+4487
+4488
+4489
+4490
+4491
+4492
+4493
+4494
+4495
+4496
+4497
+4498
+4499
+4500
+4501
+4502
+4503
+4504
+4505
+4506
+4507
+4508
+4509
+4510
+4511
+4512
+4513
+4514
+4515
+4516
+4517
+4518
+4519
+4520
+4521
+4522
+4523
+4524
+4525
+4526
+4527
+4528
+4529
+4530
+4531
+4532
+4533
+4534
+4535
+4536
+4537
+4538
+4539
+4540
+4541
+4542
+4543
+4544
+4545
+4546
+4547
+4548
+4549
+4550
+4551
+4552
+4553
+4554
+4555
+4556
+4557
+4558
+4559
+4560
+4561
+4562
+4563
+4564
+4565
+4566
+4567
+4568
+4569
+4570
+4571
+4572
+4573
+4574
+4575
+4576
+4577
+4578
+4579
+4580
+4581
+4582
+4583
+4584
+4585
+4586
+4587
+4588
+4589
+4590
+4591
+4592
+4593
+4594
+4595
+4596
+4597
+4598
+4599
+4600
+4601
+4602
+4603
+4604
+4605
+4606
+4607
+4608
+4609
+4610
+4611
+4612
+4613
+4614
+4615
+4616
+4617
+4618
+4619
+4620
+4621
+4622
+4623
+4624
+4625
+4626
+4627
+4628
+4629
+4630
+4631
+4632
+4633
+4634
+4635
+4636
+4637
+4638
+4639
+4640
+4641
+4642
+4643
+4644
+4645
+4646
+4647
+4648
+4649
+4650
+4651
+4652
+4653
+4654
+4655
+4656
+4657
+4658
+4659
+4660
+4661
+4662
+4663
+4664
+4665
+4666
+4667
+4668
+4669
+4670
+4671
+4672
+4673
+4674
+4675
+4676
+4677
+4678
+4679
+4680
+4681
+4682
+4683
+4684
+4685
+4686
+4687
+4688
+4689
+4690
+4691
+4692
+4693
+4694
+4695
+4696
+4697
+4698
+4699
+4700
+4701
+4702
+4703
+4704
+4705
+4706
+4707
+4708
+4709
+4710
+4711
+4712
+4713
+4714
+4715
+4716
+4717
+4718
+4719
+4720
+4721
+4722
+4723
+4724
+4725
+4726
+4727
+4728
+4729
+4730
+4731
+4732
+4733
+4734
+4735
+4736
+4737
+4738
+4739
+4740
+4741
+4742
+4743
+4744
+4745
+4746
+4747
+4748
+4749
+4750
+4751
+4752
+4753
+4754
+4755
+4756
+4757
+4758
+4759
+4760
+4761
+4762
+4763
+4764
+4765
+4766
+4767
+4768
+4769
+4770
+4771
+4772
+4773
+4774
+4775
+4776
+4777
+4778
+4779
+4780
+4781
+4782
+4783
+4784
+4785
+4786
+4787
+4788
+4789
+4790
+4791
+4792
+4793
+4794
+4795
+4796
+4797
+4798
+4799
+4800
+4801
+4802
+4803
+4804
+4805
+4806
+4807
+4808
+4809
+4810
+4811
+4812
+4813
+4814
+4815
+4816
+4817
+4818
+4819
+4820
+4821
+4822
+4823
+4824
+4825
+4826
+4827
+4828
+4829
+4830
+4831
+4832
+4833
+4834
+4835
+4836
+4837
+4838
+4839
+4840
+4841
+4842
+4843
+4844
+4845
+4846
+4847
+4848
+4849
+4850
+4851
+4852
+4853
+4854
+4855
+4856
+4857
+4858
+4859
+4860
+4861
+4862
+4863
+4864
+4865
+4866
+4867
+4868
+4869
+4870
+4871
+4872
+4873
+4874
+4875
+4876
+4877
+4878
+4879
+4880
+4881
+4882
+4883
+4884
+4885
+4886
+4887
+4888
+4889
+4890
+4891
+4892
+4893
+4894
+4895
+4896
+4897
+4898
+4899
+4900
+4901
+4902
+4903
+4904
+4905
+4906
+4907
+4908
+4909
+4910
+4911
+4912
+4913
+4914
+4915
+4916
+4917
+4918
+4919
+4920
+4921
+4922
+4923
+4924
+4925
+4926
+4927
+4928
+4929
+4930
+4931
+4932
+4933
+4934
+4935
+4936
+4937
+4938
+4939
+4940
+4941
+4942
+4943
+4944
+4945
+4946
+4947
+4948
+4949
+4950
+4951
+4952
+4953
+4954
+4955
+4956
+4957
+4958
+4959
+4960
+4961
+4962
+4963
+4964
+4965
+4966
+4967
+4968
+4969
+4970
+4971
+4972
+4973
+4974
+4975
+4976
+4977
+4978
+4979
+4980
+4981
+4982
+4983
+4984
+4985
+4986
+4987
+4988
+4989
+4990
+4991
+4992
+4993
+4994
+4995
+4996
+4997
+4998
+4999
+5000
+5001
+5002
+5003
+5004
+5005
+5006
+5007
+5008
+5009
+5010
+5011
+5012
+5013
+5014
+5015
+5016
+5017
+5018
+5019
+5020
+5021
+5022
+5023
+5024
+5025
+5026
+5027
+5028
+5029
+5030
+5031
+5032
+5033
+5034
+5035
+5036
+5037
+5038
+5039
+5040
+5041
+5042
+5043
+5044
+5045
+5046
+5047
+5048
+5049
+5050
+5051
+5052
+5053
+5054
+5055
+5056
+5057
+5058
+5059
+5060
+5061
+5062
+5063
+5064
+5065
+5066
+5067
+5068
+5069
+5070
+5071
+5072
+5073
+5074
+5075
+5076
+5077
+5078
+5079
+5080
+5081
+5082
+5083
+5084
+5085
+5086
+5087
+5088
+5089
+5090
+5091
+5092
+5093
+5094
+5095
+5096
+5097
+5098
+5099
+5100
+5101
+5102
+5103
+5104
+5105
+5106
+5107
+5108
+5109
+5110
+5111
+5112
+5113
+5114
+5115
+5116
+5117
+5118
+5119
+5120
+5121
+5122
+5123
+5124
+5125
+5126
+5127
+5128
+5129
+5130
+5131
+5132
+5133
+5134
+5135
+5136
+5137
+5138
+5139
+5140
+5141
+5142
+5143
+5144
+5145
+5146
+5147
+5148
+5149
+5150
+5151
+5152
+5153
+5154
+5155
+5156
+5157
+5158
+5159
+5160
+5161
+5162
+5163
+5164
+5165
+5166
+5167
+5168
+5169
+5170
+5171
+5172
+5173
+5174
+5175
+5176
+5177
+5178
+5179
+5180
+5181
+5182
+5183
+5184
+5185
+5186
+5187
+5188
+5189
+5190
+5191
+5192
+5193
+5194
+5195
+5196
+5197
+5198
+5199
+5200
+5201
+5202
+5203
+5204
+5205
+5206
+5207
+5208
+5209
+5210
+5211
+5212
+5213
+5214
+5215
+5216
+5217
+5218
+5219
+5220
+5221
+5222
+5223
+5224
+5225
+5226
+5227
+5228
+5229
+5230
+5231
+5232
+5233
+5234
+5235
+5236
+5237
+5238
+5239
+5240
+5241
+5242
+5243
+5244
+5245
+5246
+5247
+5248
+5249
+5250
+5251
+5252
+5253
+5254
+5255
+5256
+5257
+5258
+5259
+5260
+5261
+5262
+5263
+5264
+5265
+5266
+5267
+5268
+5269
+5270
+5271
+5272
+5273
+5274
+5275
+5276
+5277
+5278
+5279
+5280
+5281
+5282
+5283
+5284
+5285
+5286
+5287
+5288
+5289
+5290
+5291
+5292
+5293
+5294
+5295
+5296
+5297
+5298
+5299
+5300
+5301
+5302
+5303
+5304
+5305
+5306
+5307
+5308
+5309
+5310
+5311
+5312
+5313
+5314
+5315
+5316
+5317
+5318
+5319
+5320
+5321
+5322
+5323
+5324
+5325
+5326
+5327
+5328
+5329
+5330
+5331
+5332
+5333
+5334
+5335
+5336
+5337
+5338
+5339
+5340
+5341
+5342
+5343
+5344
+5345
+5346
+5347
+5348
+5349
+5350
+5351
+5352
+5353
+5354
+5355
+5356
+5357
+5358
+5359
+5360
+5361
+5362
+5363
+5364
+5365
+5366
+5367
+5368
+5369
+5370
+5371
+5372
+5373
+5374
+5375
+5376
+5377
+5378
+5379
+5380
+5381
+5382
+5383
+5384
+5385
+5386
+5387
+5388
+5389
+5390
+5391
+5392
+5393
+5394
+5395
+5396
+5397
+5398
+5399
+5400
+5401
+5402
+5403
+5404
+5405
+5406
+5407
+5408
+5409
+5410
+5411
+5412
+5413
+5414
+5415
+5416
+5417
+5418
+5419
+5420
+5421
+5422
+5423
+5424
+5425
+5426
+5427
+5428
+5429
+5430
+5431
+5432
+5433
+5434
+5435
+5436
+5437
+5438
+5439
+5440
+5441
+5442
+5443
+5444
+5445
+5446
+5447
+5448
+5449
+5450
+5451
+5452
+5453
+5454
+5455
+5456
+5457
+5458
+5459
+5460
+5461
+5462
+5463
+5464
+5465
+5466
+5467
+5468
+5469
+5470
+5471
+5472
+5473
+5474
+5475
+5476
+5477
+5478
+5479
+5480
+5481
+5482
+5483
+5484
+5485
+5486
+5487
+5488
+5489
+5490
+5491
+5492
+5493
+5494
+5495
+5496
+5497
+5498
+5499
+5500
+5501
+5502
+5503
+5504
+5505
+5506
+5507
+5508
+5509
+5510
+5511
+5512
+5513
+5514
+5515
+5516
+5517
+5518
+5519
+5520
+5521
+5522
+5523
+5524
+5525
+5526
+5527
+5528
+5529
+5530
+5531
+5532
+5533
+5534
+5535
+5536
+5537
+5538
+5539
+5540
+5541
+5542
+5543
+5544
+5545
+5546
+5547
+5548
+5549
+5550
+5551
+5552
+5553
+5554
+5555
+5556
+5557
+5558
+5559
+5560
+5561
+5562
+5563
+5564
+5565
+5566
+5567
+5568
+5569
+5570
+5571
+5572
+5573
+5574
+5575
+5576
+5577
+5578
+5579
+5580
+5581
+5582
+5583
+5584
+5585
+5586
+5587
+5588
+5589
+5590
+5591
+5592
+5593
+5594
+5595
+5596
+5597
+5598
+5599
+5600
+5601
+5602
+5603
+5604
+5605
+5606
+5607
+5608
+5609
+5610
+5611
+5612
+5613
+5614
+5615
+5616
+5617
+5618
+5619
+5620
+5621
+5622
+5623
+5624
+5625
+5626
+5627
+5628
+5629
+5630
+5631
+5632
+5633
+5634
+5635
+5636
+5637
+5638
+5639
+5640
+5641
+5642
+5643
+5644
+5645
+5646
+5647
+5648
+5649
+5650
+5651
+5652
+5653
+5654
+5655
+5656
+5657
+5658
+5659
+5660
+5661
+5662
+5663
+5664
+5665
+5666
+5667
+5668
+5669
+5670
+5671
+5672
+5673
+5674
+5675
+5676
+5677
+5678
+5679
+5680
+5681
+5682
+5683
+5684
+5685
+5686
+5687
+5688
+5689
+5690
+5691
+5692
+5693
+5694
+5695
+5696
+5697
+5698
+5699
+5700
+5701
+5702
+5703
+5704
+5705
+5706
+5707
+5708
+5709
+5710
+5711
+5712
+5713
+5714
+5715
+5716
+5717
+5718
+5719
+5720
+5721
+5722
+5723
+5724
+5725
+5726
+5727
+5728
+5729
+5730
+5731
+5732
+5733
+5734
+5735
+5736
+5737
+5738
+5739
+5740
+5741
+5742
+5743
+5744
+5745
+5746
+5747
+5748
+5749
+5750
+5751
+5752
+5753
+5754
+5755
+5756
+5757
+5758
+5759
+5760
+5761
+5762
+5763
+5764
+5765
+5766
+5767
+5768
+5769
+5770
+5771
+5772
+5773
+5774
+5775
+5776
+5777
+5778
+5779
+5780
+5781
+5782
+5783
+5784
+5785
+5786
+5787
+5788
+5789
+5790
+5791
+5792
+5793
+5794
+5795
+5796
+5797
+5798
+5799
+5800
+5801
+5802
+5803
+5804
+5805
+5806
+5807
+5808
+5809
+5810
+5811
+5812
+5813
+5814
+5815
+5816
+5817
+5818
+5819
+5820
+5821
+5822
+5823
+5824
+5825
+5826
+5827
+5828
+5829
+5830
+5831
+5832
+5833
+5834
+5835
+5836
+5837
+5838
+5839
+5840
+5841
+5842
+5843
+5844
+5845
+5846
+5847
+5848
+5849
+5850
+5851
+5852
+5853
+5854
+5855
+5856
+5857
+5858
+5859
+5860
+5861
+5862
+5863
+5864
+5865
+5866
+5867
+5868
+5869
+5870
+5871
+5872
+5873
+5874
+5875
+5876
+5877
+5878
+5879
+5880
+5881
+5882
+5883
+5884
+5885
+5886
+5887
+5888
+5889
+5890
+5891
+5892
+5893
+5894
+5895
+5896
+5897
+5898
+5899
+5900
+5901
+5902
+5903
+5904
+5905
+5906
+5907
+5908
+5909
+5910
+5911
+5912
+5913
+5914
+5915
+5916
+5917
+5918
+5919
+5920
+5921
+5922
+5923
+5924
+5925
+5926
+5927
+5928
+5929
+5930
+5931
+5932
+5933
+5934
+5935
+5936
+5937
+5938
+5939
+5940
+5941
+5942
+5943
+5944
+5945
+5946
+5947
+5948
+5949
+5950
+5951
+5952
+5953
+5954
+5955
+5956
+5957
+5958
+5959
+5960
+5961
+5962
+5963
+5964
+5965
+5966
+5967
+5968
+5969
+5970
+5971
+5972
+5973
+5974
+5975
+5976
+5977
+5978
+5979
+5980
+5981
+5982
+5983
+5984
+5985
+5986
+5987
+5988
+5989
+5990
+5991
+5992
+5993
+5994
+5995
+5996
+5997
+5998
+5999
+6000
+6001
+6002
+6003
+6004
+6005
+6006
+6007
+6008
+6009
+6010
+6011
+6012
+6013
+6014
+6015
+6016
+6017
+6018
+6019
+6020
+6021
+6022
+6023
+6024
+6025
+6026
+6027
+6028
+6029
+6030
+6031
+6032
+6033
+6034
+6035
+6036
+6037
+6038
+6039
+6040
+6041
+6042
+6043
+6044
+6045
+6046
+6047
+6048
+6049
+6050
+6051
+6052
+6053
+6054
+6055
+6056
+6057
+6058
+6059
+6060
+6061
+6062
+6063
+6064
+6065
+6066
+6067
+6068
+6069
+6070
+6071
+6072
+6073
+6074
+6075
+6076
+6077
+6078
+6079
+6080
+6081
+6082
+6083
+6084
+6085
+6086
+6087
+6088
+6089
+6090
+6091
+6092
+6093
+6094
+6095
+6096
+6097
+6098
+6099
+6100
+6101
+6102
+6103
+6104
+6105
+6106
+6107
+6108
+6109
+6110
+6111
+6112
+6113
+6114
+6115
+6116
+6117
+6118
+6119
+6120
+6121
+6122
+6123
+6124
+6125
+6126
+6127
+6128
+6129
+6130
+6131
+6132
+6133
+6134
+6135
+6136
+6137
+6138
+6139
+6140
+6141
+6142
+6143
+6144
+6145
+6146
+6147
+6148
+6149
+6150
+6151
+6152
+6153
+6154
+6155
+6156
+6157
+6158
+6159
+6160
+6161
+6162
+6163
+6164
+6165
+6166
+6167
+6168
+6169
+6170
+6171
+6172
+6173
+6174
+6175
+6176
+6177
+6178
+6179
+6180
+6181
+6182
+6183
+6184
+6185
+6186
+6187
+6188
+6189
+6190
+6191
+6192
+6193
+6194
+6195
+6196
+6197
+6198
+6199
+6200
+6201
+6202
+6203
+6204
+6205
+6206
+6207
+6208
+6209
+6210
+6211
+6212
+6213
+6214
+6215
+6216
+6217
+6218
+6219
+6220
+6221
+6222
+6223
+6224
+6225
+6226
+6227
+6228
+6229
+6230
+6231
+6232
+6233
+6234
+6235
+6236
+6237
+6238
+6239
+6240
+6241
+6242
+6243
+6244
+6245
+6246
+6247
+6248
+6249
+6250
+6251
+6252
+6253
+6254
+6255
+6256
+6257
+6258
+6259
+6260
+6261
+6262
+6263
+6264
+6265
+6266
+6267
+6268
+6269
+6270
+6271
+6272
+6273
+6274
+6275
+6276
+6277
+6278
+6279
+6280
+6281
+6282
+6283
+6284
+6285
+6286
+6287
+6288
+6289
+6290
+6291
+6292
+6293
+6294
+6295
+6296
+6297
+6298
+6299
+6300
+6301
+6302
+6303
+6304
+6305
+6306
+6307
+6308
+6309
+6310
+6311
+6312
+6313
+6314
+6315
+6316
+6317
+6318
+6319
+6320
+6321
+6322
+6323
+6324
+6325
+6326
+6327
+6328
+6329
+6330
+6331
+6332
+6333
+6334
+6335
+6336
+6337
+6338
+6339
+6340
+6341
+6342
+6343
+6344
+6345
+6346
+6347
+6348
+6349
+6350
+6351
+6352
+6353
+6354
+6355
+6356
+6357
+6358
+6359
+6360
+6361
+6362
+6363
+6364
+6365
+6366
+6367
+6368
+6369
+6370
+6371
+6372
+6373
+6374
+6375
+6376
+6377
+6378
+6379
+6380
+6381
+6382
+6383
+6384
+6385
+6386
+6387
+6388
+6389
+6390
+6391
+6392
+6393
+6394
+6395
+6396
+6397
+6398
+6399
+6400
+6401
+6402
+6403
+6404
+6405
+6406
+6407
+6408
+6409
+6410
+6411
+6412
+6413
+6414
+6415
+6416
+6417
+6418
+6419
+6420
+6421
+6422
+6423
+6424
+6425
+6426
+6427
+6428
+6429
+6430
+6431
+6432
+6433
+6434
+6435
+6436
+6437
+6438
+6439
+6440
+6441
+6442
+6443
+6444
+6445
+6446
+6447
+6448
+6449
+6450
+6451
+6452
+6453
+6454
+6455
+6456
+6457
+6458
+6459
+6460
+6461
+6462
+6463
+6464
+6465
+6466
+6467
+6468
+6469
+6470
+6471
+6472
+6473
+6474
+6475
+6476
+6477
+6478
+6479
+6480
+6481
+6482
+6483
+6484
+6485
+6486
+6487
+6488
+6489
+6490
+6491
+6492
+6493
+6494
+6495
+6496
+6497
+6498
+6499
+6500
+6501
+6502
+6503
+6504
+6505
+6506
+6507
+6508
+6509
+6510
+6511
+6512
+6513
+6514
+6515
+6516
+6517
+6518
+6519
+6520
+6521
+6522
+6523
+6524
+6525
+6526
+6527
+6528
+6529
+6530
+6531
+6532
+6533
+6534
+6535
+6536
+6537
+6538
+6539
+6540
+6541
+6542
+6543
+6544
+6545
+6546
+6547
+6548
+6549
+6550
+6551
+6552
+6553
+6554
+6555
+6556
+6557
+6558
+6559
+6560
+6561
+6562
+6563
+6564
+6565
+6566
+6567
+6568
+6569
+6570
+6571
+6572
+6573
+6574
+6575
+6576
+6577
+6578
+6579
+6580
+6581
+6582
+6583
+6584
+6585
+6586
+6587
+6588
+6589
+6590
+6591
+6592
+6593
+6594
+6595
+6596
+6597
+6598
+6599
+6600
+6601
+6602
+6603
+6604
+6605
+6606
+6607
+6608
+6609
+6610
+6611
+6612
+6613
+6614
+6615
+6616
+6617
+6618
+6619
+6620
+6621
+6622
+6623
+6624
+6625
+6626
+6627
+6628
+6629
+6630
+6631
+6632
+6633
+6634
+6635
+6636
+6637
+6638
+6639
+6640
+6641
+6642
+6643
+6644
+6645
+6646
+6647
+6648
+6649
+6650
+6651
+6652
+6653
+6654
+6655
+6656
+6657
+6658
+6659
+6660
+6661
+6662
+6663
+6664
+6665
+6666
+6667
+6668
+6669
+6670
+6671
+6672
+6673
+6674
+6675
+6676
+6677
+6678
+6679
+6680
+6681
+6682
+6683
+6684
+6685
+6686
+6687
+6688
+6689
+6690
+6691
+6692
+6693
+6694
+6695
+6696
+6697
+6698
+6699
+6700
+6701
+6702
+6703
+6704
+6705
+6706
+6707
+6708
+6709
+6710
+6711
+6712
+6713
+6714
+6715
+6716
+6717
+6718
+6719
+6720
+6721
+6722
+6723
+6724
+6725
+6726
+6727
+6728
+6729
+6730
+6731
+6732
+6733
+6734
+6735
+6736
+6737
+6738
+6739
+6740
+6741
+6742
+6743
+6744
+6745
+6746
+6747
+6748
+6749
+6750
+6751
+6752
+6753
+6754
+6755
+6756
+6757
+6758
+6759
+6760
+6761
+6762
+6763
+6764
+6765
+6766
+6767
+6768
+6769
+6770
+6771
+6772
+6773
+6774
+6775
+6776
+6777
+6778
+6779
+6780
+6781
+6782
+6783
+6784
+6785
+6786
+6787
+6788
+6789
+6790
+6791
+6792
+6793
+6794
+6795
+6796
+6797
+6798
+6799
+6800
+6801
+6802
+6803
+6804
+6805
+6806
+6807
+6808
+6809
+6810
+6811
+6812
+6813
+6814
+6815
+6816
+6817
+6818
+6819
+6820
+6821
+6822
+6823
+6824
+6825
+6826
+6827
+6828
+6829
+6830
+6831
+6832
+6833
+6834
+6835
+6836
+6837
+6838
+6839
+6840
+6841
+6842
+6843
+6844
+6845
+6846
+6847
+6848
+6849
+6850
+6851
+6852
+6853
+6854
+6855
+6856
+6857
+6858
+6859
+6860
+6861
+6862
+6863
+6864
+6865
+6866
+6867
+6868
+6869
+6870
+6871
+6872
+6873
+6874
+6875
+6876
+6877
+6878
+6879
+6880
+6881
+6882
+6883
+6884
+6885
+6886
+6887
+6888
+6889
+6890
+6891
+6892
+6893
+6894
+6895
+6896
+6897
+6898
+6899
+6900
+6901
+6902
+6903
+6904
+6905
+6906
+6907
+6908
+6909
+6910
+6911
+6912
+6913
+6914
+6915
+6916
+6917
+6918
+6919
+6920
+6921
+6922
+6923
+6924
+6925
+6926
+6927
+6928
+6929
+6930
+6931
+6932
+6933
+6934
+6935
+6936
+6937
+6938
+6939
+6940
+6941
+6942
+6943
+6944
+6945
+6946
+6947
+6948
+6949
+6950
+6951
+6952
+6953
+6954
+6955
+6956
+6957
+6958
+6959
+6960
+6961
+6962
+6963
+6964
+6965
+6966
+6967
+6968
+6969
+6970
+6971
+6972
+6973
+6974
+6975
+6976
+6977
+6978
+6979
+6980
+6981
+6982
+6983
+6984
+6985
+6986
+6987
+6988
+6989
+6990
+6991
+6992
+6993
+6994
+6995
+6996
+6997
+6998
+6999
+7000
+7001
+7002
+7003
+7004
+7005
+7006
+7007
+7008
+7009
+7010
+7011
+7012
+7013
+7014
+7015
+7016
+7017
+7018
+7019
+7020
+7021
+7022
+7023
+7024
+7025
+7026
+7027
+7028
+7029
+7030
+7031
+7032
+7033
+7034
+7035
+7036
+7037
+7038
+7039
+7040
+7041
+7042
+7043
+7044
+7045
+7046
+7047
+7048
+7049
+7050
+7051
+7052
+7053
+7054
+7055
+7056
+7057
+7058
+7059
+7060
+7061
+7062
+7063
+7064
+7065
+7066
+7067
+7068
+7069
+7070
+7071
+7072
+7073
+7074
+7075
+7076
+7077
+7078
+7079
+7080
+7081
+7082
+7083
+7084
+7085
+7086
+7087
+7088
+7089
+7090
+7091
+7092
+7093
+7094
+7095
+7096
+7097
+7098
+7099
+7100
+7101
+7102
+7103
+7104
+7105
+7106
+7107
+7108
+7109
+7110
+7111
+7112
+7113
+7114
+7115
+7116
+7117
+7118
+7119
+7120
+7121
+7122
+7123
+7124
+7125
+7126
+7127
+7128
+7129
+7130
+7131
+7132
+7133
+7134
+7135
+7136
+7137
+7138
+7139
+7140
+7141
+7142
+7143
+7144
+7145
+7146
+7147
+7148
+7149
+7150
+7151
+7152
+7153
+7154
+7155
+7156
+7157
+7158
+7159
+7160
+7161
+7162
+7163
+7164
+7165
+7166
+7167
+7168
+7169
+7170
+7171
+7172
+7173
+7174
+7175
+7176
+7177
+7178
+7179
+7180
+7181
+7182
+7183
+7184
+7185
+7186
+7187
+7188
+7189
+7190
+7191
+7192
+7193
+7194
+7195
+7196
+7197
+7198
+7199
+7200
+7201
+7202
+7203
+7204
+7205
+7206
+7207
+7208
+7209
+7210
+7211
+7212
+7213
+7214
+7215
+7216
+7217
+7218
+7219
+7220
+7221
+7222
+7223
+7224
+7225
+7226
+7227
+7228
+7229
+7230
+7231
+7232
+7233
+7234
+7235
+7236
+7237
+7238
+7239
+7240
+7241
+7242
+7243
+7244
+7245
+7246
+7247
+7248
+7249
+7250
+7251
+7252
+7253
+7254
+7255
+7256
+7257
+7258
+7259
+7260
+7261
+7262
+7263
+7264
+7265
+7266
+7267
+7268
+7269
+7270
+7271
+7272
+7273
+7274
+7275
+7276
+7277
+7278
+7279
+7280
+7281
+7282
+7283
+7284
+7285
+7286
+7287
+7288
+7289
+7290
+7291
+7292
+7293
+7294
+7295
+7296
+7297
+7298
+7299
+7300
+7301
+7302
+7303
+7304
+7305
+7306
+7307
+7308
+7309
+7310
+7311
+7312
+7313
+7314
+7315
+7316
+7317
+7318
+7319
+7320
+7321
+7322
+7323
+7324
+7325
+7326
+7327
+7328
+7329
+7330
+7331
+7332
+7333
+7334
+7335
+7336
+7337
+7338
+7339
+7340
+7341
+7342
+7343
+7344
+7345
+7346
+7347
+7348
+7349
+7350
+7351
+7352
+7353
+7354
+7355
+7356
+7357
+7358
+7359
+7360
+7361
+7362
+7363
+7364
+7365
+7366
+7367
+7368
+7369
+7370
+7371
+7372
+7373
+7374
+7375
+7376
+7377
+7378
+7379
+7380
+7381
+7382
+7383
+7384
+7385
+7386
+7387
+7388
+7389
+7390
+7391
+7392
+7393
+7394
+7395
+7396
+7397
+7398
+7399
+7400
+7401
+7402
+7403
+7404
+7405
+7406
+7407
+7408
+7409
+7410
+7411
+7412
+7413
+7414
+7415
+7416
+7417
+7418
+7419
+7420
+7421
+7422
+7423
+7424
+7425
+7426
+7427
+7428
+7429
+7430
+7431
+7432
+7433
+7434
+7435
+7436
+7437
+7438
+7439
+7440
+7441
+7442
+7443
+7444
+7445
+7446
+7447
+7448
+7449
+7450
+7451
+7452
+7453
+7454
+7455
+7456
+7457
+7458
+7459
+7460
+7461
+7462
+7463
+7464
+7465
+7466
+7467
+7468
+7469
+7470
+7471
+7472
+7473
+7474
+7475
+7476
+7477
+7478
+7479
+7480
+7481
+7482
+7483
+7484
+7485
+7486
+7487
+7488
+7489
+7490
+7491
+7492
+7493
+7494
+7495
+7496
+7497
+7498
+7499
+7500
+7501
+7502
+7503
+7504
+7505
+7506
+7507
+7508
+7509
+7510
+7511
+7512
+7513
+7514
+7515
+7516
+7517
+7518
+7519
+7520
+7521
+7522
+7523
+7524
+7525
+7526
+7527
+7528
+7529
+7530
+7531
+7532
+7533
+7534
+7535
+7536
+7537
+7538
+7539
+7540
+7541
+7542
+7543
+7544
+7545
+7546
+7547
+7548
+7549
+7550
+7551
+7552
+7553
+7554
+7555
+7556
+7557
+7558
+7559
+7560
+7561
+7562
+7563
+7564
+7565
+7566
+7567
+7568
+7569
+7570
+7571
+7572
+7573
+7574
+7575
+7576
+7577
+7578
+7579
+7580
+7581
+7582
+7583
+7584
+7585
+7586
+7587
+7588
+7589
+7590
+7591
+7592
+7593
+7594
+7595
+7596
+7597
+7598
+7599
+7600
+7601
+7602
+7603
+7604
+7605
+7606
+7607
+7608
+7609
+7610
+7611
+7612
+7613
+7614
+7615
+7616
+7617
+7618
+7619
+7620
+7621
+7622
+7623
+7624
+7625
+7626
+7627
+7628
+7629
+7630
+7631
+7632
+7633
+7634
+7635
+7636
+7637
+7638
+7639
+7640
+7641
+7642
+7643
+7644
+7645
+7646
+7647
+7648
+7649
+7650
+7651
+7652
+7653
+7654
+7655
+7656
+7657
+7658
+7659
+7660
+7661
+7662
+7663
+7664
+7665
+7666
+7667
+7668
+7669
+7670
+7671
+7672
+7673
+7674
+7675
+7676
+7677
+7678
+7679
+7680
+7681
+7682
+7683
+7684
+7685
+7686
+7687
+7688
+7689
+7690
+7691
+7692
+7693
+7694
+7695
+7696
+7697
+7698
+7699
+7700
+7701
+7702
+7703
+7704
+7705
+7706
+7707
+7708
+7709
+7710
+7711
+7712
+7713
+7714
+7715
+7716
+7717
+7718
+7719
+7720
+7721
+7722
+7723
+7724
+7725
+7726
+7727
+7728
+7729
+7730
+7731
+7732
+7733
+7734
+7735
+7736
+7737
+7738
+7739
+7740
+7741
+7742
+7743
+7744
+7745
+7746
+7747
+7748
+7749
+7750
+7751
+7752
+7753
+7754
+7755
+7756
+7757
+7758
+7759
+7760
+7761
+7762
+7763
+7764
+7765
+7766
+7767
+7768
+7769
+7770
+7771
+7772
+7773
+7774
+7775
+7776
+7777
+7778
+7779
+7780
+7781
+7782
+7783
+7784
+7785
+7786
+7787
+7788
+7789
+7790
+7791
+7792
+7793
+7794
+7795
+7796
+7797
+7798
+7799
+7800
+7801
+7802
+7803
+7804
+7805
+7806
+7807
+7808
+7809
+7810
+7811
+7812
+7813
+7814
+7815
+7816
+7817
+7818
+7819
+7820
+7821
+7822
+7823
+7824
+7825
+7826
+7827
+7828
+7829
+7830
+7831
+7832
+7833
+7834
+7835
+7836
+7837
+7838
+7839
+7840
+7841
+7842
+7843
+7844
+7845
+7846
+7847
+7848
+7849
+7850
+7851
+7852
+7853
+7854
+7855
+7856
+7857
+7858
+7859
+7860
+7861
+7862
+7863
+7864
+7865
+7866
+7867
+7868
+7869
+7870
+7871
+7872
+7873
+7874
+7875
+7876
+7877
+7878
+7879
+7880
+7881
+7882
+7883
+7884
+7885
+7886
+7887
+7888
+7889
+7890
+7891
+7892
+7893
+7894
+7895
+7896
+7897
+7898
+7899
+7900
+7901
+7902
+7903
+7904
+7905
+7906
+7907
+7908
+7909
+7910
+7911
+7912
+7913
+7914
+7915
+7916
+7917
+7918
+7919
+7920
+7921
+7922
+7923
+7924
+7925
+7926
+7927
+7928
+7929
+7930
+7931
+7932
+7933
+7934
+7935
+7936
+7937
+7938
+7939
+7940
+7941
+7942
+7943
+7944
+7945
+7946
+7947
+7948
+7949
+7950
+7951
+7952
+7953
+7954
+7955
+7956
+7957
+7958
+7959
+7960
+7961
+7962
+7963
+7964
+7965
+7966
+7967
+7968
+7969
+7970
+7971
+7972
+7973
+7974
+7975
+7976
+7977
+7978
+7979
+7980
+7981
+7982
+7983
+7984
+7985
+7986
+7987
+7988
+7989
+7990
+7991
+7992
+7993
+7994
+7995
+7996
+7997
+7998
+7999
+8000
+8001
+8002
+8003
+8004
+8005
+8006
+8007
+8008
+8009
+8010
+8011
+8012
+8013
+8014
+8015
+8016
+8017
+8018
+8019
+8020
+8021
+8022
+8023
+8024
+8025
+8026
+8027
+8028
+8029
+8030
+8031
+8032
+8033
+8034
+8035
+8036
+8037
+8038
+8039
+8040
+8041
+8042
+8043
+8044
+8045
+8046
+8047
+8048
+8049
+8050
+8051
+8052
+8053
+8054
+8055
+8056
+8057
+8058
+8059
+8060
+8061
+8062
+8063
+8064
+8065
+8066
+8067
+8068
+8069
+8070
+8071
+8072
+8073
+8074
+8075
+8076
+8077
+8078
+8079
+8080
+8081
+8082
+8083
+8084
+8085
+8086
+8087
+8088
+8089
+8090
+8091
+8092
+8093
+8094
+8095
+8096
+8097
+8098
+8099
+8100
+8101
+8102
+8103
+8104
+8105
+8106
+8107
+8108
+8109
+8110
+8111
+8112
+8113
+8114
+8115
+8116
+8117
+8118
+8119
+8120
+8121
+8122
+8123
+8124
+8125
+8126
+8127
+8128
+8129
+8130
+8131
+8132
+8133
+8134
+8135
+8136
+8137
+8138
+8139
+8140
+8141
+8142
+8143
+8144
+8145
+8146
+8147
+8148
+8149
+8150
+8151
+8152
+8153
+8154
+8155
+8156
+8157
+8158
+8159
+8160
+8161
+8162
+8163
+8164
+8165
+8166
+8167
+8168
+8169
+8170
+8171
+8172
+8173
+8174
+8175
+8176
+8177
+8178
+8179
+8180
+8181
+8182
+8183
+8184
+8185
+8186
+8187
+8188
+8189
+8190
+8191
+8192
+8193
+8194
+8195
+8196
+8197
+8198
+8199
+8200
+8201
+8202
+8203
+8204
+8205
+8206
+8207
+8208
+8209
+8210
+8211
+8212
+8213
+8214
+8215
+8216
+8217
+8218
+8219
+8220
+8221
+8222
+8223
+8224
+8225
+8226
+8227
+8228
+8229
+8230
+8231
+8232
+8233
+8234
+8235
+8236
+8237
+8238
+8239
+8240
+8241
+8242
+8243
+8244
+8245
+8246
+8247
+8248
+8249
+8250
+8251
+8252
+8253
+8254
+8255
+8256
+8257
+8258
+8259
+8260
+8261
+8262
+8263
+8264
+8265
+8266
+8267
+8268
+8269
+8270
+8271
+8272
+8273
+8274
+8275
+8276
+8277
+8278
+8279
+8280
+8281
+8282
+8283
+8284
+8285
+8286
+8287
+8288
+8289
+8290
+8291
+8292
+8293
+8294
+8295
+8296
+8297
+8298
+8299
+8300
+8301
+8302
+8303
+8304
+8305
+8306
+8307
+8308
+8309
+8310
+8311
+8312
+8313
+8314
+8315
+8316
+8317
+8318
+8319
+8320
+8321
+8322
+8323
+8324
+8325
+8326
+8327
+8328
+8329
+8330
+8331
+8332
+8333
+8334
+8335
+8336
+8337
+8338
+8339
+8340
+8341
+8342
+8343
+8344
+8345
+8346
+8347
+8348
+8349
+8350
+8351
+8352
+8353
+8354
+8355
+8356
+8357
+8358
+8359
+8360
+8361
+8362
+8363
+8364
+8365
+8366
+8367
+8368
+8369
+8370
+8371
+8372
+8373
+8374
+8375
+8376
+8377
+8378
+8379
+8380
+8381
+8382
+8383
+8384
+8385
+8386
+8387
+8388
+8389
+8390
+8391
+8392
+8393
+8394
+8395
+8396
+8397
+8398
+8399
+8400
+8401
+8402
+8403
+8404
+8405
+8406
+8407
+8408
+8409
+8410
+8411
+8412
+8413
+8414
+8415
+8416
+8417
+8418
+8419
+8420
+8421
+8422
+8423
+8424
+8425
+8426
+8427
+8428
+8429
+8430
+8431
+8432
+8433
+8434
+8435
+8436
+8437
+8438
+8439
+8440
+8441
+8442
+8443
+8444
+8445
+8446
+8447
+8448
+8449
+8450
+8451
+8452
+8453
+8454
+8455
+8456
+8457
+8458
+8459
+8460
+8461
+8462
+8463
+8464
+8465
+8466
+8467
+8468
+8469
+8470
+8471
+8472
+8473
+8474
+8475
+8476
+8477
+8478
+8479
+8480
+8481
+8482
+8483
+8484
+8485
+8486
+8487
+8488
+8489
+8490
+8491
+8492
+8493
+8494
+8495
+8496
+8497
+8498
+8499
+8500
+8501
+8502
+8503
+8504
+8505
+8506
+8507
+8508
+8509
+8510
+8511
+8512
+8513
+8514
+8515
+8516
+8517
+8518
+8519
+8520
+8521
+8522
+8523
+8524
+8525
+8526
+8527
+8528
+8529
+8530
+8531
+8532
+8533
+8534
+8535
+8536
+8537
+8538
+8539
+8540
+8541
+8542
+8543
+8544
+8545
+8546
+8547
+8548
+8549
+8550
+8551
+8552
+8553
+8554
+8555
+8556
+8557
+8558
+8559
+8560
+8561
+8562
+8563
+8564
+8565
+8566
+8567
+8568
+8569
+8570
+8571
+8572
+8573
+8574
+8575
+8576
+8577
+8578
+8579
+8580
+8581
+8582
+8583
+8584
+8585
+8586
+8587
+8588
+8589
+8590
+8591
+8592
+8593
+8594
+8595
+8596
+8597
+8598
+8599
+8600
+8601
+8602
+8603
+8604
+8605
+8606
+8607
+8608
+8609
+8610
+8611
+8612
+8613
+8614
+8615
+8616
+8617
+8618
+8619
+8620
+8621
+8622
+8623
+8624
+8625
+8626
+8627
+8628
+8629
+8630
+8631
+8632
+8633
+8634
+8635
+8636
+8637
+8638
+8639
+8640
+8641
+8642
+8643
+8644
+8645
+8646
+8647
+8648
+8649
+8650
+8651
+8652
+8653
+8654
+8655
+8656
+8657
+8658
+8659
+8660
+8661
+8662
+8663
+8664
+8665
+8666
+8667
+8668
+8669
+8670
+8671
+8672
+8673
+8674
+8675
+8676
+8677
+8678
+8679
+8680
+8681
+8682
+8683
+8684
+8685
+8686
+8687
+8688
+8689
+8690
+8691
+8692
+8693
+8694
+8695
+8696
+8697
+8698
+8699
+8700
+8701
+8702
+8703
+8704
+8705
+8706
+8707
+8708
+8709
+8710
+8711
+8712
+8713
+8714
+8715
+8716
+8717
+8718
+8719
+8720
+8721
+8722
+8723
+8724
+8725
+8726
+8727
+8728
+8729
+8730
+8731
+8732
+8733
+8734
+8735
+8736
+8737
+8738
+8739
+8740
+8741
+8742
+8743
+8744
+8745
+8746
+8747
+8748
+8749
+8750
+8751
+8752
+8753
+8754
+8755
+8756
+8757
+8758
+8759
+8760
+8761
+8762
+8763
+8764
+8765
+8766
+8767
+8768
+8769
+8770
+8771
+8772
+8773
+8774
+8775
+8776
+8777
+8778
+8779
+8780
+8781
+8782
+8783
+8784
+8785
+8786
+8787
+8788
+8789
+8790
+8791
+8792
+8793
+8794
+8795
+8796
+8797
+8798
+8799
+8800
+8801
+8802
+8803
+8804
+8805
+8806
+8807
+8808
+8809
+8810
+8811
+8812
+8813
+8814
+8815
+8816
+8817
+8818
+8819
+8820
+8821
+8822
+8823
+8824
+8825
+8826
+8827
+8828
+8829
+8830
+8831
+8832
+8833
+8834
+8835
+8836
+8837
+8838
+8839
+8840
+8841
+8842
+8843
+8844
+8845
+8846
+8847
+8848
+8849
+8850
+8851
+8852
+8853
+8854
+8855
+8856
+8857
+8858
+8859
+8860
+8861
+8862
+8863
+8864
+8865
+8866
+8867
+8868
+8869
+8870
+8871
+8872
+8873
+8874
+8875
+8876
+8877
+8878
+8879
+8880
+8881
+8882
+8883
+8884
+8885
+8886
+8887
+8888
+8889
+8890
+8891
+8892
+8893
+8894
+8895
+8896
+8897
+8898
+8899
+8900
+8901
+8902
+8903
+8904
+8905
+8906
+8907
+8908
+8909
+8910
+8911
+8912
+8913
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2007 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "actions.h"
+#include "dlg-batch-add.h"
+#include "dlg-delete.h"
+#include "dlg-extract.h"
+#include "dlg-open-with.h"
+#include "dlg-ask-password.h"
+#include "dlg-package-installer.h"
+#include "dlg-update.h"
+#include "eggtreemultidnd.h"
+#include "fr-marshal.h"
+#include "fr-list-model.h"
+#include "fr-archive.h"
+#include "fr-error.h"
+#include "fr-window.h"
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-init.h"
+#include "gtk-utils.h"
+#include "open-file.h"
+#include "typedefs.h"
+#include "ui.h"
+
+#ifdef __GNUC__
+#define UNUSED_VARIABLE __attribute__ ((unused))
+#else
+#define UNUSED_VARIABLE
+#endif
+
+#define LAST_OUTPUT_DIALOG_NAME "last-output"
+#define ACTIVITY_DELAY 100
+#define ACTIVITY_PULSE_STEP (0.033)
+
+#define PROGRESS_TIMEOUT_MSECS 5000
+#define PROGRESS_DIALOG_DEFAULT_WIDTH 500
+#define PROGRESS_BAR_HEIGHT 10
+#undef  LOG_PROGRESS
+
+#define HIDE_PROGRESS_TIMEOUT_MSECS 500
+#define DEFAULT_NAME_COLUMN_WIDTH 250
+#define OTHER_COLUMNS_WIDTH 100
+
+#define FILE_LIST_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
+
+#define BAD_CHARS "/\\*"
+
+static GHashTable     *tree_pixbuf_hash = NULL;
+static GtkIconTheme   *icon_theme = NULL;
+static int             file_list_icon_size = 0;
+
+#define XDS_FILENAME "xds.txt"
+#define MAX_XDS_ATOM_VAL_LEN 4096
+#define XDS_ATOM   gdk_atom_intern  ("XdndDirectSave0", FALSE)
+#define TEXT_ATOM  gdk_atom_intern  ("text/plain", FALSE)
+#define XFR_ATOM   gdk_atom_intern  ("XdndEngrampa0", FALSE)
+
+#define FR_CLIPBOARD (gdk_atom_intern_static_string ("_RNGRAMPA_SPECIAL_CLIPBOARD"))
+#define FR_SPECIAL_URI_LIST (gdk_atom_intern_static_string ("application/engrampa-uri-list"))
+
+static GtkTargetEntry clipboard_targets[] = {
+	{ "application/engrampa-uri-list", 0, 1 }
+};
+
+static GtkTargetEntry target_table[] = {
+	{ "XdndEngrampa0", 0, 0 },
+	{ "text/uri-list", 0, 1 },
+};
+
+static GtkTargetEntry folder_tree_targets[] = {
+	{ "XdndEngrampa0", 0, 0 },
+	{ "XdndDirectSave0", 0, 2 }
+};
+
+typedef struct {
+	FrBatchActionType type;
+	void *            data;
+	GFreeFunc         free_func;
+} FRBatchAction;
+
+typedef struct {
+	guint      converting : 1;
+	char      *temp_dir;
+	FrArchive *new_archive;
+	char      *password;
+	gboolean   encrypt_header;
+	guint      volume_size;
+	char      *new_file;
+} FRConvertData;
+
+typedef enum {
+	FR_CLIPBOARD_OP_CUT,
+	FR_CLIPBOARD_OP_COPY
+} FRClipboardOp;
+
+typedef struct {
+	GList       *file_list;
+	char        *extract_to_dir;
+	char        *sub_dir;
+	char        *base_dir;
+	gboolean     skip_older;
+	FrOverwrite  overwrite;
+	gboolean     junk_paths;
+	char        *password;
+	gboolean     extract_here;
+	gboolean     ask_to_open_destination;
+} ExtractData;
+
+typedef enum {
+	FR_WINDOW_AREA_MENUBAR,
+	FR_WINDOW_AREA_TOOLBAR,
+	FR_WINDOW_AREA_LOCATIONBAR,
+	FR_WINDOW_AREA_CONTENTS,
+	FR_WINDOW_AREA_FILTERBAR,
+	FR_WINDOW_AREA_STATUSBAR,
+} FrWindowArea;
+
+typedef enum {
+	DIALOG_RESPONSE_NONE = 1,
+	DIALOG_RESPONSE_OPEN_ARCHIVE,
+	DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER,
+	DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER_AND_QUIT,
+	DIALOG_RESPONSE_QUIT
+} DialogResponse;
+
+/* -- FrClipboardData -- */
+
+typedef struct {
+	int            refs;
+	char          *archive_filename;
+	char          *archive_password;
+	FRClipboardOp  op;
+	char          *base_dir;
+	GList         *files;
+	char          *tmp_dir;
+	char          *current_dir;
+} FrClipboardData;
+
+static FrClipboardData*
+fr_clipboard_data_new (void)
+{
+	FrClipboardData *data;
+
+	data = g_new0 (FrClipboardData, 1);
+	data->refs = 1;
+
+	return data;
+}
+
+static FrClipboardData *
+fr_clipboard_data_ref (FrClipboardData *clipboard_data)
+{
+	clipboard_data->refs++;
+	return clipboard_data;
+}
+
+static void
+fr_clipboard_data_unref (FrClipboardData *clipboard_data)
+{
+	if (clipboard_data == NULL)
+		return;
+	if (--clipboard_data->refs > 0)
+		return;
+
+	g_free (clipboard_data->archive_filename);
+	g_free (clipboard_data->archive_password);
+	g_free (clipboard_data->base_dir);
+	g_free (clipboard_data->tmp_dir);
+	g_free (clipboard_data->current_dir);
+	g_list_free_full (clipboard_data->files, g_free);
+	g_free (clipboard_data);
+}
+
+static void
+fr_clipboard_data_set_password (FrClipboardData *clipboard_data,
+				const char      *password)
+{
+	if (clipboard_data->archive_password != password)
+		g_free (clipboard_data->archive_password);
+	if (password != NULL)
+		clipboard_data->archive_password = g_strdup (password);
+}
+
+/**/
+
+enum {
+	ARCHIVE_LOADED,
+	PROGRESS,
+	READY,
+	LAST_SIGNAL
+};
+
+static GtkApplicationWindowClass *parent_class = NULL;
+static guint fr_window_signals[LAST_SIGNAL] = { 0 };
+
+struct _FrWindowPrivateData {
+	GtkWidget         *layout;
+	GtkWidget         *contents;
+	GtkWidget         *list_view;
+	GtkListStore      *list_store;
+	GtkWidget         *tree_view;
+	GtkTreeStore      *tree_store;
+	GtkWidget         *toolbar;
+	GtkWidget         *statusbar;
+	GtkWidget         *progress_bar;
+	GtkWidget         *location_bar;
+	GtkWidget         *location_entry;
+	GtkWidget         *location_label;
+	GtkWidget         *filter_bar;
+	GtkWidget         *filter_entry;
+	GtkWidget         *paned;
+	GtkWidget         *sidepane;
+	GtkTreePath       *list_hover_path;
+	GtkTreeViewColumn *filename_column;
+
+	gboolean         filter_mode;
+	gint             current_view_length;
+
+	guint            help_message_cid;
+	guint            list_info_cid;
+	guint            progress_cid;
+
+	GtkWidget *      up_arrows[5];
+	GtkWidget *      down_arrows[5];
+
+	FrAction         action;
+	gboolean         archive_present;
+	gboolean         archive_new;        /* A new archive has been created
+					      * but it doesn't contain any
+					      * file yet.  The real file will
+					      * be created only when the user
+					      * adds some file to the
+					      * archive.*/
+
+	char *           archive_uri;
+	char *           open_default_dir;    /* default directory to be used
+					       * in the Open dialog. */
+	char *           add_default_dir;     /* default directory to be used
+					       * in the Add dialog. */
+	char *           extract_default_dir; /* default directory to be used
+					       * in the Extract dialog. */
+	gboolean         freeze_default_dir;
+	gboolean         asked_for_password;
+	gboolean         ask_to_open_destination_after_extraction;
+	gboolean         destroy_with_error_dialog;
+
+	FRBatchAction    current_batch_action;
+
+	gboolean         give_focus_to_the_list;
+	gboolean         single_click;
+	GtkTreePath     *path_clicked;
+
+	FrWindowSortMethod sort_method;
+	GtkSortType      sort_type;
+
+	char *           last_location;
+
+	gboolean         view_folders;
+	FrWindowListMode list_mode;
+	FrWindowListMode last_list_mode;
+	GList *          history;
+	GList *          history_current;
+	char *           password;
+	char *           password_for_paste;
+	gboolean         encrypt_header;
+	FrCompression    compression;
+	guint            volume_size;
+
+	guint            activity_timeout_handle;   /* activity timeout
+						     * handle. */
+	gint             activity_ref;              /* when > 0 some activity
+						     * is present. */
+
+	guint            update_timeout_handle;     /* update file list
+						     * timeout handle. */
+
+	FRConvertData    convert_data;
+
+	gboolean         stoppable;
+	gboolean         closing;
+
+	FrClipboardData *clipboard_data;
+	FrClipboardData *copy_data;
+
+	FrArchive       *copy_from_archive;
+
+	GActionGroup     *actions;
+	GtkBuilder       *ui_manager;
+	GtkWidget        *menubar_recentmenu;
+	GtkWidget        *toolbar_recentmenu;
+
+	GtkWidget        *file_popup_menu;
+	GtkWidget        *folder_popup_menu;
+	GtkWidget        *sidebar_folder_popup_menu;
+
+	/* dragged files data */
+
+	char             *drag_destination_folder;
+	char             *drag_base_dir;
+	GError           *drag_error;
+	GList            *drag_file_list;        /* the list of files we are
+					 	  * dragging*/
+
+	/* progress dialog data */
+
+	GtkWidget        *progress_dialog;
+	GtkWidget        *pd_action;
+	GtkWidget        *pd_message;
+	GtkWidget        *pd_progress_bar;
+	GtkWidget        *pd_cancel_button;
+	GtkWidget        *pd_close_button;
+	GtkWidget        *pd_open_archive_button;
+	GtkWidget        *pd_open_destination_button;
+	GtkWidget        *pd_open_destination_and_quit_button;
+	GtkWidget        *pd_quit_button;
+	GtkWidget        *pd_state_button;    //Switch state, pause state or start state
+	GtkWidget        *pd_icon;
+	gboolean          progress_pulse;
+	guint             progress_timeout;  /* Timeout to display the progress dialog. */
+	guint             hide_progress_timeout;  /* Timeout to hide the progress dialog. */
+	char             *pd_last_archive;
+	char             *working_archive;
+	double            pd_last_fraction;
+	char             *pd_last_message;
+	gboolean          use_progress_dialog;
+
+	/* update dialog data */
+
+	gpointer          update_dialog;
+	GList            *open_files;
+
+	/* batch mode data */
+
+	gboolean          batch_mode;          /* whether we are in a non interactive
+					 	* mode. */
+	GList            *batch_action_list;   /* FRBatchAction * elements */
+	GList            *batch_action;        /* current action. */
+	char             *batch_title;
+
+	/* misc */
+
+	GSettings *settings_listing;
+	GSettings *settings_ui;
+	GSettings *settings_general;
+	GSettings *settings_dialogs;
+	GSettings *settings_caja;
+
+	gulong            theme_changed_handler_id;
+	gboolean          non_interactive;
+	char             *extract_here_dir;
+	gboolean          extract_interact_use_default_dir;
+	gboolean          update_dropped_files;
+	gboolean          batch_adding_one_file;
+
+	GtkWindow        *load_error_parent_window;
+	gboolean          showing_error_dialog;
+	GtkWindow        *error_dialog_parent;
+
+	gboolean          close_dialog;
+};
+
+/* -- fr_window_free_private_data -- */
+
+static void
+fr_window_free_batch_data (FrWindow *window)
+{
+	GList *scan;
+
+	for (scan = window->priv->batch_action_list; scan; scan = scan->next) {
+		FRBatchAction *adata = scan->data;
+
+		if ((adata->data != NULL) && (adata->free_func != NULL))
+			(*adata->free_func) (adata->data);
+		g_free (adata);
+	}
+
+	g_list_free (window->priv->batch_action_list);
+	window->priv->batch_action_list = NULL;
+	window->priv->batch_action = NULL;
+
+	g_free (window->priv->batch_title);
+	window->priv->batch_title = NULL;
+}
+
+static void
+gh_unref_pixbuf (gpointer key,
+		 gpointer value,
+		 gpointer user_data)
+{
+	g_object_unref (value);
+}
+
+static void
+fr_window_clipboard_remove_file_list (FrWindow *window,
+				      GList    *file_list)
+{
+	GList *scan1;
+
+	if (window->priv->copy_data == NULL)
+		return;
+
+	if (file_list == NULL) {
+		fr_clipboard_data_unref	 (window->priv->copy_data);
+		window->priv->copy_data = NULL;
+		return;
+	}
+
+	for (scan1 = file_list; scan1; scan1 = scan1->next) {
+		const char *name1 = scan1->data;
+		GList      *scan2;
+
+		for (scan2 = window->priv->copy_data->files; scan2;) {
+			const char *name2 = scan2->data;
+
+			if (strcmp (name1, name2) == 0) {
+				GList *tmp = scan2->next;
+				window->priv->copy_data->files = g_list_remove_link (window->priv->copy_data->files, scan2);
+				g_free (scan2->data);
+				g_list_free (scan2);
+				scan2 = tmp;
+			}
+			else
+				scan2 = scan2->next;
+		}
+	}
+
+	if (window->priv->copy_data->files == NULL) {
+		fr_clipboard_data_unref (window->priv->copy_data);
+		window->priv->copy_data = NULL;
+	}
+}
+
+static void
+fr_window_history_clear (FrWindow *window)
+{
+	if (window->priv->history != NULL)
+		path_list_free (window->priv->history);
+	window->priv->history = NULL;
+	window->priv->history_current = NULL;
+	g_free (window->priv->last_location);
+	window->priv->last_location = NULL;
+}
+
+static void
+fr_window_free_open_files (FrWindow *window)
+{
+	GList *scan;
+
+	for (scan = window->priv->open_files; scan; scan = scan->next) {
+		OpenFile *file = scan->data;
+
+		if (file->monitor != NULL)
+			g_file_monitor_cancel (file->monitor);
+		open_file_free (file);
+	}
+	g_list_free (window->priv->open_files);
+	window->priv->open_files = NULL;
+}
+
+static void
+fr_window_convert_data_free (FrWindow   *window,
+			     gboolean    all)
+{
+	if (all) {
+		g_free (window->priv->convert_data.new_file);
+		window->priv->convert_data.new_file = NULL;
+	}
+
+	window->priv->convert_data.converting = FALSE;
+
+	if (window->priv->convert_data.temp_dir != NULL) {
+		g_free (window->priv->convert_data.temp_dir);
+		window->priv->convert_data.temp_dir = NULL;
+	}
+
+	if (window->priv->convert_data.new_archive != NULL) {
+		g_object_unref (window->priv->convert_data.new_archive);
+		window->priv->convert_data.new_archive = NULL;
+	}
+
+	if (window->priv->convert_data.password != NULL) {
+		g_free (window->priv->convert_data.password);
+		window->priv->convert_data.password = NULL;
+	}
+}
+
+static void
+fr_window_free_private_data (FrWindow *window)
+{
+	if (window->priv->update_timeout_handle != 0) {
+		g_source_remove (window->priv->update_timeout_handle);
+		window->priv->update_timeout_handle = 0;
+	}
+
+	while (window->priv->activity_ref > 0)
+		fr_window_stop_activity_mode (window);
+
+	if (window->priv->progress_timeout != 0) {
+		g_source_remove (window->priv->progress_timeout);
+		window->priv->progress_timeout = 0;
+	}
+
+	if (window->priv->hide_progress_timeout != 0) {
+		g_source_remove (window->priv->hide_progress_timeout);
+		window->priv->hide_progress_timeout = 0;
+	}
+
+	if (window->priv->theme_changed_handler_id != 0)
+		g_signal_handler_disconnect (icon_theme, window->priv->theme_changed_handler_id);
+
+	fr_window_history_clear (window);
+
+	g_free (window->priv->open_default_dir);
+	g_free (window->priv->add_default_dir);
+	g_free (window->priv->extract_default_dir);
+	g_free (window->priv->archive_uri);
+	g_free (window->priv->working_archive);
+
+	g_free (window->priv->password);
+	g_free (window->priv->password_for_paste);
+
+	g_object_unref (window->priv->list_store);
+
+	if (window->priv->clipboard_data != NULL) {
+		fr_clipboard_data_unref (window->priv->clipboard_data);
+		window->priv->clipboard_data = NULL;
+	}
+	if (window->priv->copy_data != NULL) {
+		fr_clipboard_data_unref (window->priv->copy_data);
+		window->priv->copy_data = NULL;
+	}
+	if (window->priv->copy_from_archive != NULL) {
+		g_object_unref (window->priv->copy_from_archive);
+		window->priv->copy_from_archive = NULL;
+	}
+
+	fr_window_free_open_files (window);
+
+	fr_window_convert_data_free (window, TRUE);
+
+	g_clear_error (&window->priv->drag_error);
+	path_list_free (window->priv->drag_file_list);
+	window->priv->drag_file_list = NULL;
+
+	if (window->priv->file_popup_menu != NULL) {
+		gtk_widget_destroy (window->priv->file_popup_menu);
+		window->priv->file_popup_menu = NULL;
+	}
+
+	if (window->priv->folder_popup_menu != NULL) {
+		gtk_widget_destroy (window->priv->folder_popup_menu);
+		window->priv->folder_popup_menu = NULL;
+	}
+
+	if (window->priv->sidebar_folder_popup_menu != NULL) {
+		gtk_widget_destroy (window->priv->sidebar_folder_popup_menu);
+		window->priv->sidebar_folder_popup_menu = NULL;
+	}
+
+	g_free (window->priv->last_location);
+
+	fr_window_free_batch_data (window);
+	fr_window_reset_current_batch_action (window);
+
+	g_free (window->priv->pd_last_archive);
+	g_free (window->priv->pd_last_message);
+	g_free (window->priv->extract_here_dir);
+
+	g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_SORT_METHOD, window->priv->sort_method);
+	g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_SORT_TYPE, window->priv->sort_type);
+	g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE, window->priv->last_list_mode);
+
+	_g_object_unref (window->priv->settings_listing);
+	_g_object_unref (window->priv->settings_ui);
+	_g_object_unref (window->priv->settings_general);
+	_g_object_unref (window->priv->settings_dialogs);
+
+	if (window->priv->settings_caja)
+		_g_object_unref (window->priv->settings_caja);
+
+	if (window->priv->ui_manager)
+	{
+		g_object_unref (window->priv->ui_manager);
+		window->priv->ui_manager = NULL;
+	}
+}
+
+static void
+fr_window_finalize (GObject *object)
+{
+	FrWindow *window = FR_WINDOW (object);
+
+	fr_window_free_open_files (window);
+
+	if (window->archive != NULL) {
+		g_object_unref (window->archive);
+		window->archive = NULL;
+	}
+
+	if (window->priv != NULL) {
+		fr_window_free_private_data (window);
+		g_free (window->priv);
+		window->priv = NULL;
+	}
+
+	if (gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ())) == NULL) {
+		if (tree_pixbuf_hash != NULL) {
+			g_hash_table_foreach (tree_pixbuf_hash,
+					      gh_unref_pixbuf,
+					      NULL);
+			g_hash_table_destroy (tree_pixbuf_hash);
+			tree_pixbuf_hash = NULL;
+		}
+	}
+
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+close__step2 (gpointer data)
+{
+	gtk_widget_destroy (GTK_WIDGET (data));
+	return FALSE;
+}
+
+void
+fr_window_close (FrWindow *window)
+{
+	if (window->priv->activity_ref > 0)
+		return;
+
+	window->priv->closing = TRUE;
+
+	if (gtk_widget_get_realized (GTK_WIDGET (window))) {
+		int width, height;
+
+		width = gtk_widget_get_allocated_width (GTK_WIDGET (window));
+		height = gtk_widget_get_allocated_height (GTK_WIDGET (window));
+		g_settings_set_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH, width);
+		g_settings_set_int (window->priv->settings_ui, PREF_UI_WINDOW_HEIGHT, height);
+
+		width = gtk_paned_get_position (GTK_PANED (window->priv->paned));
+		if (width > 0)
+			g_settings_set_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH, width);
+
+		width = gtk_tree_view_column_get_width (window->priv->filename_column);
+		if (width > 0)
+			g_settings_set_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH, width);
+	}
+
+	g_idle_add (close__step2, window);
+}
+
+static void
+fr_window_class_init (FrWindowClass *class)
+{
+	GObjectClass *gobject_class;
+
+	parent_class = g_type_class_peek_parent (class);
+
+	fr_window_signals[ARCHIVE_LOADED] =
+		g_signal_new ("archive-loaded",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrWindowClass, archive_loaded),
+			      NULL, NULL,
+			      fr_marshal_VOID__BOOLEAN,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_BOOLEAN);
+	fr_window_signals[PROGRESS] =
+		g_signal_new ("progress",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrWindowClass, progress),
+			      NULL, NULL,
+			      fr_marshal_VOID__DOUBLE_STRING,
+			      G_TYPE_NONE, 2,
+			      G_TYPE_DOUBLE,
+			      G_TYPE_STRING);
+	fr_window_signals[READY] =
+		g_signal_new ("ready",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrWindowClass, ready),
+			      NULL, NULL,
+			      fr_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_POINTER);
+
+	gobject_class = (GObjectClass*) class;
+	gobject_class->finalize = fr_window_finalize;
+}
+
+static void fr_window_update_paste_command_sensitivity (FrWindow *, GtkClipboard *);
+
+static void
+clipboard_owner_change_cb (GtkClipboard *clipboard,
+			   GdkEvent     *event,
+			   gpointer      user_data)
+{
+	fr_window_update_paste_command_sensitivity ((FrWindow *) user_data, clipboard);
+}
+
+static void
+fr_window_realized (GtkWidget *window,
+		    gpointer  *data)
+{
+	GtkClipboard *clipboard;
+
+	clipboard = gtk_widget_get_clipboard (window, FR_CLIPBOARD);
+	g_signal_connect (clipboard,
+			  "owner_change",
+			  G_CALLBACK (clipboard_owner_change_cb),
+			  window);
+}
+
+static void
+fr_window_unrealized (GtkWidget *window,
+		      gpointer  *data)
+{
+	GtkClipboard *clipboard;
+
+	clipboard = gtk_widget_get_clipboard (window, FR_CLIPBOARD);
+	g_signal_handlers_disconnect_by_func (clipboard,
+					      G_CALLBACK (clipboard_owner_change_cb),
+					      window);
+}
+
+static void
+fr_window_init (FrWindow *window)
+{
+	GtkStyleContext *context;
+
+	window->priv = g_new0 (FrWindowPrivateData, 1);
+	window->priv->update_dropped_files = FALSE;
+	window->priv->filter_mode = FALSE;
+	window->priv->batch_title = NULL;
+	window->priv->use_progress_dialog = TRUE;
+	window->priv->batch_title = NULL;
+
+	context = gtk_widget_get_style_context (GTK_WIDGET (window));
+	gtk_style_context_add_class (context, "engrampa-window");
+
+	g_signal_connect (window,
+			  "realize",
+			  G_CALLBACK (fr_window_realized),
+			  NULL);
+	g_signal_connect (window,
+			  "unrealize",
+			  G_CALLBACK (fr_window_unrealized),
+			  NULL);
+}
+
+GType
+fr_window_get_type (void)
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrWindowClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_window_class_init,
+			NULL,
+			NULL,
+			sizeof (FrWindow),
+			0,
+			(GInstanceInitFunc) fr_window_init,
+			NULL
+		};
+
+		type = g_type_register_static (GTK_TYPE_APPLICATION_WINDOW,
+					       "FrWindow",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+/* -- window history -- */
+
+#if 0
+static void
+fr_window_history_print (FrWindow *window)
+{
+	GList *list;
+
+	debug (DEBUG_INFO, "history:\n");
+	for (list = window->priv->history; list; list = list->next)
+		g_print ("\t%s %s\n",
+			 (char*) list->data,
+			 (list == window->priv->history_current)? "<-": "");
+	g_print ("\n");
+}
+#endif
+
+static void
+fr_window_history_add (FrWindow   *window,
+		       const char *path)
+{
+	if ((window->priv->history_current == NULL) || (g_strcmp0 (path, window->priv->history_current->data) != 0)) {
+		GList *scan;
+		GList *new_current = NULL;
+
+		/* search the path in the history */
+		for (scan = window->priv->history_current; scan; scan = scan->next) {
+			char *path_in_history = scan->data;
+
+			if (g_strcmp0 (path, path_in_history) == 0) {
+				new_current = scan;
+				break;
+			}
+		}
+
+		if (new_current != NULL) {
+			window->priv->history_current = new_current;
+		}
+		else {
+			/* remove all the paths after the current position */
+			for (scan = window->priv->history; scan && (scan != window->priv->history_current); /* void */) {
+				GList *next = scan->next;
+
+				window->priv->history = g_list_remove_link (window->priv->history, scan);
+				path_list_free (scan);
+
+				scan = next;
+			}
+
+			window->priv->history = g_list_prepend (window->priv->history, g_strdup (path));
+			window->priv->history_current = window->priv->history;
+		}
+	}
+}
+
+static void
+fr_window_history_pop (FrWindow *window)
+{
+	GList *first;
+
+	if (window->priv->history == NULL)
+		return;
+
+	first = window->priv->history;
+	window->priv->history = g_list_remove_link (window->priv->history, first);
+	if (window->priv->history_current == first)
+		window->priv->history_current = window->priv->history;
+	g_free (first->data);
+	g_list_free (first);
+}
+
+/* -- window_update_file_list -- */
+
+static GPtrArray *
+fr_window_get_current_dir_list (FrWindow *window)
+{
+	GPtrArray *files;
+	guint      i;
+
+	files = g_ptr_array_sized_new (128);
+
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+
+		if (fdata->list_name == NULL)
+			continue;
+		g_ptr_array_add (files, fdata);
+	}
+
+	return files;
+}
+
+static gint
+sort_by_name (gconstpointer  ptr1,
+	      gconstpointer  ptr2)
+{
+	FileData *fdata1 = *((FileData **) ptr1);
+	FileData *fdata2 = *((FileData **) ptr2);
+
+	if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+		if (file_data_is_dir (fdata1))
+			return -1;
+		else
+			return 1;
+	}
+
+	return strcmp (fdata1->sort_key, fdata2->sort_key);
+}
+
+static gint
+sort_by_size (gconstpointer  ptr1,
+	      gconstpointer  ptr2)
+{
+	FileData *fdata1 = *((FileData **) ptr1);
+	FileData *fdata2 = *((FileData **) ptr2);
+
+	if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+		if (file_data_is_dir (fdata1))
+			return -1;
+		else
+			return 1;
+	}
+	else if (file_data_is_dir (fdata1) && file_data_is_dir (fdata2)) {
+		if (fdata1->dir_size > fdata2->dir_size)
+			return 1;
+		else
+			return -1;
+	}
+
+	if (fdata1->size == fdata2->size)
+		return sort_by_name (ptr1, ptr2);
+	else if (fdata1->size > fdata2->size)
+		return 1;
+	else
+		return -1;
+}
+
+static gint
+sort_by_type (gconstpointer  ptr1,
+	      gconstpointer  ptr2)
+{
+	FileData    *fdata1 = *((FileData **) ptr1);
+	FileData    *fdata2 = *((FileData **) ptr2);
+	int          result;
+	char        *desc1, *desc2;
+
+	if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+		if (file_data_is_dir (fdata1))
+			return -1;
+		else
+			return 1;
+	}
+	else if (file_data_is_dir (fdata1) && file_data_is_dir (fdata2))
+		return sort_by_name (ptr1, ptr2);
+
+	desc1 = g_content_type_get_description (fdata1->content_type);
+	desc2 = g_content_type_get_description (fdata2->content_type);
+
+	result = strcasecmp (desc1, desc2);
+	g_free (desc1);
+	g_free (desc2);
+
+	if (result == 0)
+		return sort_by_name (ptr1, ptr2);
+	else
+		return result;
+}
+
+static gint
+sort_by_time (gconstpointer  ptr1,
+	      gconstpointer  ptr2)
+{
+	FileData *fdata1 = *((FileData **) ptr1);
+	FileData *fdata2 = *((FileData **) ptr2);
+
+	if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+		if (file_data_is_dir (fdata1))
+			return -1;
+		else
+			return 1;
+	}
+	else if (file_data_is_dir (fdata1) && file_data_is_dir (fdata2))
+		return sort_by_name (ptr1, ptr2);
+
+	if (fdata1->modified == fdata2->modified)
+		return sort_by_name (ptr1, ptr2);
+	else if (fdata1->modified > fdata2->modified)
+		return 1;
+	else
+		return -1;
+}
+
+static gint
+sort_by_path (gconstpointer  ptr1,
+	      gconstpointer  ptr2)
+{
+	FileData *fdata1 = *((FileData **) ptr1);
+	FileData *fdata2 = *((FileData **) ptr2);
+	int       result;
+
+	if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+		if (file_data_is_dir (fdata1))
+			return -1;
+		else
+			return 1;
+	}
+	else if (file_data_is_dir (fdata1) && file_data_is_dir (fdata2))
+		return sort_by_name (ptr1, ptr2);
+
+	/* 2 files */
+
+	result = strcasecmp (fdata1->path, fdata2->path);
+	if (result == 0)
+		return sort_by_name (ptr1, ptr2);
+	else
+		return result;
+}
+
+static guint64
+get_dir_size (FrWindow   *window,
+	      const char *current_dir,
+	      const char *name)
+{
+	guint64  size;
+	char    *dirname;
+	int      dirname_l;
+	guint    i;
+
+	dirname = g_strconcat (current_dir, name, "/", NULL);
+	dirname_l = strlen (dirname);
+
+	size = 0;
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+
+		if (strncmp (dirname, fd->full_path, dirname_l) == 0)
+			size += fd->size;
+	}
+
+	g_free (dirname);
+
+	return size;
+}
+
+static gboolean
+file_data_respects_filter (FrWindow *window,
+			   FileData *fdata)
+{
+	const char *filter;
+
+	filter = gtk_entry_get_text (GTK_ENTRY (window->priv->filter_entry));
+	if ((fdata == NULL) || (filter == NULL) || (*filter == '\0'))
+		return TRUE;
+
+	if (fdata->dir || (fdata->name == NULL))
+		return FALSE;
+
+	return strncasecmp (fdata->name, filter, strlen (filter)) == 0;
+}
+
+static gboolean
+compute_file_list_name (FrWindow   *window,
+			FileData   *fdata,
+			const char *current_dir,
+			size_t      current_dir_len,
+			GHashTable *names_hash,
+			gboolean   *different_name)
+{
+	register char *scan, *end;
+
+	*different_name = FALSE;
+
+	if (! file_data_respects_filter (window, fdata))
+		return FALSE;
+
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) {
+		if (!(fdata->dir))
+			file_data_set_list_name (fdata, fdata->name);
+		return FALSE;
+	}
+
+	if (strncmp (fdata->full_path, current_dir, current_dir_len) != 0) {
+		*different_name = TRUE;
+		return FALSE;
+	}
+
+	if (strlen (fdata->full_path) == current_dir_len)
+		return FALSE;
+
+	scan = fdata->full_path + current_dir_len;
+	end = strchr (scan, '/');
+	if ((end == NULL) && ! fdata->dir) { /* file */
+		file_data_set_list_name (fdata, scan);
+	}
+	else { /* folder */
+		char *dir_name;
+
+		if (end != NULL)
+			dir_name = g_strndup (scan, end - scan);
+		else
+			dir_name = g_strdup (scan);
+
+		/* avoid to insert duplicated folders */
+		if (g_hash_table_lookup (names_hash, dir_name) != NULL) {
+			g_free (dir_name);
+			return FALSE;
+		}
+		g_hash_table_insert (names_hash, dir_name, GINT_TO_POINTER (1));
+
+		if ((end != NULL) && (*(end + 1) != '\0'))
+			fdata->list_dir = TRUE;
+		file_data_set_list_name (fdata, dir_name);
+		fdata->dir_size = get_dir_size (window, current_dir, dir_name);
+	}
+
+	return TRUE;
+}
+
+static void
+fr_window_compute_list_names (FrWindow  *window,
+			      GPtrArray *files)
+{
+	const char *current_dir;
+	size_t      current_dir_len;
+	GHashTable *names_hash;
+	guint       i;
+	gboolean    visible_list_started = FALSE;
+	gboolean    visible_list_completed = FALSE;
+	gboolean    different_name;
+
+	current_dir = fr_window_get_current_location (window);
+	current_dir_len = strlen (current_dir);
+	names_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+	for (i = 0; i < files->len; i++) {
+		FileData *fdata = g_ptr_array_index (files, i);
+
+		file_data_set_list_name (fdata, NULL);
+		fdata->list_dir = FALSE;
+
+		/* the files array is sorted by path, when the visible list
+		 * is started and we find a path that doesn't match the
+		 * current_dir path, the following files can't match
+		 * the current_dir path. */
+
+		if (visible_list_completed)
+			continue;
+
+		if (compute_file_list_name (window, fdata, current_dir, current_dir_len, names_hash, &different_name)) {
+			visible_list_started = TRUE;
+		}
+		else if (visible_list_started && different_name)
+			visible_list_completed = TRUE;
+	}
+
+	g_hash_table_destroy (names_hash);
+}
+
+static gboolean
+fr_window_dir_exists_in_archive (FrWindow   *window,
+				 const char *dir_name)
+{
+	int dir_name_len;
+	guint i;
+
+	if (dir_name == NULL)
+		return FALSE;
+
+	dir_name_len = strlen (dir_name);
+	if (dir_name_len == 0)
+		return TRUE;
+
+	if (strcmp (dir_name, "/") == 0)
+		return TRUE;
+
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+
+		if (strncmp (dir_name, fdata->full_path, dir_name_len) == 0) {
+			return TRUE;
+		}
+		else if (fdata->dir
+			 && (fdata->full_path[strlen (fdata->full_path) -1] != '/')
+			 && (strncmp (dir_name, fdata->full_path, dir_name_len - 1) == 0))
+		{
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+static char *
+get_parent_dir (const char *current_dir)
+{
+	char *dir;
+	char *new_dir;
+	char *retval;
+
+	if (current_dir == NULL)
+		return NULL;
+	if (strcmp (current_dir, "/") == 0)
+		return g_strdup ("/");
+
+	dir = g_strdup (current_dir);
+	dir[strlen (dir) - 1] = 0;
+	new_dir = remove_level_from_path (dir);
+	g_free (dir);
+
+	if (new_dir[strlen (new_dir) - 1] == '/')
+		retval = new_dir;
+	else {
+		retval = g_strconcat (new_dir, "/", NULL);
+		g_free (new_dir);
+	}
+
+	return retval;
+}
+
+static void fr_window_update_statusbar_list_info (FrWindow *window);
+
+static GdkPixbuf *
+get_mime_type_icon (const char *mime_type)
+{
+	GdkPixbuf *pixbuf = NULL;
+
+	pixbuf = g_hash_table_lookup (tree_pixbuf_hash, mime_type);
+	if (pixbuf != NULL) {
+		g_object_ref (G_OBJECT (pixbuf));
+		return pixbuf;
+	}
+
+	pixbuf = get_mime_type_pixbuf (mime_type, file_list_icon_size, icon_theme);
+	if (pixbuf == NULL)
+		return NULL;
+
+	pixbuf = gdk_pixbuf_copy (pixbuf);
+	g_hash_table_insert (tree_pixbuf_hash, (gpointer) mime_type, pixbuf);
+	g_object_ref (G_OBJECT (pixbuf));
+
+	return pixbuf;
+}
+
+static GdkPixbuf *
+get_icon (FileData  *fdata)
+{
+	const char *content_type;
+
+	if (file_data_is_dir (fdata))
+		content_type = MIME_TYPE_DIRECTORY;
+	else
+		content_type = fdata->content_type;
+
+	return get_mime_type_icon (content_type);
+}
+
+static GdkPixbuf *
+get_emblem (FileData  *fdata)
+{
+	if (! fdata->encrypted)
+		return NULL;
+
+	return get_mime_type_icon ("emblem-nowrite");
+}
+
+static int
+get_column_from_sort_method (FrWindowSortMethod sort_method)
+{
+	switch (sort_method) {
+	case FR_WINDOW_SORT_BY_NAME: return COLUMN_NAME;
+	case FR_WINDOW_SORT_BY_SIZE: return COLUMN_SIZE;
+	case FR_WINDOW_SORT_BY_TYPE: return COLUMN_TYPE;
+	case FR_WINDOW_SORT_BY_TIME: return COLUMN_TIME;
+	case FR_WINDOW_SORT_BY_PATH: return COLUMN_PATH;
+	default:
+		break;
+	}
+
+	return COLUMN_NAME;
+}
+
+static int
+get_sort_method_from_column (int column_id)
+{
+	switch (column_id) {
+	case COLUMN_NAME: return FR_WINDOW_SORT_BY_NAME;
+	case COLUMN_SIZE: return FR_WINDOW_SORT_BY_SIZE;
+	case COLUMN_TYPE: return FR_WINDOW_SORT_BY_TYPE;
+	case COLUMN_TIME: return FR_WINDOW_SORT_BY_TIME;
+	case COLUMN_PATH: return FR_WINDOW_SORT_BY_PATH;
+	default:
+		break;
+	}
+
+	return FR_WINDOW_SORT_BY_NAME;
+}
+
+static void
+add_selected_from_list_view (GtkTreeModel *model,
+			     GtkTreePath  *path,
+			     GtkTreeIter  *iter,
+			     gpointer      data)
+{
+	GList    **list = data;
+	FileData  *fdata;
+
+	gtk_tree_model_get (model, iter,
+			    COLUMN_FILE_DATA, &fdata,
+			    -1);
+	*list = g_list_prepend (*list, fdata);
+}
+
+static void
+add_selected_from_tree_view (GtkTreeModel *model,
+			     GtkTreePath  *path,
+			     GtkTreeIter  *iter,
+			     gpointer      data)
+{
+	GList **list = data;
+	char   *dir_path;
+
+	gtk_tree_model_get (model, iter,
+			    TREE_COLUMN_PATH, &dir_path,
+			    -1);
+	*list = g_list_prepend (*list, dir_path);
+}
+
+static void
+add_selected_fd (GtkTreeModel *model,
+		 GtkTreePath  *path,
+		 GtkTreeIter  *iter,
+		 gpointer      data)
+{
+	GList    **list = data;
+	FileData  *fdata;
+
+	gtk_tree_model_get (model, iter,
+			    COLUMN_FILE_DATA, &fdata,
+			    -1);
+	if (! fdata->list_dir)
+		*list = g_list_prepend (*list, fdata);
+}
+
+static GList *
+get_selection_as_fd (FrWindow *window)
+{
+	GtkTreeSelection *selection;
+	GList            *list = NULL;
+
+	if (! gtk_widget_get_realized (window->priv->list_view))
+		return NULL;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (selection == NULL)
+		return NULL;
+	gtk_tree_selection_selected_foreach (selection, add_selected_fd, &list);
+
+	return list;
+}
+
+static void
+fr_window_update_statusbar_list_info (FrWindow *window)
+{
+	char    *info, *archive_info, *selected_info;
+	char    *size_txt, *sel_size_txt;
+	gulong   tot_n = 0;
+	gulong   sel_n = 0;
+	goffset  tot_size = 0;
+	goffset  sel_size = 0;
+	GList   *scan;
+
+	if (window == NULL)
+		return;
+
+	if ((window->archive == NULL) || (window->archive->command == NULL)) {
+		gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), window->priv->list_info_cid);
+		return;
+	}
+
+	if (window->priv->archive_present) {
+		GPtrArray *files = fr_window_get_current_dir_list (window);
+		guint i;
+
+		for (i = 0; i < files->len; i++) {
+			FileData *fd = g_ptr_array_index (files, i);
+
+			tot_n++;
+			if (! file_data_is_dir (fd))
+				tot_size += fd->size;
+			else
+				tot_size += fd->dir_size;
+		}
+		g_ptr_array_free (files, TRUE);
+	}
+
+	if (window->priv->archive_present) {
+		GList *selection = get_selection_as_fd (window);
+
+		for (scan = selection; scan; scan = scan->next) {
+			FileData *fd = scan->data;
+
+			sel_n++;
+			if (! file_data_is_dir (fd))
+				sel_size += fd->size;
+		}
+		g_list_free (selection);
+	}
+
+	size_txt = g_format_size (tot_size);
+	sel_size_txt = g_format_size (sel_size);
+
+	if (tot_n == 0)
+		archive_info = g_strdup ("");
+	else
+		archive_info = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%lu object (%s)", "%lu objects (%s)", tot_n), tot_n, size_txt);
+
+	if (sel_n == 0)
+		selected_info = g_strdup ("");
+	else
+		selected_info = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%lu object selected (%s)", "%lu objects selected (%s)", sel_n), sel_n, sel_size_txt);
+
+	info = g_strconcat (archive_info,
+			    ((sel_n == 0) ? NULL : ", "),
+			    selected_info,
+			    NULL);
+
+	gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar), window->priv->list_info_cid, info);
+
+	g_free (size_txt);
+	g_free (sel_size_txt);
+	g_free (archive_info);
+	g_free (selected_info);
+	g_free (info);
+}
+
+static void
+fr_window_populate_file_list (FrWindow  *window,
+			      GPtrArray *files)
+{
+	guint i;
+
+	gtk_list_store_clear (window->priv->list_store);
+
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (window->priv->list_store),
+	 				      GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+	 				      GTK_SORT_ASCENDING);
+
+	for (i = 0; i < files->len; i++) {
+		FileData    *fdata = g_ptr_array_index (files, i);
+		GtkTreeIter  iter;
+		GdkPixbuf   *icon, *emblem;
+		char        *utf8_name;
+
+		if (fdata->list_name == NULL)
+			continue;
+
+		gtk_list_store_append (window->priv->list_store, &iter);
+
+		icon = get_icon (fdata);
+		utf8_name = g_filename_display_name (fdata->list_name);
+		emblem = get_emblem (fdata);
+
+		if (file_data_is_dir (fdata)) {
+			char *utf8_path;
+			char *tmp;
+			char *s_size;
+			char *s_time;
+
+			if (fdata->list_dir)
+				tmp = remove_ending_separator (fr_window_get_current_location (window));
+
+			else
+				tmp = remove_level_from_path (fdata->path);
+			utf8_path = g_filename_display_name (tmp);
+			g_free (tmp);
+
+			s_size = g_format_size (fdata->dir_size);
+
+			if (fdata->list_dir) {
+				s_time = g_strdup ("");
+			} else {
+				GDateTime *date_time;
+				date_time = g_date_time_new_from_unix_local (fdata->modified);
+				s_time = g_date_time_format (date_time, _("%d %B %Y, %H:%M"));
+				g_date_time_unref (date_time);
+			}
+
+			gtk_list_store_set (window->priv->list_store, &iter,
+					    COLUMN_FILE_DATA, fdata,
+					    COLUMN_ICON, icon,
+					    COLUMN_NAME, utf8_name,
+					    COLUMN_EMBLEM, emblem,
+					    COLUMN_TYPE, _("Folder"),
+					    COLUMN_SIZE, s_size,
+					    COLUMN_TIME, s_time,
+					    COLUMN_PATH, utf8_path,
+					    -1);
+			g_free (utf8_path);
+			g_free (s_size);
+			g_free (s_time);
+		}
+		else {
+			GDateTime  *date_time;
+			char       *utf8_path;
+			char       *s_size;
+			char       *s_time;
+			char       *desc;
+
+			utf8_path = g_filename_display_name (fdata->path);
+
+			s_size = g_format_size (fdata->size);
+			date_time = g_date_time_new_from_unix_local (fdata->modified);
+			s_time = g_date_time_format (date_time, _("%d %B %Y, %H:%M"));
+			g_date_time_unref (date_time);
+			desc = g_content_type_get_description (fdata->content_type);
+
+			gtk_list_store_set (window->priv->list_store, &iter,
+					    COLUMN_FILE_DATA, fdata,
+					    COLUMN_ICON, icon,
+					    COLUMN_NAME, utf8_name,
+					    COLUMN_EMBLEM, emblem,
+					    COLUMN_TYPE, desc,
+					    COLUMN_SIZE, s_size,
+					    COLUMN_TIME, s_time,
+					    COLUMN_PATH, utf8_path,
+					    -1);
+			g_free (utf8_path);
+			g_free (s_size);
+			g_free (s_time);
+			g_free (desc);
+		}
+		g_free (utf8_name);
+		if (icon != NULL)
+			g_object_unref (icon);
+		if (emblem != NULL)
+			g_object_unref (emblem);
+	}
+
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (window->priv->list_store),
+					      get_column_from_sort_method (window->priv->sort_method),
+					      window->priv->sort_type);
+
+	fr_window_update_statusbar_list_info (window);
+	fr_window_stop_activity_mode (window);
+}
+
+static int
+path_compare (gconstpointer a,
+	      gconstpointer b)
+{
+	char *path_a = *((char**) a);
+	char *path_b = *((char**) b);
+
+	return strcmp (path_a, path_b);
+}
+
+static gboolean
+get_tree_iter_from_path (FrWindow    *window,
+			 const char  *path,
+			 GtkTreeIter *parent,
+			 GtkTreeIter *iter)
+{
+	gboolean    result = FALSE;
+
+	if (! gtk_tree_model_iter_children (GTK_TREE_MODEL (window->priv->tree_store), iter, parent))
+		return FALSE;
+
+	do {
+		GtkTreeIter  tmp;
+		char        *iter_path;
+
+		if (get_tree_iter_from_path (window, path, iter, &tmp)) {
+			*iter = tmp;
+			return TRUE;
+		}
+
+		gtk_tree_model_get (GTK_TREE_MODEL (window->priv->tree_store),
+				    iter,
+				    TREE_COLUMN_PATH, &iter_path,
+				    -1);
+
+		if ((iter_path != NULL) && (strcmp (path, iter_path) == 0)) {
+			result = TRUE;
+			g_free (iter_path);
+			break;
+		}
+		g_free (iter_path);
+	} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (window->priv->tree_store), iter));
+
+	return result;
+}
+
+static void
+set_sensitive (FrWindow   *window,
+               const char *id,
+               gboolean    sensitive)
+{
+	GtkWidget *widget;
+
+	widget = (GtkWidget *)gtk_builder_get_object (window->priv->ui_manager, id);
+	g_object_set (widget, "sensitive", sensitive, NULL);
+}
+
+static void
+fr_window_update_current_location (FrWindow *window)
+{
+	const char *current_dir = fr_window_get_current_location (window);
+	char       *path;
+	GtkTreeIter iter;
+
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) {
+		gtk_widget_hide (window->priv->location_bar);
+		return;
+	}
+
+	gtk_widget_show (window->priv->location_bar);
+
+	gtk_entry_set_text (GTK_ENTRY (window->priv->location_entry), window->priv->archive_present? current_dir: "");
+
+	set_sensitive (window, "tool_goback_item", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
+	set_sensitive (window, "tool_gonext_item", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
+	set_sensitive (window, "tool_goup_item", window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0));
+	set_sensitive (window, "tool_gohome_item", window->priv->archive_present);
+	gtk_widget_set_sensitive (window->priv->location_entry, window->priv->archive_present);
+	gtk_widget_set_sensitive (window->priv->location_label, window->priv->archive_present);
+	gtk_widget_set_sensitive (window->priv->filter_entry, window->priv->archive_present);
+
+#if 0
+	fr_window_history_print (window);
+#endif
+
+	path = remove_ending_separator (current_dir);
+	if (get_tree_iter_from_path (window, path, NULL, &iter)) {
+		GtkTreeSelection *selection;
+		GtkTreePath      *t_path;
+
+		t_path = gtk_tree_model_get_path (GTK_TREE_MODEL (window->priv->tree_store), &iter);
+		gtk_tree_view_expand_to_path (GTK_TREE_VIEW (window->priv->tree_view), t_path);
+		gtk_tree_path_free (t_path);
+
+		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
+		gtk_tree_selection_select_iter (selection, &iter);
+	}
+	g_free (path);
+}
+
+static void
+fr_window_update_dir_tree (FrWindow *window)
+{
+	GPtrArray  *dirs;
+	GHashTable *dir_cache;
+	guint       i;
+	GdkPixbuf  *icon;
+
+	gtk_tree_store_clear (window->priv->tree_store);
+
+	if (! window->priv->view_folders
+	    || ! window->priv->archive_present
+	    || (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT))
+	{
+		gtk_widget_set_sensitive (window->priv->tree_view, FALSE);
+		gtk_widget_hide (window->priv->sidepane);
+		return;
+	}
+	else {
+		gtk_widget_set_sensitive (window->priv->tree_view, TRUE);
+		if (! gtk_widget_get_visible (window->priv->sidepane))
+			gtk_widget_show_all (window->priv->sidepane);
+	}
+
+	if (gtk_widget_get_realized (window->priv->tree_view))
+		gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (window->priv->tree_view), 0, 0);
+
+	/**/
+
+	dirs = g_ptr_array_sized_new (128);
+
+	dir_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+		char     *dir;
+
+		if (gtk_entry_get_text (GTK_ENTRY (window->priv->filter_entry)) != NULL) {
+			if (! file_data_respects_filter (window, fdata))
+				continue;
+		}
+
+		if (fdata->dir)
+			dir = remove_ending_separator (fdata->full_path);
+		else
+			dir = remove_level_from_path (fdata->full_path);
+
+		while ((dir != NULL) && (strcmp (dir, "/") != 0)) {
+			char *new_dir;
+
+			if (g_hash_table_lookup (dir_cache, dir) != NULL)
+				break;
+
+			new_dir = dir;
+			g_ptr_array_add (dirs, new_dir);
+			g_hash_table_replace (dir_cache, new_dir, "1");
+
+			dir = remove_level_from_path (new_dir);
+		}
+
+		g_free (dir);
+	}
+	g_hash_table_destroy (dir_cache);
+
+	g_ptr_array_sort (dirs, path_compare);
+	dir_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) gtk_tree_path_free);
+
+	/**/
+
+	icon = get_mime_type_icon (MIME_TYPE_ARCHIVE);
+	{
+		GtkTreeIter  node;
+		char        *uri;
+		char        *name;
+
+		uri = g_file_get_uri (window->archive->file);
+		name = g_uri_display_basename (uri);
+
+		gtk_tree_store_append (window->priv->tree_store, &node, NULL);
+		gtk_tree_store_set (window->priv->tree_store, &node,
+				    TREE_COLUMN_ICON, icon,
+				    TREE_COLUMN_NAME, name,
+				    TREE_COLUMN_PATH, "/",
+				    TREE_COLUMN_WEIGHT, PANGO_WEIGHT_BOLD,
+				    -1);
+		g_hash_table_replace (dir_cache, "/", gtk_tree_model_get_path (GTK_TREE_MODEL (window->priv->tree_store), &node));
+
+		g_free (name);
+		g_free (uri);
+	}
+	g_object_unref (icon);
+
+	/**/
+
+	icon = get_mime_type_icon (MIME_TYPE_DIRECTORY);
+	for (i = 0; i < dirs->len; i++) {
+		char        *dir = g_ptr_array_index (dirs, i);
+		char        *parent_dir;
+		GtkTreePath *parent_path;
+		GtkTreeIter  parent;
+		GtkTreeIter  node;
+
+		parent_dir = remove_level_from_path (dir);
+		if (parent_dir == NULL)
+			continue;
+
+		parent_path = g_hash_table_lookup (dir_cache, parent_dir);
+		gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->tree_store),
+					 &parent,
+					 parent_path);
+		gtk_tree_store_append (window->priv->tree_store, &node, &parent);
+		gtk_tree_store_set (window->priv->tree_store, &node,
+				    TREE_COLUMN_ICON, icon,
+				    TREE_COLUMN_NAME, file_name_from_path (dir),
+				    TREE_COLUMN_PATH, dir,
+				    TREE_COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
+				    -1);
+		g_hash_table_replace (dir_cache, dir, gtk_tree_model_get_path (GTK_TREE_MODEL (window->priv->tree_store), &node));
+
+		g_free (parent_dir);
+	}
+	g_hash_table_destroy (dir_cache);
+	if (icon != NULL)
+		g_object_unref (icon);
+
+	g_ptr_array_free (dirs, TRUE);
+
+	fr_window_update_current_location (window);
+}
+
+static void
+fr_window_update_filter_bar_visibility (FrWindow *window)
+{
+	const char *filter;
+
+	filter = gtk_entry_get_text (GTK_ENTRY (window->priv->filter_entry));
+	if ((filter == NULL) || (*filter == '\0'))
+		gtk_widget_hide (window->priv->filter_bar);
+	else
+		gtk_widget_show (window->priv->filter_bar);
+}
+
+static void
+fr_window_update_file_list (FrWindow *window,
+			    gboolean  update_view)
+{
+	GPtrArray  *files;
+	gboolean    free_files = FALSE;
+
+	if (gtk_widget_get_realized (window->priv->list_view))
+		gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (window->priv->list_view), 0, 0);
+
+	if (! window->priv->archive_present || window->priv->archive_new) {
+		if (update_view)
+			gtk_list_store_clear (window->priv->list_store);
+
+		window->priv->current_view_length = 0;
+
+		if (window->priv->archive_new) {
+			gtk_widget_set_sensitive (window->priv->list_view, TRUE);
+			gtk_widget_show_all (gtk_widget_get_parent (window->priv->list_view));
+		}
+		else {
+			gtk_widget_set_sensitive (window->priv->list_view, FALSE);
+			gtk_widget_hide (gtk_widget_get_parent (window->priv->list_view));
+		}
+
+		return;
+	}
+	else {
+		gtk_widget_set_sensitive (window->priv->list_view, TRUE);
+		gtk_widget_show_all (gtk_widget_get_parent (window->priv->list_view));
+	}
+
+	if (window->priv->give_focus_to_the_list) {
+		gtk_widget_grab_focus (window->priv->list_view);
+		window->priv->give_focus_to_the_list = FALSE;
+	}
+
+	/**/
+
+	fr_window_start_activity_mode (window);
+
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) {
+		fr_window_compute_list_names (window, window->archive->command->files);
+		files = window->archive->command->files;
+		free_files = FALSE;
+	}
+	else {
+		char *current_dir = g_strdup (fr_window_get_current_location (window));
+
+		while (! fr_window_dir_exists_in_archive (window, current_dir)) {
+			char *tmp;
+
+			fr_window_history_pop (window);
+
+			tmp = get_parent_dir (current_dir);
+			g_free (current_dir);
+			current_dir = tmp;
+
+			fr_window_history_add (window, current_dir);
+		}
+		g_free (current_dir);
+
+		fr_window_compute_list_names (window, window->archive->command->files);
+		files = fr_window_get_current_dir_list (window);
+		free_files = TRUE;
+	}
+
+	if (files != NULL)
+		window->priv->current_view_length = files->len;
+	else
+		window->priv->current_view_length = 0;
+
+	if (update_view)
+		fr_window_populate_file_list (window, files);
+
+	if (free_files)
+		g_ptr_array_free (files, TRUE);
+}
+
+void
+fr_window_update_list_order (FrWindow *window)
+{
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (window->priv->list_store), get_column_from_sort_method (window->priv->sort_method), window->priv->sort_type);
+}
+
+static void
+fr_window_update_title (FrWindow *window)
+{
+	if (! window->priv->archive_present)
+		gtk_window_set_title (GTK_WINDOW (window), _("Archive Manager"));
+	else {
+		char *title;
+		char *name;
+
+		name = g_uri_display_basename (fr_window_get_archive_uri (window));
+		title = g_strdup_printf ("%s %s",
+					 name,
+					 window->archive->read_only ? _("[read only]") : "");
+
+		gtk_window_set_title (GTK_WINDOW (window), title);
+		g_free (title);
+		g_free (name);
+	}
+}
+
+static void
+check_whether_has_a_dir (GtkTreeModel *model,
+			 GtkTreePath  *path,
+			 GtkTreeIter  *iter,
+			 gpointer      data)
+{
+	gboolean *has_a_dir = data;
+	FileData *fdata;
+
+	gtk_tree_model_get (model, iter,
+			    COLUMN_FILE_DATA, &fdata,
+			    -1);
+	if (file_data_is_dir (fdata))
+		*has_a_dir = TRUE;
+}
+
+static gboolean
+selection_has_a_dir (FrWindow *window)
+{
+	GtkTreeSelection *selection;
+	gboolean          has_a_dir = FALSE;
+
+	if (! gtk_widget_get_realized (window->priv->list_view))
+		return FALSE;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (selection == NULL)
+		return FALSE;
+
+	gtk_tree_selection_selected_foreach (selection,
+					     check_whether_has_a_dir,
+					     &has_a_dir);
+
+	return has_a_dir;
+}
+
+static void
+set_active (FrWindow   *window,
+	    const char *action_name,
+	    gboolean    is_active)
+{
+	GAction *action;
+
+	action = g_action_map_lookup_action (G_ACTION_MAP (window->priv->actions), action_name);
+	g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (is_active));
+}
+
+static void
+fr_window_update_paste_command_sensitivity (FrWindow     *window,
+					    GtkClipboard *clipboard)
+{
+	gboolean running;
+	gboolean no_archive;
+	gboolean ro;
+	gboolean compr_file;
+
+	if (window->priv->closing)
+		return;
+
+	if (clipboard == NULL)
+		clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), FR_CLIPBOARD);
+	running    = window->priv->activity_ref > 0;
+	no_archive = (window->archive == NULL) || ! window->priv->archive_present;
+	ro         = ! no_archive && window->archive->read_only;
+	compr_file = ! no_archive && window->archive->is_compressed_file;
+
+	set_sensitive (window, "paste_item", ! no_archive && ! ro && ! running && ! compr_file && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT) && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
+	set_sensitive (window, "popup_paste_item", ! no_archive && ! ro && ! running && ! compr_file && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT) && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
+	set_sensitive (window, "popup_paste_item1", ! no_archive && ! ro && ! running && ! compr_file && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT) && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
+}
+
+static void
+fr_window_update_sensitivity (FrWindow *window)
+{
+	gboolean no_archive;
+	gboolean ro;
+	gboolean file_op;
+	gboolean running;
+	gboolean compr_file;
+	gboolean sel_not_null;
+	gboolean one_file_selected;
+	gboolean dir_selected;
+	int      n_selected;
+
+	if (window->priv->batch_mode)
+		return;
+
+	running           = window->priv->activity_ref > 0;
+	no_archive        = (window->archive == NULL) || ! window->priv->archive_present;
+	ro                = ! no_archive && window->archive->read_only;
+	file_op           = ! no_archive && ! window->priv->archive_new  && ! running;
+	compr_file        = ! no_archive && window->archive->is_compressed_file;
+	n_selected        = fr_window_get_n_selected_files (window);
+	sel_not_null      = n_selected > 0;
+	one_file_selected = n_selected == 1;
+	dir_selected      = selection_has_a_dir (window);
+
+	set_sensitive (window, "add_files_item", ! no_archive && ! ro && ! running && ! compr_file);
+	set_sensitive (window, "tool_add_files_item", ! no_archive && ! ro && ! running && ! compr_file);
+	set_sensitive (window, "add_folder_item", ! no_archive && ! ro && ! running && ! compr_file);
+	set_sensitive (window, "tool_add_folder_item", ! no_archive && ! ro && ! running && ! compr_file);
+	set_sensitive (window, "copy_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "popup_copy_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "popup_copy_item1", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "cut_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "popup_cut_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "popup_cut_item1", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+	set_sensitive (window, "delete_item", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file);
+	set_sensitive (window, "popup_delete_item", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file);
+	set_sensitive (window, "popup_delete_item1", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file);
+	set_sensitive (window, "deselect_all_item", ! no_archive && sel_not_null);
+	set_sensitive (window, "extract_item", file_op);
+	set_sensitive (window, "tool_extract_item", file_op);
+	set_sensitive (window, "find_item", ! no_archive);
+	set_sensitive (window, "last_output_item", ((window->archive != NULL)
+					      && (window->archive->process != NULL)
+					      && (window->archive->process->out.raw != NULL)));
+	set_sensitive (window, "new_item", ! running);
+	set_sensitive (window, "tool_new_item", ! running);
+	set_sensitive (window, "open_item", ! running);
+	set_sensitive (window, "popup_open_select_item", file_op && sel_not_null && ! dir_selected);
+	set_sensitive (window, "popup_open_item1", file_op && one_file_selected && dir_selected);
+	set_sensitive (window, "password_item", ! running && (window->priv->asked_for_password || (! no_archive && window->archive->command->propPassword)));
+	set_sensitive (window, "properties_item", file_op);
+	set_sensitive (window, "close_item", !running || window->priv->stoppable);
+	set_sensitive (window, "reload_item", ! (no_archive || running));
+	set_sensitive (window, "rename_item", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected);
+	set_sensitive (window, "popup_rename_item", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected);
+	set_sensitive (window, "popup_rename_item1", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected);
+	set_sensitive (window, "open_saveas_item", ! no_archive && ! compr_file && ! running);
+	set_sensitive (window, "select_all_item", ! no_archive);
+	set_sensitive (window, "stop_item", running && window->priv->stoppable);
+	set_sensitive (window, "tool_stop_item", running && window->priv->stoppable);
+	set_sensitive (window, "test_integrity_item", ! no_archive && ! running && window->archive->command->propTest);
+	set_sensitive (window, "popup_open_item", file_op && one_file_selected && ! dir_selected);
+
+	if (window->priv->progress_dialog != NULL)
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog),
+						   GTK_RESPONSE_OK,
+						   running && window->priv->stoppable);
+
+	fr_window_update_paste_command_sensitivity (window, NULL);
+
+	set_sensitive (window, "select_all_item", (window->priv->current_view_length > 0) && (window->priv->current_view_length != n_selected));
+	set_sensitive (window, "deselect_all_item", n_selected > 0);
+	set_sensitive (window, "open_recent_item", ! running);
+	set_sensitive (window, "tool_open_recent_item", ! running);
+
+	set_sensitive (window, "view_folder_item", (window->priv->list_mode == FR_WINDOW_LIST_MODE_AS_DIR));
+
+	set_sensitive (window, "view_all_files_item", ! window->priv->filter_mode);
+	set_sensitive (window, "view_as_folder_item", ! window->priv->filter_mode);
+}
+
+static gboolean
+location_entry_key_press_event_cb (GtkWidget   *widget,
+				   GdkEventKey *event,
+				   FrWindow    *window)
+{
+	if ((event->keyval == GDK_KEY_Return)
+	    || (event->keyval == GDK_KEY_KP_Enter)
+	    || (event->keyval == GDK_KEY_ISO_Enter))
+	{
+		fr_window_go_to_location (window, gtk_entry_get_text (GTK_ENTRY (window->priv->location_entry)), FALSE);
+	}
+
+	return FALSE;
+}
+
+static gboolean
+real_close_progress_dialog (gpointer data)
+{
+	FrWindow *window = data;
+
+	if (window->priv->hide_progress_timeout != 0) {
+		g_source_remove (window->priv->hide_progress_timeout);
+		window->priv->hide_progress_timeout = 0;
+	}
+
+	if (window->priv->progress_dialog != NULL)
+		gtk_widget_hide (window->priv->progress_dialog);
+
+	return FALSE;
+}
+
+static void close_suspend_process(FrWindow *window)
+{
+    if (window->archive->process != NULL)
+    {
+         start_close_suspend_process(window->archive->process);
+    }
+}
+static void
+close_progress_dialog (FrWindow *window,
+		       gboolean  close_now)
+{
+	if (window->priv->progress_timeout != 0) {
+		g_source_remove (window->priv->progress_timeout);
+		window->priv->progress_timeout = 0;
+	}
+
+	if (! window->priv->batch_mode && gtk_widget_get_mapped (GTK_WIDGET (window)))
+		gtk_widget_hide (window->priv->progress_bar);
+
+	if (window->priv->progress_dialog == NULL)
+		return;
+
+	if (close_now) {
+		if (window->priv->hide_progress_timeout != 0) {
+			g_source_remove (window->priv->hide_progress_timeout);
+			window->priv->hide_progress_timeout = 0;
+		}
+		real_close_progress_dialog (window);
+	}
+	else {
+		if (window->priv->hide_progress_timeout != 0)
+			return;
+		window->priv->hide_progress_timeout = g_timeout_add (HIDE_PROGRESS_TIMEOUT_MSECS,
+								     real_close_progress_dialog,
+								     window);
+	}
+    close_suspend_process(window);
+}
+
+static gboolean
+progress_dialog_delete_event (GtkWidget *caller,
+			      GdkEvent  *event,
+			      FrWindow  *window)
+{
+	if (window->priv->stoppable) {
+		activate_action_stop (NULL, NULL, window);
+		close_progress_dialog (window, TRUE);
+	}
+
+	return TRUE;
+}
+
+static void
+open_folder (GtkWindow  *parent,
+	     const char *folder)
+{
+	GError *error = NULL;
+
+	if (folder == NULL)
+		return;
+
+	if (! gtk_show_uri_on_window (parent, folder, GDK_CURRENT_TIME, &error)) {
+		GtkWidget *d;
+		char      *utf8_name;
+		char      *message;
+
+		utf8_name = g_filename_display_name (folder);
+		message = g_strdup_printf (_("Could not display the folder \"%s\""), utf8_name);
+		g_free (utf8_name);
+
+		d = _gtk_error_dialog_new (parent,
+					   GTK_DIALOG_MODAL,
+					   NULL,
+					   message,
+					   "%s",
+					   error->message);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (d);
+
+		g_free (message);
+		g_clear_error (&error);
+	}
+}
+
+static void
+fr_window_view_extraction_destination_folder (FrWindow *window)
+{
+	open_folder (GTK_WINDOW (window), fr_archive_get_last_extraction_destination (window->archive));
+}
+
+static void change_button_label (FrWindow  *window,
+                                 GtkWidget *button)
+{
+	const gchar *state;
+	state = gtk_button_get_label (GTK_BUTTON (button));
+
+	if (g_strrstr (_("_Pause"), state) != NULL)
+	{
+		gtk_widget_set_visible (window->priv->pd_progress_bar, FALSE);
+		fr_command_message (window->archive->command, _("Process paused"));
+
+		gtk_button_set_label (GTK_BUTTON (button), _("_Resume"));
+		gtk_button_set_image (GTK_BUTTON (button),
+				      gtk_image_new_from_icon_name ("media-playback-start",
+								    GTK_ICON_SIZE_BUTTON));
+	}
+	else
+	{
+		gtk_widget_set_visible (window->priv->pd_progress_bar, TRUE);
+		fr_command_message (window->archive->command, _("Please wait…"));
+
+		gtk_button_set_label (GTK_BUTTON(button), _("_Pause"));
+		gtk_button_set_image (GTK_BUTTON (button),
+				      gtk_image_new_from_icon_name ("media-playback-pause",
+								    GTK_ICON_SIZE_BUTTON));
+	}
+}
+
+static void
+fr_state_switch (FrWindow  *window)
+{
+	if ((window->archive->process != NULL) &&
+	    ((start_switch_state (window->archive->process) == 0))) {
+		change_button_label (window, window->priv->pd_state_button);
+	}
+}
+
+static void
+progress_dialog_response (GtkDialog *dialog,
+			  int        response_id,
+			  FrWindow  *window)
+{
+	GtkWidget *new_window;
+
+	switch (response_id) {
+	case GTK_RESPONSE_CANCEL:
+		if (window->priv->stoppable) {
+			activate_action_stop (NULL, NULL, window);
+			close_progress_dialog (window, TRUE);
+		}
+		break;
+	case GTK_RESPONSE_CLOSE:
+		close_progress_dialog (window, TRUE);
+		break;
+	case DIALOG_RESPONSE_OPEN_ARCHIVE:
+		new_window = fr_window_new ();
+		gtk_widget_show (new_window);
+		fr_window_archive_open (FR_WINDOW (new_window), window->priv->convert_data.new_file, GTK_WINDOW (new_window));
+		close_progress_dialog (window, TRUE);
+		break;
+	case DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER:
+		fr_window_view_extraction_destination_folder (window);
+		close_progress_dialog (window, TRUE);
+		break;
+	case DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER_AND_QUIT:
+		fr_window_view_extraction_destination_folder (window);
+		close_progress_dialog (window, TRUE);
+		fr_window_close (window);
+		break;
+	case DIALOG_RESPONSE_QUIT:
+		fr_window_close (window);
+		break;
+	case GTK_RESPONSE_ACCEPT:
+		fr_state_switch (window);
+		break;
+	default:
+		break;
+	}
+}
+
+static char*
+get_action_description (FrAction    action,
+			const char *uri)
+{
+	char *basename;
+	char *message;
+
+	basename = (uri != NULL) ? g_uri_display_basename (uri) : NULL;
+
+	message = NULL;
+	switch (action) {
+	case FR_ACTION_CREATING_NEW_ARCHIVE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Creating \"%s\""), basename);
+		break;
+	case FR_ACTION_LOADING_ARCHIVE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Loading \"%s\""), basename);
+		break;
+	case FR_ACTION_LISTING_CONTENT:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Reading \"%s\""), basename);
+		break;
+	case FR_ACTION_DELETING_FILES:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Deleting files from \"%s\""), basename);
+		break;
+	case FR_ACTION_TESTING_ARCHIVE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Testing \"%s\""), basename);
+		break;
+	case FR_ACTION_GETTING_FILE_LIST:
+		message = g_strdup (_("Getting the file list"));
+		break;
+	case FR_ACTION_COPYING_FILES_FROM_REMOTE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Copying the files to add to \"%s\""), basename);
+		break;
+	case FR_ACTION_ADDING_FILES:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Adding files to \"%s\""), basename);
+		break;
+	case FR_ACTION_EXTRACTING_FILES:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Extracting files from \"%s\""), basename);
+		break;
+	case FR_ACTION_COPYING_FILES_TO_REMOTE:
+		message = g_strdup (_("Copying the extracted files to the destination"));
+		break;
+	case FR_ACTION_CREATING_ARCHIVE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Creating \"%s\""), basename);
+		break;
+	case FR_ACTION_SAVING_REMOTE_ARCHIVE:
+		/* Translators: %s is a filename */
+		message = g_strdup_printf (_("Saving \"%s\""), basename);
+		break;
+	case FR_ACTION_NONE:
+		break;
+	}
+	g_free (basename);
+
+	return message;
+}
+
+static void
+progress_dialog_update_action_description (FrWindow *window)
+{
+	const char *current_archive;
+	char        *description;
+	char       *description_markup;
+
+	if (window->priv->progress_dialog == NULL)
+		return;
+
+	if (window->priv->convert_data.converting)
+		current_archive = window->priv->convert_data.new_file;
+	else if (window->priv->working_archive != NULL)
+		current_archive = window->priv->working_archive;
+	else
+		current_archive = window->priv->archive_uri;
+
+	g_free (window->priv->pd_last_archive);
+	window->priv->pd_last_archive = NULL;
+	if (current_archive != NULL)
+		window->priv->pd_last_archive = g_strdup (current_archive);
+
+	description = get_action_description (window->priv->action, window->priv->pd_last_archive);
+	description_markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"larger\">%s</span>", description);
+	gtk_label_set_markup (GTK_LABEL (window->priv->pd_action), description_markup);
+
+	g_free (description_markup);
+	g_free (description);
+}
+
+static gboolean
+fr_window_working_archive_cb (FrCommand  *command,
+			      const char *archive_filename,
+			      FrWindow   *window)
+{
+	g_free (window->priv->working_archive);
+	if (archive_filename != NULL)
+		window->priv->working_archive = g_strdup (archive_filename);
+	else
+		window->priv->working_archive = NULL;
+	progress_dialog_update_action_description (window);
+
+	return TRUE;
+}
+
+static gboolean
+fr_window_message_cb (FrCommand  *command,
+		      const char *msg,
+		      FrWindow   *window)
+{
+	if (window->priv->pd_last_message != msg) {
+		g_free (window->priv->pd_last_message);
+		window->priv->pd_last_message = g_strdup (msg);
+	}
+
+	if (window->priv->progress_dialog == NULL)
+		return TRUE;
+
+	if (msg != NULL) {
+		while (*msg == ' ')
+			msg++;
+		if (*msg == 0)
+			msg = NULL;
+	}
+
+	if (msg != NULL) {
+		char *utf8_msg;
+
+		if (! g_utf8_validate (msg, -1, NULL))
+			utf8_msg = g_locale_to_utf8 (msg, -1 , 0, 0, 0);
+		else
+			utf8_msg = g_strdup (msg);
+		if (utf8_msg == NULL)
+			return TRUE;
+
+		if (g_utf8_validate (utf8_msg, -1, NULL))
+			gtk_label_set_text (GTK_LABEL (window->priv->pd_message), utf8_msg);
+
+		g_free (window->priv->pd_last_message);
+		window->priv->pd_last_message = g_strdup (utf8_msg);
+
+		g_signal_emit (G_OBJECT (window),
+			       fr_window_signals[PROGRESS],
+			       0,
+			       window->priv->pd_last_fraction,
+			       window->priv->pd_last_message);
+
+#ifdef LOG_PROGRESS
+		g_print ("message > %s\n", utf8_msg);
+#endif
+
+		g_free (utf8_msg);
+	}
+	else
+		gtk_label_set_text (GTK_LABEL (window->priv->pd_message), "");
+
+	progress_dialog_update_action_description (window);
+
+	return TRUE;
+}
+
+static GtkWidget*
+dialog_add_button_with_icon_name (GtkDialog   *dialog,
+                                  const gchar *button_text,
+                                  const gchar *icon_name,
+                                  gint         response_id)
+{
+	GtkWidget *button;
+
+	button = gtk_button_new_with_mnemonic (button_text);
+	gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
+
+	gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
+	gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
+	gtk_widget_set_can_default (button, TRUE);
+	gtk_widget_show (button);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
+
+	return button;
+}
+
+static void
+create_the_progress_dialog (FrWindow *window)
+{
+	GtkWindow     *parent;
+	GtkDialogFlags flags;
+	GtkDialog     *d;
+	GtkWidget     *hbox;
+	GtkWidget     *vbox;
+	GtkWidget     *progress_vbox;
+	GtkWidget     *lbl;
+	PangoAttrList *attr_list;
+	GdkPixbuf     *icon;
+
+	if (window->priv->progress_dialog != NULL)
+		return;
+
+	flags = GTK_DIALOG_DESTROY_WITH_PARENT;
+	if (window->priv->batch_mode) {
+		parent = NULL;
+	}
+	else {
+		parent = GTK_WINDOW (window);
+		flags |= GTK_DIALOG_MODAL;
+	}
+
+	window->priv->progress_dialog = gtk_dialog_new_with_buttons ((window->priv->batch_mode ? window->priv->batch_title : NULL),
+								     parent,
+								     flags,
+								     NULL,
+								     NULL);
+
+	window->priv->pd_quit_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Quit"), "application-exit", DIALOG_RESPONSE_QUIT);
+	window->priv->pd_open_archive_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), _("_Open the Archive"), DIALOG_RESPONSE_OPEN_ARCHIVE);
+	window->priv->pd_open_destination_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), _("_Show the Files"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER);
+	window->priv->pd_open_destination_and_quit_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), _("Show the _Files and Quit"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER_AND_QUIT);
+	window->priv->pd_close_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Close"), "window-close", GTK_RESPONSE_CLOSE);
+	window->priv->pd_cancel_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL);
+	/*add start button default suspend*/
+	window->priv->pd_state_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Pause"), "media-playback-pause", GTK_RESPONSE_ACCEPT);
+	d = GTK_DIALOG (window->priv->progress_dialog);
+	gtk_window_set_resizable (GTK_WINDOW (d), TRUE);
+	gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+	gtk_window_set_default_size (GTK_WINDOW (d), PROGRESS_DIALOG_DEFAULT_WIDTH, -1);
+
+	/* Main */
+
+	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 24);
+	gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
+	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (d)), hbox, FALSE, FALSE, 10);
+
+	icon = get_mime_type_pixbuf ("package-x-generic", _gtk_widget_lookup_for_size (GTK_WIDGET (window), GTK_ICON_SIZE_DIALOG), NULL);
+	window->priv->pd_icon = gtk_image_new_from_pixbuf (icon);
+	g_object_unref (icon);
+
+	gtk_widget_set_valign (window->priv->pd_icon, GTK_ALIGN_START);
+	gtk_box_pack_start (GTK_BOX (hbox), window->priv->pd_icon, FALSE, FALSE, 0);
+
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
+	gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+	/* action description */
+
+	lbl = window->priv->pd_action = gtk_label_new ("");
+	gtk_widget_set_halign (lbl, GTK_ALIGN_START);
+	gtk_widget_set_valign (lbl, GTK_ALIGN_START);
+	gtk_widget_set_hexpand (lbl, TRUE);
+	gtk_widget_set_vexpand (lbl, TRUE);
+	gtk_widget_set_margin_bottom (lbl, 12);
+
+	gtk_label_set_xalign (GTK_LABEL (lbl), 0.0);
+	gtk_label_set_ellipsize (GTK_LABEL (lbl), PANGO_ELLIPSIZE_END);
+	gtk_box_pack_start (GTK_BOX (vbox), lbl, TRUE, TRUE, 0);
+
+	/* archive name */
+
+	g_free (window->priv->pd_last_archive);
+	window->priv->pd_last_archive = NULL;
+
+	if (window->priv->archive_uri != NULL)
+		window->priv->pd_last_archive = g_strdup (window->priv->archive_uri);
+
+	/* progress and details */
+
+	progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_widget_set_valign (progress_vbox, GTK_ALIGN_START);
+	gtk_widget_set_hexpand (progress_vbox, TRUE);
+	gtk_widget_set_vexpand (progress_vbox, TRUE);
+	gtk_widget_set_margin_bottom (progress_vbox, 6);
+	gtk_box_pack_start (GTK_BOX (vbox), progress_vbox, TRUE, TRUE, 0);
+
+	/* progress bar */
+
+	window->priv->pd_progress_bar = gtk_progress_bar_new ();
+	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (window->priv->pd_progress_bar), ACTIVITY_PULSE_STEP);
+	gtk_box_pack_start (GTK_BOX (progress_vbox), window->priv->pd_progress_bar, TRUE, TRUE, 0);
+
+	/* details label */
+
+	lbl = window->priv->pd_message = gtk_label_new ("");
+
+	attr_list = pango_attr_list_new ();
+	pango_attr_list_insert (attr_list, pango_attr_size_new (9000));
+	gtk_label_set_attributes (GTK_LABEL (lbl), attr_list);
+	pango_attr_list_unref (attr_list);
+
+	gtk_label_set_xalign (GTK_LABEL (lbl), 0.0);
+	gtk_label_set_ellipsize (GTK_LABEL (lbl), PANGO_ELLIPSIZE_END);
+	gtk_box_pack_start (GTK_BOX (progress_vbox), lbl, TRUE, TRUE, 0);
+
+	gtk_widget_show_all (hbox);
+
+	progress_dialog_update_action_description (window);
+
+	/* signals */
+
+	g_signal_connect (G_OBJECT (window->priv->progress_dialog),
+			  "response",
+			  G_CALLBACK (progress_dialog_response),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->progress_dialog),
+			  "delete_event",
+			  G_CALLBACK (progress_dialog_delete_event),
+			  window);
+}
+
+static gboolean
+display_progress_dialog (gpointer data)
+{
+	FrWindow *window = data;
+
+	if (window->priv->progress_timeout != 0)
+		g_source_remove (window->priv->progress_timeout);
+
+	if (window->priv->use_progress_dialog && (window->priv->progress_dialog != NULL)) {
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog),
+						   GTK_RESPONSE_OK,
+						   window->priv->stoppable);
+		if (! window->priv->non_interactive)
+			gtk_widget_show (GTK_WIDGET (window));
+		gtk_widget_hide (window->priv->progress_bar);
+		gtk_widget_show (window->priv->progress_dialog);
+		fr_window_message_cb (NULL, window->priv->pd_last_message, window);
+	}
+
+	window->priv->progress_timeout = 0;
+
+	return FALSE;
+}
+
+static void
+open_progress_dialog (FrWindow *window,
+		      gboolean  open_now)
+{
+	if (window->priv->hide_progress_timeout != 0) {
+		g_source_remove (window->priv->hide_progress_timeout);
+		window->priv->hide_progress_timeout = 0;
+	}
+
+	if (open_now) {
+		if (window->priv->progress_timeout != 0)
+			g_source_remove (window->priv->progress_timeout);
+		window->priv->progress_timeout = 0;
+	}
+
+	if ((window->priv->progress_timeout != 0)
+	    || ((window->priv->progress_dialog != NULL) && gtk_widget_get_visible (window->priv->progress_dialog)))
+		return;
+
+	if (! window->priv->batch_mode && ! open_now)
+		gtk_widget_show (window->priv->progress_bar);
+
+	create_the_progress_dialog (window);
+	gtk_widget_show (window->priv->pd_cancel_button);
+	gtk_widget_show (window->priv->pd_state_button);
+	gtk_widget_hide (window->priv->pd_open_archive_button);
+	gtk_widget_hide (window->priv->pd_open_destination_button);
+	gtk_widget_hide (window->priv->pd_open_destination_and_quit_button);
+	gtk_widget_hide (window->priv->pd_quit_button);
+	gtk_widget_hide (window->priv->pd_close_button);
+
+	if (open_now)
+		display_progress_dialog (window);
+	else
+		window->priv->progress_timeout = g_timeout_add (PROGRESS_TIMEOUT_MSECS,
+								display_progress_dialog,
+								window);
+}
+
+static gboolean
+fr_window_progress_cb (FrArchive *archive,
+		       double     fraction,
+		       FrWindow  *window)
+{
+	window->priv->progress_pulse = (fraction < 0.0);
+	if (! window->priv->progress_pulse) {
+		fraction = CLAMP (fraction, 0.0, 1.0);
+		if (window->priv->progress_dialog != NULL)
+			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->pd_progress_bar), fraction);
+		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress_bar), fraction);
+
+		if ((archive != NULL) && (archive->command != NULL) && (archive->command->n_files > 0)) {
+			char *message = NULL;
+			gulong remaining_files;
+
+			remaining_files = (gulong) (archive->command->n_files - archive->command->n_file + 1);
+
+			switch (window->priv->action) {
+			case FR_ACTION_ADDING_FILES:
+			case FR_ACTION_EXTRACTING_FILES:
+			case FR_ACTION_DELETING_FILES:
+				message = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+				                                        "%lu file remaining",
+				                                        "%lu files remaining",
+			                                                remaining_files),
+				                           remaining_files);
+				break;
+			default:
+				break;
+			}
+
+			if (message != NULL)
+				fr_command_message (archive->command, message);
+		}
+
+		window->priv->pd_last_fraction = fraction;
+
+		g_signal_emit (G_OBJECT (window),
+			       fr_window_signals[PROGRESS],
+			       0,
+			       window->priv->pd_last_fraction,
+			       window->priv->pd_last_message);
+
+#ifdef LOG_PROGRESS
+		g_print ("progress > %2.2f\n", fraction);
+#endif
+	}
+	return TRUE;
+}
+
+static void
+open_progress_dialog_with_open_destination (FrWindow *window)
+{
+	window->priv->ask_to_open_destination_after_extraction = FALSE;
+
+	if (window->priv->hide_progress_timeout != 0) {
+		g_source_remove (window->priv->hide_progress_timeout);
+		window->priv->hide_progress_timeout = 0;
+	}
+	if (window->priv->progress_timeout != 0) {
+		g_source_remove (window->priv->progress_timeout);
+		window->priv->progress_timeout = 0;
+	}
+
+	create_the_progress_dialog (window);
+	gtk_widget_hide (window->priv->pd_cancel_button);
+	gtk_widget_hide (window->priv->pd_state_button);
+	gtk_widget_hide (window->priv->pd_open_archive_button);
+	gtk_widget_show (window->priv->pd_open_destination_button);
+	gtk_widget_show (window->priv->pd_open_destination_and_quit_button);
+	gtk_widget_show (window->priv->pd_quit_button);
+	gtk_widget_show (window->priv->pd_close_button);
+	display_progress_dialog (window);
+	fr_window_progress_cb (NULL, 1.0, window);
+	fr_window_message_cb (NULL, _("Extraction completed successfully"), window);
+
+	if (window->priv->close_dialog)
+		close_progress_dialog (window, TRUE);
+
+}
+
+static void
+open_progress_dialog_with_open_archive (FrWindow *window)
+{
+	if (window->priv->hide_progress_timeout != 0) {
+		g_source_remove (window->priv->hide_progress_timeout);
+		window->priv->hide_progress_timeout = 0;
+	}
+	if (window->priv->progress_timeout != 0) {
+		g_source_remove (window->priv->progress_timeout);
+		window->priv->progress_timeout = 0;
+	}
+
+	create_the_progress_dialog (window);
+	gtk_widget_hide (window->priv->pd_cancel_button);
+	gtk_widget_hide (window->priv->pd_state_button);
+	gtk_widget_hide (window->priv->pd_open_destination_button);
+	gtk_widget_hide (window->priv->pd_open_destination_and_quit_button);
+	gtk_widget_show (window->priv->pd_open_archive_button);
+	gtk_widget_show (window->priv->pd_close_button);
+	display_progress_dialog (window);
+	fr_window_progress_cb (NULL, 1.0, window);
+	fr_window_message_cb (NULL, _("Archive created successfully"), window);
+}
+
+void
+fr_window_push_message (FrWindow   *window,
+			const char *msg)
+{
+	if (! gtk_widget_get_mapped (GTK_WIDGET (window)))
+		return;
+
+	gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
+			    window->priv->progress_cid,
+			    msg);
+}
+
+void
+fr_window_pop_message (FrWindow *window)
+{
+	if (! gtk_widget_get_mapped (GTK_WIDGET (window)))
+		return;
+	gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), window->priv->progress_cid);
+	if (window->priv->progress_dialog != NULL)
+		gtk_label_set_text (GTK_LABEL (window->priv->pd_message), "");
+}
+
+static void
+action_started (FrArchive *archive,
+		FrAction   action,
+		gpointer   data)
+{
+	FrWindow *window = data;
+	char     *message;
+
+	window->priv->action = action;
+	fr_window_start_activity_mode (window);
+
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [START] (FR::Window)\n", get_action_name (action));
+#endif
+
+	message = get_action_description (action, window->priv->pd_last_archive);
+	fr_window_push_message (window, message);
+	g_free (message);
+
+	switch (action) {
+	case FR_ACTION_EXTRACTING_FILES:
+		open_progress_dialog (window, window->priv->ask_to_open_destination_after_extraction || window->priv->convert_data.converting || window->priv->batch_mode);
+		break;
+	default:
+		open_progress_dialog (window, window->priv->batch_mode);
+		break;
+	}
+
+	if (archive->command != NULL) {
+		fr_command_progress (archive->command, -1.0);
+		fr_command_message (archive->command, _("Please wait…"));
+	}
+}
+
+static void
+fr_window_add_to_recent_list (FrWindow *window,
+			      char     *uri)
+{
+	if (window->priv->batch_mode)
+		return;
+
+	if (is_temp_dir (uri))
+		return;
+
+	if (window->archive->content_type != NULL) {
+		GtkRecentData *recent_data;
+
+		recent_data = g_new0 (GtkRecentData, 1);
+		recent_data->mime_type = g_content_type_get_mime_type (window->archive->content_type);
+		recent_data->app_name = "Engrampa";
+		recent_data->app_exec = "engrampa";
+		gtk_recent_manager_add_full (gtk_recent_manager_get_default (), uri, recent_data);
+
+		g_free (recent_data->mime_type);
+		g_free (recent_data);
+	}
+	else
+		gtk_recent_manager_add_item (gtk_recent_manager_get_default (), uri);
+}
+
+static void
+fr_window_remove_from_recent_list (FrWindow *window,
+				   char     *filename)
+{
+	if (filename != NULL)
+		gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), filename, NULL);
+}
+
+static void
+error_dialog_response_cb (GtkDialog *dialog,
+			  gint       arg1,
+			  gpointer   user_data)
+{
+	FrWindow  *window = user_data;
+	GtkWindow *dialog_parent = window->priv->error_dialog_parent;
+
+	window->priv->showing_error_dialog = FALSE;
+	window->priv->error_dialog_parent = NULL;
+
+	if ((dialog_parent != NULL) && (gtk_widget_get_toplevel (GTK_WIDGET (dialog_parent)) != (GtkWidget*) dialog_parent))
+		gtk_window_set_modal (dialog_parent, TRUE);
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+
+	if (window->priv->destroy_with_error_dialog)
+		gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+static void
+fr_window_show_error_dialog (FrWindow   *window,
+			     GtkWidget  *dialog,
+			     GtkWindow  *dialog_parent,
+			     const char *details)
+{
+	if (window->priv->batch_mode && ! window->priv->use_progress_dialog) {
+		GError *error;
+
+		error = g_error_new_literal (FR_ERROR, FR_PROC_ERROR_GENERIC, details ? details : _("Command exited abnormally."));
+		g_signal_emit (window,
+			       fr_window_signals[READY],
+			       0,
+			       error);
+
+		gtk_widget_destroy (GTK_WIDGET (window));
+
+		return;
+	}
+
+	close_progress_dialog (window, TRUE);
+
+	if (window->priv->batch_mode)
+		fr_window_destroy_with_error_dialog (window);
+
+	if (dialog_parent != NULL)
+		gtk_window_set_modal (dialog_parent, FALSE);
+	g_signal_connect (dialog,
+			  "response",
+			  G_CALLBACK (error_dialog_response_cb),
+			  window);
+	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+	gtk_widget_show (dialog);
+
+	window->priv->showing_error_dialog = TRUE;
+	window->priv->error_dialog_parent = dialog_parent;
+}
+
+void
+fr_window_destroy_with_error_dialog (FrWindow *window)
+{
+	window->priv->destroy_with_error_dialog = TRUE;
+}
+
+static gboolean
+handle_errors (FrWindow    *window,
+	       FrArchive   *archive,
+	       FrAction     action,
+	       FrProcError *error)
+{
+	if (error->type == FR_PROC_ERROR_ASK_PASSWORD) {
+		close_progress_dialog (window, TRUE);
+		dlg_ask_password (window);
+		return FALSE;
+	}
+	else if (error->type == FR_PROC_ERROR_UNSUPPORTED_FORMAT) {
+		close_progress_dialog (window, TRUE);
+		dlg_package_installer (window, archive, action);
+		return FALSE;
+	}
+#if 0
+	else if (error->type == FR_PROC_ERROR_BAD_CHARSET) {
+		close_progress_dialog (window, TRUE);
+		/* dlg_ask_archive_charset (window); FIXME: implement after feature freeze */
+		return FALSE;
+	}
+#endif
+	else if (error->type == FR_PROC_ERROR_STOPPED) {
+		/* nothing */
+	}
+	else if (error->type != FR_PROC_ERROR_NONE) {
+		char      *msg = NULL;
+		char      *utf8_name;
+		char      *details = NULL;
+		GtkWindow *dialog_parent;
+		GtkWidget *dialog;
+		FrProcess *process = archive->process;
+		GList     *output = NULL;
+
+		if (window->priv->batch_mode) {
+			dialog_parent = NULL;
+			window->priv->load_error_parent_window = NULL;
+		}
+		else {
+			dialog_parent = (GtkWindow *) window;
+			if (window->priv->load_error_parent_window == NULL)
+				window->priv->load_error_parent_window = (GtkWindow *) window;
+		}
+
+		if ((action == FR_ACTION_LISTING_CONTENT) || (action == FR_ACTION_LOADING_ARCHIVE))
+			fr_window_archive_close (window);
+
+		switch (action) {
+		case FR_ACTION_CREATING_NEW_ARCHIVE:
+			dialog_parent = window->priv->load_error_parent_window;
+			msg = _("Could not create the archive");
+			break;
+
+		case FR_ACTION_EXTRACTING_FILES:
+		case FR_ACTION_COPYING_FILES_TO_REMOTE:
+			msg = _("An error occurred while extracting files.");
+			break;
+
+		case FR_ACTION_LOADING_ARCHIVE:
+			dialog_parent = window->priv->load_error_parent_window;
+			utf8_name = g_uri_display_basename (window->priv->archive_uri);
+			msg = g_strdup_printf (_("Could not open \"%s\""), utf8_name);
+			g_free (utf8_name);
+			break;
+
+		case FR_ACTION_LISTING_CONTENT:
+			msg = _("An error occurred while loading the archive.");
+			break;
+
+		case FR_ACTION_DELETING_FILES:
+			msg = _("An error occurred while deleting files from the archive.");
+			break;
+
+		case FR_ACTION_ADDING_FILES:
+		case FR_ACTION_GETTING_FILE_LIST:
+		case FR_ACTION_COPYING_FILES_FROM_REMOTE:
+			msg = _("An error occurred while adding files to the archive.");
+			break;
+
+		case FR_ACTION_TESTING_ARCHIVE:
+			msg = _("An error occurred while testing archive.");
+			break;
+
+		case FR_ACTION_SAVING_REMOTE_ARCHIVE:
+			msg = _("An error occurred while saving the archive.");
+			break;
+
+		default:
+			msg = _("An error occurred.");
+			break;
+		}
+
+		switch (error->type) {
+		case FR_PROC_ERROR_COMMAND_NOT_FOUND:
+			details = _("Command not found.");
+			break;
+		case FR_PROC_ERROR_EXITED_ABNORMALLY:
+			details = _("Command exited abnormally.");
+			break;
+		case FR_PROC_ERROR_SPAWN:
+			details = error->gerror->message;
+			break;
+		default:
+			if (error->gerror != NULL)
+				details = error->gerror->message;
+			else
+				details = NULL;
+			break;
+		}
+
+		if (error->type != FR_PROC_ERROR_GENERIC)
+			output = (process->err.raw != NULL) ? process->err.raw : process->out.raw;
+
+		dialog = _gtk_error_dialog_new (dialog_parent,
+						0,
+						output,
+						msg,
+						((details != NULL) ? "%s" : NULL),
+						details);
+		fr_window_show_error_dialog (window, dialog, dialog_parent, details);
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void
+convert__action_performed (FrArchive   *archive,
+			   FrAction     action,
+			   FrProcError *error,
+			   gpointer     data)
+{
+	FrWindow *window = data;
+
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [CONVERT::DONE] (FR::Window)\n", get_action_name (action));
+#endif
+
+	if ((action == FR_ACTION_GETTING_FILE_LIST) || (action == FR_ACTION_ADDING_FILES)) {
+		fr_window_stop_activity_mode (window);
+		fr_window_pop_message (window);
+		close_progress_dialog (window, FALSE);
+	}
+
+	if (action != FR_ACTION_ADDING_FILES)
+		return;
+
+	handle_errors (window, archive, action, error);
+
+	if (error->type == FR_PROC_ERROR_NONE)
+		open_progress_dialog_with_open_archive (window);
+
+	remove_local_directory (window->priv->convert_data.temp_dir);
+	fr_window_convert_data_free (window, FALSE);
+
+	fr_window_update_sensitivity (window);
+	fr_window_update_statusbar_list_info (window);
+}
+
+static void fr_window_exec_next_batch_action (FrWindow *window);
+
+static void
+action_performed (FrArchive   *archive,
+		  FrAction     action,
+		  FrProcError *error,
+		  gpointer     data)
+{
+	FrWindow *window = data;
+	gboolean  continue_batch = FALSE;
+	char     *archive_dir;
+	gboolean  temp_dir;
+
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [DONE] (FR::Window)\n", get_action_name (action));
+#endif
+
+	fr_window_stop_activity_mode (window);
+	fr_window_pop_message (window);
+
+	continue_batch = handle_errors (window, archive, action, error);
+
+	if ((error->type == FR_PROC_ERROR_ASK_PASSWORD)
+	    || (error->type == FR_PROC_ERROR_UNSUPPORTED_FORMAT)
+	    /*|| (error->type == FR_PROC_ERROR_BAD_CHARSET)*/)
+	{
+		return;
+	}
+
+	switch (action) {
+	case FR_ACTION_CREATING_NEW_ARCHIVE:
+	case FR_ACTION_CREATING_ARCHIVE:
+		close_progress_dialog (window, FALSE);
+		if (error->type != FR_PROC_ERROR_STOPPED) {
+			fr_window_history_clear (window);
+			fr_window_go_to_location (window, "/", TRUE);
+			fr_window_update_dir_tree (window);
+			fr_window_update_title (window);
+			fr_window_update_sensitivity (window);
+		}
+		break;
+
+	case FR_ACTION_LOADING_ARCHIVE:
+		close_progress_dialog (window, FALSE);
+		if (error->type != FR_PROC_ERROR_NONE) {
+			fr_window_remove_from_recent_list (window, window->priv->archive_uri);
+			if (window->priv->non_interactive) {
+				fr_window_archive_close (window);
+				fr_window_stop_batch (window);
+			}
+		}
+		else {
+			fr_window_add_to_recent_list (window, window->priv->archive_uri);
+			if (! window->priv->non_interactive)
+				gtk_window_present (GTK_WINDOW (window));
+		}
+		continue_batch = FALSE;
+		g_signal_emit (window,
+			       fr_window_signals[ARCHIVE_LOADED],
+			       0,
+			       error->type == FR_PROC_ERROR_NONE);
+		break;
+
+	case FR_ACTION_LISTING_CONTENT:
+		/* update the uri because multi-volume archives can have
+		 * a different name after loading. */
+		g_free (window->priv->archive_uri);
+		window->priv->archive_uri = g_file_get_uri (window->archive->file);
+
+		close_progress_dialog (window, FALSE);
+		if (error->type != FR_PROC_ERROR_NONE) {
+			fr_window_remove_from_recent_list (window, window->priv->archive_uri);
+			fr_window_archive_close (window);
+			fr_window_set_password (window, NULL);
+			break;
+		}
+
+		archive_dir = remove_level_from_path (window->priv->archive_uri);
+		temp_dir = is_temp_dir (archive_dir);
+		if (! window->priv->archive_present) {
+			window->priv->archive_present = TRUE;
+
+			fr_window_history_clear (window);
+			fr_window_history_add (window, "/");
+
+			if (! temp_dir) {
+				fr_window_set_open_default_dir (window, archive_dir);
+				fr_window_set_add_default_dir (window, archive_dir);
+				if (! window->priv->freeze_default_dir)
+					fr_window_set_extract_default_dir (window, archive_dir, FALSE);
+			}
+
+			window->priv->archive_new = FALSE;
+		}
+		g_free (archive_dir);
+
+		if (! temp_dir)
+			fr_window_add_to_recent_list (window, window->priv->archive_uri);
+
+		fr_window_update_title (window);
+		fr_window_go_to_location (window, fr_window_get_current_location (window), TRUE);
+		fr_window_update_dir_tree (window);
+		if (! window->priv->batch_mode && window->priv->non_interactive)
+			gtk_window_present (GTK_WINDOW (window));
+		break;
+
+	case FR_ACTION_DELETING_FILES:
+		close_progress_dialog (window, FALSE);
+		if (error->type != FR_PROC_ERROR_STOPPED)
+			fr_window_archive_reload (window);
+		return;
+
+	case FR_ACTION_ADDING_FILES:
+		close_progress_dialog (window, FALSE);
+
+		/* update the uri because multi-volume archives can have
+		 * a different name after creation. */
+		g_free (window->priv->archive_uri);
+		window->priv->archive_uri = g_file_get_uri (window->archive->file);
+
+		if (error->type == FR_PROC_ERROR_NONE) {
+			if (window->priv->archive_new)
+				window->priv->archive_new = FALSE;
+			fr_window_add_to_recent_list (window, window->priv->archive_uri);
+		}
+		if (! window->priv->batch_mode && (error->type != FR_PROC_ERROR_STOPPED)) {
+			fr_window_archive_reload (window);
+			return;
+		}
+		break;
+
+	case FR_ACTION_TESTING_ARCHIVE:
+		close_progress_dialog (window, FALSE);
+		if (error->type == FR_PROC_ERROR_NONE)
+			fr_window_view_last_output (window, _("Test Result"));
+		return;
+
+	case FR_ACTION_EXTRACTING_FILES:
+		if (error->type != FR_PROC_ERROR_NONE) {
+			if (window->priv->convert_data.converting) {
+				remove_local_directory (window->priv->convert_data.temp_dir);
+				fr_window_convert_data_free (window, TRUE);
+			}
+			break;
+		}
+		if (window->priv->convert_data.converting) {
+			char *source_dir;
+
+			source_dir = g_filename_to_uri (window->priv->convert_data.temp_dir, NULL, NULL);
+			fr_archive_add_with_wildcard (
+				  window->priv->convert_data.new_archive,
+				  "*",
+				  NULL,
+				  NULL,
+				  source_dir,
+				  NULL,
+				  FALSE,
+				  TRUE,
+				  window->priv->convert_data.password,
+				  window->priv->convert_data.encrypt_header,
+				  window->priv->compression,
+				  window->priv->convert_data.volume_size);
+			g_free (source_dir);
+		}
+		else {
+			if (window->priv->ask_to_open_destination_after_extraction)
+				open_progress_dialog_with_open_destination (window);
+			else
+				close_progress_dialog (window, FALSE);
+		}
+		break;
+
+	default:
+		close_progress_dialog (window, FALSE);
+		continue_batch = FALSE;
+		break;
+	}
+
+	if (window->priv->batch_action == NULL) {
+		fr_window_update_sensitivity (window);
+		fr_window_update_statusbar_list_info (window);
+	}
+
+	if (continue_batch) {
+		if (error->type != FR_PROC_ERROR_NONE)
+			fr_window_stop_batch (window);
+		else
+			fr_window_exec_next_batch_action (window);
+	}
+}
+
+/* -- selections -- */
+
+#undef DEBUG_GET_DIR_LIST_FROM_PATH
+
+static GList *
+get_dir_list_from_path (FrWindow *window,
+	      		char     *path)
+{
+	char  *dirname;
+	int    dirname_l;
+	GList *list = NULL;
+	guint  i;
+
+	if (path[strlen (path) - 1] != '/')
+		dirname = g_strconcat (path, "/", NULL);
+	else
+		dirname = g_strdup (path);
+	dirname_l = strlen (dirname);
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+		gboolean  matches = FALSE;
+
+#ifdef DEBUG_GET_DIR_LIST_FROM_PATH
+		g_print ("%s <=> %s (%d)\n", dirname, fd->full_path, dirname_l);
+#endif
+
+		if (fd->dir) {
+			int full_path_l = strlen (fd->full_path);
+			if ((full_path_l == dirname_l - 1) && (strncmp (dirname, fd->full_path, full_path_l) == 0))
+				/* example: dirname is '/path/to/dir/' and fd->full_path is '/path/to/dir' */
+				matches = TRUE;
+			else if (strcmp (dirname, fd->full_path) == 0)
+				matches = TRUE;
+		}
+
+		if (! matches && strncmp (dirname, fd->full_path, dirname_l) == 0) {
+			matches = TRUE;
+		}
+
+		if (matches) {
+#ifdef DEBUG_GET_DIR_LIST_FROM_PATH
+			g_print ("`-> OK\n");
+#endif
+			list = g_list_prepend (list, g_strdup (fd->original_path));
+		}
+	}
+	g_free (dirname);
+
+	return g_list_reverse (list);
+}
+
+static GList *
+get_dir_list_from_file_data (FrWindow *window,
+				   FileData *fdata)
+{
+	char  *dirname;
+	GList *list;
+
+	dirname = g_strconcat (fr_window_get_current_location (window),
+			       fdata->list_name,
+			       NULL);
+	list = get_dir_list_from_path (window, dirname);
+	g_free (dirname);
+
+	return list;
+}
+
+GList *
+fr_window_get_file_list_selection (FrWindow *window,
+				   gboolean  recursive,
+				   gboolean *has_dirs)
+{
+	GtkTreeSelection *selection;
+	GList            *selections = NULL, *list, *scan;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	if (has_dirs != NULL)
+		*has_dirs = FALSE;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (selection == NULL)
+		return NULL;
+	gtk_tree_selection_selected_foreach (selection, add_selected_from_list_view, &selections);
+
+	list = NULL;
+	for (scan = selections; scan; scan = scan->next) {
+		FileData *fd = scan->data;
+
+		if (!fd)
+			continue;
+
+		if (file_data_is_dir (fd)) {
+			if (has_dirs != NULL)
+				*has_dirs = TRUE;
+
+			if (recursive)
+				list = g_list_concat (list, get_dir_list_from_file_data (window, fd));
+		}
+		else
+			list = g_list_prepend (list, g_strdup (fd->original_path));
+	}
+	if (selections)
+		g_list_free (selections);
+
+	return g_list_reverse (list);
+}
+
+GList *
+fr_window_get_folder_tree_selection (FrWindow *window,
+				     gboolean  recursive,
+				     gboolean *has_dirs)
+{
+	GtkTreeSelection *tree_selection;
+	GList            *selections, *list, *scan;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	if (has_dirs != NULL)
+		*has_dirs = FALSE;
+
+	tree_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
+	if (tree_selection == NULL)
+		return NULL;
+
+	selections = NULL;
+	gtk_tree_selection_selected_foreach (tree_selection, add_selected_from_tree_view, &selections);
+	if (selections == NULL)
+		return NULL;
+
+	if (has_dirs != NULL)
+		*has_dirs = TRUE;
+
+	list = NULL;
+	for (scan = selections; scan; scan = scan->next) {
+		char *path = scan->data;
+
+		if (recursive)
+			list = g_list_concat (list, get_dir_list_from_path (window, path));
+	}
+	path_list_free (selections);
+
+	return g_list_reverse (list);
+}
+
+GList *
+fr_window_get_file_list_from_path_list (FrWindow *window,
+					GList    *path_list,
+					gboolean *has_dirs)
+{
+	GtkTreeModel *model;
+	GList        *selections, *list, *scan;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	model = GTK_TREE_MODEL (window->priv->list_store);
+	selections = NULL;
+
+	if (has_dirs != NULL)
+		*has_dirs = FALSE;
+
+	for (scan = path_list; scan; scan = scan->next) {
+		GtkTreeRowReference *reference = scan->data;
+		GtkTreePath         *path;
+		GtkTreeIter          iter;
+		FileData            *fdata;
+
+		path = gtk_tree_row_reference_get_path (reference);
+		if (path == NULL)
+			continue;
+
+		if (! gtk_tree_model_get_iter (model, &iter, path))
+			continue;
+
+		gtk_tree_model_get (model, &iter,
+				    COLUMN_FILE_DATA, &fdata,
+				    -1);
+
+		selections = g_list_prepend (selections, fdata);
+	}
+
+	list = NULL;
+	for (scan = selections; scan; scan = scan->next) {
+		FileData *fd = scan->data;
+
+		if (!fd)
+			continue;
+
+		if (file_data_is_dir (fd)) {
+			if (has_dirs != NULL)
+				*has_dirs = TRUE;
+			list = g_list_concat (list, get_dir_list_from_file_data (window, fd));
+		}
+		else
+			list = g_list_prepend (list, g_strdup (fd->original_path));
+	}
+
+	if (selections != NULL)
+		g_list_free (selections);
+
+	return g_list_reverse (list);
+}
+
+GList *
+fr_window_get_file_list_pattern (FrWindow    *window,
+				 const char  *pattern)
+{
+	GRegex **regexps;
+	GList   *list;
+	guint    i;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	regexps = search_util_get_regexps (pattern, G_REGEX_CASELESS);
+	list = NULL;
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+		char     *utf8_name;
+
+		/* FIXME: only files in the current location ? */
+
+		if (fd == NULL)
+			continue;
+
+		utf8_name = g_filename_to_utf8 (fd->name, -1, NULL, NULL, NULL);
+		if (match_regexps (regexps, utf8_name, 0))
+			list = g_list_prepend (list, g_strdup (fd->original_path));
+		g_free (utf8_name);
+	}
+	free_regexps (regexps);
+
+	return g_list_reverse (list);
+}
+
+static GList *
+fr_window_get_file_list (FrWindow *window)
+{
+	GList *list;
+	guint  i;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	list = NULL;
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+		list = g_list_prepend (list, g_strdup (fd->original_path));
+	}
+
+	return g_list_reverse (list);
+}
+
+int
+fr_window_get_n_selected_files (FrWindow *window)
+{
+	return gtk_tree_selection_count_selected_rows (gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view)));
+}
+
+/**/
+
+static int
+dir_tree_button_press_cb (GtkWidget      *widget,
+			  GdkEventButton *event,
+			  gpointer        data)
+{
+	FrWindow         *window = data;
+	GtkTreeSelection *selection;
+
+	if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->tree_view)))
+		return FALSE;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
+	if (selection == NULL)
+		return FALSE;
+
+	if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) {
+		GtkTreePath *path;
+		GtkTreeIter  iter;
+
+		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->tree_view),
+						   (int) event->x, (int) event->y,
+						   &path, NULL, NULL, NULL)) {
+
+			if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->tree_store), &iter, path)) {
+				gtk_tree_path_free (path);
+				return FALSE;
+			}
+			gtk_tree_path_free (path);
+
+			if (! gtk_tree_selection_iter_is_selected (selection, &iter)) {
+				gtk_tree_selection_unselect_all (selection);
+				gtk_tree_selection_select_iter (selection, &iter);
+			}
+
+			gtk_menu_popup_at_pointer (GTK_MENU (window->priv->sidebar_folder_popup_menu),
+			                           (const GdkEvent*) event);
+		}
+		else
+			gtk_tree_selection_unselect_all (selection);
+
+		return TRUE;
+	}
+	else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 8)) {
+		fr_window_go_back (window);
+		return TRUE;
+	}
+	else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 9)) {
+		fr_window_go_forward (window);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static FileData *
+fr_window_get_selected_item_from_file_list (FrWindow *window)
+{
+	GtkTreeSelection *tree_selection;
+	GList            *selection;
+	FileData         *fdata = NULL;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	tree_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (tree_selection == NULL)
+		return NULL;
+
+	selection = NULL;
+	gtk_tree_selection_selected_foreach (tree_selection, add_selected_from_list_view, &selection);
+	if ((selection == NULL) || (selection->next != NULL)) {
+		/* return NULL if the selection contains more than one entry. */
+		g_list_free (selection);
+		return NULL;
+	}
+
+	fdata = file_data_copy (selection->data);
+	g_list_free (selection);
+
+	return fdata;
+}
+
+static char *
+fr_window_get_selected_folder_in_tree_view (FrWindow *window)
+{
+	GtkTreeSelection *tree_selection;
+	GList            *selections;
+	char             *path = NULL;
+
+	g_return_val_if_fail (window != NULL, NULL);
+
+	tree_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
+	if (tree_selection == NULL)
+		return NULL;
+
+	selections = NULL;
+	gtk_tree_selection_selected_foreach (tree_selection, add_selected_from_tree_view, &selections);
+
+	if (selections != NULL) {
+		path = selections->data;
+		g_list_free (selections);
+	}
+
+	return path;
+}
+
+void
+fr_window_current_folder_activated (FrWindow *window,
+				   gboolean   from_sidebar)
+{
+	char *dir_path;
+
+	if (! from_sidebar) {
+		FileData *fdata;
+		char     *dir_name;
+
+		fdata = fr_window_get_selected_item_from_file_list (window);
+		if ((fdata == NULL) || ! file_data_is_dir (fdata)) {
+			file_data_free (fdata);
+			return;
+		}
+		dir_name = g_strdup (fdata->list_name);
+		dir_path = g_strconcat (fr_window_get_current_location (window),
+					dir_name,
+					"/",
+					NULL);
+		g_free (dir_name);
+		file_data_free (fdata);
+	}
+	else
+		dir_path = fr_window_get_selected_folder_in_tree_view (window);
+
+	fr_window_go_to_location (window, dir_path, FALSE);
+
+	g_free (dir_path);
+}
+
+static gboolean
+row_activated_cb (GtkTreeView       *tree_view,
+		  GtkTreePath       *path,
+		  GtkTreeViewColumn *column,
+		  gpointer           data)
+{
+	FrWindow    *window = data;
+	FileData    *fdata;
+	GtkTreeIter  iter;
+
+	if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
+				       &iter,
+				       path))
+		return FALSE;
+
+	gtk_tree_model_get (GTK_TREE_MODEL (window->priv->list_store), &iter,
+			    COLUMN_FILE_DATA, &fdata,
+			    -1);
+
+	if (! file_data_is_dir (fdata)) {
+		GList *list = g_list_prepend (NULL, fdata->original_path);
+		fr_window_open_files (window, list, FALSE);
+		g_list_free (list);
+	}
+	else if (window->priv->list_mode == FR_WINDOW_LIST_MODE_AS_DIR) {
+		char *new_dir;
+		new_dir = g_strconcat (fr_window_get_current_location (window),
+				       fdata->list_name,
+				       "/",
+				       NULL);
+		fr_window_go_to_location (window, new_dir, FALSE);
+		g_free (new_dir);
+	}
+
+	return FALSE;
+}
+
+static int
+file_button_press_cb (GtkWidget      *widget,
+		      GdkEventButton *event,
+		      gpointer        data)
+{
+	FrWindow         *window = data;
+	GtkTreeSelection *selection;
+
+	if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
+		return FALSE;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (selection == NULL)
+		return FALSE;
+
+	if (window->priv->path_clicked != NULL) {
+		gtk_tree_path_free (window->priv->path_clicked);
+		window->priv->path_clicked = NULL;
+	}
+
+	if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) {
+		GtkTreePath *path;
+		GtkTreeIter  iter;
+		int          n_selected;
+
+		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
+						   (int) event->x, (int) event->y,
+						   &path, NULL, NULL, NULL)) {
+
+			if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store), &iter, path)) {
+				gtk_tree_path_free (path);
+				return FALSE;
+			}
+			gtk_tree_path_free (path);
+
+			if (! gtk_tree_selection_iter_is_selected (selection, &iter)) {
+				gtk_tree_selection_unselect_all (selection);
+				gtk_tree_selection_select_iter (selection, &iter);
+			}
+		}
+		else
+			gtk_tree_selection_unselect_all (selection);
+
+		n_selected = fr_window_get_n_selected_files (window);
+		if ((n_selected == 1) && selection_has_a_dir (window))
+			gtk_menu_popup_at_pointer (GTK_MENU (window->priv->folder_popup_menu),
+			                           (const GdkEvent*) event);
+		else
+			gtk_menu_popup_at_pointer (GTK_MENU (window->priv->file_popup_menu),
+			                           (const GdkEvent*) event);
+		return TRUE;
+	}
+	else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 1)) {
+		GtkTreePath *path = NULL;
+
+		if (! gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
+						     (int) event->x, (int) event->y,
+						     &path, NULL, NULL, NULL)) {
+			gtk_tree_selection_unselect_all (selection);
+		}
+
+		if (window->priv->path_clicked != NULL) {
+			gtk_tree_path_free (window->priv->path_clicked);
+			window->priv->path_clicked = NULL;
+		}
+
+		if (path != NULL) {
+			window->priv->path_clicked = gtk_tree_path_copy (path);
+			gtk_tree_path_free (path);
+		}
+
+		return FALSE;
+	}
+	else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 8)) {
+		// go back
+		fr_window_go_back (window);
+		return TRUE;
+	}
+	else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 9)) {
+		// go forward
+		fr_window_go_forward (window);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static int
+file_button_release_cb (GtkWidget      *widget,
+			GdkEventButton *event,
+			gpointer        data)
+{
+	FrWindow         *window = data;
+	GtkTreeSelection *selection;
+
+	if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
+		return FALSE;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	if (selection == NULL)
+		return FALSE;
+
+	if (window->priv->path_clicked == NULL)
+		return FALSE;
+
+	if ((event->type == GDK_BUTTON_RELEASE)
+	    && (event->button == 1)
+	    && (window->priv->path_clicked != NULL)) {
+		GtkTreePath *path = NULL;
+
+		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
+						   (int) event->x, (int) event->y,
+						   &path, NULL, NULL, NULL)) {
+
+			if ((gtk_tree_path_compare (window->priv->path_clicked, path) == 0)
+			    && window->priv->single_click
+			    && ! ((event->state & GDK_CONTROL_MASK) || (event->state & GDK_SHIFT_MASK))) {
+				gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget),
+							  path,
+							  NULL,
+							  FALSE);
+				gtk_tree_view_row_activated (GTK_TREE_VIEW (widget),
+							     path,
+							     NULL);
+			}
+		}
+
+		if (path != NULL)
+			gtk_tree_path_free (path);
+	}
+
+	if (window->priv->path_clicked != NULL) {
+		gtk_tree_path_free (window->priv->path_clicked);
+		window->priv->path_clicked = NULL;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+file_motion_notify_callback (GtkWidget *widget,
+			     GdkEventMotion *event,
+			     gpointer user_data)
+{
+	FrWindow    *window = user_data;
+	GdkCursor   *cursor;
+	GtkTreePath *last_hover_path;
+	GdkDisplay  *display;
+	GtkTreeIter  iter;
+
+	if (! window->priv->single_click)
+		return FALSE;
+
+	if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view)))
+		return FALSE;
+
+	last_hover_path = window->priv->list_hover_path;
+
+	gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
+				       (int) event->x, (int) event->y,
+				       &window->priv->list_hover_path,
+				       NULL, NULL, NULL);
+
+	display = gtk_widget_get_display (GTK_WIDGET (widget));
+
+	if (window->priv->list_hover_path != NULL)
+		cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+	else
+		cursor = NULL;
+
+	gdk_window_set_cursor (event->window, cursor);
+
+	/* only redraw if the hover row has changed */
+	if (!(last_hover_path == NULL && window->priv->list_hover_path == NULL) &&
+	    (!(last_hover_path != NULL && window->priv->list_hover_path != NULL) ||
+	     gtk_tree_path_compare (last_hover_path, window->priv->list_hover_path)))
+	{
+		if (last_hover_path) {
+			gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
+						 &iter, last_hover_path);
+			gtk_tree_model_row_changed (GTK_TREE_MODEL (window->priv->list_store),
+						    last_hover_path, &iter);
+		}
+
+		if (window->priv->list_hover_path) {
+			gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
+						 &iter, window->priv->list_hover_path);
+			gtk_tree_model_row_changed (GTK_TREE_MODEL (window->priv->list_store),
+						    window->priv->list_hover_path, &iter);
+		}
+	}
+
+	gtk_tree_path_free (last_hover_path);
+
+ 	return FALSE;
+}
+
+static gboolean
+file_leave_notify_callback (GtkWidget *widget,
+			    GdkEventCrossing *event,
+			    gpointer user_data)
+{
+	FrWindow    *window = user_data;
+	GtkTreeIter  iter;
+
+	if (window->priv->single_click && (window->priv->list_hover_path != NULL)) {
+		gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
+					 &iter,
+					 window->priv->list_hover_path);
+		gtk_tree_model_row_changed (GTK_TREE_MODEL (window->priv->list_store),
+					    window->priv->list_hover_path,
+					    &iter);
+
+		gtk_tree_path_free (window->priv->list_hover_path);
+		window->priv->list_hover_path = NULL;
+	}
+
+	return FALSE;
+}
+
+/* -- drag and drop -- */
+
+static GList *
+get_uri_list_from_selection_data (char *uri_list)
+{
+	GList  *list = NULL;
+	char  **uris;
+	int     i;
+
+	if (uri_list == NULL)
+		return NULL;
+
+	uris = g_uri_list_extract_uris (uri_list);
+	for (i = 0; uris[i] != NULL; i++)
+		list = g_list_prepend (list, g_strdup (uris[i]));
+	g_strfreev (uris);
+
+	return g_list_reverse (list);
+}
+
+static gboolean
+fr_window_drag_motion (GtkWidget      *widget,
+		       GdkDragContext *context,
+		       gint            x,
+		       gint            y,
+		       guint           time,
+		       gpointer        user_data)
+{
+	FrWindow  *window = user_data;
+
+	if ((gtk_drag_get_source_widget (context) == window->priv->list_view)
+	    || (gtk_drag_get_source_widget (context) == window->priv->tree_view))
+	{
+		gdk_drag_status (context, 0, time);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void fr_window_paste_from_clipboard_data (FrWindow *window, FrClipboardData *data);
+
+static FrClipboardData*
+get_clipboard_data_from_selection_data (FrWindow   *window,
+					const char *data)
+{
+	FrClipboardData  *clipboard_data;
+	char            **uris;
+	int               i;
+
+	clipboard_data = fr_clipboard_data_new ();
+
+	uris = g_strsplit (data, "\r\n", -1);
+
+	clipboard_data->archive_filename = g_strdup (uris[0]);
+	if (window->priv->password_for_paste != NULL)
+		clipboard_data->archive_password = g_strdup (window->priv->password_for_paste);
+	else if (strcmp (uris[1], "") != 0)
+		clipboard_data->archive_password = g_strdup (uris[1]);
+	clipboard_data->op = (strcmp (uris[2], "copy") == 0) ? FR_CLIPBOARD_OP_COPY : FR_CLIPBOARD_OP_CUT;
+	clipboard_data->base_dir = g_strdup (uris[3]);
+	for (i = 4; uris[i] != NULL; i++)
+		if (uris[i][0] != '\0')
+			clipboard_data->files = g_list_prepend (clipboard_data->files, g_strdup (uris[i]));
+	clipboard_data->files = g_list_reverse (clipboard_data->files);
+
+	g_strfreev (uris);
+
+	return clipboard_data;
+}
+
+static void
+fr_window_drag_data_received  (GtkWidget          *widget,
+			       GdkDragContext     *context,
+			       gint                x,
+			       gint                y,
+			       GtkSelectionData   *data,
+			       guint               info,
+			       guint               time,
+			       gpointer            extra_data)
+{
+	FrWindow  *window = extra_data;
+	GList     *list;
+	gboolean   one_file;
+	gboolean   is_an_archive;
+
+	debug (DEBUG_INFO, "::DragDataReceived -->\n");
+
+	if ((gtk_drag_get_source_widget (context) == window->priv->list_view)
+	    || (gtk_drag_get_source_widget (context) == window->priv->tree_view))
+	{
+		gtk_drag_finish (context, FALSE, FALSE, time);
+		return;
+	}
+
+	if (! ((gtk_selection_data_get_length (data) >= 0) && (gtk_selection_data_get_format (data) == 8))) {
+		gtk_drag_finish (context, FALSE, FALSE, time);
+		return;
+	}
+
+	if (window->priv->activity_ref > 0) {
+		gtk_drag_finish (context, FALSE, FALSE, time);
+		return;
+	}
+
+	gtk_drag_finish (context, TRUE, FALSE, time);
+
+	if (gtk_selection_data_get_target (data) == XFR_ATOM) {
+		FrClipboardData *dnd_data;
+
+		dnd_data = get_clipboard_data_from_selection_data (window, (char*) gtk_selection_data_get_data (data));
+		dnd_data->current_dir = g_strdup (fr_window_get_current_location (window));
+		fr_window_paste_from_clipboard_data (window, dnd_data);
+
+		return;
+	}
+
+	list = get_uri_list_from_selection_data ((char*) gtk_selection_data_get_data (data));
+	if (list == NULL) {
+		GtkWidget *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_MODAL,
+					   NULL,
+					   _("Could not perform the operation"),
+					   NULL);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy(d);
+
+ 		return;
+	}
+
+	one_file = (list->next == NULL);
+	if (one_file)
+		is_an_archive = uri_is_archive (list->data);
+	else
+		is_an_archive = FALSE;
+
+	if (window->priv->archive_present
+	    && (window->archive != NULL)
+	    && ! window->archive->read_only
+	    && ! window->archive->is_compressed_file)
+	{
+		if (one_file && is_an_archive) {
+			GtkWidget *d;
+			gint       r;
+
+			d = _gtk_message_dialog_new (GTK_WINDOW (window),
+						     GTK_DIALOG_MODAL,
+						     "dialog-question",
+						     _("Do you want to add this file to the current archive or open it as a new archive?"),
+						     NULL,
+						     "gtk-cancel", GTK_RESPONSE_CANCEL,
+						     "gtk-add", 0,
+						     "gtk-open", 1,
+						     NULL);
+
+			gtk_dialog_set_default_response (GTK_DIALOG (d), 2);
+
+			r = gtk_dialog_run (GTK_DIALOG (d));
+			gtk_widget_destroy (GTK_WIDGET (d));
+
+			if (r == 0)  /* Add */
+				fr_window_archive_add_dropped_items (window, list, FALSE);
+			else if (r == 1)  /* Open */
+				fr_window_archive_open (window, list->data, GTK_WINDOW (window));
+ 		}
+ 		else
+			fr_window_archive_add_dropped_items (window, list, FALSE);
+	}
+	else {
+		if (one_file && is_an_archive)
+			fr_window_archive_open (window, list->data, GTK_WINDOW (window));
+		else {
+			GtkWidget *d;
+			int        r;
+
+			d = _gtk_message_dialog_new (GTK_WINDOW (window),
+						     GTK_DIALOG_MODAL,
+						     "dialog-question",
+						     _("Do you want to create a new archive with these files?"),
+						     NULL,
+						     "gtk-cancel", GTK_RESPONSE_CANCEL,
+						     _("Create _Archive"), GTK_RESPONSE_YES,
+						     NULL);
+
+			gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
+			r = gtk_dialog_run (GTK_DIALOG (d));
+			gtk_widget_destroy (GTK_WIDGET (d));
+
+			if (r == GTK_RESPONSE_YES) {
+				char       *first_item;
+				char       *folder;
+				char       *local_path = NULL;
+				char       *utf8_path = NULL;
+				const char *archive_name;
+
+				fr_window_free_batch_data (window);
+				fr_window_append_batch_action (window,
+							       FR_BATCH_ACTION_ADD,
+							       path_list_dup (list),
+							       (GFreeFunc) path_list_free);
+
+				first_item = (char*) list->data;
+				folder = remove_level_from_path (first_item);
+				if (folder != NULL)
+					fr_window_set_open_default_dir (window, folder);
+
+				if ((list->next != NULL) && (folder != NULL)) {
+					archive_name = file_name_from_path (folder);
+				}
+				else {
+					if (uri_is_local (first_item)) {
+						local_path = g_filename_from_uri (first_item, NULL, NULL);
+						if (local_path)
+							utf8_path = g_filename_to_utf8 (local_path, -1, NULL, NULL, NULL);
+						if (!utf8_path)
+							utf8_path= g_strdup (first_item);
+						g_free (local_path);
+					}
+					else {
+						utf8_path = g_strdup (first_item);
+					}
+					archive_name = file_name_from_path (utf8_path);
+				}
+
+				show_new_archive_dialog (window, archive_name);
+				g_free (utf8_path);
+
+				g_free (folder);
+			}
+		}
+	}
+
+	path_list_free (list);
+
+	debug (DEBUG_INFO, "::DragDataReceived <--\n");
+}
+
+static gboolean
+file_list_drag_begin (GtkWidget          *widget,
+		      GdkDragContext     *context,
+		      gpointer            data)
+{
+	FrWindow *window = data;
+
+	debug (DEBUG_INFO, "::DragBegin -->\n");
+
+	if (window->priv->activity_ref > 0)
+		return FALSE;
+
+	g_free (window->priv->drag_destination_folder);
+	window->priv->drag_destination_folder = NULL;
+
+	g_free (window->priv->drag_base_dir);
+	window->priv->drag_base_dir = NULL;
+
+	gdk_property_change (gdk_drag_context_get_source_window (context),
+			     XDS_ATOM, TEXT_ATOM,
+			     8, GDK_PROP_MODE_REPLACE,
+			     (guchar *) XDS_FILENAME,
+			     strlen (XDS_FILENAME));
+
+	return TRUE;
+}
+
+static void
+file_list_drag_end (GtkWidget      *widget,
+		    GdkDragContext *context,
+		    gpointer        data)
+{
+	FrWindow *window = data;
+
+	debug (DEBUG_INFO, "::DragEnd -->\n");
+
+	gdk_property_delete (gdk_drag_context_get_source_window (context), XDS_ATOM);
+
+	if (window->priv->drag_error != NULL) {
+		_gtk_error_dialog_run (GTK_WINDOW (window),
+				       _("Extraction not performed"),
+				       "%s",
+				       window->priv->drag_error->message);
+		g_clear_error (&window->priv->drag_error);
+	}
+	else if (window->priv->drag_destination_folder != NULL) {
+		fr_window_archive_extract (window,
+					   window->priv->drag_file_list,
+					   window->priv->drag_destination_folder,
+					   NULL,
+					   window->priv->drag_base_dir,
+					   FALSE,
+					   FR_OVERWRITE_ASK,
+					   FALSE,
+					   FALSE);
+		path_list_free (window->priv->drag_file_list);
+		window->priv->drag_file_list = NULL;
+	}
+
+	debug (DEBUG_INFO, "::DragEnd <--\n");
+}
+
+/* The following three functions taken from bugzilla
+ * (http://bugzilla.mate.org/attachment.cgi?id=49362&action=view)
+ * Author: Christian Neumair
+ * Copyright: 2005 Free Software Foundation, Inc
+ * License: GPL */
+static char *
+get_xds_atom_value (GdkDragContext *context)
+{
+	gint actual_length;
+	char *data;
+	char *ret = NULL;
+
+	g_return_val_if_fail (context != NULL, NULL);
+	g_return_val_if_fail (gdk_drag_context_get_source_window (context) != NULL, NULL);
+
+	if (gdk_property_get (gdk_drag_context_get_source_window (context),
+			      XDS_ATOM, TEXT_ATOM,
+			      0, MAX_XDS_ATOM_VAL_LEN,
+			      FALSE, NULL, NULL, &actual_length,
+			      (unsigned char **) &data)) {
+		/* add not included \0 to the end of the string */
+		ret = g_strndup ((gchar *) data, actual_length);
+		g_free (data);
+	}
+
+	return ret;
+}
+
+static gboolean
+context_offers_target (GdkDragContext *context,
+		       GdkAtom target)
+{
+	return (g_list_find (gdk_drag_context_list_targets (context), target) != NULL);
+}
+
+static gboolean
+caja_xds_dnd_is_valid_xds_context (GdkDragContext *context)
+{
+	char *tmp;
+	gboolean ret;
+
+	g_return_val_if_fail (context != NULL, FALSE);
+
+	tmp = NULL;
+	if (context_offers_target (context, XDS_ATOM)) {
+		tmp = get_xds_atom_value (context);
+	}
+
+	ret = (tmp != NULL);
+	g_free (tmp);
+
+	return ret;
+}
+
+static char *
+get_selection_data_from_clipboard_data (FrWindow        *window,
+		      			FrClipboardData *data)
+{
+	GString *list;
+	char    *local_filename;
+	GList   *scan;
+
+	list = g_string_new (NULL);
+
+	local_filename = g_file_get_uri (window->archive->local_copy);
+	g_string_append (list, local_filename);
+	g_free (local_filename);
+
+	g_string_append (list, "\r\n");
+	if (window->priv->password != NULL)
+		g_string_append (list, window->priv->password);
+	g_string_append (list, "\r\n");
+	g_string_append (list, (data->op == FR_CLIPBOARD_OP_COPY) ? "copy" : "cut");
+	g_string_append (list, "\r\n");
+	g_string_append (list, data->base_dir);
+	g_string_append (list, "\r\n");
+	for (scan = data->files; scan; scan = scan->next) {
+		g_string_append (list, scan->data);
+		g_string_append (list, "\r\n");
+	}
+
+	return g_string_free (list, FALSE);
+}
+
+static gboolean
+fr_window_folder_tree_drag_data_get (GtkWidget        *widget,
+				     GdkDragContext   *context,
+				     GtkSelectionData *selection_data,
+				     guint             info,
+				     guint             time,
+				     gpointer          user_data)
+{
+	FrWindow *window = user_data;
+	GList    *file_list;
+	char     *destination;
+	char     *destination_folder;
+
+	debug (DEBUG_INFO, "::DragDataGet -->\n");
+
+	if (window->priv->activity_ref > 0)
+		return FALSE;
+
+	file_list = fr_window_get_folder_tree_selection (window, TRUE, NULL);
+	if (file_list == NULL)
+		return FALSE;
+
+	if (gtk_selection_data_get_target (selection_data) == XFR_ATOM) {
+		FrClipboardData *tmp;
+		char            *data;
+
+		tmp = fr_clipboard_data_new ();
+		tmp->files = file_list;
+		tmp->op = FR_CLIPBOARD_OP_COPY;
+		tmp->base_dir = g_strdup (fr_window_get_current_location (window));
+
+		data = get_selection_data_from_clipboard_data (window, tmp);
+		gtk_selection_data_set (selection_data, XFR_ATOM, 8, (guchar *) data, strlen (data));
+
+		fr_clipboard_data_unref (tmp);
+		g_free (data);
+
+		return TRUE;
+	}
+
+	if (! caja_xds_dnd_is_valid_xds_context (context))
+		return FALSE;
+
+	destination = get_xds_atom_value (context);
+	g_return_val_if_fail (destination != NULL, FALSE);
+
+	destination_folder = remove_level_from_path (destination);
+	g_free (destination);
+
+	/* check whether the extraction can be performed in the destination
+	 * folder */
+
+	g_clear_error (&window->priv->drag_error);
+
+	if (! check_permissions (destination_folder, R_OK | W_OK)) {
+		char *destination_folder_display_name;
+
+		destination_folder_display_name = g_filename_display_name (destination_folder);
+		window->priv->drag_error = g_error_new (FR_ERROR, 0, _("You don't have the right permissions to extract archives in the folder \"%s\""), destination_folder_display_name);
+		g_free (destination_folder_display_name);
+	}
+
+	if (window->priv->drag_error == NULL) {
+		g_free (window->priv->drag_destination_folder);
+		g_free (window->priv->drag_base_dir);
+		path_list_free (window->priv->drag_file_list);
+		window->priv->drag_destination_folder = g_strdup (destination_folder);
+		window->priv->drag_base_dir = fr_window_get_selected_folder_in_tree_view (window);
+		window->priv->drag_file_list = file_list;
+	}
+
+	g_free (destination_folder);
+
+	/* sends back the response */
+
+	gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8, (guchar *) ((window->priv->drag_error == NULL) ? "S" : "E"), 1);
+
+	debug (DEBUG_INFO, "::DragDataGet <--\n");
+
+	return TRUE;
+}
+
+gboolean
+fr_window_file_list_drag_data_get (FrWindow         *window,
+				   GdkDragContext   *context,
+				   GtkSelectionData *selection_data,
+				   GList            *path_list)
+{
+	char *destination;
+	char *destination_folder;
+
+	debug (DEBUG_INFO, "::DragDataGet -->\n");
+
+	if (window->priv->path_clicked != NULL) {
+		gtk_tree_path_free (window->priv->path_clicked);
+		window->priv->path_clicked = NULL;
+	}
+
+	if (window->priv->activity_ref > 0)
+		return FALSE;
+
+	if (gtk_selection_data_get_target (selection_data) == XFR_ATOM) {
+		FrClipboardData *tmp;
+		char            *data;
+
+		tmp = fr_clipboard_data_new ();
+		tmp->files = fr_window_get_file_list_selection (window, TRUE, NULL);
+		tmp->op = FR_CLIPBOARD_OP_COPY;
+		tmp->base_dir = g_strdup (fr_window_get_current_location (window));
+
+		data = get_selection_data_from_clipboard_data (window, tmp);
+		gtk_selection_data_set (selection_data, XFR_ATOM, 8, (guchar *) data, strlen (data));
+
+		fr_clipboard_data_unref (tmp);
+		g_free (data);
+
+		return TRUE;
+	}
+
+	if (! caja_xds_dnd_is_valid_xds_context (context))
+		return FALSE;
+
+	destination = get_xds_atom_value (context);
+	g_return_val_if_fail (destination != NULL, FALSE);
+
+	destination_folder = remove_level_from_path (destination);
+	g_free (destination);
+
+	/* check whether the extraction can be performed in the destination
+	 * folder */
+
+	g_clear_error (&window->priv->drag_error);
+
+	if (! check_permissions (destination_folder, R_OK | W_OK)) {
+		char *destination_folder_display_name;
+
+		destination_folder_display_name = g_filename_display_name (destination_folder);
+		window->priv->drag_error = g_error_new (FR_ERROR, 0, _("You don't have the right permissions to extract archives in the folder \"%s\""), destination_folder_display_name);
+		g_free (destination_folder_display_name);
+	}
+
+	if (window->priv->drag_error == NULL) {
+		g_free (window->priv->drag_destination_folder);
+		g_free (window->priv->drag_base_dir);
+		path_list_free (window->priv->drag_file_list);
+		window->priv->drag_destination_folder = g_strdup (destination_folder);
+		window->priv->drag_base_dir = g_strdup (fr_window_get_current_location (window));
+		window->priv->drag_file_list = fr_window_get_file_list_from_path_list (window, path_list, NULL);
+	}
+
+	g_free (destination_folder);
+
+	/* sends back the response */
+
+	gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8, (guchar *) ((window->priv->drag_error == NULL) ? "S" : "E"), 1);
+
+	debug (DEBUG_INFO, "::DragDataGet <--\n");
+
+	return TRUE;
+}
+
+/* -- window_new -- */
+
+static void
+fr_window_deactivate_filter (FrWindow *window)
+{
+	window->priv->filter_mode = FALSE;
+	window->priv->list_mode = window->priv->last_list_mode;
+
+	gtk_entry_set_text (GTK_ENTRY (window->priv->filter_entry), "");
+	fr_window_update_filter_bar_visibility (window);
+
+	gtk_list_store_clear (window->priv->list_store);
+
+	fr_window_update_columns_visibility (window);
+	fr_window_update_file_list (window, TRUE);
+	fr_window_update_dir_tree (window);
+	fr_window_update_current_location (window);
+}
+
+static gboolean
+key_press_cb (GtkWidget   *widget,
+	      GdkEventKey *event,
+	      gpointer     data)
+{
+	FrWindow *window = data;
+	gboolean  retval = FALSE;
+	gboolean  alt;
+
+	if (gtk_widget_has_focus (window->priv->location_entry))
+		return FALSE;
+
+	if (gtk_widget_has_focus (window->priv->filter_entry)) {
+		switch (event->keyval) {
+		case GDK_KEY_Escape:
+			fr_window_deactivate_filter (window);
+			retval = TRUE;
+			break;
+		default:
+			break;
+		}
+		return retval;
+	}
+
+	alt = (event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK;
+
+	switch (event->keyval) {
+	case GDK_KEY_Escape:
+		activate_action_stop (NULL, NULL, window);
+		if (window->priv->filter_mode)
+			fr_window_deactivate_filter (window);
+		retval = TRUE;
+		break;
+
+	case GDK_KEY_F10:
+		if (event->state & GDK_SHIFT_MASK) {
+			GtkTreeSelection *selection;
+
+			selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+			if (selection == NULL)
+				return FALSE;
+
+			gtk_menu_popup_at_pointer (GTK_MENU (window->priv->file_popup_menu),
+			                           (const GdkEvent*) event);
+			retval = TRUE;
+		}
+		break;
+
+	case GDK_KEY_Up:
+	case GDK_KEY_KP_Up:
+		if (alt) {
+			fr_window_go_up_one_level (window);
+			retval = TRUE;
+		}
+		break;
+
+	case GDK_KEY_BackSpace:
+		fr_window_go_up_one_level (window);
+		retval = TRUE;
+		break;
+
+	case GDK_KEY_Right:
+	case GDK_KEY_KP_Right:
+		if (alt) {
+			fr_window_go_forward (window);
+			retval = TRUE;
+		}
+		break;
+
+	case GDK_KEY_Left:
+	case GDK_KEY_KP_Left:
+		if (alt) {
+			fr_window_go_back (window);
+			retval = TRUE;
+		}
+		break;
+
+	case GDK_KEY_Home:
+	case GDK_KEY_KP_Home:
+		if (alt) {
+			fr_window_go_to_location (window, "/", FALSE);
+			retval = TRUE;
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	return retval;
+}
+
+static gboolean
+dir_tree_selection_changed_cb (GtkTreeSelection *selection,
+			       gpointer          user_data)
+{
+	FrWindow    *window = user_data;
+	GtkTreeIter  iter;
+
+	if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
+		char *path;
+
+		gtk_tree_model_get (GTK_TREE_MODEL (window->priv->tree_store),
+				    &iter,
+				    TREE_COLUMN_PATH, &path,
+				    -1);
+		fr_window_go_to_location (window, path, FALSE);
+		g_free (path);
+	}
+
+	return FALSE;
+}
+
+static gboolean
+selection_changed_cb (GtkTreeSelection *selection,
+		      gpointer          user_data)
+{
+	FrWindow *window = user_data;
+
+	fr_window_update_statusbar_list_info (window);
+	fr_window_update_sensitivity (window);
+
+	return FALSE;
+}
+
+static void
+fr_window_delete_event_cb (GtkWidget *caller,
+			   GdkEvent  *event,
+			   FrWindow  *window)
+{
+	fr_window_close (window);
+}
+
+static gboolean
+is_single_click_policy (FrWindow *window)
+{
+	gboolean  result = FALSE;
+
+	if (window->priv->settings_caja) {
+		char *value;
+
+		value = g_settings_get_string (window->priv->settings_caja, CAJA_CLICK_POLICY);
+		result = (value != NULL) && (strncmp (value, "single", 6) == 0);
+		g_free (value);
+	}
+
+	return result;
+}
+
+static void
+filename_cell_data_func (GtkTreeViewColumn *column,
+			 GtkCellRenderer   *renderer,
+			 GtkTreeModel      *model,
+			 GtkTreeIter       *iter,
+			 FrWindow          *window)
+{
+	char           *text;
+	PangoUnderline  underline;
+
+	gtk_tree_model_get (model, iter,
+			    COLUMN_NAME, &text,
+			    -1);
+
+	if (window->priv->single_click) {
+		GtkTreePath *path;
+
+		path = gtk_tree_model_get_path (model, iter);
+
+		if ((window->priv->list_hover_path == NULL)
+		    || gtk_tree_path_compare (path, window->priv->list_hover_path))
+			underline = PANGO_UNDERLINE_NONE;
+		else
+			underline = PANGO_UNDERLINE_SINGLE;
+
+		gtk_tree_path_free (path);
+	}
+	else
+		underline = PANGO_UNDERLINE_NONE;
+
+	g_object_set (G_OBJECT (renderer),
+		      "text", text,
+		      "underline", underline,
+		      NULL);
+
+	g_free (text);
+}
+
+static void
+add_dir_tree_columns (FrWindow    *window,
+		      GtkTreeView *treeview)
+{
+	GtkCellRenderer   *renderer;
+	GtkTreeViewColumn *column;
+	GValue             value = { 0, };
+
+	/* First column. */
+
+	column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title (column, _("Folders"));
+
+	/* icon */
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "pixbuf", TREE_COLUMN_ICON,
+					     NULL);
+
+	/* name */
+
+	renderer = gtk_cell_renderer_text_new ();
+
+	g_value_init (&value, PANGO_TYPE_ELLIPSIZE_MODE);
+	g_value_set_enum (&value, PANGO_ELLIPSIZE_END);
+	g_object_set_property (G_OBJECT (renderer), "ellipsize", &value);
+	g_value_unset (&value);
+
+	gtk_tree_view_column_pack_start (column,
+					 renderer,
+					 TRUE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "text", TREE_COLUMN_NAME,
+					     "weight", TREE_COLUMN_WEIGHT,
+					     NULL);
+
+	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_column_set_sort_column_id (column, TREE_COLUMN_NAME);
+
+	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+}
+
+static void
+add_file_list_columns (FrWindow    *window,
+		       GtkTreeView *treeview)
+{
+	static const char *titles[] = {NC_("File", "Size"),
+				       NC_("File", "Type"),
+				       NC_("File", "Date Modified"),
+				       NC_("File", "Location")};
+	GtkCellRenderer   *renderer;
+	GtkTreeViewColumn *column;
+	GValue             value = { 0, };
+	int                i, j, w;
+
+	/* First column. */
+
+	window->priv->filename_column = column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title (column, C_("File", "Name"));
+
+	/* emblem */
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_tree_view_column_pack_end (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "pixbuf", COLUMN_EMBLEM,
+					     NULL);
+
+	/* icon */
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "pixbuf", COLUMN_ICON,
+					     NULL);
+
+	/* name */
+
+	window->priv->single_click = is_single_click_policy (window);
+
+	renderer = gtk_cell_renderer_text_new ();
+
+	g_value_init (&value, PANGO_TYPE_ELLIPSIZE_MODE);
+	g_value_set_enum (&value, PANGO_ELLIPSIZE_END);
+	g_object_set_property (G_OBJECT (renderer), "ellipsize", &value);
+	g_value_unset (&value);
+
+	gtk_tree_view_column_pack_start (column,
+					 renderer,
+					 TRUE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "text", COLUMN_NAME,
+					     NULL);
+
+	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+	w = g_settings_get_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH);
+	if (w <= 0)
+		w = DEFAULT_NAME_COLUMN_WIDTH;
+	gtk_tree_view_column_set_fixed_width (column, w);
+	gtk_tree_view_column_set_resizable (column, TRUE);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+	gtk_tree_view_column_set_cell_data_func (column, renderer,
+						 (GtkTreeCellDataFunc) filename_cell_data_func,
+						 window, NULL);
+
+	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+	/* Other columns */
+
+	for (j = 0, i = COLUMN_SIZE; i < NUMBER_OF_COLUMNS; i++, j++) {
+		GValue  value_oc = { 0, };
+
+		renderer = gtk_cell_renderer_text_new ();
+		column = gtk_tree_view_column_new_with_attributes (g_dpgettext2 (NULL, "File", titles[j]),
+								   renderer,
+								   "text", i,
+								   NULL);
+
+		gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+		gtk_tree_view_column_set_fixed_width (column, OTHER_COLUMNS_WIDTH);
+		gtk_tree_view_column_set_resizable (column, TRUE);
+
+		gtk_tree_view_column_set_sort_column_id (column, i);
+
+		g_value_init (&value_oc, PANGO_TYPE_ELLIPSIZE_MODE);
+		g_value_set_enum (&value_oc, PANGO_ELLIPSIZE_END);
+		g_object_set_property (G_OBJECT (renderer), "ellipsize", &value_oc);
+		g_value_unset (&value_oc);
+
+		gtk_tree_view_append_column (treeview, column);
+	}
+}
+
+static int
+name_column_sort_func (GtkTreeModel *model,
+		       GtkTreeIter  *a,
+		       GtkTreeIter  *b,
+		       gpointer      user_data)
+{
+	FileData *fdata1, *fdata2;
+
+	gtk_tree_model_get (model, a, COLUMN_FILE_DATA, &fdata1, -1);
+	gtk_tree_model_get (model, b, COLUMN_FILE_DATA, &fdata2, -1);
+
+	return sort_by_name (&fdata1, &fdata2);
+}
+
+static int
+size_column_sort_func (GtkTreeModel *model,
+		       GtkTreeIter  *a,
+		       GtkTreeIter  *b,
+		       gpointer      user_data)
+{
+	FileData *fdata1, *fdata2;
+
+	gtk_tree_model_get (model, a, COLUMN_FILE_DATA, &fdata1, -1);
+	gtk_tree_model_get (model, b, COLUMN_FILE_DATA, &fdata2, -1);
+
+	return sort_by_size (&fdata1, &fdata2);
+}
+
+static int
+type_column_sort_func (GtkTreeModel *model,
+		       GtkTreeIter  *a,
+		       GtkTreeIter  *b,
+		       gpointer      user_data)
+{
+	FileData *fdata1, *fdata2;
+
+	gtk_tree_model_get (model, a, COLUMN_FILE_DATA, &fdata1, -1);
+	gtk_tree_model_get (model, b, COLUMN_FILE_DATA, &fdata2, -1);
+
+	return sort_by_type (&fdata1, &fdata2);
+}
+
+static int
+time_column_sort_func (GtkTreeModel *model,
+		       GtkTreeIter  *a,
+		       GtkTreeIter  *b,
+		       gpointer      user_data)
+{
+	FileData *fdata1, *fdata2;
+
+	gtk_tree_model_get (model, a, COLUMN_FILE_DATA, &fdata1, -1);
+	gtk_tree_model_get (model, b, COLUMN_FILE_DATA, &fdata2, -1);
+
+	return sort_by_time (&fdata1, &fdata2);
+}
+
+static int
+path_column_sort_func (GtkTreeModel *model,
+		       GtkTreeIter  *a,
+		       GtkTreeIter  *b,
+		       gpointer      user_data)
+{
+	FileData *fdata1, *fdata2;
+
+	gtk_tree_model_get (model, a, COLUMN_FILE_DATA, &fdata1, -1);
+	gtk_tree_model_get (model, b, COLUMN_FILE_DATA, &fdata2, -1);
+
+	return sort_by_path (&fdata1, &fdata2);
+}
+
+static int
+no_sort_column_sort_func (GtkTreeModel *model,
+			  GtkTreeIter  *a,
+			  GtkTreeIter  *b,
+			  gpointer      user_data)
+{
+	return -1;
+}
+
+static void
+sort_column_changed_cb (GtkTreeSortable *sortable,
+			gpointer         user_data)
+{
+	FrWindow    *window = user_data;
+	GtkSortType  order;
+	int          column_id;
+
+	if (! gtk_tree_sortable_get_sort_column_id (sortable,
+						    &column_id,
+						    &order))
+		return;
+
+	window->priv->sort_method = get_sort_method_from_column (column_id);
+	window->priv->sort_type = order;
+}
+
+static gboolean
+fr_window_show_cb (GtkWidget *widget,
+		   FrWindow  *window)
+{
+	fr_window_update_current_location (window);
+
+	set_active (window, "ViewToolbar", g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_TOOLBAR));
+	set_active (window, "ViewStatusbar", g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_STATUSBAR));
+
+	window->priv->view_folders = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_FOLDERS);
+	set_active (window, "ViewFolders", window->priv->view_folders);
+
+	fr_window_update_filter_bar_visibility (window);
+
+	return TRUE;
+}
+
+/* preferences changes notification callbacks */
+
+static void
+pref_history_len_changed (GSettings *settings,
+				const char *key,
+				gpointer user_data)
+{
+	FrWindow  *window = user_data;
+	int        limit;
+
+	limit = g_settings_get_int (settings, PREF_UI_HISTORY_LEN);
+
+	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->menubar_recentmenu), limit);
+	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->toolbar_recentmenu), limit);
+}
+
+static void
+pref_view_toolbar_changed (GSettings *settings,
+                           const char *key,
+                           gpointer user_data)
+{
+	FrWindow *window = user_data;
+	fr_window_set_toolbar_visibility (window, g_settings_get_boolean (settings, key));
+}
+
+static void
+pref_view_statusbar_changed (GSettings *settings,
+                             const char *key,
+                             gpointer user_data)
+{
+	FrWindow *window = user_data;
+
+	fr_window_set_statusbar_visibility (window, g_settings_get_boolean (settings, key));
+}
+
+static void
+pref_view_folders_changed (GSettings *settings,
+                           const char *key,
+                           gpointer user_data)
+{
+	FrWindow *window = user_data;
+
+	fr_window_set_folders_visibility (window, g_settings_get_boolean (settings, key));
+}
+
+static void
+pref_show_field_changed (GSettings *settings,
+                         const char *key,
+                         gpointer user_data)
+{
+	FrWindow *window = user_data;
+
+	fr_window_update_columns_visibility (window);
+}
+
+static void
+pref_click_policy_changed (GSettings *settings,
+                           const char *key,
+                           gpointer user_data)
+{
+	FrWindow   *window = user_data;
+	GdkWindow  *win = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view));
+	GdkDisplay *display;
+
+	window->priv->single_click = is_single_click_policy (window);
+
+	gdk_window_set_cursor (win, NULL);
+	display = gtk_widget_get_display (GTK_WIDGET (window->priv->list_view));
+	if (display != NULL)
+		gdk_display_flush (display);
+}
+
+static void
+pref_use_mime_icons_changed (GSettings *settings,
+                             const char *key,
+                             gpointer user_data)
+{
+	FrWindow *window = user_data;
+
+	if (tree_pixbuf_hash != NULL) {
+		g_hash_table_foreach (tree_pixbuf_hash,
+				      gh_unref_pixbuf,
+				      NULL);
+		g_hash_table_destroy (tree_pixbuf_hash);
+		tree_pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	}
+
+	fr_window_update_file_list (window, FALSE);
+	fr_window_update_dir_tree (window);
+}
+
+static void
+theme_changed_cb (GtkIconTheme *theme, FrWindow *window)
+{
+	file_list_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), FILE_LIST_ICON_SIZE);
+
+	if (tree_pixbuf_hash != NULL) {
+		g_hash_table_foreach (tree_pixbuf_hash,
+				      gh_unref_pixbuf,
+				      NULL);
+		g_hash_table_destroy (tree_pixbuf_hash);
+		tree_pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	}
+
+	fr_window_update_file_list (window, TRUE);
+	fr_window_update_dir_tree (window);
+}
+
+static gboolean
+fr_window_stoppable_cb (FrCommand  *command,
+			gboolean    stoppable,
+			FrWindow   *window)
+{
+	window->priv->stoppable = stoppable;
+	set_sensitive (window, "stop_item", stoppable);
+	set_sensitive (window, "tool_stop_item", stoppable);
+	if (window->priv->progress_dialog != NULL)
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog),
+						   GTK_RESPONSE_OK,
+						   stoppable);
+	return TRUE;
+}
+
+static gboolean
+fr_window_fake_load (FrArchive *archive,
+		     gpointer   data)
+{
+	/* fake loads are disabled to allow exact progress dialogs (#153281) */
+
+	return FALSE;
+
+#if 0
+	FrWindow *window = data;
+	gboolean  add_after_opening = FALSE;
+	gboolean  extract_after_opening = FALSE;
+	GList    *scan;
+
+	/* fake loads are used only in batch mode to avoid unnecessary
+	 * archive loadings. */
+
+	if (! window->priv->batch_mode)
+		return FALSE;
+
+	/* Check whether there is an ADD or EXTRACT action in the batch list. */
+
+	for (scan = window->priv->batch_action; scan; scan = scan->next) {
+		FRBatchAction *action;
+
+		action = (FRBatchAction *) scan->data;
+		if (action->type == FR_BATCH_ACTION_ADD) {
+			add_after_opening = TRUE;
+			break;
+		}
+		if ((action->type == FR_BATCH_ACTION_EXTRACT)
+		    || (action->type == FR_BATCH_ACTION_EXTRACT_HERE)
+		    || (action->type == FR_BATCH_ACTION_EXTRACT_INTERACT))
+		{
+			extract_after_opening = TRUE;
+			break;
+		}
+	}
+
+	/* use fake load when in batch mode and the archive type supports all
+	 * of the required features */
+
+	return (window->priv->batch_mode
+		&& ! (add_after_opening && window->priv->update_dropped_files && ! archive->command->propAddCanUpdate)
+		&& ! (add_after_opening && ! window->priv->update_dropped_files && ! archive->command->propAddCanReplace)
+		&& ! (extract_after_opening && !archive->command->propCanExtractAll));
+#endif
+}
+
+static void
+menu_item_select_cb (GtkMenuItem *proxy,
+                     FrWindow    *window)
+{
+	char      *message;
+
+	message = gtk_widget_get_tooltip_text (GTK_WIDGET (proxy));
+	if (message) {
+		gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
+				    window->priv->help_message_cid, message);
+		g_free (message);
+	}
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy,
+                       FrWindow    *window)
+{
+	gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
+			   window->priv->help_message_cid);
+}
+
+static void
+view_all_files_selected_toggled (GtkMenuItem *menuitem,
+                                 gpointer     data)
+{
+	FrWindow *window = data;
+
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
+		fr_window_set_list_mode (window, FR_WINDOW_LIST_MODE_FLAT);
+	else
+		fr_window_set_list_mode (window, FR_WINDOW_LIST_MODE_AS_DIR);
+}
+
+static void
+recent_chooser_item_activated_cb (GtkRecentChooser *chooser,
+				  FrWindow         *window)
+{
+	char *uri;
+
+	uri = gtk_recent_chooser_get_current_uri (chooser);
+	if (uri != NULL) {
+		fr_window_archive_open (window, uri, GTK_WINDOW (window));
+		g_free (uri);
+	}
+}
+
+static GtkWidget *
+fr_window_create_recent_chooser (FrWindow  *window)
+{
+	GtkRecentManager *manager;
+	GtkRecentFilter  *filter;
+	GtkWidget        *menu;
+	int               i;
+
+	manager = gtk_recent_manager_get_default ();
+	menu = gtk_recent_chooser_menu_new_for_manager (manager);
+
+	filter = gtk_recent_filter_new ();
+	gtk_recent_filter_set_name (filter, _("All archives"));
+	for (i = 0; open_type[i] != -1; i++)
+		gtk_recent_filter_add_mime_type (filter, mime_type_desc[open_type[i]].mime_type);
+	gtk_recent_filter_add_application (filter, "Engrampa");
+	gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+
+	gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (menu), FALSE);
+	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (menu), g_settings_get_int (window->priv->settings_ui, PREF_UI_HISTORY_LEN));
+	gtk_recent_chooser_set_show_not_found (GTK_RECENT_CHOOSER (menu), TRUE);
+	gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu), GTK_RECENT_SORT_MRU);
+
+	g_signal_connect (G_OBJECT (menu),
+			  "item_activated",
+			  G_CALLBACK (recent_chooser_item_activated_cb),
+			  window);
+	return menu;
+}
+
+static void
+close_sidepane_button_clicked_cb (GtkButton *button,
+				  FrWindow  *window)
+{
+	fr_window_set_folders_visibility (window, FALSE);
+}
+
+static void
+fr_window_activate_filter (FrWindow *window)
+{
+	GtkTreeView       *tree_view = GTK_TREE_VIEW (window->priv->list_view);
+	GtkTreeViewColumn *column;
+
+	fr_window_update_filter_bar_visibility (window);
+	window->priv->list_mode = FR_WINDOW_LIST_MODE_FLAT;
+
+	gtk_list_store_clear (window->priv->list_store);
+
+	column = gtk_tree_view_get_column (tree_view, 4);
+	gtk_tree_view_column_set_visible (column, TRUE);
+
+	fr_window_update_file_list (window, TRUE);
+	fr_window_update_dir_tree (window);
+	fr_window_update_current_location (window);
+}
+
+static void
+filter_entry_activate_cb (GtkEntry *entry,
+			  FrWindow *window)
+{
+	fr_window_activate_filter (window);
+}
+
+static void
+filter_entry_icon_release_cb (GtkEntry             *entry,
+			      GtkEntryIconPosition  icon_pos,
+			      GdkEventButton       *event,
+			      gpointer              user_data)
+{
+	FrWindow *window = FR_WINDOW (user_data);
+
+	if ((event->button == 1) && (icon_pos == GTK_ENTRY_ICON_SECONDARY))
+		fr_window_deactivate_filter (window);
+}
+
+static void
+fr_window_attach (FrWindow      *window,
+		  GtkWidget     *child,
+		  FrWindowArea   area)
+{
+	int position;
+
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (FR_IS_WINDOW (window));
+	g_return_if_fail (child != NULL);
+	g_return_if_fail (GTK_IS_WIDGET (child));
+
+	switch (area) {
+	case FR_WINDOW_AREA_MENUBAR:
+		position = 0;
+		break;
+	case FR_WINDOW_AREA_TOOLBAR:
+		position = 1;
+		break;
+	case FR_WINDOW_AREA_LOCATIONBAR:
+		position = 2;
+		break;
+	case FR_WINDOW_AREA_CONTENTS:
+		position = 3;
+		if (window->priv->contents != NULL)
+			gtk_widget_destroy (window->priv->contents);
+		window->priv->contents = child;
+		gtk_widget_set_vexpand (child, TRUE);
+		break;
+	case FR_WINDOW_AREA_FILTERBAR:
+		position = 4;
+		break;
+	case FR_WINDOW_AREA_STATUSBAR:
+		position = 5;
+		break;
+	default:
+		g_critical ("%s: area not recognized!", G_STRFUNC);
+		return;
+		break;
+	}
+
+	gtk_widget_set_hexpand (child, TRUE);
+	gtk_grid_attach (GTK_GRID (window->priv->layout),
+			 child,
+			 0, position,
+			 1, 1);
+}
+
+static void
+fr_window_construct (FrWindow *window)
+{
+	GtkWidget        *menubar;
+	GtkWidget        *toolbar;
+	GtkWidget        *list_scrolled_window;
+	GtkWidget        *location_box;
+	GtkStatusbar     *statusbar;
+	GtkWidget        *statusbar_box;
+	GtkWidget        *filter_box;
+	GtkWidget        *tree_scrolled_window;
+	GtkWidget        *sidepane_title;
+	GtkWidget        *sidepane_title_box;
+	GtkWidget        *sidepane_title_label;
+	GtkWidget        *close_sidepane_button;
+	GtkWidget        *menu_radio_files;
+	GtkWidget        *menuitem;
+	GtkTreeSelection *selection;
+	GActionGroup     *actions;
+	GSimpleAction    *action;
+	GtkAccelGroup    *accel_group;
+	GtkBuilder       *ui;
+	GError           *error = NULL;
+	GSettingsSchemaSource *schema_source;
+	GSettingsSchema  *caja_schema;
+
+	/* data common to all windows. */
+
+	if (tree_pixbuf_hash == NULL)
+		tree_pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	if (icon_theme == NULL)
+		icon_theme = gtk_icon_theme_get_default ();
+
+        /* Create the settings objects */
+
+	window->priv->settings_listing = g_settings_new (ENGRAMPA_SCHEMA_LISTING);
+	window->priv->settings_ui = g_settings_new (ENGRAMPA_SCHEMA_UI);
+	window->priv->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+	window->priv->settings_dialogs = g_settings_new (ENGRAMPA_SCHEMA_DIALOGS);
+
+	schema_source = g_settings_schema_source_get_default ();
+	caja_schema = g_settings_schema_source_lookup (schema_source, CAJA_SCHEMA, FALSE);
+	if (caja_schema) {
+		window->priv->settings_caja = g_settings_new (CAJA_SCHEMA);
+		g_settings_schema_unref (caja_schema);
+	}
+
+	/* Create the application. */
+
+	window->priv->layout = gtk_grid_new ();
+	gtk_container_add (GTK_CONTAINER (window), window->priv->layout);
+	gtk_widget_show (window->priv->layout);
+
+	gtk_window_set_title (GTK_WINDOW (window), _("Archive Manager"));
+
+	g_signal_connect (G_OBJECT (window),
+			  "delete_event",
+			  G_CALLBACK (fr_window_delete_event_cb),
+			  window);
+
+	g_signal_connect (G_OBJECT (window),
+			  "show",
+			  G_CALLBACK (fr_window_show_cb),
+			  window);
+
+	window->priv->theme_changed_handler_id =
+		g_signal_connect (icon_theme,
+				  "changed",
+				  G_CALLBACK (theme_changed_cb),
+				  window);
+
+	file_list_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), FILE_LIST_ICON_SIZE);
+
+	gtk_window_set_default_size (GTK_WINDOW (window),
+				g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH),
+				g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_HEIGHT));
+
+	gtk_drag_dest_set (GTK_WIDGET (window),
+			   GTK_DEST_DEFAULT_ALL,
+			   target_table, G_N_ELEMENTS (target_table),
+			   GDK_ACTION_COPY);
+
+	g_signal_connect (G_OBJECT (window),
+			  "drag_data_received",
+			  G_CALLBACK (fr_window_drag_data_received),
+			  window);
+	g_signal_connect (G_OBJECT (window),
+			  "drag_motion",
+			  G_CALLBACK (fr_window_drag_motion),
+			  window);
+
+	g_signal_connect (G_OBJECT (window),
+			  "key_press_event",
+			  G_CALLBACK (key_press_cb),
+			  window);
+
+	/* Initialize Data. */
+
+	window->archive = fr_archive_new ();
+	g_signal_connect (G_OBJECT (window->archive),
+			  "start",
+			  G_CALLBACK (action_started),
+			  window);
+	g_signal_connect (G_OBJECT (window->archive),
+			  "done",
+			  G_CALLBACK (action_performed),
+			  window);
+	g_signal_connect (G_OBJECT (window->archive),
+			  "progress",
+			  G_CALLBACK (fr_window_progress_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->archive),
+			  "message",
+			  G_CALLBACK (fr_window_message_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->archive),
+			  "stoppable",
+			  G_CALLBACK (fr_window_stoppable_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->archive),
+			  "working_archive",
+			  G_CALLBACK (fr_window_working_archive_cb),
+			  window);
+
+	fr_archive_set_fake_load_func (window->archive,
+				       fr_window_fake_load,
+				       window);
+
+	window->priv->sort_method = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_SORT_METHOD);
+	window->priv->sort_type = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_SORT_TYPE);
+
+	window->priv->list_mode = window->priv->last_list_mode = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE);
+	g_settings_set_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+
+	window->priv->history = NULL;
+	window->priv->history_current = NULL;
+
+	window->priv->action = FR_ACTION_NONE;
+
+	window->priv->open_default_dir = g_strdup (get_home_uri ());
+	window->priv->add_default_dir = g_strdup (get_home_uri ());
+	window->priv->extract_default_dir = g_strdup (get_home_uri ());
+
+	window->priv->give_focus_to_the_list = FALSE;
+
+	window->priv->activity_ref = 0;
+	window->priv->activity_timeout_handle = 0;
+
+	window->priv->update_timeout_handle = 0;
+
+	window->priv->archive_present = FALSE;
+	window->priv->archive_new = FALSE;
+	window->priv->archive_uri = NULL;
+
+	window->priv->drag_destination_folder = NULL;
+	window->priv->drag_base_dir = NULL;
+	window->priv->drag_error = NULL;
+	window->priv->drag_file_list = NULL;
+
+	window->priv->batch_mode = FALSE;
+	window->priv->batch_action_list = NULL;
+	window->priv->batch_action = NULL;
+	window->priv->extract_interact_use_default_dir = FALSE;
+	window->priv->non_interactive = FALSE;
+
+	window->priv->password = NULL;
+	window->priv->compression = g_settings_get_enum (window->priv->settings_general, PREF_GENERAL_COMPRESSION_LEVEL);
+        window->priv->encrypt_header = g_settings_get_boolean (window->priv->settings_general, PREF_GENERAL_ENCRYPT_HEADER);
+	window->priv->volume_size = 0;
+
+	window->priv->convert_data.converting = FALSE;
+	window->priv->convert_data.temp_dir = NULL;
+	window->priv->convert_data.new_archive = NULL;
+	window->priv->convert_data.password = NULL;
+	window->priv->convert_data.encrypt_header = FALSE;
+	window->priv->convert_data.volume_size = 0;
+
+	window->priv->stoppable = TRUE;
+
+	window->priv->batch_adding_one_file = FALSE;
+
+	window->priv->path_clicked = NULL;
+
+	window->priv->current_view_length = 0;
+
+	window->priv->current_batch_action.type = FR_BATCH_ACTION_NONE;
+	window->priv->current_batch_action.data = NULL;
+	window->priv->current_batch_action.free_func = NULL;
+
+	window->priv->pd_last_archive = NULL;
+	window->priv->pd_last_message = NULL;
+	window->priv->pd_last_fraction = 0.0;
+
+	/* Create the widgets. */
+
+	/* * File list. */
+
+	window->priv->list_store = fr_list_model_new (NUMBER_OF_COLUMNS,
+						      G_TYPE_POINTER,
+						      GDK_TYPE_PIXBUF,
+						      G_TYPE_STRING,
+						      GDK_TYPE_PIXBUF,
+						      G_TYPE_STRING,
+						      G_TYPE_STRING,
+						      G_TYPE_STRING,
+						      G_TYPE_STRING);
+	g_object_set_data (G_OBJECT (window->priv->list_store), "FrWindow", window);
+	window->priv->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (window->priv->list_store));
+
+	add_file_list_columns (window, GTK_TREE_VIEW (window->priv->list_view));
+	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (window->priv->list_view),
+					 TRUE);
+	gtk_tree_view_set_search_column (GTK_TREE_VIEW (window->priv->list_view),
+					 COLUMN_NAME);
+
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+					 COLUMN_NAME, name_column_sort_func,
+					 NULL, NULL);
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+					 COLUMN_SIZE, size_column_sort_func,
+					 NULL, NULL);
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+					 COLUMN_TYPE, type_column_sort_func,
+					 NULL, NULL);
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+					 COLUMN_TIME, time_column_sort_func,
+					 NULL, NULL);
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+					 COLUMN_PATH, path_column_sort_func,
+					 NULL, NULL);
+
+	gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (window->priv->list_store),
+						 no_sort_column_sort_func,
+						 NULL, NULL);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+
+	g_signal_connect (selection,
+			  "changed",
+			  G_CALLBACK (selection_changed_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "row_activated",
+			  G_CALLBACK (row_activated_cb),
+			  window);
+
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "button_press_event",
+			  G_CALLBACK (file_button_press_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "button_release_event",
+			  G_CALLBACK (file_button_release_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "motion_notify_event",
+			  G_CALLBACK (file_motion_notify_callback),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "leave_notify_event",
+			  G_CALLBACK (file_leave_notify_callback),
+			  window);
+
+	g_signal_connect (G_OBJECT (window->priv->list_store),
+			  "sort_column_changed",
+			  G_CALLBACK (sort_column_changed_cb),
+			  window);
+
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "drag_begin",
+			  G_CALLBACK (file_list_drag_begin),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->list_view),
+			  "drag_end",
+			  G_CALLBACK (file_list_drag_end),
+			  window);
+	egg_tree_multi_drag_add_drag_support (GTK_TREE_VIEW (window->priv->list_view));
+
+	list_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_scrolled_window),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (list_scrolled_window),
+	                                     GTK_SHADOW_IN);
+	gtk_container_add (GTK_CONTAINER (list_scrolled_window), window->priv->list_view);
+
+	/* filter bar */
+
+	window->priv->filter_bar = filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+	gtk_container_set_border_width (GTK_CONTAINER (filter_box), 3);
+	fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
+
+	gtk_box_pack_start (GTK_BOX (filter_box),
+			    gtk_label_new (_("Find:")), FALSE, FALSE, 0);
+
+	/* * filter entry */
+
+	window->priv->filter_entry = GTK_WIDGET (gtk_entry_new ());
+	gtk_entry_set_icon_from_icon_name (GTK_ENTRY (window->priv->filter_entry),
+				           GTK_ENTRY_ICON_SECONDARY,
+				           "edit-clear");
+
+	gtk_widget_set_size_request (window->priv->filter_entry, 300, -1);
+	gtk_box_pack_start (GTK_BOX (filter_box),
+			    window->priv->filter_entry, FALSE, FALSE, 6);
+
+	g_signal_connect (G_OBJECT (window->priv->filter_entry),
+			  "activate",
+			  G_CALLBACK (filter_entry_activate_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->filter_entry),
+			  "icon-release",
+			  G_CALLBACK (filter_entry_icon_release_cb),
+			  window);
+
+	gtk_widget_show_all (filter_box);
+
+	/* tree view */
+
+	window->priv->tree_store = gtk_tree_store_new (TREE_NUMBER_OF_COLUMNS,
+						       G_TYPE_STRING,
+						       GDK_TYPE_PIXBUF,
+						       G_TYPE_STRING,
+						       PANGO_TYPE_WEIGHT);
+	window->priv->tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (window->priv->tree_store));
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (window->priv->tree_view), FALSE);
+	add_dir_tree_columns (window, GTK_TREE_VIEW (window->priv->tree_view));
+
+	g_signal_connect (G_OBJECT (window->priv->tree_view),
+			  "button_press_event",
+			  G_CALLBACK (dir_tree_button_press_cb),
+			  window);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
+	g_signal_connect (selection,
+			  "changed",
+			  G_CALLBACK (dir_tree_selection_changed_cb),
+			  window);
+
+	g_signal_connect (G_OBJECT (window->priv->tree_view),
+			  "drag_begin",
+			  G_CALLBACK (file_list_drag_begin),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->tree_view),
+			  "drag_end",
+			  G_CALLBACK (file_list_drag_end),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->tree_view),
+			  "drag_data_get",
+			  G_CALLBACK (fr_window_folder_tree_drag_data_get),
+			  window);
+	gtk_drag_source_set (window->priv->tree_view,
+			     GDK_BUTTON1_MASK,
+			     folder_tree_targets, G_N_ELEMENTS (folder_tree_targets),
+			     GDK_ACTION_COPY);
+
+	tree_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tree_scrolled_window),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (tree_scrolled_window),
+	                                     GTK_SHADOW_IN);
+	gtk_container_add (GTK_CONTAINER (tree_scrolled_window), window->priv->tree_view);
+
+	/* side pane */
+
+	window->priv->sidepane = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+	sidepane_title = gtk_frame_new (NULL);
+	gtk_frame_set_shadow_type (GTK_FRAME (sidepane_title), GTK_SHADOW_ETCHED_IN);
+
+	sidepane_title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+	gtk_container_set_border_width (GTK_CONTAINER (sidepane_title_box), 2);
+	gtk_container_add (GTK_CONTAINER (sidepane_title), sidepane_title_box);
+	sidepane_title_label = gtk_label_new (_("Folders"));
+
+	gtk_label_set_xalign (GTK_LABEL (sidepane_title_label), 0.0);
+	gtk_box_pack_start (GTK_BOX (sidepane_title_box), sidepane_title_label, TRUE, TRUE, 0);
+
+	close_sidepane_button = gtk_button_new ();
+	gtk_container_add (GTK_CONTAINER (close_sidepane_button),
+	                                  gtk_image_new_from_icon_name ("window-close",
+	                                                                GTK_ICON_SIZE_MENU));
+	gtk_button_set_relief (GTK_BUTTON (close_sidepane_button), GTK_RELIEF_NONE);
+	gtk_widget_set_tooltip_text (close_sidepane_button, _("Close the folders pane"));
+	g_signal_connect (close_sidepane_button,
+			  "clicked",
+			  G_CALLBACK (close_sidepane_button_clicked_cb),
+			  window);
+	gtk_box_pack_end (GTK_BOX (sidepane_title_box), close_sidepane_button, FALSE, FALSE, 0);
+
+	gtk_box_pack_start (GTK_BOX (window->priv->sidepane), sidepane_title, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (window->priv->sidepane), tree_scrolled_window, TRUE, TRUE, 0);
+
+	/* main content */
+
+	window->priv->paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
+	gtk_paned_pack1 (GTK_PANED (window->priv->paned), window->priv->sidepane, FALSE, TRUE);
+	gtk_paned_pack2 (GTK_PANED (window->priv->paned), list_scrolled_window, TRUE, TRUE);
+	gtk_paned_set_position (GTK_PANED (window->priv->paned), g_settings_get_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH));
+
+	fr_window_attach (FR_WINDOW (window), window->priv->paned, FR_WINDOW_AREA_CONTENTS);
+	gtk_widget_show_all (window->priv->paned);
+
+	/* Build the menu and the toolbar. */
+
+	window->priv->ui_manager = ui = gtk_builder_new ();
+
+	window->priv->actions = actions = (GActionGroup*)g_simple_action_group_new ();
+
+	/* other actions */
+	g_action_map_add_action_entries (G_ACTION_MAP (actions),
+					 action_entries, G_N_ELEMENTS (action_entries),
+					 window);
+
+	accel_group = gtk_accel_group_new ();
+	gtk_widget_insert_action_group (GTK_WIDGET (window), "win", actions);
+	gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
+
+	/* Add a hidden short cut Ctrl-Q for power users */
+	gtk_accel_group_connect (accel_group,
+				 GDK_KEY_q, GDK_CONTROL_MASK, 0,
+				 g_cclosure_new_swap (G_CALLBACK (fr_window_close), window, NULL));
+
+	if (! gtk_builder_add_from_resource (ui, ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "menus-toolbars.ui", &error)) {
+		g_message ("building menus failed: %s", error->message);
+		g_error_free (error);
+	}
+    /*Add shortcut keys*/
+	for (gulong i = 0; i < G_N_ELEMENTS (menu_keybindings); i++)
+	{
+		menuitem = (GtkWidget*)gtk_builder_get_object (ui, menu_keybindings[i].widget_id);
+		gtk_widget_add_accelerator (menuitem, "activate", accel_group,
+					    menu_keybindings[i].keyval,
+					    menu_keybindings[i].modifier,
+					    GTK_ACCEL_VISIBLE);
+	}
+
+	gtk_builder_add_callback_symbols (ui,
+					  "menu_item_select_cb", G_CALLBACK (menu_item_select_cb),
+					  "menu_item_deselect_cb", G_CALLBACK (menu_item_deselect_cb),
+					  NULL);
+	gtk_builder_connect_signals (ui, window);
+	/* open recent toolbar item action  */
+
+	window->priv->menubar_recentmenu = fr_window_create_recent_chooser (window);
+	menuitem = (GtkWidget *)gtk_builder_get_object (ui, "open_recent_item");
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), window->priv->menubar_recentmenu);
+
+    /* open recent toolbar item action  */
+	menuitem = (GtkWidget *)gtk_builder_get_object (ui, "tool_open_recent_item");
+	window->priv->toolbar_recentmenu = fr_window_create_recent_chooser (window);
+	gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menuitem), window->priv->toolbar_recentmenu);
+
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT)
+		action = g_simple_action_new_stateful ("ViewAllFiles", G_VARIANT_TYPE ("s"), g_variant_new_string ("files"));
+	else
+		action = g_simple_action_new_stateful ("ViewAllFiles", G_VARIANT_TYPE ("s"), g_variant_new_string ("folder"));
+
+	g_action_map_add_action (G_ACTION_MAP (actions), G_ACTION (action));
+	g_object_unref (action);
+
+	menubar = (GtkWidget *)gtk_builder_get_object (ui, "engrampamenubar");
+	fr_window_attach (FR_WINDOW (window), menubar, FR_WINDOW_AREA_MENUBAR);
+	gtk_widget_show (menubar);
+
+	window->priv->toolbar = toolbar = (GtkWidget *)gtk_builder_get_object (ui, "engrampatoolbar");
+	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
+	gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
+
+	/* location bar */
+
+	window->priv->location_bar = (GtkWidget *)gtk_builder_get_object (ui, "locationbar");
+	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (window->priv->location_bar), FALSE);
+	gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->location_bar), GTK_TOOLBAR_BOTH_HORIZ);
+	gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->location_bar), GTK_STYLE_CLASS_TOOLBAR);
+
+	init_engramp_menu_popup (window, ui);
+
+	/* file list mode */
+	menu_radio_files = (GtkWidget *)gtk_builder_get_object (ui, "view_all_files_item");
+	g_signal_connect (G_OBJECT (menu_radio_files),
+			  "toggled",
+			  G_CALLBACK (view_all_files_selected_toggled),
+			  window);
+	/* current location */
+
+	location_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+	/* Translators: after the colon there is a folder name. */
+	window->priv->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
+	gtk_box_pack_start (GTK_BOX (location_box),
+			    window->priv->location_label, FALSE, FALSE, 5);
+
+	window->priv->location_entry = gtk_entry_new ();
+	gtk_entry_set_icon_from_icon_name (GTK_ENTRY (window->priv->location_entry),
+				       GTK_ENTRY_ICON_PRIMARY,
+				       "folder");
+	gtk_label_set_mnemonic_widget (GTK_LABEL (window->priv->location_label),
+				       window->priv->location_entry);
+
+	gtk_box_pack_start (GTK_BOX (location_box),
+			    window->priv->location_entry, TRUE, TRUE, 5);
+
+	g_signal_connect (G_OBJECT (window->priv->location_entry),
+			  "key_press_event",
+			  G_CALLBACK (location_entry_key_press_event_cb),
+			  window);
+
+	{
+		GtkToolItem *tool_item;
+
+		tool_item = gtk_separator_tool_item_new ();
+		gtk_widget_show_all (GTK_WIDGET (tool_item));
+		gtk_toolbar_insert (GTK_TOOLBAR (window->priv->location_bar), tool_item, -1);
+
+		tool_item = gtk_tool_item_new ();
+		gtk_tool_item_set_expand (tool_item, TRUE);
+		gtk_container_add (GTK_CONTAINER (tool_item), location_box);
+		gtk_widget_show_all (GTK_WIDGET (tool_item));
+		gtk_toolbar_insert (GTK_TOOLBAR (window->priv->location_bar), tool_item, -1);
+	}
+
+	fr_window_attach (FR_WINDOW (window), window->priv->location_bar, FR_WINDOW_AREA_LOCATIONBAR);
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT)
+		gtk_widget_hide (window->priv->location_bar);
+	else
+		gtk_widget_show (window->priv->location_bar);
+
+	/**/
+
+	fr_window_attach (FR_WINDOW (window), window->priv->toolbar, FR_WINDOW_AREA_TOOLBAR);
+	if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_TOOLBAR))
+		gtk_widget_show (toolbar);
+	else
+		gtk_widget_hide (toolbar);
+
+	window->priv->file_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "FilePopupMenu");
+	window->priv->folder_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "FolderPopupMenu");
+	window->priv->sidebar_folder_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "SidebarFolderPopupMenu");
+
+	/* Create the statusbar. */
+
+	window->priv->statusbar = gtk_statusbar_new ();
+	window->priv->help_message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->priv->statusbar), "help_message");
+	window->priv->list_info_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->priv->statusbar), "list_info");
+	window->priv->progress_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->priv->statusbar), "progress");
+
+	statusbar = GTK_STATUSBAR (window->priv->statusbar);
+
+	/*reduce size of statusbar */
+	gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0);
+	gtk_widget_set_margin_bottom (GTK_WIDGET (statusbar), 0);
+
+	statusbar_box = gtk_statusbar_get_message_area (statusbar);
+	gtk_box_set_homogeneous (GTK_BOX (statusbar_box), FALSE);
+	gtk_box_set_spacing (GTK_BOX (statusbar_box), 4);
+	gtk_box_set_child_packing (GTK_BOX (statusbar_box), gtk_statusbar_get_message_area (statusbar), TRUE, TRUE, 0, GTK_PACK_START );
+
+	window->priv->progress_bar = gtk_progress_bar_new ();
+	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (window->priv->progress_bar), ACTIVITY_PULSE_STEP);
+	gtk_widget_set_size_request (window->priv->progress_bar, -1, PROGRESS_BAR_HEIGHT);
+	{
+		GtkWidget *vbox;
+
+		vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+		gtk_box_pack_start (GTK_BOX (statusbar_box), vbox, FALSE, FALSE, 0);
+		gtk_box_pack_start (GTK_BOX (vbox), window->priv->progress_bar, TRUE, TRUE, 1);
+		gtk_widget_show (vbox);
+	}
+	gtk_widget_show (statusbar_box);
+
+	fr_window_attach (FR_WINDOW (window), window->priv->statusbar, FR_WINDOW_AREA_STATUSBAR);
+	if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_STATUSBAR))
+		gtk_widget_show (window->priv->statusbar);
+	else
+		gtk_widget_hide (window->priv->statusbar);
+
+	/**/
+
+	fr_window_update_title (window);
+	fr_window_update_sensitivity (window);
+	fr_window_update_file_list (window, FALSE);
+	fr_window_update_dir_tree (window);
+	fr_window_update_current_location (window);
+	fr_window_update_columns_visibility (window);
+
+	/* Add notification callbacks. */
+
+	g_signal_connect (window->priv->settings_ui,
+			"changed::" PREF_UI_HISTORY_LEN,
+			G_CALLBACK (pref_history_len_changed),
+			window);
+	g_signal_connect (window->priv->settings_ui,
+			"changed::" PREF_UI_VIEW_TOOLBAR,
+			G_CALLBACK (pref_view_toolbar_changed),
+			window);
+	g_signal_connect (window->priv->settings_ui,
+			"changed::" PREF_UI_VIEW_STATUSBAR,
+			G_CALLBACK (pref_view_statusbar_changed),
+			window);
+        g_signal_connect (window->priv->settings_ui,
+			"changed::" PREF_UI_VIEW_FOLDERS,
+			G_CALLBACK (pref_view_folders_changed),
+			window);
+	g_signal_connect (window->priv->settings_listing,
+			"changed::" PREF_LISTING_SHOW_TYPE,
+			G_CALLBACK (pref_show_field_changed),
+			window);
+	g_signal_connect (window->priv->settings_listing,
+			"changed::" PREF_LISTING_SHOW_SIZE,
+			G_CALLBACK (pref_show_field_changed),
+			window);
+        g_signal_connect (window->priv->settings_listing,
+			"changed::" PREF_LISTING_SHOW_TIME,
+			G_CALLBACK (pref_show_field_changed),
+			window);
+	g_signal_connect (window->priv->settings_listing,
+			"changed::" PREF_LISTING_SHOW_PATH,
+			G_CALLBACK (pref_show_field_changed),
+			window);
+	g_signal_connect (window->priv->settings_listing,
+			"changed::" PREF_LISTING_USE_MIME_ICONS,
+			G_CALLBACK (pref_use_mime_icons_changed),
+			window);
+
+	if (window->priv->settings_caja)
+		g_signal_connect (window->priv->settings_caja,
+				"changed::" CAJA_CLICK_POLICY,
+				G_CALLBACK (pref_click_policy_changed),
+				window);
+
+	/* Give focus to the list. */
+
+	gtk_widget_grab_focus (window->priv->list_view);
+}
+
+GtkWidget *
+fr_window_new (void)
+{
+	GtkWidget *window;
+
+	window = g_object_new (FR_TYPE_WINDOW, "application", g_application_get_default (), NULL);
+	fr_window_construct ((FrWindow*) window);
+
+	return window;
+}
+
+static void
+fr_window_set_archive_uri (FrWindow   *window,
+			   const char *uri)
+{
+	if (window->priv->archive_uri != NULL)
+			g_free (window->priv->archive_uri);
+		window->priv->archive_uri = g_strdup (uri);
+}
+
+gboolean
+fr_window_archive_new (FrWindow   *window,
+		       const char *uri)
+{
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	if (! fr_archive_create (window->archive, uri)) {
+		GtkWindow *file_sel = g_object_get_data (G_OBJECT (window), "fr_file_sel");
+
+		window->priv->load_error_parent_window = file_sel;
+		fr_archive_action_completed (window->archive,
+					     FR_ACTION_CREATING_NEW_ARCHIVE,
+					     FR_PROC_ERROR_GENERIC,
+					     _("Archive type not supported."));
+
+		return FALSE;
+	}
+
+	fr_window_set_archive_uri (window, uri);
+	window->priv->archive_present = TRUE;
+	window->priv->archive_new = TRUE;
+
+	fr_archive_action_completed (window->archive,
+				     FR_ACTION_CREATING_NEW_ARCHIVE,
+				     FR_PROC_ERROR_NONE,
+				     NULL);
+
+	return TRUE;
+}
+
+FrWindow *
+fr_window_archive_open (FrWindow   *current_window,
+			const char *uri,
+			GtkWindow  *parent)
+{
+	FrWindow *window = current_window;
+
+	if (current_window->priv->archive_present)
+		window = (FrWindow *) fr_window_new ();
+
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	fr_window_archive_close (window);
+
+	fr_window_set_archive_uri (window, uri);
+	window->priv->archive_present = FALSE;
+	window->priv->give_focus_to_the_list = TRUE;
+	window->priv->load_error_parent_window = parent;
+
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_LOAD,
+					    g_strdup (window->priv->archive_uri),
+					    (GFreeFunc) g_free);
+
+	fr_archive_load (window->archive, window->priv->archive_uri, window->priv->password);
+
+	return window;
+}
+
+void
+fr_window_archive_close (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (! window->priv->archive_new && ! window->priv->archive_present)
+		return;
+
+	fr_window_free_open_files (window);
+	fr_clipboard_data_unref (window->priv->copy_data);
+	window->priv->copy_data = NULL;
+
+	fr_window_set_password (window, NULL);
+	fr_window_set_volume_size(window, 0);
+	fr_window_history_clear (window);
+
+	window->priv->archive_new = FALSE;
+	window->priv->archive_present = FALSE;
+
+	fr_window_update_title (window);
+	fr_window_update_sensitivity (window);
+	fr_window_update_file_list (window, FALSE);
+	fr_window_update_dir_tree (window);
+	fr_window_update_current_location (window);
+	fr_window_update_statusbar_list_info (window);
+}
+
+const char *
+fr_window_get_archive_uri (FrWindow *window)
+{
+	g_return_val_if_fail (window != NULL, NULL);
+
+	return window->priv->archive_uri;
+}
+
+const char *
+fr_window_get_paste_archive_uri (FrWindow *window)
+{
+	g_return_val_if_fail (window != NULL, NULL);
+
+	if (window->priv->clipboard_data != NULL)
+		return window->priv->clipboard_data->archive_filename;
+	else
+		return NULL;
+}
+
+gboolean
+fr_window_archive_is_present (FrWindow *window)
+{
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	return window->priv->archive_present;
+}
+
+typedef struct {
+	char     *uri;
+	char     *password;
+	gboolean  encrypt_header;
+	guint     volume_size;
+} SaveAsData;
+
+static SaveAsData *
+save_as_data_new (const char *uri,
+		  const char *password,
+		  gboolean    encrypt_header,
+	  	  guint       volume_size)
+{
+	SaveAsData *sdata;
+
+	sdata = g_new0 (SaveAsData, 1);
+	if (uri != NULL)
+		sdata->uri = g_strdup (uri);
+	if (password != NULL)
+		sdata->password = g_strdup (password);
+	sdata->encrypt_header = encrypt_header;
+	sdata->volume_size = volume_size;
+
+	return sdata;
+}
+
+static void
+save_as_data_free (SaveAsData *sdata)
+{
+	if (sdata == NULL)
+		return;
+	g_free (sdata->uri);
+	g_free (sdata->password);
+	g_free (sdata);
+}
+
+void
+fr_window_archive_save_as (FrWindow   *window,
+			   const char *uri,
+			   const char *password,
+			   gboolean    encrypt_header,
+			   guint       volume_size)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (uri != NULL);
+	g_return_if_fail (window->archive != NULL);
+
+	fr_window_convert_data_free (window, TRUE);
+	window->priv->convert_data.new_file = g_strdup (uri);
+
+	/* create the new archive */
+
+	window->priv->convert_data.new_archive = fr_archive_new ();
+	if (! fr_archive_create (window->priv->convert_data.new_archive, uri)) {
+		GtkWidget *d;
+		char      *utf8_name;
+		char      *message;
+
+		utf8_name = g_uri_display_basename (uri);
+		message = g_strdup_printf (_("Could not save the archive \"%s\""), utf8_name);
+		g_free (utf8_name);
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   message,
+					   "%s",
+					   _("Archive type not supported."));
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (d);
+
+		g_free (message);
+
+		g_object_unref (window->priv->convert_data.new_archive);
+		window->priv->convert_data.new_archive = NULL;
+
+		return;
+	}
+
+	g_return_if_fail (window->priv->convert_data.new_archive->command != NULL);
+
+	if (password != NULL) {
+		window->priv->convert_data.password = g_strdup (password);
+		window->priv->convert_data.encrypt_header = encrypt_header;
+	}
+	else
+		window->priv->convert_data.encrypt_header = FALSE;
+	window->priv->convert_data.volume_size = volume_size;
+
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_SAVE_AS,
+					    save_as_data_new (uri, password, encrypt_header, volume_size),
+					    (GFreeFunc) save_as_data_free);
+
+	g_signal_connect (G_OBJECT (window->priv->convert_data.new_archive),
+			  "start",
+			  G_CALLBACK (action_started),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->convert_data.new_archive),
+			  "done",
+			  G_CALLBACK (convert__action_performed),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->convert_data.new_archive),
+			  "progress",
+			  G_CALLBACK (fr_window_progress_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->convert_data.new_archive),
+			  "message",
+			  G_CALLBACK (fr_window_message_cb),
+			  window);
+	g_signal_connect (G_OBJECT (window->priv->convert_data.new_archive),
+			  "stoppable",
+			  G_CALLBACK (fr_window_stoppable_cb),
+			  window);
+
+	window->priv->convert_data.converting = TRUE;
+	window->priv->convert_data.temp_dir = get_temp_work_dir (NULL);
+
+	fr_process_clear (window->archive->process);
+	fr_archive_extract_to_local (window->archive,
+				     NULL,
+				     window->priv->convert_data.temp_dir,
+				     NULL,
+				     FALSE,
+				     TRUE,
+				     FALSE,
+				     window->priv->password);
+	fr_process_start (window->archive->process);
+}
+
+void
+fr_window_archive_reload (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->activity_ref > 0)
+		return;
+	if (window->priv->archive_new)
+		return;
+
+	fr_archive_reload (window->archive, window->priv->password);
+}
+
+/**/
+
+void
+fr_window_archive_add_files (FrWindow *window,
+			     GList    *file_list, /* GFile list */
+			     gboolean  update)
+{
+	GFile *base;
+	char  *base_dir;
+	int    base_len;
+	GList *files = NULL;
+	GList *scan;
+	char  *base_uri;
+
+	base = g_file_get_parent ((GFile *) file_list->data);
+	base_dir = g_file_get_path (base);
+	base_len = 0;
+	if (strcmp (base_dir, "/") != 0)
+		base_len = strlen (base_dir);
+
+	for (scan = file_list; scan; scan = scan->next) {
+		GFile *file = scan->data;
+		char  *path;
+		char  *rel_path;
+
+		path = g_file_get_path (file);
+		rel_path = g_strdup (path + base_len + 1);
+		files = g_list_prepend (files, rel_path);
+
+		g_free (path);
+	}
+
+	base_uri = g_file_get_uri (base);
+
+	fr_archive_add_files (window->archive,
+			      files,
+			      base_uri,
+			      fr_window_get_current_location (window),
+			      update,
+			      window->priv->password,
+			      window->priv->encrypt_header,
+			      window->priv->compression,
+			      window->priv->volume_size);
+
+	g_free (base_uri);
+	path_list_free (files);
+	g_free (base_dir);
+	g_object_unref (base);
+}
+
+void
+fr_window_archive_add_with_wildcard (FrWindow      *window,
+				     const char    *include_files,
+				     const char    *exclude_files,
+				     const char    *exclude_folders,
+				     const char    *base_dir,
+				     const char    *dest_dir,
+				     gboolean       update,
+				     gboolean       follow_links)
+{
+	fr_archive_add_with_wildcard (window->archive,
+				      include_files,
+				      exclude_files,
+				      exclude_folders,
+				      base_dir,
+				      (dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
+				      update,
+				      follow_links,
+				      window->priv->password,
+				      window->priv->encrypt_header,
+				      window->priv->compression,
+				      window->priv->volume_size);
+}
+
+void
+fr_window_archive_add_directory (FrWindow      *window,
+				 const char    *directory,
+				 const char    *base_dir,
+				 const char    *dest_dir,
+				 gboolean       update)
+{
+	fr_archive_add_directory (window->archive,
+				  directory,
+				  base_dir,
+				  (dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
+				  update,
+				  window->priv->password,
+				  window->priv->encrypt_header,
+				  window->priv->compression,
+				  window->priv->volume_size);
+}
+
+void
+fr_window_archive_add_items (FrWindow      *window,
+			     GList         *item_list,
+			     const char    *base_dir,
+			     const char    *dest_dir,
+			     gboolean       update)
+{
+	fr_archive_add_items (window->archive,
+			      item_list,
+			      base_dir,
+			      (dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
+			      update,
+			      window->priv->password,
+			      window->priv->encrypt_header,
+			      window->priv->compression,
+			      window->priv->volume_size);
+}
+
+void
+fr_window_archive_add_dropped_items (FrWindow *window,
+				     GList    *item_list,
+				     gboolean  update)
+{
+	fr_archive_add_dropped_items (window->archive,
+				      item_list,
+				      fr_window_get_current_location (window),
+				      fr_window_get_current_location (window),
+				      update,
+				      window->priv->password,
+				      window->priv->encrypt_header,
+				      window->priv->compression,
+				      window->priv->volume_size);
+}
+
+static void
+remove_data_free (GList *rdata)
+{
+	g_list_free_full(rdata, g_free);
+}
+
+void
+fr_window_archive_remove (FrWindow      *window,
+			  GList         *file_list)
+{
+	char  *password;
+	GList *remove_list;
+
+	fr_window_clipboard_remove_file_list (window, file_list);
+
+	fr_process_clear (window->archive->process);
+
+	remove_list = g_list_copy_deep (file_list, (GCopyFunc) g_strdup, NULL);
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_DELETE,
+					    remove_list,
+					    (GFreeFunc) remove_data_free);
+
+	password = window->priv->password;
+	if (password != NULL && password[0] != '\0')
+		g_object_set (window->archive->command, "password", password, NULL);
+
+	fr_archive_remove (window->archive, remove_list, window->priv->compression);
+	fr_process_start (window->archive->process);
+}
+
+/* -- window_archive_extract -- */
+
+static ExtractData*
+extract_data_new (GList       *file_list,
+		  const char  *extract_to_dir,
+		  const char  *sub_dir,
+		  const char  *base_dir,
+		  gboolean     skip_older,
+		  FrOverwrite  overwrite,
+		  gboolean     junk_paths,
+		  gboolean     extract_here,
+		  gboolean     ask_to_open_destination)
+{
+	ExtractData *edata;
+	int i = 1;
+
+	edata = g_new0 (ExtractData, 1);
+	edata->file_list = path_list_dup (file_list);
+	if (sub_dir != NULL)
+		edata->sub_dir = g_strdup (sub_dir);
+	if (extract_to_dir != NULL && sub_dir == NULL) {
+		edata->extract_to_dir = g_strdup (extract_to_dir);
+	} else if (extract_to_dir != NULL && sub_dir != NULL) {
+		edata->extract_to_dir = g_build_filename (extract_to_dir, sub_dir, NULL);
+		while (uri_exists (edata->extract_to_dir) && uri_is_file (edata->extract_to_dir)) {
+			g_free (edata->extract_to_dir);
+			edata->extract_to_dir = g_strdup_printf ("%s/%s_%d", extract_to_dir, sub_dir, i++);
+		}
+	}
+	edata->skip_older = skip_older;
+	edata->overwrite = overwrite;
+	edata->junk_paths = junk_paths;
+	if (base_dir != NULL)
+		edata->base_dir = g_strdup (base_dir);
+	edata->extract_here = extract_here;
+	edata->ask_to_open_destination = ask_to_open_destination;
+
+	return edata;
+}
+
+static ExtractData*
+extract_to_data_new (const char *extract_to_dir)
+{
+	return extract_data_new (NULL,
+				 extract_to_dir,
+				 NULL,
+				 NULL,
+				 FALSE,
+				 TRUE,
+				 FALSE,
+				 FALSE,
+				 FALSE);
+}
+
+static void
+extract_data_free (ExtractData *edata)
+{
+	g_return_if_fail (edata != NULL);
+
+	path_list_free (edata->file_list);
+	g_free (edata->extract_to_dir);
+	g_free (edata->sub_dir);
+	g_free (edata->base_dir);
+
+	g_free (edata);
+}
+
+static gboolean
+archive_is_encrypted (FrWindow *window,
+		      GList    *file_list)
+{
+	gboolean encrypted = FALSE;
+
+	if (file_list == NULL) {
+		guint i;
+
+		for (i = 0; ! encrypted && i < window->archive->command->files->len; i++) {
+			FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+
+			if (fdata->encrypted)
+				encrypted = TRUE;
+		}
+	}
+	else {
+
+		GHashTable *file_hash;
+		guint       i;
+		GList      *scan;
+
+		file_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		for (i = 0; i < window->archive->command->files->len; i++) {
+			FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+			g_hash_table_insert (file_hash, fdata->original_path, fdata);
+		}
+
+		for (scan = file_list; ! encrypted && scan; scan = scan->next) {
+			char     *filename = scan->data;
+			FileData *fdata;
+
+			fdata = g_hash_table_lookup (file_hash, filename);
+			g_return_val_if_fail (fdata != NULL, FALSE);
+
+			if (fdata->encrypted)
+				encrypted = TRUE;
+		}
+
+		g_hash_table_destroy (file_hash);
+	}
+
+	return encrypted;
+}
+
+static gboolean
+archive_extract_check_disk_space_full (GPtrArray  *files,
+                                       const char *extract_to_dir)
+{
+	guint64 freespace;
+	guint64 archive_size = 0;
+	guint   i;
+
+	freespace = get_dest_free_space (g_filename_from_uri (extract_to_dir, NULL, NULL));
+
+	for (i = 0; i <files->len; i++)
+	{
+		FileData *fdata = g_ptr_array_index (files, i);
+		archive_size += fdata->size;
+	}
+	/* When the decompressed target file is less than 100MB,
+     2 * (target file size)  needs to disk space
+     and when it is greater than 100MB,
+     100MB + (target file size) needs to disk space */
+
+	if (archive_size <= 1024 * 1024 * 100)
+		archive_size = archive_size * 2;
+	else
+		archive_size += 1024 * 1024 * 100;
+
+	return freespace < archive_size * 2;
+}
+
+void
+fr_window_archive_extract_here (FrWindow   *window,
+				gboolean    skip_older,
+				FrOverwrite overwrite,
+				gboolean    junk_paths)
+{
+	ExtractData *edata;
+
+	edata = extract_data_new (NULL,
+				  NULL,
+				  NULL,
+				  NULL,
+				  skip_older,
+				  overwrite,
+				  junk_paths,
+				  TRUE,
+				  FALSE);
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_EXTRACT,
+					    edata,
+					    (GFreeFunc) extract_data_free);
+
+	if (archive_is_encrypted (window, NULL) && (window->priv->password == NULL)) {
+		dlg_ask_password (window);
+		return;
+	}
+
+	window->priv->ask_to_open_destination_after_extraction = edata->ask_to_open_destination;
+
+	fr_process_clear (window->archive->process);
+	if (fr_archive_extract_here (window->archive,
+				     edata->skip_older,
+				     edata->overwrite,
+				     edata->junk_paths,
+				     window->priv->password))
+	{
+		fr_process_start (window->archive->process);
+	}
+}
+
+/* -- fr_window_archive_extract -- */
+
+typedef struct {
+	FrWindow    *window;
+	ExtractData *edata;
+	GList       *current_file;
+	gboolean     extract_all;
+} OverwriteData;
+
+#define _FR_RESPONSE_OVERWRITE_YES_ALL 100
+#define _FR_RESPONSE_OVERWRITE_YES     101
+#define _FR_RESPONSE_OVERWRITE_NO      102
+
+static void
+_fr_window_archive_extract_from_edata (FrWindow    *window,
+				       ExtractData *edata)
+{
+	window->priv->ask_to_open_destination_after_extraction = edata->ask_to_open_destination;
+
+	fr_process_clear (window->archive->process);
+	fr_archive_extract (window->archive,
+			    edata->file_list,
+			    edata->extract_to_dir,
+			    edata->base_dir,
+			    edata->skip_older,
+			    edata->overwrite == FR_OVERWRITE_YES,
+			    edata->junk_paths,
+			    window->priv->password);
+	fr_process_start (window->archive->process);
+}
+
+static void _fr_window_ask_overwrite_dialog (OverwriteData *odata);
+
+static void
+overwrite_dialog_response_cb (GtkDialog *dialog,
+			      int        response_id,
+			      gpointer   user_data)
+{
+	OverwriteData *odata = user_data;
+	gboolean       do_not_extract = FALSE;
+
+	switch (response_id) {
+	case _FR_RESPONSE_OVERWRITE_YES_ALL:
+		odata->edata->overwrite = FR_OVERWRITE_YES;
+		break;
+
+	case _FR_RESPONSE_OVERWRITE_YES:
+		odata->current_file = odata->current_file->next;
+		break;
+
+	case _FR_RESPONSE_OVERWRITE_NO:
+		{
+			/* remove the file from the list to extract */
+			GList *next = odata->current_file->next;
+			odata->edata->file_list = g_list_remove_link (odata->edata->file_list, odata->current_file);
+			path_list_free (odata->current_file);
+			odata->current_file = next;
+			odata->extract_all = FALSE;
+		}
+		break;
+
+	case GTK_RESPONSE_DELETE_EVENT:
+	case GTK_RESPONSE_CANCEL:
+		do_not_extract = TRUE;
+		break;
+
+	default:
+		break;
+	}
+
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+
+	if (do_not_extract) {
+		fr_window_stop_batch (odata->window);
+		g_free (odata);
+		return;
+	}
+
+	_fr_window_ask_overwrite_dialog (odata);
+}
+
+static void
+_fr_window_ask_overwrite_dialog (OverwriteData *odata)
+{
+	while ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
+		const char *base_name;
+		char       *e_base_name;
+		char       *dest_uri;
+		GFile      *file;
+		GFileInfo  *info;
+		GFileType   file_type;
+
+		base_name = _g_path_get_base_name ((char *) odata->current_file->data, odata->edata->base_dir, odata->edata->junk_paths);
+		e_base_name = g_uri_escape_string (base_name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
+		dest_uri = g_strdup_printf ("%s/%s", odata->edata->extract_to_dir, e_base_name);
+		file = g_file_new_for_uri (dest_uri);
+		info = g_file_query_info (file,
+					  G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,<--- There is an unknown macro here somewhere. Configuration is required. If G_FILE_ATTRIBUTE_STANDARD_NAME is a macro then please configure it.
+					  G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+					  NULL,
+					  NULL);
+
+		g_free (dest_uri);
+		g_free (e_base_name);
+
+		if (info == NULL) {
+			g_object_unref (file);
+			odata->current_file = odata->current_file->next;
+			continue;
+		}
+
+		file_type = g_file_info_get_file_type (info);
+		if ((file_type != G_FILE_TYPE_UNKNOWN) && (file_type != G_FILE_TYPE_DIRECTORY)) {
+			char      *msg;
+			GFile     *parent;
+			char      *parent_name;
+			char      *details;
+			GtkWidget *d;
+
+			msg = g_strdup_printf (_("Replace file \"%s\"?"), g_file_info_get_display_name (info));
+			parent = g_file_get_parent (file);
+			parent_name = g_file_get_parse_name (parent);
+			details = g_strdup_printf (_("Another file with the same name already exists in \"%s\"."), parent_name);
+			d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
+						     GTK_DIALOG_MODAL,
+						     "dialog-question",
+						     msg,
+						     details,
+						     "gtk-cancel", GTK_RESPONSE_CANCEL,
+						     _("Replace _All"), _FR_RESPONSE_OVERWRITE_YES_ALL,
+						     _("_Skip"), _FR_RESPONSE_OVERWRITE_NO,
+						     _("_Replace"), _FR_RESPONSE_OVERWRITE_YES,
+						     NULL);
+			gtk_dialog_set_default_response (GTK_DIALOG (d), _FR_RESPONSE_OVERWRITE_YES);
+			g_signal_connect (d,
+					  "response",
+					  G_CALLBACK (overwrite_dialog_response_cb),
+					  odata);
+			gtk_widget_show (d);
+
+			g_free (parent_name);
+			g_object_unref (parent);
+			g_object_unref (info);
+			g_object_unref (file);
+
+			return;
+		}
+		else
+			odata->current_file = odata->current_file->next;
+
+		g_object_unref (info);
+		g_object_unref (file);
+	}
+
+	if (odata->edata->file_list != NULL) {
+		/* speed optimization: passing NULL when extracting all the
+		 * files is faster if the command supports the
+		 * propCanExtractAll property. */
+		if (odata->extract_all) {
+			path_list_free (odata->edata->file_list);
+			odata->edata->file_list = NULL;
+		}
+		odata->edata->overwrite = FR_OVERWRITE_YES;
+		_fr_window_archive_extract_from_edata (odata->window, odata->edata);
+	}
+	else {
+		GtkWidget *d;
+
+		d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
+					     0,
+					     "dialog-warning",
+					     _("Extraction not performed"),
+					     NULL,
+					     "gtk-ok", GTK_RESPONSE_OK,
+					     NULL);
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+		fr_window_show_error_dialog (odata->window, d, GTK_WINDOW (odata->window), _("Extraction not performed"));
+
+		fr_window_stop_batch (odata->window);
+	}
+	g_free (odata);
+}
+
+void
+fr_window_archive_extract (FrWindow    *window,
+			   GList       *file_list,
+			   const char  *extract_to_dir,
+			   const char  *sub_dir,
+			   const char  *base_dir,
+			   gboolean     skip_older,
+			   FrOverwrite  overwrite,
+			   gboolean     junk_paths,
+			   gboolean     ask_to_open_destination)
+{
+	ExtractData *edata;
+	gboolean     do_not_extract = FALSE;
+	GError      *error = NULL;
+
+	edata = extract_data_new (file_list,
+				  extract_to_dir,
+				  sub_dir,
+				  base_dir,
+				  skip_older,
+				  overwrite,
+				  junk_paths,
+				  FALSE,
+				  ask_to_open_destination);
+
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_EXTRACT,
+					    edata,
+					    (GFreeFunc) extract_data_free);
+
+	if (archive_extract_check_disk_space_full (window->archive->command->files, extract_to_dir))
+	{
+		GtkWidget *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_MODAL,
+					   NULL,
+					   _("Insufficient remaining disk space"),
+					   NULL);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy(d);
+		return;
+	}
+
+	if (archive_is_encrypted (window, edata->file_list) && (window->priv->password == NULL)) {
+		dlg_ask_password (window);
+		return;
+	}
+
+	if (! uri_is_dir (edata->extract_to_dir)) {
+
+		/* There is nothing to ask if the destination doesn't exist. */
+		if (edata->overwrite == FR_OVERWRITE_ASK)
+			edata->overwrite = FR_OVERWRITE_YES;
+
+		if (! ForceDirectoryCreation) {
+			GtkWidget *d;
+			int        r;
+			char      *folder_name;
+			char      *msg;
+
+			folder_name = g_filename_display_name (edata->extract_to_dir);
+			msg = g_strdup_printf (_("Destination folder \"%s\" does not exist.\n\nDo you want to create it?"), folder_name);
+			g_free (folder_name);
+
+			d = _gtk_message_dialog_new (GTK_WINDOW (window),
+						     GTK_DIALOG_MODAL,
+						     "dialog-question",
+						     msg,
+						     NULL,
+						     "gtk-cancel", GTK_RESPONSE_CANCEL,
+						     _("Create _Folder"), GTK_RESPONSE_YES,
+						     NULL);
+
+			gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
+			r = gtk_dialog_run (GTK_DIALOG (d));
+			gtk_widget_destroy (GTK_WIDGET (d));
+
+			g_free (msg);
+
+			if (r != GTK_RESPONSE_YES)
+				do_not_extract = TRUE;
+		}
+
+		if (! do_not_extract && ! ensure_dir_exists (edata->extract_to_dir, 0755, &error)) {
+			GtkWidget *d;
+			char      *details;
+
+			details = g_strdup_printf (_("Could not create the destination folder: %s."), error->message);
+			d = _gtk_error_dialog_new (GTK_WINDOW (window),
+						   0,
+						   NULL,
+						   _("Extraction not performed"),
+						   "%s",
+						   details);
+			g_clear_error (&error);
+			fr_window_show_error_dialog (window, d, GTK_WINDOW (window), details);
+			fr_window_stop_batch (window);
+
+			g_free (details);
+
+			return;
+		}
+	}
+
+	if (do_not_extract) {
+		GtkWidget *d;
+
+		d = _gtk_message_dialog_new (GTK_WINDOW (window),
+					     0,
+					     "dialog-warning",
+					     _("Extraction not performed"),
+					     NULL,
+					     "gtk-ok", GTK_RESPONSE_OK,
+					     NULL);
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+		fr_window_show_error_dialog (window, d, GTK_WINDOW (window), _("Extraction not performed"));
+		fr_window_stop_batch (window);
+
+		return;
+	}
+
+	if (edata->overwrite == FR_OVERWRITE_ASK) {
+		OverwriteData *odata;
+
+		odata = g_new0 (OverwriteData, 1);
+		odata->window = window;
+		odata->edata = edata;
+		odata->extract_all = (edata->file_list == NULL) || (g_list_length (edata->file_list) == window->archive->command->files->len);
+		if (edata->file_list == NULL)
+			edata->file_list = fr_window_get_file_list (window);
+		odata->current_file = odata->edata->file_list;
+		_fr_window_ask_overwrite_dialog (odata);
+	}
+	else
+		_fr_window_archive_extract_from_edata (window, edata);
+}
+
+void
+fr_window_archive_test (FrWindow *window)
+{
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_TEST,
+					    NULL,
+					    NULL);
+	fr_archive_test (window->archive, window->priv->password);
+}
+
+void
+fr_window_set_password (FrWindow   *window,
+			const char *password)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->password != NULL) {
+		g_free (window->priv->password);
+		window->priv->password = NULL;
+	}
+
+	if ((password != NULL) && (password[0] != '\0'))
+		window->priv->password = g_strdup (password);
+}
+
+void
+fr_window_set_password_for_paste (FrWindow   *window,
+				  const char *password)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->password_for_paste != NULL) {
+		g_free (window->priv->password_for_paste);
+		window->priv->password_for_paste = NULL;
+	}
+
+	if ((password != NULL) && (password[0] != '\0'))
+		window->priv->password_for_paste = g_strdup (password);
+}
+
+const char *
+fr_window_get_password (FrWindow *window)
+{
+	g_return_val_if_fail (window != NULL, NULL);
+
+	return window->priv->password;
+}
+
+void
+fr_window_set_encrypt_header (FrWindow *window,
+			      gboolean  encrypt_header)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->encrypt_header = encrypt_header;
+}
+
+gboolean
+fr_window_get_encrypt_header (FrWindow *window)
+{
+	return window->priv->encrypt_header;
+}
+
+void
+fr_window_set_compression (FrWindow      *window,
+			   FrCompression  compression)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->compression = compression;
+}
+
+FrCompression
+fr_window_get_compression (FrWindow *window)
+{
+	return window->priv->compression;
+}
+
+void
+fr_window_set_volume_size (FrWindow *window,
+			   guint     volume_size)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->volume_size = volume_size;
+}
+
+guint
+fr_window_get_volume_size (FrWindow *window)
+{
+	return window->priv->volume_size;
+}
+
+void
+fr_window_go_to_location (FrWindow   *window,
+			  const char *path,
+			  gboolean    force_update)
+{
+	char *dir;
+
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (path != NULL);
+
+	if (force_update) {
+		g_free (window->priv->last_location);
+		window->priv->last_location = NULL;
+	}
+
+	if (path[strlen (path) - 1] != '/')
+		dir = g_strconcat (path, "/", NULL);
+	else
+		dir = g_strdup (path);
+
+	if ((window->priv->last_location == NULL) || (strcmp (window->priv->last_location, dir) != 0)) {
+		g_free (window->priv->last_location);
+		window->priv->last_location = dir;
+
+		fr_window_history_add (window, dir);
+		fr_window_update_file_list (window, TRUE);
+		fr_window_update_current_location (window);
+	}
+	else
+		g_free (dir);
+}
+
+const char *
+fr_window_get_current_location (FrWindow *window)
+{
+	if (window->priv->history_current == NULL) {
+		fr_window_history_add (window, "/");
+		return window->priv->history_current->data;
+	}
+	else
+		return (const char*) window->priv->history_current->data;
+}
+
+void
+fr_window_go_up_one_level (FrWindow *window)
+{
+	char *parent_dir;
+
+	g_return_if_fail (window != NULL);
+
+	parent_dir = get_parent_dir (fr_window_get_current_location (window));
+	fr_window_go_to_location (window, parent_dir, FALSE);
+	g_free (parent_dir);
+}
+
+void
+fr_window_go_back (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->history == NULL)
+		return;
+	if (window->priv->history_current == NULL)
+		return;
+	if (window->priv->history_current->next == NULL)
+		return;
+	window->priv->history_current = window->priv->history_current->next;
+
+	fr_window_go_to_location (window, window->priv->history_current->data, FALSE);
+}
+
+void
+fr_window_go_forward (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->history == NULL)
+		return;
+	if (window->priv->history_current == NULL)
+		return;
+	if (window->priv->history_current->prev == NULL)
+		return;
+	window->priv->history_current = window->priv->history_current->prev;
+
+	fr_window_go_to_location (window, window->priv->history_current->data, FALSE);
+}
+
+void
+fr_window_set_list_mode (FrWindow         *window,
+			 FrWindowListMode  list_mode)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->list_mode = window->priv->last_list_mode = list_mode;
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) {
+		fr_window_history_clear (window);
+		fr_window_history_add (window, "/");
+	}
+
+	g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE, window->priv->last_list_mode);
+	g_settings_set_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+
+	fr_window_update_file_list (window, TRUE);
+	fr_window_update_dir_tree (window);
+	fr_window_update_current_location (window);
+}
+
+GtkTreeModel *
+fr_window_get_list_store (FrWindow *window)
+{
+	return GTK_TREE_MODEL (window->priv->list_store);
+}
+
+void
+fr_window_find (FrWindow *window)
+{
+	window->priv->filter_mode = TRUE;
+	gtk_widget_show (window->priv->filter_bar);
+	gtk_widget_grab_focus (window->priv->filter_entry);
+}
+
+void
+fr_window_select_all (FrWindow *window)
+{
+	gtk_tree_selection_select_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view)));
+}
+
+void
+fr_window_unselect_all (FrWindow *window)
+{
+	gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view)));
+}
+
+void
+fr_window_stop (FrWindow *window)
+{
+	if (! window->priv->stoppable)
+		return;
+
+	if (window->priv->activity_ref > 0)
+		fr_archive_stop (window->archive);
+
+	if (window->priv->convert_data.converting)
+		fr_window_convert_data_free (window, TRUE);
+}
+
+/* -- start/stop activity mode -- */
+
+static int
+activity_cb (gpointer data)
+{
+	FrWindow *window = data;
+
+	if ((window->priv->pd_progress_bar != NULL) && window->priv->progress_pulse)
+		gtk_progress_bar_pulse (GTK_PROGRESS_BAR (window->priv->pd_progress_bar));
+	if (window->priv->progress_pulse)
+		gtk_progress_bar_pulse (GTK_PROGRESS_BAR (window->priv->progress_bar));
+
+	return TRUE;
+}
+
+void
+fr_window_start_activity_mode (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->activity_ref++ > 0)
+		return;
+
+	window->priv->activity_timeout_handle = g_timeout_add (ACTIVITY_DELAY,
+							       activity_cb,
+							       window);
+	fr_window_update_sensitivity (window);
+}
+
+void
+fr_window_stop_activity_mode (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->activity_ref == 0)
+		return;
+
+	window->priv->activity_ref--;
+
+	if (window->priv->activity_ref > 0)
+		return;
+
+	if (window->priv->activity_timeout_handle == 0)
+		return;
+
+	g_source_remove (window->priv->activity_timeout_handle);
+	window->priv->activity_timeout_handle = 0;
+
+	if (! gtk_widget_get_realized (GTK_WIDGET (window)))
+		return;
+
+	if (window->priv->progress_dialog != NULL)
+		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->pd_progress_bar), 0.0);
+
+	if (! window->priv->batch_mode) {
+		if (window->priv->progress_bar != NULL)
+			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress_bar), 0.0);
+		fr_window_update_sensitivity (window);
+	}
+}
+
+static gboolean
+last_output_window__unrealize_cb (GtkWidget  *widget,
+				  gpointer    data)
+{
+	pref_util_save_window_geometry (GTK_WINDOW (widget), LAST_OUTPUT_DIALOG_NAME);
+	return FALSE;
+}
+
+static void
+fr_window_view_last_output_print(GtkTextBuffer *text_buffer,
+                                 GtkTextIter   *iter,
+                                 GList         *scan)
+{
+    for (; scan; scan = scan->next) {
+        char        *line = scan->data;
+        char        *utf8_line;
+        gsize        bytes_written;
+
+        utf8_line = g_locale_to_utf8 (line, -1, NULL, &bytes_written, NULL);
+        gtk_text_buffer_insert_with_tags_by_name (text_buffer,
+                                                  iter,
+                                                  utf8_line,
+                                                  bytes_written,
+                                                  "monospace", NULL);
+        g_free (utf8_line);
+        gtk_text_buffer_insert (text_buffer, iter, "\n", 1);
+    }
+}
+
+void
+fr_window_view_last_output (FrWindow   *window,
+			    const char *title)
+{
+	GtkWidget     *dialog;
+	GtkWidget     *vbox;
+	GtkWidget     *text_view;
+	GtkWidget     *scrolled;
+	GtkTextBuffer *text_buffer;
+	GtkTextIter    iter;
+
+	if (title == NULL)
+		title = _("Last Output");
+
+	dialog = gtk_dialog_new_with_buttons (title,
+					      GTK_WINDOW (window),
+					      /* Make this dialog modal, otherwise with most WMs
+					       * the focus can’t be regained without the mouse. */
+					      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+					      "gtk-close", GTK_RESPONSE_CLOSE,
+					      NULL);
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
+	gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+	gtk_widget_set_size_request (dialog, 500, 300);
+
+	/* Add text */
+
+	scrolled = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
+					     GTK_SHADOW_ETCHED_IN);
+
+	text_buffer = gtk_text_buffer_new (NULL);
+	gtk_text_buffer_create_tag (text_buffer, "monospace",
+				    "family", "monospace", NULL);
+
+	text_view = gtk_text_view_new_with_buffer (text_buffer);
+	g_object_unref (text_buffer);
+	gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
+	/* Although this isn’t an editable text area, we do want the
+	 * cursor for accessibility purposes. */
+	gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), TRUE);
+
+	/**/
+
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+	gtk_container_add (GTK_CONTAINER (scrolled), text_view);
+	gtk_box_pack_start (GTK_BOX (vbox), scrolled,
+			    TRUE, TRUE, 0);
+
+	gtk_widget_show_all (vbox);
+	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+			    vbox,
+			    TRUE, TRUE, 0);
+
+	/* signals */
+
+	g_signal_connect (G_OBJECT (dialog),
+			  "response",
+			  G_CALLBACK (gtk_widget_destroy),
+			  NULL);
+
+	g_signal_connect (G_OBJECT (dialog),
+			  "unrealize",
+			  G_CALLBACK (last_output_window__unrealize_cb),
+			  NULL);
+
+	gtk_text_buffer_get_iter_at_offset (text_buffer, &iter, 0);
+	/* Show STDOUT of process */
+	fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->out.raw);
+	/* Show STDERR of process */
+	fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->err.raw);
+	/* place the cursor at the start */
+	gtk_text_buffer_get_iter_at_offset (text_buffer, &iter, 0);
+	gtk_text_buffer_place_cursor(text_buffer, &iter);
+
+	/**/
+
+	pref_util_restore_window_geometry (GTK_WINDOW (dialog), LAST_OUTPUT_DIALOG_NAME);
+	gtk_widget_grab_focus (text_view);
+}
+
+/* -- fr_window_rename_selection -- */
+
+typedef struct {
+	char     *path_to_rename;
+	char     *old_name;
+	char     *new_name;
+	char     *current_dir;
+	gboolean  is_dir;
+	gboolean  dir_in_archive;
+	char     *original_path;
+} RenameData;
+
+static RenameData*
+rename_data_new (const char *path_to_rename,
+		 const char *old_name,
+		 const char *new_name,
+		 const char *current_dir,
+		 gboolean    is_dir,
+		 gboolean    dir_in_archive,
+		 const char *original_path)
+{
+	RenameData *rdata;
+
+	rdata = g_new0 (RenameData, 1);
+	rdata->path_to_rename = g_strdup (path_to_rename);
+	if (old_name != NULL)
+		rdata->old_name = g_strdup (old_name);
+	if (new_name != NULL)
+		rdata->new_name = g_strdup (new_name);
+	if (current_dir != NULL)
+		rdata->current_dir = g_strdup (current_dir);
+	rdata->is_dir = is_dir;
+	rdata->dir_in_archive = dir_in_archive;
+	if (original_path != NULL)
+		rdata->original_path = g_strdup (original_path);
+
+	return rdata;
+}
+
+static void
+rename_data_free (RenameData *rdata)
+{
+	g_return_if_fail (rdata != NULL);
+
+	g_free (rdata->path_to_rename);
+	g_free (rdata->old_name);
+	g_free (rdata->new_name);
+	g_free (rdata->current_dir);
+	g_free (rdata->original_path);
+	g_free (rdata);
+}
+
+static void
+rename_selection (FrWindow   *window,
+		  const char *path_to_rename,
+		  const char *old_name,
+		  const char *new_name,
+		  const char *current_dir,
+		  gboolean    is_dir,
+		  gboolean    dir_in_archive,
+		  const char *original_path)
+{
+	FrArchive  *archive = window->archive;
+	RenameData *rdata;
+	char       *tmp_dir;
+	GList      *file_list;
+	gboolean    added_dir;
+	char       *new_dirname;
+	GList      *new_file_list;
+	GList      *scan;
+
+	rdata = rename_data_new (path_to_rename,
+				 old_name,
+				 new_name,
+				 current_dir,
+				 is_dir,
+				 dir_in_archive,
+				 original_path);
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_RENAME,
+					    rdata,
+					    (GFreeFunc) rename_data_free);
+
+	fr_process_clear (archive->process);
+
+	tmp_dir = get_temp_work_dir (NULL);
+
+	if (is_dir)
+		file_list = get_dir_list_from_path (window, rdata->path_to_rename);
+	else
+		file_list = g_list_append (NULL, g_strdup (rdata->path_to_rename));
+
+	fr_archive_extract_to_local (archive,
+				     file_list,
+				     tmp_dir,
+				     NULL,
+				     FALSE,
+				     TRUE,
+				     FALSE,
+				     window->priv->password);
+
+	/* temporarily add the dir to rename to the list if it's stored in the
+	 * archive, this way it will be removed from the archive... */
+	added_dir = FALSE;
+	if (is_dir && dir_in_archive && ! g_list_find_custom (file_list, original_path, (GCompareFunc) strcmp)) {
+		file_list = g_list_prepend (file_list, g_strdup (original_path));
+		added_dir = TRUE;
+	}
+
+	fr_archive_remove (archive, file_list, window->priv->compression);
+	fr_window_clipboard_remove_file_list (window, file_list);
+
+	/* ...and remove it from the list again */
+	if (added_dir) {
+		GList *tmp;
+
+		tmp = file_list;
+		file_list = g_list_remove_link (file_list, tmp);
+
+		g_free (tmp->data);
+		g_list_free (tmp);
+	}
+
+	/* rename the files. */
+
+	new_dirname = g_build_filename (rdata->current_dir + 1, rdata->new_name, "/", NULL);
+	new_file_list = NULL;
+	if (rdata->is_dir) {
+		char *old_path;
+		char *new_path;
+
+		old_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->old_name, NULL);
+		new_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->new_name, NULL);
+
+		fr_process_begin_command (archive->process, "mv");
+		fr_process_add_arg (archive->process, "-f");
+		fr_process_add_arg (archive->process, old_path);
+		fr_process_add_arg (archive->process, new_path);
+		fr_process_end_command (archive->process);
+
+		g_free (old_path);
+		g_free (new_path);
+	}
+
+	for (scan = file_list; scan; scan = scan->next) {
+		const char *current_dir_relative = rdata->current_dir + 1;
+		const char *filename = (char*) scan->data;
+		char       *old_path = NULL, *common = NULL, *new_path = NULL;
+		char       *new_filename;
+
+		old_path = g_build_filename (tmp_dir, filename, NULL);
+
+		if (strlen (filename) > (strlen (rdata->current_dir) + strlen (rdata->old_name)))
+			common = g_strdup (filename + strlen (rdata->current_dir) + strlen (rdata->old_name));
+		new_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->new_name, common, NULL);
+
+		if (! rdata->is_dir) {
+			fr_process_begin_command (archive->process, "mv");
+			fr_process_add_arg (archive->process, "-f");
+			fr_process_add_arg (archive->process, old_path);
+			fr_process_add_arg (archive->process, new_path);
+			fr_process_end_command (archive->process);
+		}
+
+		new_filename = g_build_filename (current_dir_relative, rdata->new_name, common, NULL);
+		new_file_list = g_list_prepend (new_file_list, new_filename);
+
+		g_free (old_path);
+		g_free (common);
+		g_free (new_path);
+	}
+	new_file_list = g_list_reverse (new_file_list);
+
+	/* FIXME: this is broken for tar archives.
+	if (is_dir && dir_in_archive && ! g_list_find_custom (new_file_list, new_dirname, (GCompareFunc) strcmp))
+		new_file_list = g_list_prepend (new_file_list, g_build_filename (rdata->current_dir + 1, rdata->new_name, NULL));
+	*/
+
+	fr_archive_add (archive,
+			new_file_list,
+			tmp_dir,
+			NULL,
+			FALSE,
+			FALSE,
+			window->priv->password,
+			window->priv->encrypt_header,
+			window->priv->compression,
+			window->priv->volume_size);
+
+	g_free (new_dirname);
+	path_list_free (new_file_list);
+	path_list_free (file_list);
+
+	/* remove the tmp dir */
+
+	fr_process_begin_command (archive->process, "rm");
+	fr_process_set_working_dir (archive->process, g_get_tmp_dir ());
+	fr_process_set_sticky (archive->process, TRUE);
+	fr_process_add_arg (archive->process, "-rf");
+	fr_process_add_arg (archive->process, tmp_dir);
+	fr_process_end_command (archive->process);
+
+	fr_process_start (archive->process);
+
+	g_free (tmp_dir);
+}
+
+static gboolean
+valid_name (const char  *new_name,
+	    const char  *old_name,
+	    char       **reason)
+{
+	char     *utf8_new_name;
+	gboolean  retval = TRUE;
+
+	new_name = eat_spaces (new_name);
+	utf8_new_name = g_filename_display_name (new_name);
+
+	if (*new_name == '\0') {
+		/* Translators: the name references to a filename.  This message can appear when renaming a file. */
+		*reason = g_strdup (_("New name is void, please type a name."));
+		retval = FALSE;
+	}
+	else if (strcmp (new_name, old_name) == 0) {
+		/* Translators: the name references to a filename.  This message can appear when renaming a file. */
+		*reason = g_strdup (_("New name is the same as old one, please type other name."));
+		retval = FALSE;
+	}
+	else if (strchrs (new_name, BAD_CHARS)) {
+		/* Translators: the %s references to a filename.  This message can appear when renaming a file. */
+		*reason = g_strdup_printf (_("Name \"%s\" is not valid because it contains at least one of the following characters: %s, please type other name."), utf8_new_name, BAD_CHARS);
+		retval = FALSE;
+	}
+
+	g_free (utf8_new_name);
+
+	return retval;
+}
+
+static gboolean
+name_is_present (FrWindow    *window,
+		 const char  *current_dir,
+		 const char  *new_name,
+		 char       **reason)
+{
+	gboolean  retval = FALSE;
+	guint     i;
+	char     *new_filename;
+	int       new_filename_l;
+
+	*reason = NULL;
+
+	new_filename = g_build_filename (current_dir, new_name, NULL);
+	new_filename_l = strlen (new_filename);
+
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData   *fdata = g_ptr_array_index (window->archive->command->files, i);
+		const char *filename = fdata->full_path;
+
+		if ((strncmp (filename, new_filename, new_filename_l) == 0)
+		    && ((filename[new_filename_l] == '\0')
+			|| (filename[new_filename_l] == G_DIR_SEPARATOR))) {
+			char *utf8_name = g_filename_display_name (new_name);
+
+			if (filename[new_filename_l] == G_DIR_SEPARATOR)
+				*reason = g_strdup_printf (_("A folder named \"%s\" already exists.\n\n%s"), utf8_name, _("Please use a different name."));
+			else
+				*reason = g_strdup_printf (_("A file named \"%s\" already exists.\n\n%s"), utf8_name, _("Please use a different name."));
+
+			retval = TRUE;
+			break;
+		}
+	}
+
+	g_free (new_filename);
+
+	return retval;
+}
+
+void
+fr_window_rename_selection (FrWindow *window,
+			    gboolean  from_sidebar)
+{
+	char     *path_to_rename;
+	char     *parent_dir;
+	char     *old_name;
+	gboolean  renaming_dir = FALSE;
+	gboolean  dir_in_archive = FALSE;
+	char     *original_path = NULL;
+	char     *utf8_old_name;
+	char     *utf8_new_name;
+
+	if (from_sidebar) {
+		path_to_rename = fr_window_get_selected_folder_in_tree_view (window);
+		if (path_to_rename == NULL)
+			return;
+		parent_dir = remove_level_from_path (path_to_rename);
+		old_name = g_strdup (file_name_from_path (path_to_rename));
+		renaming_dir = TRUE;
+	}
+	else {
+		FileData *selected_item;
+
+		selected_item = fr_window_get_selected_item_from_file_list (window);
+		if (selected_item == NULL)
+			return;
+
+		renaming_dir = file_data_is_dir (selected_item);
+		dir_in_archive = selected_item->dir;
+		original_path = g_strdup (selected_item->original_path);
+
+		if (renaming_dir && ! dir_in_archive) {
+			parent_dir = g_strdup (fr_window_get_current_location (window));
+			old_name = g_strdup (selected_item->list_name);
+			path_to_rename = g_build_filename (parent_dir, old_name, NULL);
+		}
+		else {
+			if (renaming_dir) {
+				path_to_rename = remove_ending_separator (selected_item->full_path);
+				parent_dir = remove_level_from_path (path_to_rename);
+			}
+			else {
+				path_to_rename = g_strdup (selected_item->original_path);
+				parent_dir = remove_level_from_path (selected_item->full_path);
+			}
+			old_name = g_strdup (selected_item->name);
+		}
+
+		file_data_free (selected_item);
+	}
+
+ retry__rename_selection:
+	utf8_old_name = g_locale_to_utf8 (old_name, -1 ,0 ,0 ,0);
+	utf8_new_name = _gtk_request_dialog_run (GTK_WINDOW (window),
+						 (GTK_DIALOG_DESTROY_WITH_PARENT
+						  | GTK_DIALOG_MODAL),
+						 _("Rename"),
+						 (renaming_dir ? _("_New folder name:") : _("_New file name:")),
+						 utf8_old_name,
+						 1024,
+						 _("_Cancel"),
+						 _("_Rename"));
+	g_free (utf8_old_name);
+
+	if (utf8_new_name != NULL) {
+		char *new_name;
+		char *reason = NULL;
+
+		new_name = g_filename_from_utf8 (utf8_new_name, -1, 0, 0, 0);
+		g_free (utf8_new_name);
+
+		if (! valid_name (new_name, old_name, &reason)) {
+			char      *utf8_name = g_filename_display_name (new_name);
+			GtkWidget *dlg;
+
+			dlg = _gtk_error_dialog_new (GTK_WINDOW (window),
+						     GTK_DIALOG_DESTROY_WITH_PARENT,
+						     NULL,
+						     (renaming_dir ? _("Could not rename the folder") : _("Could not rename the file")),
+						     "%s",
+						     reason);
+			gtk_dialog_run (GTK_DIALOG (dlg));
+			gtk_widget_destroy (dlg);
+
+			g_free (reason);
+			g_free (utf8_name);
+			g_free (new_name);
+
+			goto retry__rename_selection;
+		}
+
+		if (name_is_present (window, parent_dir, new_name, &reason)) {
+			GtkWidget *dlg;
+
+			dlg = _gtk_message_dialog_new (GTK_WINDOW (window),
+						       GTK_DIALOG_MODAL,
+						       "dialog-question",
+						       (renaming_dir ? _("Could not rename the folder") : _("Could not rename the file")),
+						       reason,
+						       "gtk-close", GTK_RESPONSE_OK,
+						       NULL);
+			gtk_dialog_run (GTK_DIALOG (dlg));
+			gtk_widget_destroy (dlg);
+			g_free (reason);
+			g_free (new_name);
+			goto retry__rename_selection;
+		}
+
+		rename_selection (window,
+				  path_to_rename,
+				  old_name,
+				  new_name,
+				  parent_dir,
+				  renaming_dir,
+				  dir_in_archive,
+				  original_path);
+
+		g_free (new_name);
+	}
+
+	g_free (old_name);
+	g_free (parent_dir);
+	g_free (path_to_rename);
+	g_free (original_path);
+}
+
+static void
+fr_clipboard_get (GtkClipboard     *clipboard,
+		  GtkSelectionData *selection_data,
+		  guint             info,
+		  gpointer          user_data_or_owner)
+{
+	FrWindow *window = user_data_or_owner;
+	char     *data;
+
+	if (gtk_selection_data_get_target (selection_data) != FR_SPECIAL_URI_LIST)
+		return;
+
+	data = get_selection_data_from_clipboard_data (window, window->priv->copy_data);
+	gtk_selection_data_set (selection_data,
+				gtk_selection_data_get_target (selection_data),
+				8,
+				(guchar *) data,
+				strlen (data));
+	g_free (data);
+}
+
+static void
+fr_clipboard_clear (GtkClipboard *clipboard,
+		    gpointer      user_data_or_owner)
+{
+	FrWindow *window = user_data_or_owner;
+
+	if (window->priv->copy_data != NULL) {
+		fr_clipboard_data_unref (window->priv->copy_data);
+		window->priv->copy_data = NULL;
+	}
+}
+
+GList *
+fr_window_get_selection (FrWindow   *window,
+		  	 gboolean    from_sidebar,
+		  	 char      **return_base_dir)
+{
+	GList *files;
+	char  *base_dir;
+
+	if (from_sidebar) {
+		char *selected_folder;
+		char *parent_folder;
+
+		files = fr_window_get_folder_tree_selection (window, TRUE, NULL);
+		selected_folder = fr_window_get_selected_folder_in_tree_view (window);
+		parent_folder = remove_level_from_path (selected_folder);
+		if (parent_folder == NULL)
+			base_dir = g_strdup ("/");
+		else if (parent_folder[strlen (parent_folder) - 1] == '/')
+			base_dir = g_strdup (parent_folder);
+		else
+			base_dir = g_strconcat (parent_folder, "/", NULL);
+		g_free (selected_folder);
+		g_free (parent_folder);
+	}
+	else {
+		files = fr_window_get_file_list_selection (window, TRUE, NULL);
+		base_dir = g_strdup (fr_window_get_current_location (window));
+	}
+
+	if (return_base_dir)
+		*return_base_dir = base_dir;
+	else
+		g_free (base_dir);
+
+	return files;
+}
+
+static void
+fr_window_copy_or_cut_selection (FrWindow      *window,
+				 FRClipboardOp  op,
+			  	 gboolean       from_sidebar)
+{
+	GList        *files;
+	char         *base_dir;
+	GtkClipboard *clipboard;
+
+	files = fr_window_get_selection (window, from_sidebar, &base_dir);
+
+	if (window->priv->copy_data != NULL)
+		fr_clipboard_data_unref (window->priv->copy_data);
+	window->priv->copy_data = fr_clipboard_data_new ();
+	window->priv->copy_data->files = files;
+	window->priv->copy_data->op = op;
+	window->priv->copy_data->base_dir = base_dir;
+
+	clipboard = gtk_clipboard_get (FR_CLIPBOARD);
+	gtk_clipboard_set_with_owner (clipboard,
+				      clipboard_targets,
+				      G_N_ELEMENTS (clipboard_targets),
+				      fr_clipboard_get,
+				      fr_clipboard_clear,
+				      G_OBJECT (window));
+
+	fr_window_update_sensitivity (window);
+}
+
+void
+fr_window_copy_selection (FrWindow *window,
+			  gboolean  from_sidebar)
+{
+	fr_window_copy_or_cut_selection (window, FR_CLIPBOARD_OP_COPY, from_sidebar);
+}
+
+void
+fr_window_cut_selection (FrWindow *window,
+			 gboolean  from_sidebar)
+{
+	fr_window_copy_or_cut_selection (window, FR_CLIPBOARD_OP_CUT, from_sidebar);
+}
+
+static gboolean
+always_fake_load (FrArchive *archive,
+		  gpointer   data)
+{
+	return TRUE;
+}
+
+static void
+add_pasted_files (FrWindow        *window,
+		  FrClipboardData *data)
+{
+	const char *current_dir_relative = data->current_dir + 1;
+	GList      *scan;
+	GList      *new_file_list = NULL;
+
+	if (window->priv->password_for_paste != NULL) {
+		g_free (window->priv->password_for_paste);
+		window->priv->password_for_paste = NULL;
+	}
+
+	fr_process_clear (window->archive->process);
+	for (scan = data->files; scan; scan = scan->next) {
+		const char *old_name = (char*) scan->data;
+		char       *new_name = g_build_filename (current_dir_relative, old_name + strlen (data->base_dir) - 1, NULL);
+
+		/* skip folders */
+
+		if ((strcmp (old_name, new_name) != 0)
+		    && (old_name[strlen (old_name) - 1] != '/'))
+		{
+			fr_process_begin_command (window->archive->process, "mv");
+			fr_process_set_working_dir (window->archive->process, data->tmp_dir);
+			fr_process_add_arg (window->archive->process, "-f");
+			if (old_name[0] == '/')
+				old_name = old_name + 1;
+			fr_process_add_arg (window->archive->process, old_name);
+			fr_process_add_arg (window->archive->process, new_name);
+			fr_process_end_command (window->archive->process);
+		}
+
+		new_file_list = g_list_prepend (new_file_list, new_name);
+	}
+
+	fr_archive_add (window->archive,
+			new_file_list,
+			data->tmp_dir,
+			NULL,
+			FALSE,
+			FALSE,
+			window->priv->password,
+			window->priv->encrypt_header,
+			window->priv->compression,
+			window->priv->volume_size);
+
+	path_list_free (new_file_list);
+
+	/* remove the tmp dir */
+
+	fr_process_begin_command (window->archive->process, "rm");
+	fr_process_set_working_dir (window->archive->process, g_get_tmp_dir ());
+	fr_process_set_sticky (window->archive->process, TRUE);
+	fr_process_add_arg (window->archive->process, "-rf");
+	fr_process_add_arg (window->archive->process, data->tmp_dir);
+	fr_process_end_command (window->archive->process);
+
+	fr_process_start (window->archive->process);
+}
+
+static void
+copy_from_archive_action_performed_cb (FrArchive   *archive,
+				       FrAction     action,
+				       FrProcError *error,
+				       gpointer     data)
+{
+	FrWindow *window = data;
+	gboolean  UNUSED_VARIABLE continue_batch = FALSE;
+
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [DONE] (FR::Window)\n", get_action_name (action));
+#endif
+
+	fr_window_stop_activity_mode (window);
+	fr_window_pop_message (window);
+	close_progress_dialog (window, FALSE);
+
+	if (error->type == FR_PROC_ERROR_ASK_PASSWORD) {
+		dlg_ask_password_for_paste_operation (window);
+		return;
+	}
+
+	(void) handle_errors (window, archive, action, error);
+
+	if (error->type != FR_PROC_ERROR_NONE) {
+		fr_clipboard_data_unref (window->priv->clipboard_data);
+		window->priv->clipboard_data = NULL;
+		return;
+	}
+
+	switch (action) {
+	case FR_ACTION_LISTING_CONTENT:
+		fr_process_clear (window->priv->copy_from_archive->process);
+		fr_archive_extract_to_local (window->priv->copy_from_archive,
+					     window->priv->clipboard_data->files,
+					     window->priv->clipboard_data->tmp_dir,
+					     NULL,
+					     FALSE,
+					     TRUE,
+					     FALSE,
+					     window->priv->clipboard_data->archive_password);
+		fr_process_start (window->priv->copy_from_archive->process);
+		break;
+
+	case FR_ACTION_EXTRACTING_FILES:
+		if (window->priv->clipboard_data->op == FR_CLIPBOARD_OP_CUT) {
+			fr_process_clear (window->priv->copy_from_archive->process);
+			fr_archive_remove (window->priv->copy_from_archive,
+					   window->priv->clipboard_data->files,
+					   window->priv->compression);
+			fr_process_start (window->priv->copy_from_archive->process);
+		}
+		else
+			add_pasted_files (window, window->priv->clipboard_data);
+		break;
+
+	case FR_ACTION_DELETING_FILES:
+		add_pasted_files (window, window->priv->clipboard_data);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void
+fr_window_paste_from_clipboard_data (FrWindow        *window,
+				     FrClipboardData *data)
+{
+	const char *current_dir_relative;
+	GHashTable *created_dirs;
+	GList      *scan;
+
+	if (window->priv->password_for_paste != NULL)
+		fr_clipboard_data_set_password (data, window->priv->password_for_paste);
+
+	if (window->priv->clipboard_data != data) {
+		fr_clipboard_data_unref (window->priv->clipboard_data);
+		window->priv->clipboard_data = data;
+	}
+
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_PASTE,
+					    fr_clipboard_data_ref (data),
+					    (GFreeFunc) fr_clipboard_data_unref);
+
+	current_dir_relative = data->current_dir + 1;
+
+	data->tmp_dir = get_temp_work_dir (NULL);
+	created_dirs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	for (scan = data->files; scan; scan = scan->next) {
+		const char *old_name = (char*) scan->data;
+		char       *new_name = g_build_filename (current_dir_relative, old_name + strlen (data->base_dir) - 1, NULL);
+		char       *dir = remove_level_from_path (new_name);
+
+		if ((dir != NULL) && (g_hash_table_lookup (created_dirs, dir) == NULL)) {
+			char *dir_path;
+
+			dir_path = g_build_filename (data->tmp_dir, dir, NULL);
+			debug (DEBUG_INFO, "mktree %s\n", dir_path);
+			make_directory_tree_from_path (dir_path, 0700, NULL);
+
+			g_free (dir_path);
+			g_hash_table_replace (created_dirs, g_strdup (dir), "1");
+		}
+
+		g_free (dir);
+		g_free (new_name);
+	}
+	g_hash_table_destroy (created_dirs);
+
+	/**/
+
+	if (window->priv->copy_from_archive == NULL) {
+		window->priv->copy_from_archive = fr_archive_new ();
+		g_signal_connect (G_OBJECT (window->priv->copy_from_archive),
+				  "start",
+				  G_CALLBACK (action_started),
+				  window);
+		g_signal_connect (G_OBJECT (window->priv->copy_from_archive),
+				  "done",
+				  G_CALLBACK (copy_from_archive_action_performed_cb),
+				  window);
+		g_signal_connect (G_OBJECT (window->priv->copy_from_archive),
+				  "progress",
+				  G_CALLBACK (fr_window_progress_cb),
+				  window);
+		g_signal_connect (G_OBJECT (window->priv->copy_from_archive),
+				  "message",
+				  G_CALLBACK (fr_window_message_cb),
+				  window);
+		g_signal_connect (G_OBJECT (window->priv->copy_from_archive),
+				  "stoppable",
+				  G_CALLBACK (fr_window_stoppable_cb),
+				  window);
+		fr_archive_set_fake_load_func (window->priv->copy_from_archive, always_fake_load, NULL);
+	}
+	fr_archive_load_local (window->priv->copy_from_archive,
+			       data->archive_filename,
+			       data->archive_password);
+}
+
+static void
+fr_window_paste_selection_to (FrWindow   *window,
+			      const char *current_dir)
+{
+	GtkClipboard     *clipboard;
+	GtkSelectionData *selection_data;
+	FrClipboardData  *paste_data;
+
+	clipboard = gtk_clipboard_get (FR_CLIPBOARD);
+	selection_data = gtk_clipboard_wait_for_contents (clipboard, FR_SPECIAL_URI_LIST);
+	if (selection_data == NULL)
+		return;
+
+	paste_data = get_clipboard_data_from_selection_data (window, (char*) gtk_selection_data_get_data (selection_data));
+	paste_data->current_dir = g_strdup (current_dir);
+	fr_window_paste_from_clipboard_data (window, paste_data);
+
+	gtk_selection_data_free (selection_data);
+}
+
+void
+fr_window_paste_selection (FrWindow *window,
+			   gboolean  from_sidebar)
+{
+	char *utf8_path, *utf8_old_path, *destination;
+	char *current_dir;
+
+	if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT)
+		return;
+
+	/**/
+
+	utf8_old_path = g_filename_to_utf8 (fr_window_get_current_location (window), -1, NULL, NULL, NULL);
+	utf8_path = _gtk_request_dialog_run (GTK_WINDOW (window),
+					       (GTK_DIALOG_DESTROY_WITH_PARENT
+						| GTK_DIALOG_MODAL),
+					       _("Paste Selection"),
+					       _("_Destination folder:"),
+					       utf8_old_path,
+					       1024,
+					       _("_Cancel"),
+					       _("_Paste"));
+	g_free (utf8_old_path);
+	if (utf8_path == NULL)
+		return;
+
+	destination = g_filename_from_utf8 (utf8_path, -1, NULL, NULL, NULL);
+	g_free (utf8_path);
+
+	if (destination[0] != '/')
+		current_dir = build_uri (fr_window_get_current_location (window), destination, NULL);
+	else
+		current_dir = g_strdup (destination);
+	g_free (destination);
+
+	fr_window_paste_selection_to (window, current_dir);
+
+	g_free (current_dir);
+}
+
+/* -- fr_window_open_files -- */
+
+void
+fr_window_open_files_with_command (FrWindow *window,
+				   GList    *file_list,
+				   char     *command)
+{
+	GAppInfo *app;
+	GError   *error = NULL;
+
+	app = g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, &error);
+	if (error != NULL) {
+		_gtk_error_dialog_run (GTK_WINDOW (window),
+				       _("Could not perform the operation"),
+				       "%s",
+				       error->message);
+		g_clear_error (&error);
+		return;
+	}
+
+	fr_window_open_files_with_application (window, file_list, app);
+}
+
+void
+fr_window_open_files_with_application (FrWindow *window,
+				       GList    *file_list,
+				       GAppInfo *app)
+{
+	GList               *uris;
+	GList               *scan;
+	GdkAppLaunchContext *context;
+	GError              *error = NULL;
+
+	if (window->priv->activity_ref > 0)
+		return;
+
+	g_assert (file_list != NULL);
+
+	uris = NULL;
+	for (scan = file_list; scan; scan = scan->next)
+		uris = g_list_prepend (uris, g_filename_to_uri (scan->data, NULL, NULL));
+
+	context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (window)));
+	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (window)));
+	gdk_app_launch_context_set_timestamp (context, 0);
+
+	if (! g_app_info_launch_uris (app, uris, G_APP_LAUNCH_CONTEXT (context), &error)) {
+		_gtk_error_dialog_run (GTK_WINDOW (window),
+				       _("Could not perform the operation"),
+				       "%s",
+				       error->message);
+		g_clear_error (&error);
+	}
+
+	g_object_unref (context);
+	path_list_free (uris);
+}
+
+typedef struct {
+	FrWindow    *window;
+	GList       *file_list;
+	gboolean     ask_application;
+	CommandData *cdata;
+} OpenFilesData;
+
+static OpenFilesData*
+open_files_data_new (FrWindow *window,
+		     GList    *file_list,
+		     gboolean  ask_application)
+
+{
+	OpenFilesData *odata;
+	GList         *scan;
+
+	odata = g_new0 (OpenFilesData, 1);
+	odata->window = window;
+	odata->file_list = path_list_dup (file_list);
+	odata->ask_application = ask_application;
+	odata->cdata = g_new0 (CommandData, 1);
+	odata->cdata->temp_dir = get_temp_work_dir (NULL);
+	odata->cdata->file_list = NULL;
+	for (scan = file_list; scan; scan = scan->next) {
+		char *file = scan->data;
+		char *filename;
+
+		filename = g_strconcat (odata->cdata->temp_dir,
+					"/",
+					file,
+					NULL);
+		odata->cdata->file_list = g_list_prepend (odata->cdata->file_list, filename);
+	}
+
+	/* Add to CommandList so the cdata is released on exit. */
+	CommandList = g_list_prepend (CommandList, odata->cdata);
+
+	return odata;
+}
+
+static void
+open_files_data_free (OpenFilesData *odata)
+{
+	g_return_if_fail (odata != NULL);
+
+	path_list_free (odata->file_list);
+	g_free (odata);
+}
+
+void
+fr_window_update_dialog_closed (FrWindow *window)
+{
+	window->priv->update_dialog = NULL;
+}
+
+gboolean
+fr_window_update_files (FrWindow *window,
+			GList    *file_list)
+{
+	GList *scan;
+
+	if (window->priv->activity_ref > 0)
+		return FALSE;
+
+	if (window->archive->read_only)
+		return FALSE;
+
+	fr_process_clear (window->archive->process);
+
+	for (scan = file_list; scan; scan = scan->next) {
+		OpenFile *file = scan->data;
+		GList    *local_file_list;
+
+		local_file_list = g_list_append (NULL, file->path);
+		fr_archive_add (window->archive,
+				local_file_list,
+				file->temp_dir,
+				"/",
+				FALSE,
+				FALSE,
+				window->priv->password,
+				window->priv->encrypt_header,
+				window->priv->compression,
+				window->priv->volume_size);
+		g_list_free (local_file_list);
+	}
+
+	fr_process_start (window->archive->process);
+
+	return TRUE;
+}
+
+static void
+open_file_modified_cb (GFileMonitor     *monitor,
+		       GFile            *monitor_file,
+		       GFile            *other_file,
+		       GFileMonitorEvent event_type,
+		       gpointer          user_data)
+{
+	FrWindow *window = user_data;
+	char     *monitor_uri;
+	OpenFile *file;
+	GList    *scan;
+
+	if ((event_type != G_FILE_MONITOR_EVENT_CHANGED)
+	    && (event_type != G_FILE_MONITOR_EVENT_CREATED))
+	{
+		return;
+	}
+
+	monitor_uri = g_file_get_uri (monitor_file);
+	file = NULL;
+	for (scan = window->priv->open_files; scan; scan = scan->next) {
+		OpenFile *test = scan->data;
+		if (uricmp (test->extracted_uri, monitor_uri) == 0) {
+			file = test;
+			break;
+		}
+	}
+	g_free (monitor_uri);
+
+	g_return_if_fail (file != NULL);
+
+	if (window->priv->update_dialog == NULL)
+		window->priv->update_dialog = dlg_update (window);
+	dlg_update_add_file (window->priv->update_dialog, file);
+}
+
+static void
+fr_window_monitor_open_file (FrWindow *window,
+			     OpenFile *file)
+{
+	GFile *f;
+
+	window->priv->open_files = g_list_prepend (window->priv->open_files, file);
+	f = g_file_new_for_uri (file->extracted_uri);
+	file->monitor = g_file_monitor_file (f, 0, NULL, NULL);
+	g_signal_connect (file->monitor,
+			  "changed",
+			  G_CALLBACK (open_file_modified_cb),
+			  window);
+	g_object_unref (f);
+}
+
+static void
+monitor_extracted_files (OpenFilesData *odata)
+{
+	FrWindow *window = odata->window;
+	GList    *scan1, *scan2;
+
+	for (scan1 = odata->file_list, scan2 = odata->cdata->file_list;
+	     scan1 && scan2;
+	     scan1 = scan1->next, scan2 = scan2->next)
+	{
+		OpenFile   *ofile;
+		const char *file = scan1->data;
+		const char *extracted_path = scan2->data;
+
+		ofile = open_file_new (file, extracted_path, odata->cdata->temp_dir);
+		if (ofile != NULL)
+			fr_window_monitor_open_file (window, ofile);
+	}
+}
+
+static gboolean
+fr_window_open_extracted_files (OpenFilesData *odata)
+{
+	GList               *file_list = odata->cdata->file_list;
+	const char          *first_file;
+	const char          *first_mime_type;
+	GAppInfo            *app;
+	GList               *files_to_open = NULL;
+	GdkAppLaunchContext *context;
+	gboolean             result;
+	GError              *error = NULL;
+
+	g_return_val_if_fail (file_list != NULL, FALSE);
+
+	first_file = (char*) file_list->data;
+	if (first_file == NULL)
+		return FALSE;
+
+	if (! odata->window->archive->read_only)
+		monitor_extracted_files (odata);
+
+	if (odata->ask_application) {
+		dlg_open_with (odata->window, file_list);
+		return FALSE;
+	}
+
+	first_mime_type = get_file_mime_type_for_path (first_file, FALSE);
+	app = g_app_info_get_default_for_type (first_mime_type, FALSE);
+
+	if (app == NULL) {
+		dlg_open_with (odata->window, file_list);
+		return FALSE;
+	}
+
+	files_to_open = g_list_append (files_to_open, g_filename_to_uri (first_file, NULL, NULL));
+
+	if (g_app_info_supports_files (app)) {
+		GList *scan;
+
+		for (scan = file_list->next; scan; scan = scan->next) {
+			const char *path = scan->data;
+			const char *mime_type;
+
+			mime_type = get_file_mime_type_for_path (path, FALSE);
+			if (mime_type == NULL)
+				continue;
+
+			if (strcmp (mime_type, first_mime_type) == 0) {
+				files_to_open = g_list_append (files_to_open, g_filename_to_uri (path, NULL, NULL));
+			}
+			else {
+				GAppInfo *app2;
+
+				app2 = g_app_info_get_default_for_type (mime_type, FALSE);
+				if (g_app_info_equal (app, app2))
+					files_to_open = g_list_append (files_to_open, g_filename_to_uri (path, NULL, NULL));
+				g_object_unref (app2);
+			}
+		}
+	}
+
+	context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (odata->window)));
+	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (odata->window)));
+	gdk_app_launch_context_set_timestamp (context, 0);
+	result = g_app_info_launch_uris (app, files_to_open, G_APP_LAUNCH_CONTEXT (context), &error);
+	if (! result) {
+		_gtk_error_dialog_run (GTK_WINDOW (odata->window),
+				       _("Could not perform the operation"),
+				       "%s",
+				       error->message);
+		g_clear_error (&error);
+	}
+
+	g_object_unref (context);
+	g_object_unref (app);
+	path_list_free (files_to_open);
+
+	return result;
+}
+
+static void
+fr_window_open_files__extract_done_cb (FrArchive   *archive,
+				       FrAction     action,
+				       FrProcError *error,
+				       gpointer     callback_data)
+{
+	OpenFilesData *odata = callback_data;
+
+	g_signal_handlers_disconnect_matched (G_OBJECT (archive),
+					      G_SIGNAL_MATCH_DATA,
+					      0,
+					      0, NULL,
+					      0,
+					      odata);
+
+	if (error->type == FR_PROC_ERROR_NONE)
+		fr_window_open_extracted_files (odata);
+}
+
+void
+fr_window_open_files (FrWindow *window,
+		      GList    *file_list,
+		      gboolean  ask_application)
+{
+	OpenFilesData *odata;
+
+	if (window->priv->activity_ref > 0)
+		return;
+
+	odata = open_files_data_new (window, file_list, ask_application);
+	fr_window_set_current_batch_action (window,
+					    FR_BATCH_ACTION_OPEN_FILES,
+					    odata,
+					    (GFreeFunc) open_files_data_free);
+
+	g_signal_connect (G_OBJECT (window->archive),
+			  "done",
+			  G_CALLBACK (fr_window_open_files__extract_done_cb),
+			  odata);
+
+	fr_process_clear (window->archive->process);
+	fr_archive_extract_to_local (window->archive,
+				     odata->file_list,
+				     odata->cdata->temp_dir,
+				     NULL,
+				     FALSE,
+				     TRUE,
+				     FALSE,
+				     window->priv->password);
+	fr_process_start (window->archive->process);
+}
+
+/**/
+
+static char*
+get_default_dir (const char *dir)
+{
+	if (! is_temp_dir (dir))
+		return g_strdup (dir);
+	else
+		return NULL;
+}
+
+void
+fr_window_set_open_default_dir (FrWindow   *window,
+				const char *default_dir)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (default_dir != NULL);
+
+	if (window->priv->open_default_dir != NULL)
+		g_free (window->priv->open_default_dir);
+	window->priv->open_default_dir = get_default_dir (default_dir);
+}
+
+const char *
+fr_window_get_open_default_dir (FrWindow *window)
+{
+	if (window->priv->open_default_dir == NULL)
+		return get_home_uri ();
+	else
+		return  window->priv->open_default_dir;
+}
+
+void
+fr_window_set_add_default_dir (FrWindow   *window,
+			       const char *default_dir)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (default_dir != NULL);
+
+	if (window->priv->add_default_dir != NULL)
+		g_free (window->priv->add_default_dir);
+	window->priv->add_default_dir = get_default_dir (default_dir);
+}
+
+const char *
+fr_window_get_add_default_dir (FrWindow *window)
+{
+	if (window->priv->add_default_dir == NULL)
+		return get_home_uri ();
+	else
+		return  window->priv->add_default_dir;
+}
+
+void
+fr_window_set_extract_default_dir (FrWindow   *window,
+				   const char *default_dir,
+				   gboolean    freeze)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (default_dir != NULL);
+
+	/* do not change this dir while it's used by the non-interactive
+	 * extraction operation. */
+	if (window->priv->extract_interact_use_default_dir)
+		return;
+
+	window->priv->extract_interact_use_default_dir = freeze;
+
+	if (window->priv->extract_default_dir != NULL)
+		g_free (window->priv->extract_default_dir);
+	window->priv->extract_default_dir = get_default_dir (default_dir);
+}
+
+const char *
+fr_window_get_extract_default_dir (FrWindow *window)
+{
+	if (window->priv->extract_default_dir == NULL)
+		return get_home_uri ();
+	else
+		return  window->priv->extract_default_dir;
+}
+
+void
+fr_window_set_default_dir (FrWindow   *window,
+			   const char *default_dir,
+			   gboolean    freeze)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (default_dir != NULL);
+
+	window->priv->freeze_default_dir = freeze;
+
+	fr_window_set_open_default_dir (window, default_dir);
+	fr_window_set_add_default_dir (window, default_dir);
+	fr_window_set_extract_default_dir (window, default_dir, FALSE);
+}
+
+void
+fr_window_update_columns_visibility (FrWindow *window)
+{
+	GtkTreeView       *tree_view = GTK_TREE_VIEW (window->priv->list_view);
+	GtkTreeViewColumn *column;
+
+	column = gtk_tree_view_get_column (tree_view, 1);
+	gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_SIZE));
+
+	column = gtk_tree_view_get_column (tree_view, 2);
+	gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TYPE));
+
+	column = gtk_tree_view_get_column (tree_view, 3);
+	gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TIME));
+
+	column = gtk_tree_view_get_column (tree_view, 4);
+	gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH));
+}
+
+void
+fr_window_set_toolbar_visibility (FrWindow *window,
+				  gboolean  visible)
+{
+	g_return_if_fail (window != NULL);
+
+	if (visible)
+		gtk_widget_show (window->priv->toolbar);
+	else
+		gtk_widget_hide (window->priv->toolbar);
+
+	set_active (window, "ViewToolbar", visible);
+}
+
+void
+fr_window_set_statusbar_visibility  (FrWindow *window,
+				     gboolean  visible)
+{
+	g_return_if_fail (window != NULL);
+
+	if (visible)
+		gtk_widget_show (window->priv->statusbar);
+	else
+		gtk_widget_hide (window->priv->statusbar);
+
+	set_active (window, "ViewStatusbar", visible);
+}
+
+void
+fr_window_set_folders_visibility (FrWindow   *window,
+				  gboolean    value)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->view_folders = value;
+	fr_window_update_dir_tree (window);
+
+	set_active (window, "ViewFolders", window->priv->view_folders);
+}
+
+void
+fr_window_use_progress_dialog (FrWindow *window,
+			       gboolean  value)
+{
+	window->priv->use_progress_dialog = value;
+}
+
+/* -- batch mode procedures -- */
+
+static void fr_window_exec_current_batch_action (FrWindow *window);
+
+static void
+fr_window_exec_batch_action (FrWindow      *window,
+			     FRBatchAction *action)
+{
+	ExtractData   *edata;
+	RenameData    *rdata;
+	OpenFilesData *odata;
+	SaveAsData    *sdata;
+
+	switch (action->type) {
+	case FR_BATCH_ACTION_LOAD:
+		debug (DEBUG_INFO, "[BATCH] LOAD\n");
+
+		if (! uri_exists ((char*) action->data))
+			fr_window_archive_new (window, (char*) action->data);
+		else
+			fr_window_archive_open (window, (char*) action->data, GTK_WINDOW (window));
+		break;
+
+	case FR_BATCH_ACTION_ADD:
+		debug (DEBUG_INFO, "[BATCH] ADD\n");
+
+		fr_window_archive_add_dropped_items (window, (GList*) action->data, FALSE);
+		break;
+
+	case FR_BATCH_ACTION_DELETE:
+		debug (DEBUG_INFO, "[BATCH] DELETE\n");
+
+		fr_window_archive_remove (window, (GList*) action->data);
+		break;
+
+	case FR_BATCH_ACTION_OPEN:
+		debug (DEBUG_INFO, "[BATCH] OPEN\n");
+
+		fr_window_push_message (window, _("Add files to an archive"));
+		dlg_batch_add_files (window, (GList*) action->data);
+		break;
+
+	case FR_BATCH_ACTION_EXTRACT:
+		debug (DEBUG_INFO, "[BATCH] EXTRACT\n");
+
+		edata = action->data;
+		fr_window_archive_extract (window,
+					   edata->file_list,
+					   edata->extract_to_dir,
+					   edata->sub_dir,
+					   edata->base_dir,
+					   edata->skip_older,
+					   edata->overwrite,
+					   edata->junk_paths,
+					   TRUE);
+		break;
+
+	case FR_BATCH_ACTION_EXTRACT_HERE:
+		debug (DEBUG_INFO, "[BATCH] EXTRACT HERE\n");
+
+		fr_window_archive_extract_here (window,
+						FALSE,
+						FR_OVERWRITE_NO,
+						FALSE);
+		break;
+
+	case FR_BATCH_ACTION_EXTRACT_INTERACT:
+		debug (DEBUG_INFO, "[BATCH] EXTRACT_INTERACT\n");
+
+		if (window->priv->extract_interact_use_default_dir
+		    && (window->priv->extract_default_dir != NULL))
+		{
+			fr_window_archive_extract (window,
+						   NULL,
+						   window->priv->extract_default_dir,
+						   NULL,
+						   NULL,
+						   FALSE,
+						   FR_OVERWRITE_ASK,
+						   FALSE,
+						   TRUE);
+		}
+		else {
+			fr_window_push_message (window, _("Extract archive"));
+			dlg_extract (NULL, window);
+		}
+		break;
+
+	case FR_BATCH_ACTION_RENAME:
+		debug (DEBUG_INFO, "[BATCH] RENAME\n");
+
+		rdata = action->data;
+		rename_selection (window,
+				  rdata->path_to_rename,
+				  rdata->old_name,
+				  rdata->new_name,
+				  rdata->current_dir,
+				  rdata->is_dir,
+				  rdata->dir_in_archive,
+				  rdata->original_path);
+		break;
+
+	case FR_BATCH_ACTION_PASTE:
+		debug (DEBUG_INFO, "[BATCH] PASTE\n");
+
+		fr_window_paste_from_clipboard_data (window, (FrClipboardData*) action->data);
+		break;
+
+	case FR_BATCH_ACTION_OPEN_FILES:
+		debug (DEBUG_INFO, "[BATCH] OPEN FILES\n");
+
+		odata = action->data;
+		fr_window_open_files (window, odata->file_list, odata->ask_application);
+		break;
+
+	case FR_BATCH_ACTION_SAVE_AS:
+		debug (DEBUG_INFO, "[BATCH] SAVE_AS\n");
+
+		sdata = action->data;
+		fr_window_archive_save_as (window,
+					   sdata->uri,
+					   sdata->password,
+					   sdata->encrypt_header,
+					   sdata->volume_size);
+		break;
+
+	case FR_BATCH_ACTION_TEST:
+		debug (DEBUG_INFO, "[BATCH] TEST\n");
+
+		fr_window_archive_test (window);
+		break;
+
+	case FR_BATCH_ACTION_CLOSE:
+		debug (DEBUG_INFO, "[BATCH] CLOSE\n");
+
+		fr_window_archive_close (window);
+		fr_window_exec_next_batch_action (window);
+		break;
+
+	case FR_BATCH_ACTION_QUIT:
+		debug (DEBUG_INFO, "[BATCH] QUIT\n");
+
+		g_signal_emit (window,
+			       fr_window_signals[READY],
+			       0,
+			       NULL);
+
+		if ((window->priv->progress_dialog != NULL) && (gtk_widget_get_parent (window->priv->progress_dialog) != GTK_WIDGET (window)))
+			gtk_widget_destroy (window->priv->progress_dialog);
+		gtk_widget_destroy (GTK_WIDGET (window));
+		break;
+
+	default:
+		break;
+	}
+}
+
+void
+fr_window_reset_current_batch_action (FrWindow *window)
+{
+	FRBatchAction *adata = &window->priv->current_batch_action;
+
+	if ((adata->data != NULL) && (adata->free_func != NULL))
+		(*adata->free_func) (adata->data);
+	adata->type = FR_BATCH_ACTION_NONE;
+	adata->data = NULL;
+	adata->free_func = NULL;
+}
+
+void
+fr_window_set_current_batch_action (FrWindow          *window,
+				    FrBatchActionType  action,
+				    void              *data,
+				    GFreeFunc          free_func)
+{
+	FRBatchAction *adata = &window->priv->current_batch_action;
+
+	fr_window_reset_current_batch_action (window);
+
+	adata->type = action;
+	adata->data = data;
+	adata->free_func = free_func;
+}
+
+void
+fr_window_restart_current_batch_action (FrWindow *window)
+{
+	fr_window_exec_batch_action (window, &window->priv->current_batch_action);
+}
+
+void
+fr_window_append_batch_action (FrWindow          *window,
+			       FrBatchActionType  action,
+			       void              *data,
+			       GFreeFunc          free_func)
+{
+	FRBatchAction *a_desc;
+
+	g_return_if_fail (window != NULL);
+
+	a_desc = g_new0 (FRBatchAction, 1);
+	a_desc->type = action;
+	a_desc->data = data;
+	a_desc->free_func = free_func;
+
+	window->priv->batch_action_list = g_list_append (window->priv->batch_action_list, a_desc);
+}
+
+static void
+fr_window_exec_current_batch_action (FrWindow *window)
+{
+	FRBatchAction *action;
+
+	if (window->priv->batch_action == NULL) {
+		window->priv->batch_mode = FALSE;
+		return;
+	}
+	action = (FRBatchAction *) window->priv->batch_action->data;
+	fr_window_exec_batch_action (window, action);
+}
+
+static void
+fr_window_exec_next_batch_action (FrWindow *window)
+{
+	if (window->priv->batch_action != NULL)
+		window->priv->batch_action = g_list_next (window->priv->batch_action);
+	else
+		window->priv->batch_action = window->priv->batch_action_list;
+	fr_window_exec_current_batch_action (window);
+}
+
+void
+fr_window_start_batch (FrWindow *window)
+{
+	g_return_if_fail (window != NULL);
+
+	if (window->priv->batch_mode)
+		return;
+
+	if (window->priv->batch_action_list == NULL)
+		return;
+
+	if (window->priv->progress_dialog != NULL)
+		gtk_window_set_title (GTK_WINDOW (window->priv->progress_dialog),
+				      window->priv->batch_title);
+
+	window->priv->batch_mode = TRUE;
+	window->priv->batch_action = window->priv->batch_action_list;
+	window->archive->can_create_compressed_file = window->priv->batch_adding_one_file;
+
+	fr_window_exec_current_batch_action (window);
+}
+
+void
+fr_window_stop_batch (FrWindow *window)
+{
+	if (! window->priv->non_interactive)
+		return;
+
+	window->priv->extract_interact_use_default_dir = FALSE;
+	window->archive->can_create_compressed_file = FALSE;
+
+	if (window->priv->batch_mode) {
+		if (! window->priv->showing_error_dialog) {
+			gtk_widget_destroy (GTK_WIDGET (window));
+			return;
+		}
+	}
+	else {
+		gtk_window_present (GTK_WINDOW (window));
+		fr_window_archive_close (window);
+	}
+
+	window->priv->batch_mode = FALSE;
+}
+
+void
+fr_window_resume_batch (FrWindow *window)
+{
+	fr_window_exec_current_batch_action (window);
+}
+
+gboolean
+fr_window_is_batch_mode (FrWindow *window)
+{
+	return window->priv->batch_mode;
+}
+
+void
+fr_window_new_batch (FrWindow   *window,
+		     const char *title)
+{
+	fr_window_free_batch_data (window);
+	window->priv->non_interactive = TRUE;
+	g_free (window->priv->batch_title);
+	window->priv->batch_title = g_strdup (title);
+}
+
+void
+fr_window_set_batch__extract_here (FrWindow   *window,
+				   const char *filename)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (filename != NULL);
+
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_LOAD,
+				       g_strdup (filename),
+				       (GFreeFunc) g_free);
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_EXTRACT_HERE,
+				       extract_to_data_new (NULL),
+				       (GFreeFunc) extract_data_free);
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_CLOSE,
+				       NULL,
+				       NULL);
+}
+
+void
+fr_window_set_batch__extract (FrWindow   *window,
+			      const char *filename,
+			      const char *dest_dir)
+{
+	g_return_if_fail (window != NULL);
+	g_return_if_fail (filename != NULL);
+
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_LOAD,
+				       g_strdup (filename),
+				       (GFreeFunc) g_free);
+	if (dest_dir != NULL)
+		fr_window_append_batch_action (window,
+					       FR_BATCH_ACTION_EXTRACT,
+					       extract_to_data_new (dest_dir),
+					       (GFreeFunc) extract_data_free);
+	else
+		fr_window_append_batch_action (window,
+					       FR_BATCH_ACTION_EXTRACT_INTERACT,
+					       NULL,
+					       NULL);
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_CLOSE,
+				       NULL,
+				       NULL);
+}
+
+void
+fr_window_set_batch__add (FrWindow   *window,
+			  const char *archive,
+			  GList      *file_list)
+{
+	window->priv->batch_adding_one_file = (file_list->next == NULL) && (uri_is_file (file_list->data));
+
+	if (archive != NULL)
+		fr_window_append_batch_action (window,
+					       FR_BATCH_ACTION_LOAD,
+					       g_strdup (archive),
+					       (GFreeFunc) g_free);
+	else
+		fr_window_append_batch_action (window,
+					       FR_BATCH_ACTION_OPEN,
+					       file_list,
+					       NULL);
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_ADD,
+				       file_list,
+				       NULL);
+	fr_window_append_batch_action (window,
+				       FR_BATCH_ACTION_CLOSE,
+				       NULL,
+				       NULL);
+}
+
+void
+fr_window_set_close_dialog (FrWindow *window,
+			     gboolean  state)
+{
+	g_return_if_fail (window != NULL);
+
+	window->priv->close_dialog = state;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/102.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/102.html new file mode 100644 index 0000000..18c5d6f --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/102.html @@ -0,0 +1,2985 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "glib-utils.h"
+#include "file-utils.h"
+#include "gio-utils.h"
+
+#define N_FILES_PER_REQUEST 128
+
+/* -- filter -- */
+
+typedef enum {
+	FILTER_DEFAULT = 0,
+	FILTER_NODOTFILES = 1 << 1,
+	FILTER_IGNORECASE = 1 << 2,
+	FILTER_NOBACKUPFILES = 1 << 3
+} FilterOptions;
+
+typedef struct {
+	char           *pattern;
+	FilterOptions   options;
+	GRegex        **regexps;
+} Filter;
+
+static Filter *
+filter_new (const char    *pattern,
+	    FilterOptions  options)
+{
+	Filter             *filter;
+	GRegexCompileFlags  flags;
+
+	filter = g_new0 (Filter, 1);
+
+	if ((pattern != NULL) && (strcmp (pattern, "*") != 0))
+		filter->pattern = g_strdup (pattern);
+
+	filter->options = options;
+	if (filter->options & FILTER_IGNORECASE)
+		flags = G_REGEX_CASELESS;
+	else
+		flags = 0;
+	filter->regexps = search_util_get_regexps (pattern, flags);
+
+	return filter;
+}
+
+static void
+filter_destroy (Filter *filter)
+{
+	if (filter == NULL)
+		return;
+
+	g_free (filter->pattern);
+	if (filter->regexps != NULL)
+		free_regexps (filter->regexps);
+	g_free (filter);
+}
+
+static gboolean
+filter_matches (Filter     *filter,
+	        const char *name)
+{
+	const char *file_name;
+	char       *utf8_name;
+	gboolean    matched;
+
+	g_return_val_if_fail (name != NULL, FALSE);
+
+	file_name = file_name_from_path (name);
+
+	if ((filter->options & FILTER_NODOTFILES)
+	    && ((file_name[0] == '.') || (strstr (file_name, "/.") != NULL)))
+		return FALSE;
+
+	if ((filter->options & FILTER_NOBACKUPFILES)
+	    && (file_name[strlen (file_name) - 1] == '~'))
+		return FALSE;
+
+	if (filter->pattern == NULL)
+		return TRUE;
+
+	utf8_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
+	matched = match_regexps (filter->regexps, utf8_name, 0);
+	g_free (utf8_name);
+
+	return matched;
+}
+
+static gboolean
+filter_empty (Filter *filter)<--- Parameter 'filter' can be declared as pointer to const
+{
+	return ((filter->pattern == NULL) || (strcmp (filter->pattern, "*") == 0));
+}
+
+/* -- g_directory_foreach_child -- */
+
+typedef struct {
+	GFile                *base_directory;
+	gboolean              recursive;
+	gboolean              follow_links;
+	StartDirCallback      start_dir_func;
+	ForEachChildCallback  for_each_file_func;
+	ForEachDoneCallback   done_func;
+	gpointer              user_data;
+
+	/* private */
+
+	GFile                *current;
+	GHashTable           *already_visited;
+	GList                *to_visit;
+	GCancellable         *cancellable;
+	GFileEnumerator      *enumerator;
+	GError               *error;
+	guint                 source_id;
+} ForEachChildData;
+
+static void
+for_each_child_data_free (ForEachChildData *fec)
+{
+	if (fec == NULL)
+		return;
+
+	if (fec->base_directory != NULL)
+		g_object_unref (fec->base_directory);
+	if (fec->current != NULL)
+		g_object_unref (fec->current);
+	if (fec->already_visited)
+		g_hash_table_destroy (fec->already_visited);
+	if (fec->to_visit != NULL)
+		g_list_free (fec->to_visit);
+	g_free (fec);
+}
+
+static gboolean
+for_each_child_done_cb (gpointer user_data)
+{
+	ForEachChildData *fec = user_data;
+
+	g_source_remove (fec->source_id);
+	if (fec->current != NULL) {
+		g_object_unref (fec->current);
+		fec->current = NULL;
+	}
+	if (fec->done_func)
+		fec->done_func (fec->error, fec->user_data);
+	for_each_child_data_free (fec);
+
+	return FALSE;
+}
+
+static void
+for_each_child_done (ForEachChildData *fec)
+{
+	fec->source_id = g_idle_add (for_each_child_done_cb, fec);
+}
+
+static void for_each_child_start_current (ForEachChildData *fec);
+
+static gboolean
+for_each_child_start_cb (gpointer user_data)
+{
+	ForEachChildData *fec = user_data;
+
+	g_source_remove (fec->source_id);
+	for_each_child_start_current (fec);
+
+	return FALSE;
+}
+
+static void
+for_each_child_start (ForEachChildData *fec)
+{
+	fec->source_id = g_idle_add (for_each_child_start_cb, fec);
+}
+
+static void
+for_each_child_set_current_uri (ForEachChildData *fec,
+				const char       *directory)
+{
+	if (fec->current != NULL)
+		g_object_unref (fec->current);
+	fec->current = g_file_new_for_uri (directory);
+}
+
+static void
+for_each_child_set_current (ForEachChildData *fec,
+			    GFile            *directory)
+{
+	if (fec->current != NULL)
+		g_object_unref (fec->current);
+	fec->current = g_file_dup (directory);
+}
+
+static void
+for_each_child_start_next_sub_directory (ForEachChildData *fec)
+{
+	char *sub_directory = NULL;<--- Variable 'sub_directory' can be declared as pointer to const
+
+	if (fec->to_visit != NULL) {
+		GList *tmp;
+
+		sub_directory = (char*) fec->to_visit->data;
+		tmp = fec->to_visit;
+		fec->to_visit = g_list_remove_link (fec->to_visit, tmp);
+		g_list_free (tmp);
+	}
+
+	if (sub_directory != NULL) {
+		for_each_child_set_current_uri (fec, sub_directory);
+		for_each_child_start (fec);
+	}
+	else
+		for_each_child_done (fec);
+}
+
+static void
+for_each_child_close_enumerator (GObject      *source_object,
+	              		 GAsyncResult *result,
+		      		 gpointer      user_data)
+{
+	ForEachChildData *fec = user_data;
+	GError           *error = NULL;
+
+	if (! g_file_enumerator_close_finish (fec->enumerator,
+					      result,
+					      &error))
+	{
+		if (fec->error == NULL)
+			fec->error = g_error_copy (error);
+		else
+			g_clear_error (&error);
+	}
+
+	if ((fec->error == NULL) && fec->recursive)
+		for_each_child_start_next_sub_directory (fec);
+	else
+		for_each_child_done (fec);
+}
+
+static void
+for_each_child_next_files_ready (GObject      *source_object,
+			         GAsyncResult *result,
+			         gpointer      user_data)
+{
+	ForEachChildData *fec = user_data;
+	GList            *children, *scan;
+
+	children = g_file_enumerator_next_files_finish (fec->enumerator,
+                                                        result,
+                                                        &(fec->error));
+
+	if (children == NULL) {
+		g_file_enumerator_close_async (fec->enumerator,
+					       G_PRIORITY_DEFAULT,
+					       fec->cancellable,
+					       for_each_child_close_enumerator,
+					       fec);
+		return;
+	}
+
+	for (scan = children; scan; scan = scan->next) {
+		GFileInfo *child_info = scan->data;
+		GFile     *f;
+		char      *uri;
+
+		f = g_file_get_child (fec->current, g_file_info_get_name (child_info));
+		uri = g_file_get_uri (f);
+
+		if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY) {
+			/* avoid to visit a directory more than once */
+
+			if (g_hash_table_lookup (fec->already_visited, uri) == NULL) {
+				char *sub_directory;
+
+				sub_directory = g_strdup (uri);
+				g_hash_table_insert (fec->already_visited, sub_directory, GINT_TO_POINTER (1));
+				fec->to_visit = g_list_append (fec->to_visit, sub_directory);
+			}
+		}
+
+		fec->for_each_file_func (uri, fec->follow_links, child_info, fec->user_data);
+
+		g_free (uri);
+		g_object_unref (f);
+	}
+
+	g_file_enumerator_next_files_async (fec->enumerator,
+                                            N_FILES_PER_REQUEST,
+                                            G_PRIORITY_DEFAULT,
+                                            fec->cancellable,
+                                            for_each_child_next_files_ready,
+                                            fec);
+}
+
+static void
+for_each_child_ready (GObject      *source_object,
+		      GAsyncResult *result,
+		      gpointer      user_data)
+{
+	ForEachChildData *fec = user_data;
+
+	fec->enumerator = g_file_enumerate_children_finish (fec->current, result, &(fec->error));
+	if (fec->enumerator == NULL) {
+		for_each_child_done (fec);
+		return;
+	}
+
+	g_file_enumerator_next_files_async (fec->enumerator,
+                                            N_FILES_PER_REQUEST,
+                                            G_PRIORITY_DEFAULT,
+                                            fec->cancellable,
+                                            for_each_child_next_files_ready,
+                                            fec);
+}
+
+static void
+for_each_child_start_current (ForEachChildData *fec)
+{
+	if (fec->start_dir_func != NULL) {
+		char  *directory;
+		DirOp  op;
+
+		directory = g_file_get_uri (fec->current);
+		op = fec->start_dir_func (directory, &(fec->error), fec->user_data);
+		g_free (directory);
+
+		switch (op) {
+		case DIR_OP_SKIP:
+			for_each_child_start_next_sub_directory (fec);
+			return;
+		case DIR_OP_STOP:
+			for_each_child_done (fec);
+			return;
+		case DIR_OP_CONTINUE:
+			break;
+		}
+	}
+
+	g_file_enumerate_children_async (fec->current,
+					 "standard::name,standard::type",
+					 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+					 G_PRIORITY_DEFAULT,
+					 fec->cancellable,
+					 for_each_child_ready,
+					 fec);
+}
+
+/**
+ * g_directory_foreach_child:
+ * @directory: The directory to visit.
+ * @recursive: Whether to traverse the @directory recursively.
+ * @follow_links: Whether to dereference the symbolic links.
+ * @cancellable: An optional @GCancellable object, used to cancel the process.
+ * @start_dir_func: the function called for each sub-directory, or %NULL if
+ *   not needed.
+ * @for_each_file_func: the function called for each file.  Can't be %NULL.
+ * @done_func: the function called at the end of the traversing process.
+ *   Can't be %NULL.
+ * @user_data: data to pass to @done_func
+ *
+ * Traverse the @directory's filesystem structure calling the
+ * @for_each_file_func function for each file in the directory; the
+ * @start_dir_func function on each directory before it's going to be
+ * traversed, this includes @directory too; the @done_func function is
+ * called at the end of the process.
+ * Some traversing options are available: if @recursive is TRUE the
+ * directory is traversed recursively; if @follow_links is TRUE, symbolic
+ * links are dereferenced, otherwise they are returned as links.
+ * Each callback uses the same @user_data additional parameter.
+ */
+void
+g_directory_foreach_child (GFile                *directory,
+			   gboolean              recursive,
+			   gboolean              follow_links,
+			   GCancellable         *cancellable,
+			   StartDirCallback      start_dir_func,
+			   ForEachChildCallback  for_each_file_func,
+			   ForEachDoneCallback   done_func,
+			   gpointer              user_data)
+{
+	ForEachChildData *fec;
+
+	g_return_if_fail (for_each_file_func != NULL);
+
+	fec = g_new0 (ForEachChildData, 1);
+
+	fec->base_directory = g_object_ref (directory);
+	fec->recursive = recursive;
+	fec->follow_links = follow_links;
+	fec->cancellable = cancellable;
+	fec->start_dir_func = start_dir_func;
+	fec->for_each_file_func = for_each_file_func;
+	fec->done_func = done_func;
+	fec->user_data = user_data;
+	fec->already_visited = g_hash_table_new_full (g_str_hash,
+						      g_str_equal,
+						      g_free,
+						      NULL);
+
+	for_each_child_set_current (fec, fec->base_directory);
+	for_each_child_start_current (fec);
+}
+
+/* -- get_file_list_data -- */
+
+typedef struct {
+	GList             *files;
+	GList             *dirs;
+	GFile             *directory;
+	GFile             *base_dir;
+	GCancellable      *cancellable;
+	ListReadyCallback  done_func;
+	gpointer           done_data;
+	GList             *to_visit;
+	GList             *current_dir;
+	Filter            *include_filter;
+	Filter            *exclude_filter;
+	Filter            *exclude_folders_filter;
+	guint              visit_timeout;
+} GetFileListData;
+
+static void
+get_file_list_data_free (GetFileListData *gfl)
+{
+	if (gfl == NULL)
+		return;
+
+	filter_destroy (gfl->include_filter);
+	filter_destroy (gfl->exclude_filter);
+	filter_destroy (gfl->exclude_folders_filter);
+	path_list_free (gfl->files);
+	path_list_free (gfl->dirs);
+	path_list_free (gfl->to_visit);
+	if (gfl->directory != NULL)
+		g_object_unref (gfl->directory);
+	if (gfl->base_dir != NULL)
+		g_object_unref (gfl->base_dir);
+	g_free (gfl);
+}
+
+/* -- g_directory_list_async -- */
+
+static GList*
+get_relative_file_list (GList *rel_list,
+			GList *file_list,
+			GFile *base_dir)
+{
+	GList *scan;
+
+	if (base_dir == NULL)
+		return NULL;
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char  *full_path = scan->data;
+		GFile *f;
+		char  *relative_path;
+
+		f = g_file_new_for_commandline_arg (full_path);
+		relative_path = g_file_get_relative_path (base_dir, f);
+		if (relative_path != NULL)
+			rel_list = g_list_prepend (rel_list, relative_path);
+		g_object_unref (f);
+	}
+
+	return rel_list;
+}
+
+static GList*
+get_dir_list_from_file_list (GHashTable *h_dirs,
+			     const char *base_dir,
+			     GList      *files,
+			     gboolean    is_dir_list)
+{
+	GList *scan;
+	GList *dir_list = NULL;
+	size_t base_dir_len;
+
+	if (base_dir == NULL)
+		base_dir = "";
+	base_dir_len = strlen (base_dir);
+
+	for (scan = files; scan; scan = scan->next) {
+		char *filename = scan->data;
+		char *dir_name;
+
+		if (strlen (filename) <= base_dir_len)
+			continue;
+
+		if (is_dir_list)
+			dir_name = g_strdup (filename + base_dir_len + 1);
+		else
+			dir_name = remove_level_from_path (filename + base_dir_len + 1);
+
+		while ((dir_name != NULL) && (dir_name[0] != '\0') && (strcmp (dir_name, "/") != 0)) {
+			char *tmp;
+			char *dir;
+
+			/* avoid to insert duplicated folders */
+
+			dir = g_strconcat (base_dir, "/", dir_name, NULL);
+			if (g_hash_table_lookup (h_dirs, dir) == NULL) {
+				g_hash_table_insert (h_dirs, dir, GINT_TO_POINTER (1));
+				dir_list = g_list_prepend (dir_list, dir);
+			}
+			else
+				g_free (dir);
+
+			tmp = dir_name;
+			dir_name = remove_level_from_path (tmp);
+			g_free (tmp);
+		}
+
+		g_free (dir_name);
+	}
+
+	return dir_list;
+}
+
+static void
+get_file_list_done (GError   *error,
+		    gpointer  user_data)
+{
+	GetFileListData *gfl = user_data;
+	GHashTable      *h_dirs;
+	GList           *scan;
+	char            *uri;
+
+	gfl->files = g_list_reverse (gfl->files);
+	gfl->dirs = g_list_reverse (gfl->dirs);
+
+	if (! filter_empty (gfl->include_filter) || (gfl->exclude_filter->pattern != NULL)) {
+		path_list_free (gfl->dirs);
+		gfl->dirs = NULL;
+	}
+
+	h_dirs = g_hash_table_new (g_str_hash, g_str_equal);
+
+	/* Always include the base directory, this way empty base
+ 	 * directories are added to the archive as well.  */
+
+	if (gfl->base_dir != NULL) {
+		char *dir;
+
+		dir = g_file_get_uri (gfl->base_dir);
+		gfl->dirs = g_list_prepend (gfl->dirs, dir);
+		g_hash_table_insert (h_dirs, dir, GINT_TO_POINTER (1));
+	}
+
+	/* Add all the parent directories in gfl->files/gfl->dirs to the
+	 * gfl->dirs list, the hash table is used to avoid duplicated
+	 * entries. */
+
+	for (scan = gfl->dirs; scan; scan = scan->next)
+		g_hash_table_insert (h_dirs, (char*)scan->data, GINT_TO_POINTER (1));
+
+	uri = g_file_get_uri (gfl->base_dir);
+	gfl->dirs = g_list_concat (gfl->dirs, get_dir_list_from_file_list (h_dirs, uri, gfl->files, FALSE));
+
+	if (filter_empty (gfl->include_filter))
+		gfl->dirs = g_list_concat (gfl->dirs, get_dir_list_from_file_list (h_dirs, uri, gfl->dirs, TRUE));
+
+	g_free (uri);
+	/**/
+
+	if (error == NULL) {
+		GList *rel_files, *rel_dirs;
+
+		if (gfl->base_dir != NULL) {
+			rel_files = get_relative_file_list (NULL, gfl->files, gfl->base_dir);
+			rel_dirs = get_relative_file_list (NULL, gfl->dirs, gfl->base_dir);
+		}
+		else {
+			rel_files = gfl->files;
+			rel_dirs = gfl->dirs;
+			gfl->files = NULL;
+			gfl->dirs = NULL;
+		}
+
+		/* rel_files/rel_dirs must be deallocated in done_func */
+		gfl->done_func (rel_files, rel_dirs, NULL, gfl->done_data);
+	}
+	else
+		gfl->done_func (NULL, NULL, error, gfl->done_data);
+
+	g_hash_table_destroy (h_dirs);
+	get_file_list_data_free (gfl);
+}
+
+static void
+get_file_list_for_each_file (const char *uri,
+			      gboolean    follow_links,
+			      GFileInfo  *info,
+			      gpointer    user_data)
+{
+	GetFileListData *gfl = user_data;
+
+	switch (g_file_info_get_file_type (info)) {
+	case G_FILE_TYPE_REGULAR:
+		if (filter_matches (gfl->include_filter, uri))
+			if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
+				gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
+		break;
+	case G_FILE_TYPE_SYMBOLIC_LINK:
+		if (follow_links)
+			if (filter_matches (gfl->include_filter, uri))
+				if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
+					gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
+		break;
+	default:
+		break;
+	}
+}
+
+static DirOp
+get_file_list_start_dir (const char  *uri,
+			 GError     **error,
+			 gpointer     user_data)
+{
+	GetFileListData *gfl = user_data;
+
+	if ((gfl->exclude_folders_filter->pattern == NULL) || ! filter_matches (gfl->exclude_folders_filter, uri)) {
+		gfl->dirs = g_list_prepend (gfl->dirs, g_strdup (uri));
+		return DIR_OP_CONTINUE;
+	}
+	else
+		return DIR_OP_SKIP;
+}
+
+void
+g_directory_list_async (const char        *directory,
+		        const char        *base_dir,
+		        gboolean           recursive,
+		        gboolean           follow_links,
+		        gboolean           no_backup_files,
+		        gboolean           no_dot_files,
+		        const char        *include_files,
+		        const char        *exclude_files,
+		        const char        *exclude_folders,
+		        gboolean           ignorecase,
+		        GCancellable      *cancellable,
+		        ListReadyCallback  done_func,
+		        gpointer           done_data)
+{
+	GetFileListData *gfl;
+	FilterOptions    filter_options;
+
+	gfl = g_new0 (GetFileListData, 1);
+	gfl->directory = g_file_new_for_commandline_arg (directory);
+	gfl->base_dir = g_file_new_for_commandline_arg (base_dir);
+	gfl->done_func = done_func;
+	gfl->done_data = done_data;
+
+	filter_options = FILTER_DEFAULT;
+	if (no_backup_files)
+		filter_options |= FILTER_NOBACKUPFILES;
+	if (no_dot_files)
+		filter_options |= FILTER_NODOTFILES;
+	if (ignorecase)
+		filter_options |= FILTER_IGNORECASE;
+	gfl->include_filter = filter_new (include_files, filter_options);
+	gfl->exclude_filter = filter_new (exclude_files, ignorecase ? FILTER_IGNORECASE : FILTER_DEFAULT);
+	gfl->exclude_folders_filter = filter_new (exclude_folders, ignorecase ? FILTER_IGNORECASE : FILTER_DEFAULT);
+
+	g_directory_foreach_child (gfl->directory,
+				   recursive,
+				   follow_links,
+				   cancellable,
+				   get_file_list_start_dir,
+				   get_file_list_for_each_file,
+				   get_file_list_done,
+				   gfl);
+}
+
+/* -- g_list_items_async -- */
+
+static void get_items_for_current_dir (GetFileListData *gfl);
+
+static gboolean
+get_items_for_next_dir_idle_cb (gpointer data)
+{
+	GetFileListData *gfl = data;
+
+	g_source_remove (gfl->visit_timeout);
+	gfl->visit_timeout = 0;
+
+	gfl->current_dir = g_list_next (gfl->current_dir);
+	get_items_for_current_dir (gfl);
+
+	return FALSE;
+}
+
+static void
+get_items_for_current_dir_done (GList    *files,
+			        GList    *dirs,
+			        GError   *error,
+			        gpointer  data)
+{
+	GetFileListData *gfl = data;
+
+	if (error != NULL) {
+		if (gfl->done_func)
+			gfl->done_func (NULL, NULL, error, gfl->done_data);
+		path_list_free (files);
+		path_list_free (dirs);
+		get_file_list_data_free (gfl);
+		return;
+	}
+
+	gfl->files = g_list_concat (gfl->files, files);
+	gfl->dirs = g_list_concat (gfl->dirs, dirs);
+
+	gfl->visit_timeout = g_idle_add (get_items_for_next_dir_idle_cb, gfl);
+}
+
+static void
+get_items_for_current_dir (GetFileListData *gfl)
+{
+	GFile *current_dir;
+	char  *directory_name;
+	GFile *directory_file;
+	char  *directory_uri;
+	char  *base_dir_uri;
+
+	if (gfl->current_dir == NULL) {
+		if (gfl->done_func) {
+			/* gfl->files/gfl->dirs must be deallocated in gfl->done_func */
+			gfl->done_func (gfl->files, gfl->dirs, NULL, gfl->done_data);
+			gfl->files = NULL;
+			gfl->dirs = NULL;
+		}
+		get_file_list_data_free (gfl);
+		return;
+	}
+
+	current_dir = g_file_new_for_uri ((char*) gfl->current_dir->data);
+	directory_name = g_file_get_basename (current_dir);
+	directory_file = g_file_get_child (gfl->base_dir, directory_name);
+	directory_uri = g_file_get_uri (directory_file);
+	base_dir_uri = g_file_get_uri (gfl->base_dir);
+
+	g_directory_list_all_async (directory_uri,
+				    base_dir_uri,
+				    TRUE,
+				    gfl->cancellable,
+				    get_items_for_current_dir_done,
+				    gfl);
+
+	g_free (base_dir_uri);
+	g_free (directory_uri);
+	g_object_unref (directory_file);
+	g_free (directory_name);
+	g_object_unref (current_dir);
+}
+
+void
+g_list_items_async (GList             *items,
+		    const char        *base_dir,
+		    GCancellable      *cancellable,
+		    ListReadyCallback  done_func,
+		    gpointer           done_data)
+{
+	GetFileListData *gfl;
+	int              base_len;
+	GList           *scan;
+
+	g_return_if_fail (base_dir != NULL);
+
+	gfl = g_new0 (GetFileListData, 1);
+	gfl->base_dir = g_file_new_for_commandline_arg (base_dir);
+	gfl->cancellable = cancellable;
+	gfl->done_func = done_func;
+	gfl->done_data = done_data;
+
+	base_len = 0;
+	if (strcmp (base_dir, "/") != 0)
+		base_len = strlen (base_dir);
+
+	for (scan = items; scan; scan = scan->next) {
+		char *uri = scan->data;
+
+		/* FIXME: this is not async */
+		if (uri_is_dir (uri)) {
+			gfl->to_visit = g_list_prepend (gfl->to_visit, g_strdup (uri));
+		}
+		else {
+			char *rel_path = g_uri_unescape_string (uri + base_len + 1, NULL);
+			gfl->files = g_list_prepend (gfl->files, rel_path);
+		}
+	}
+
+	gfl->current_dir = gfl->to_visit;
+	get_items_for_current_dir (gfl);
+}
+
+/* -- g_copy_files_async -- */
+
+typedef struct {
+	GList                 *sources;
+	GList                 *destinations;
+	GFileCopyFlags         flags;
+	int                    io_priority;
+	GCancellable          *cancellable;
+	CopyProgressCallback   progress_callback;
+	gpointer               progress_callback_data;
+	CopyDoneCallback       callback;
+	gpointer               user_data;
+
+	GList                 *source;
+	GList                 *destination;
+	int                    n_file;
+	int                    tot_files;
+} CopyFilesData;
+
+static CopyFilesData*
+copy_files_data_new (GList                 *sources,
+		     GList                 *destinations,
+		     GFileCopyFlags         flags,
+		     int                    io_priority,
+		     GCancellable          *cancellable,
+		     CopyProgressCallback   progress_callback,
+		     gpointer               progress_callback_data,
+		     CopyDoneCallback       callback,
+		     gpointer               user_data)
+{
+	CopyFilesData *cfd;
+
+	cfd = g_new0 (CopyFilesData, 1);
+	cfd->sources = gio_file_list_dup (sources);
+	cfd->destinations = gio_file_list_dup (destinations);
+	cfd->flags = flags;
+	cfd->io_priority = io_priority;
+	cfd->cancellable = cancellable;
+	cfd->progress_callback = progress_callback;
+	cfd->progress_callback_data = progress_callback_data;
+	cfd->callback = callback;
+	cfd->user_data = user_data;
+
+	cfd->source = cfd->sources;
+	cfd->destination = cfd->destinations;
+	cfd->n_file = 1;
+	cfd->tot_files = g_list_length (cfd->sources);
+
+	return cfd;
+}
+
+static void
+copy_files_data_free (CopyFilesData *cfd)
+{
+	if (cfd == NULL)
+		return;
+	gio_file_list_free (cfd->sources);
+	gio_file_list_free (cfd->destinations);
+	g_free (cfd);
+}
+
+static void g_copy_current_file (CopyFilesData *cfd);
+
+static void
+g_copy_next_file (CopyFilesData *cfd)
+{
+	cfd->source = g_list_next (cfd->source);
+	cfd->destination = g_list_next (cfd->destination);
+	cfd->n_file++;
+
+	g_copy_current_file (cfd);
+}
+
+static void
+g_copy_files_ready_cb (GObject      *source_object,
+                       GAsyncResult *result,
+                       gpointer      user_data)
+{
+	CopyFilesData *cfd = user_data;
+	GFile         *source = cfd->source->data;
+	GError        *error = NULL;
+
+	if (! g_file_copy_finish (source, result, &error)) {
+		/* source and target are directories, ignore the error */
+		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_MERGE))
+			g_clear_error (&error);
+		/* source is directory, create target directory */
+		if (g_error_matches (error, G_IO_ERROR,  G_IO_ERROR_WOULD_RECURSE)) {
+			g_clear_error (&error);
+			g_file_make_directory ((GFile*) cfd->destination->data,
+					       cfd->cancellable,
+					       &error);
+		}
+	}
+
+	if (error) {
+		if (cfd->callback)
+			cfd->callback (error, cfd->user_data);
+		g_clear_error (&error);
+		copy_files_data_free (cfd);
+		return;
+	}
+
+	g_copy_next_file (cfd);
+}
+
+static void
+g_copy_files_progress_cb (goffset  current_num_bytes,
+                          goffset  total_num_bytes,
+                          gpointer user_data)
+{
+	CopyFilesData *cfd = user_data;
+
+	if (cfd->progress_callback)
+		cfd->progress_callback (cfd->n_file,
+					cfd->tot_files,
+					(GFile*) cfd->source->data,
+					(GFile*) cfd->destination->data,
+					current_num_bytes,
+					total_num_bytes,
+					cfd->progress_callback_data);
+}
+
+static void
+g_copy_current_file (CopyFilesData *cfd)
+{
+	if ((cfd->source == NULL) || (cfd->destination == NULL)) {
+		if (cfd->callback)
+			cfd->callback (NULL, cfd->user_data);
+		copy_files_data_free (cfd);
+		return;
+	}
+
+	g_file_copy_async ((GFile*) cfd->source->data,
+			   (GFile*) cfd->destination->data,
+			   cfd->flags,
+			   cfd->io_priority,
+			   cfd->cancellable,
+			   g_copy_files_progress_cb,
+			   cfd,
+			   g_copy_files_ready_cb,
+			   cfd);
+}
+
+void
+g_copy_files_async (GList                 *sources,
+		    GList                 *destinations,
+		    GFileCopyFlags         flags,
+		    int                    io_priority,
+		    GCancellable          *cancellable,
+		    CopyProgressCallback   progress_callback,
+		    gpointer               progress_callback_data,
+		    CopyDoneCallback       callback,
+		    gpointer               user_data)
+{
+	CopyFilesData *cfd;
+
+	cfd = copy_files_data_new (sources,
+				   destinations,
+				   flags,
+				   io_priority,
+				   cancellable,
+				   progress_callback,
+				   progress_callback_data,
+				   callback,
+				   user_data);
+	g_copy_current_file (cfd);
+}
+
+void
+g_copy_file_async (GFile                 *source,
+		   GFile                 *destination,
+		   GFileCopyFlags         flags,
+		   int                    io_priority,
+		   GCancellable          *cancellable,
+		   CopyProgressCallback   progress_callback,
+		   gpointer               progress_callback_data,
+		   CopyDoneCallback       callback,
+		   gpointer               user_data)
+{
+	GList *source_files;
+	GList *destination_files;
+
+	source_files = g_list_append (NULL, (gpointer) source);
+	destination_files = g_list_append (NULL, (gpointer) destination);
+
+	g_copy_files_async (source_files,
+			    destination_files,
+			    flags,
+			    io_priority,
+			    cancellable,
+			    progress_callback,
+			    progress_callback_data,
+			    callback,
+			    user_data);
+
+	g_list_free (source_files);
+	g_list_free (destination_files);
+}
+
+/* -- g_directory_copy_async -- */
+
+typedef struct {
+	char      *uri;
+	GFileInfo *info;
+} ChildData;
+
+static ChildData*
+child_data_new (const char *uri,
+		GFileInfo  *info)
+{
+	ChildData *data;
+
+	data = g_new0 (ChildData, 1);
+	data->uri = g_strdup (uri);
+	data->info = g_file_info_dup (info);
+
+	return data;
+}
+
+static void
+child_data_free (ChildData *child)
+{
+	if (child == NULL)
+		return;
+	g_free (child->uri);
+	g_object_unref (child->info);
+	g_free (child);
+}
+
+typedef struct {
+	GFile                 *source;
+	GFile                 *destination;
+	GFileCopyFlags         flags;
+	int                    io_priority;
+	GCancellable          *cancellable;
+	CopyProgressCallback   progress_callback;
+	gpointer               progress_callback_data;
+	CopyDoneCallback       callback;
+	gpointer               user_data;
+	GError                *error;
+
+	GList                 *to_copy;
+	GList                 *current;
+	GFile                 *current_source;
+	GFile                 *current_destination;
+	int                    n_file, tot_files;
+	guint                  source_id;
+} DirectoryCopyData;
+
+static void
+directory_copy_data_free (DirectoryCopyData *dcd)
+{
+	if (dcd == NULL)
+		return;
+
+	if (dcd->source != NULL)
+		g_object_unref (dcd->source);
+	if (dcd->destination != NULL)
+		g_object_unref (dcd->destination);
+	if (dcd->current_source != NULL) {
+		g_object_unref (dcd->current_source);
+		dcd->current_source = NULL;
+	}
+	if (dcd->current_destination != NULL) {
+		g_object_unref (dcd->current_destination);
+		dcd->current_destination = NULL;
+	}
+	g_list_free_full (dcd->to_copy, (GDestroyNotify) child_data_free);
+	g_free (dcd);
+}
+
+static gboolean
+g_directory_copy_done (gpointer user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	g_source_remove (dcd->source_id);
+
+	if (dcd->callback)
+		dcd->callback (dcd->error, dcd->user_data);
+	if (dcd->error != NULL)
+		g_clear_error (&(dcd->error));
+	directory_copy_data_free (dcd);
+
+	return FALSE;
+}
+
+static GFile *
+get_destination_for_uri (DirectoryCopyData *dcd,
+		         const char        *uri)
+{
+	GFile *f_uri;
+	GFile *destination_file;
+	char  *relative_path;
+
+	f_uri = g_file_new_for_uri (uri);
+	relative_path = g_file_get_relative_path (dcd->source, f_uri);
+	if (relative_path != NULL)
+		destination_file = g_file_resolve_relative_path (dcd->destination, relative_path);
+	else
+		destination_file = g_file_dup (dcd->destination);
+
+	g_free (relative_path);
+	g_object_unref (f_uri);
+
+	return destination_file;
+}
+
+static void g_directory_copy_current_child (DirectoryCopyData *dcd);
+
+static gboolean
+g_directory_copy_next_child (gpointer user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	g_source_remove (dcd->source_id);
+
+	dcd->current = g_list_next (dcd->current);
+	dcd->n_file++;
+	g_directory_copy_current_child (dcd);
+
+	return FALSE;
+}
+
+static void
+g_directory_copy_child_done_cb (GObject      *source_object,
+                        	GAsyncResult *result,
+ 	                        gpointer      user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	if (! g_file_copy_finish ((GFile*)source_object, result, &(dcd->error))) {
+		dcd->source_id = g_idle_add (g_directory_copy_done, dcd);
+		return;
+	}
+
+	dcd->source_id = g_idle_add (g_directory_copy_next_child, dcd);
+}
+
+static void
+g_directory_copy_child_progress_cb (goffset  current_num_bytes,
+                                    goffset  total_num_bytes,
+                                    gpointer user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	if (dcd->progress_callback)
+		dcd->progress_callback (dcd->n_file,
+					dcd->tot_files,
+					dcd->current_source,
+					dcd->current_destination,
+					current_num_bytes,
+					total_num_bytes,
+					dcd->progress_callback_data);
+}
+
+static void
+g_directory_copy_current_child (DirectoryCopyData *dcd)
+{
+	ChildData *child;
+	gboolean   async_op = FALSE;
+
+	if (dcd->current == NULL) {
+		dcd->source_id = g_idle_add (g_directory_copy_done, dcd);
+		return;
+	}
+
+	if (dcd->current_source != NULL) {
+		g_object_unref (dcd->current_source);
+		dcd->current_source = NULL;
+	}
+	if (dcd->current_destination != NULL) {
+		g_object_unref (dcd->current_destination);
+		dcd->current_destination = NULL;
+	}
+
+	child = dcd->current->data;
+	dcd->current_source = g_file_new_for_uri (child->uri);
+	dcd->current_destination = get_destination_for_uri (dcd, child->uri);
+	if (dcd->current_destination == NULL) {
+		dcd->source_id = g_idle_add (g_directory_copy_next_child, dcd);
+		return;
+	}
+
+	switch (g_file_info_get_file_type (child->info)) {
+	case G_FILE_TYPE_DIRECTORY:
+		/* FIXME: how to make a directory asynchronously ? */
+
+		/* doesn't check the returned error for now, because when an
+		 * error occurs the code is not returned (for example when
+		 * a directory already exists the G_IO_ERROR_EXISTS code is
+		 * *not* returned), so we cannot discriminate between warnings
+		 * and fatal errors. (see bug #525155) */
+
+		g_file_make_directory (dcd->current_destination,
+				       NULL,
+				       NULL);
+
+		/*if (! g_file_make_directory (dcd->current_destination,
+					     dcd->cancellable,
+					     &(dcd->error)))
+		{
+			dcd->source_id = g_idle_add (g_directory_copy_done, dcd);
+			return;
+		}*/
+		break;
+	case G_FILE_TYPE_SYMBOLIC_LINK:
+		/* FIXME: how to make a link asynchronously ? */
+
+		g_file_make_symbolic_link (dcd->current_destination,
+					   g_file_info_get_symlink_target (child->info),
+					   NULL,
+					   NULL);
+
+		/*if (! g_file_make_symbolic_link (dcd->current_destination,
+						 g_file_info_get_symlink_target (child->info),
+						 dcd->cancellable,
+						 &(dcd->error)))
+		{
+			dcd->source_id = g_idle_add (g_directory_copy_done, dcd);
+			return;
+		}*/
+		break;
+	case G_FILE_TYPE_REGULAR:
+		g_file_copy_async (dcd->current_source,
+				   dcd->current_destination,
+				   dcd->flags,
+				   dcd->io_priority,
+				   dcd->cancellable,
+				   g_directory_copy_child_progress_cb,
+				   dcd,
+				   g_directory_copy_child_done_cb,
+				   dcd);
+		async_op = TRUE;
+		break;
+	default:
+		break;
+	}
+
+	if (! async_op)
+		dcd->source_id = g_idle_add (g_directory_copy_next_child, dcd);
+}
+
+static gboolean
+g_directory_copy_start_copying (gpointer user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	g_source_remove (dcd->source_id);
+
+	dcd->to_copy = g_list_reverse (dcd->to_copy);
+	dcd->current = dcd->to_copy;
+	dcd->n_file = 1;
+	g_directory_copy_current_child (dcd);
+
+	return FALSE;
+}
+
+static void
+g_directory_copy_list_ready (GError   *error,
+			     gpointer  user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	if (error != NULL) {
+		dcd->error = g_error_copy (error);
+		dcd->source_id = g_idle_add (g_directory_copy_done, dcd);
+		return;
+	}
+
+	dcd->source_id = g_idle_add (g_directory_copy_start_copying, dcd);
+}
+
+static void
+g_directory_copy_for_each_file (const char *uri,
+				 gboolean    follow_links,
+				 GFileInfo  *info,
+				 gpointer    user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+
+	dcd->to_copy = g_list_prepend (dcd->to_copy, child_data_new (uri, info));
+	dcd->tot_files++;
+}
+
+static DirOp
+g_directory_copy_start_dir (const char  *uri,
+			    GError     **error,
+			    gpointer     user_data)
+{
+	DirectoryCopyData *dcd = user_data;
+	GFileInfo         *info;
+
+	info = g_file_info_new ();
+	g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
+	dcd->to_copy = g_list_prepend (dcd->to_copy, child_data_new (uri, info));
+	g_object_unref (info);
+
+	dcd->tot_files++;
+
+	return DIR_OP_CONTINUE;
+}
+
+void
+g_directory_copy_async (const char            *source,
+			const char            *destination,
+			GFileCopyFlags         flags,
+			int                    io_priority,
+			GCancellable          *cancellable,
+			CopyProgressCallback   progress_callback,
+			gpointer               progress_callback_data,
+			CopyDoneCallback       callback,
+			gpointer               user_data)
+{
+	DirectoryCopyData *dcd;
+
+	/* Creating GFile objects here will save us lot of effort in path construction */
+	dcd = g_new0 (DirectoryCopyData, 1);
+	dcd->source = g_file_new_for_commandline_arg (source);
+	dcd->destination = g_file_new_for_commandline_arg (destination);
+	dcd->flags = flags;
+	dcd->io_priority = io_priority;
+	dcd->cancellable = cancellable;
+	dcd->progress_callback = progress_callback;
+	dcd->progress_callback_data = progress_callback_data;
+	dcd->callback = callback;
+	dcd->user_data = user_data;
+
+	g_directory_foreach_child (dcd->source,
+			           TRUE,
+			           TRUE,
+			           dcd->cancellable,
+			           g_directory_copy_start_dir,
+			           g_directory_copy_for_each_file,
+			           g_directory_copy_list_ready,
+			           dcd);
+}
+
+gboolean
+g_load_file_in_buffer (GFile   *file,
+	               void    *buffer,
+	               gsize    size,
+                       GError **error)
+{
+	GFileInputStream *istream;
+	int               n;
+
+	istream = g_file_read (file, NULL, error);
+	if (istream == NULL)
+		return FALSE;
+
+	n = g_input_stream_read (G_INPUT_STREAM (istream), buffer, size, NULL, error);
+	g_object_unref (istream);
+
+	return (n >= 0);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/103.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/103.html new file mode 100644 index 0000000..0240352 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/103.html @@ -0,0 +1,1297 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gprintf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "glib-utils.h"
+
+#define MAX_PATTERNS 128
+
+/* gobject utils*/
+
+void
+_g_object_unref (gpointer object)
+{
+	if (object != NULL)
+		g_object_unref (object);
+}
+
+/* string utils */
+
+gboolean
+strchrs (const char *str,
+	 const char *chars)
+{
+	const char *c;
+	for (c = chars; *c != '\0'; c++)
+		if (strchr (str, *c) != NULL)
+			return TRUE;
+	return FALSE;
+}
+
+char *
+str_substitute (const char *str,
+		const char *from_str,
+		const char *to_str)
+{
+	char    **tokens;
+	int       i;
+	GString  *gstr;
+
+	if (str == NULL)
+		return NULL;
+
+	if (from_str == NULL)
+		return g_strdup (str);
+
+	if (strcmp (str, from_str) == 0)
+		return g_strdup (to_str);
+
+	tokens = g_strsplit (str, from_str, -1);
+
+	gstr = g_string_new (NULL);
+	for (i = 0; tokens[i] != NULL; i++) {
+		gstr = g_string_append (gstr, tokens[i]);
+		if ((to_str != NULL) && (tokens[i+1] != NULL))
+			gstr = g_string_append (gstr, to_str);
+	}
+
+	g_strfreev (tokens);
+
+	return g_string_free (gstr, FALSE);
+}
+
+/* counts how many characters to escape in @str. */
+static int
+count_chars_to_escape (const char *str,
+		       const char *meta_chars)
+{
+	int         meta_chars_n = strlen (meta_chars);
+	const char *s;
+	int         n = 0;
+
+	for (s = str; *s != 0; s++) {
+		int i;
+		for (i = 0; i < meta_chars_n; i++)
+			if (*s == meta_chars[i]) {
+				n++;
+				break;
+			}
+	}
+	return n;
+}
+
+static char*
+escape_str_common (const char *str,
+		   const char *meta_chars,
+		   const char  prefix,
+		   const char  postfix)
+{
+	int         meta_chars_n = strlen (meta_chars);
+	char       *escaped;
+	int         i, new_l, extra_chars = 0;
+	const char *s;
+	char       *t;
+
+	if (str == NULL)
+		return NULL;
+
+	if (prefix)
+		extra_chars++;
+	if (postfix)
+		extra_chars++;
+
+	new_l = strlen (str) + (count_chars_to_escape (str, meta_chars) * extra_chars);
+	escaped = g_malloc (new_l + 1);
+
+	s = str;
+	t = escaped;
+	while (*s) {
+		gboolean is_bad = FALSE;
+		for (i = 0; (i < meta_chars_n) && !is_bad; i++)
+			is_bad = (*s == meta_chars[i]);
+		if (is_bad && prefix)
+			*t++ = prefix;
+		*t++ = *s++;
+		if (is_bad && postfix)
+			*t++ = postfix;
+	}
+	*t = 0;
+
+	return escaped;
+}
+
+/* escape with backslash the string @str. */
+char*
+escape_str (const char *str,
+	    const char *meta_chars)
+{
+	return escape_str_common (str, meta_chars, '\\', 0);
+}
+
+static const char *
+g_utf8_strstr (const char *haystack, const char *needle)
+{
+	const char *s;
+	gsize       i;
+	gsize       haystack_len = g_utf8_strlen (haystack, -1);
+	gsize       needle_len = g_utf8_strlen (needle, -1);
+	int         needle_size = strlen (needle);
+
+	s = haystack;
+	for (i = 0; i <= haystack_len - needle_len; i++) {
+		if (strncmp (s, needle, needle_size) == 0)
+			return s;
+		s = g_utf8_next_char(s);
+	}
+
+	return NULL;
+}
+
+static char**
+g_utf8_strsplit (const char *string,
+		 const char *delimiter,
+		 int         max_tokens)
+{
+	GSList      *string_list = NULL, *slist;
+	char       **str_array;
+	const char  *s;
+	guint        n = 0;
+	const char  *remainder;
+
+	g_return_val_if_fail (string != NULL, NULL);
+	g_return_val_if_fail (delimiter != NULL, NULL);
+	g_return_val_if_fail (delimiter[0] != '\0', NULL);
+
+	if (max_tokens < 1)
+		max_tokens = G_MAXINT;
+
+	remainder = string;
+	s = g_utf8_strstr (remainder, delimiter);
+	if (s != NULL) {
+		gsize delimiter_size = strlen (delimiter);
+
+		while (--max_tokens && (s != NULL)) {
+			gsize  size = s - remainder;
+			char  *new_string;
+
+			new_string = g_new (char, size + 1);
+			strncpy (new_string, remainder, size);
+			new_string[size] = 0;
+
+			string_list = g_slist_prepend (string_list, new_string);
+			n++;
+			remainder = s + delimiter_size;
+			s = g_utf8_strstr (remainder, delimiter);
+		}
+	}
+	if (*string) {
+		n++;
+		string_list = g_slist_prepend (string_list, g_strdup (remainder));
+	}
+
+	str_array = g_new (char*, n + 1);
+
+	str_array[n--] = NULL;
+	for (slist = string_list; slist; slist = slist->next)
+		str_array[n--] = slist->data;
+
+	g_slist_free (string_list);
+
+	return str_array;
+}
+
+static char*
+g_utf8_strchug (char *string)
+{
+	char     *scan;
+	gunichar  c;
+
+	g_return_val_if_fail (string != NULL, NULL);
+
+	scan = string;
+	c = g_utf8_get_char (scan);
+	while (g_unichar_isspace (c)) {
+		scan = g_utf8_next_char (scan);
+		c = g_utf8_get_char (scan);
+	}
+
+	memmove (string, scan, strlen (scan) + 1);
+
+	return string;
+}
+
+static char*
+g_utf8_strchomp (char *string)
+{
+	char   *scan;
+	gsize   len;
+
+	g_return_val_if_fail (string != NULL, NULL);
+
+	len = g_utf8_strlen (string, -1);
+
+	if (len == 0)
+		return string;
+
+	scan = g_utf8_offset_to_pointer (string, len - 1);
+
+	while (len--) {
+		gunichar c = g_utf8_get_char (scan);
+		if (g_unichar_isspace (c))
+			*scan = '\0';
+		else
+			break;
+		scan = g_utf8_find_prev_char (string, scan);
+	}
+
+	return string;
+}
+
+#define g_utf8_strstrip(string)    g_utf8_strchomp (g_utf8_strchug (string))
+
+gboolean
+match_regexps (GRegex           **regexps,
+	       const char        *string,
+	       GRegexMatchFlags   match_options)
+{
+	gboolean matched;
+	int      i;
+
+	if ((regexps == NULL) || (regexps[0] == NULL))
+		return TRUE;
+
+	if (string == NULL)
+		return FALSE;
+
+	matched = FALSE;
+	for (i = 0; regexps[i] != NULL; i++)
+		if (g_regex_match (regexps[i], string, match_options, NULL)) {
+			matched = TRUE;
+			break;
+		}
+
+	return matched;
+}
+
+void
+free_regexps (GRegex **regexps)
+{
+	int i;
+
+	if (regexps == NULL)
+		return;
+
+	for (i = 0; regexps[i] != NULL; i++)
+		g_regex_unref (regexps[i]);
+	g_free (regexps);
+}
+
+char **
+search_util_get_patterns (const char *pattern_string)
+{
+	char **patterns;
+	int    i;
+
+	if (pattern_string == NULL)
+		return NULL;
+
+	patterns = g_utf8_strsplit (pattern_string, ";", MAX_PATTERNS);
+	for (i = 0; patterns[i] != NULL; i++) {
+		char *p1, *p2;
+
+		p1 = g_utf8_strstrip (patterns[i]);
+		p2 = str_substitute (p1, ".", "\\.");
+		patterns[i] = str_substitute (p2, "*", ".*");
+
+		g_free (p2);
+		g_free (p1);
+	}
+
+	return patterns;
+}
+
+GRegex **
+search_util_get_regexps (const char         *pattern_string,
+			 GRegexCompileFlags  compile_options)
+{
+	char   **patterns;
+	GRegex **regexps;
+	int      i;
+
+	patterns = search_util_get_patterns (pattern_string);
+	if (patterns == NULL)
+		return NULL;
+
+	regexps = g_new0 (GRegex*, g_strv_length (patterns) + 1);
+	for (i = 0; patterns[i] != NULL; i++)
+		regexps[i] = g_regex_new (patterns[i],
+					  G_REGEX_OPTIMIZE | compile_options,
+					  G_REGEX_MATCH_NOTEMPTY,
+					  NULL);
+	g_strfreev (patterns);
+
+	return regexps;
+}
+
+const char *
+eat_spaces (const char *line)
+{
+	if (line == NULL)
+		return NULL;
+	while (*line == ' ')
+		line++;
+	return line;
+}
+
+char **
+split_line (const char *line,
+	    int         n_fields)
+{
+	char       **fields;
+	const char  *scan, *field_end;
+	int          i;
+
+	fields = g_new0 (char *, n_fields + 1);
+	fields[n_fields] = NULL;
+
+	scan = eat_spaces (line);
+	for (i = 0; i < n_fields; i++) {
+		if (scan == NULL) {
+			fields[i] = NULL;
+			continue;
+		}
+		field_end = strchr (scan, ' ');
+		if (field_end != NULL) {
+			fields[i] = g_strndup (scan, field_end - scan);
+			scan = eat_spaces (field_end);
+		}
+		else if (scan != NULL && i == n_fields - 1)<--- Condition 'scan!=NULL' is always true
+		{
+			fields[i] = g_strdup (scan);
+		}
+	}
+
+	return fields;
+}
+
+const char *
+get_last_field (const char *line,
+		int         last_field)
+{
+	const char *field;
+	int         i;
+
+	if (line == NULL)
+		return NULL;
+
+	last_field--;
+	field = eat_spaces (line);
+	for (i = 0; i < last_field; i++) {
+		if (field == NULL)
+			return NULL;
+		field = strchr (field, ' ');
+		field = eat_spaces (field);
+	}
+
+	return field;
+}
+
+void
+debug (const char *file,
+       int         line,
+       const char *function,
+       const char *format, ...)
+{
+#ifdef MATE_ENABLE_DEBUG
+	va_list  args;
+	char    *str;
+
+	g_return_if_fail (format != NULL);
+
+	va_start (args, format);
+	str = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	g_fprintf (stderr, "[FR] %s:%d (%s):\n\t%s\n", file, line, function, str);
+
+	g_free (str);
+#else /* ! DEBUG */
+#endif
+}
+
+GHashTable *static_strings = NULL;
+
+const char *
+get_static_string (const char *s)
+{
+        const char *result;
+
+        if (s == NULL)
+                return NULL;
+
+        if (static_strings == NULL)
+                static_strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+        if (! g_hash_table_lookup_extended (static_strings, s, (gpointer*) &result, NULL)) {
+                result = g_strdup (s);
+                g_hash_table_insert (static_strings,
+                                     (gpointer) result,
+                                     GINT_TO_POINTER (1));
+        }
+
+        return result;
+}
+
+char*
+g_uri_display_basename (const char  *uri)
+{
+	char *e_name, *name;
+
+	e_name = g_filename_display_basename (uri);
+	name = g_uri_unescape_string (e_name, "");
+	g_free (e_name);
+
+	return name;
+}
+
+const gchar *
+_g_path_get_file_name (const gchar *file_name)
+{
+	register char   *base;
+	register gssize  last_char;
+
+	if (file_name == NULL)
+		return NULL;
+
+	if (file_name[0] == '\0')
+		return "";
+
+	last_char = strlen (file_name) - 1;
+
+	if (file_name [last_char] == G_DIR_SEPARATOR)
+		return "";
+
+	base = g_utf8_strrchr (file_name, -1, G_DIR_SEPARATOR);
+	if (! base)
+		return file_name;
+
+	return base + 1;
+}
+
+const char *
+_g_path_get_base_name (const char *path,
+		       const char *base_dir,
+		       gboolean    junk_paths)
+{
+	size_t      base_dir_len;
+	const char *base_path;
+
+	if (junk_paths)
+		return _g_path_get_file_name (path);
+
+	if (base_dir == NULL)
+		return (path[0] == '/') ? path + 1 : path;
+
+	base_dir_len = strlen (base_dir);
+	if (strlen (path) < base_dir_len)
+		return NULL;
+
+	base_path = path + base_dir_len;
+	if (path[0] != '/')
+		base_path -= 1;
+
+	return base_path;
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/104.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/104.html new file mode 100644 index 0000000..bc8dd6c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/104.html @@ -0,0 +1,1379 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "gtk-utils.h"
+
+GtkWidget*
+_gtk_message_dialog_new (GtkWindow        *parent,
+			 GtkDialogFlags    flags,
+			 const char       *icon_name,
+			 const char       *message,
+			 const char       *secondary_message,
+			 const gchar      *first_button_text,
+			 ...)
+{
+	GtkWidget    *dialog;
+	GtkWidget    *label;
+	GtkWidget    *image;
+	GtkWidget    *hbox;
+	GtkWidget    *content_area;
+	va_list       args;
+	const gchar  *text;
+	int           response_id;
+	char         *markup_text;
+
+	g_return_val_if_fail ((message != NULL) || (secondary_message != NULL), NULL);
+
+	if (icon_name == NULL)
+		icon_name = "dialog-information";
+
+	dialog = gtk_dialog_new_with_buttons ("", parent, flags, NULL, NULL);
+	content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	/* Add label and image */
+
+	image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
+	gtk_widget_set_valign (image, GTK_ALIGN_START);
+
+	label = gtk_label_new ("");
+
+	if (message != NULL) {
+		char *escaped_message;
+
+		escaped_message = g_markup_escape_text (message, -1);
+		if (secondary_message != NULL) {
+			char *escaped_secondary_message = g_markup_escape_text (secondary_message, -1);
+			markup_text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
+						       escaped_message,
+						       escaped_secondary_message);
+			g_free (escaped_secondary_message);
+		}
+		else
+			markup_text = g_strdup (escaped_message);
+		g_free (escaped_message);
+	}
+	else
+		markup_text = g_markup_escape_text (secondary_message, -1);
+
+	gtk_label_set_markup (GTK_LABEL (label), markup_text);
+	g_free (markup_text);
+
+	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+
+	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 24);
+	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+
+	gtk_box_pack_start (GTK_BOX (hbox), image,
+			    FALSE, FALSE, 0);
+
+	gtk_box_pack_start (GTK_BOX (hbox), label,
+			    TRUE, TRUE, 0);
+
+	gtk_box_pack_start (GTK_BOX (content_area),
+			    hbox,
+			    FALSE, FALSE, 0);
+
+	gtk_widget_show_all (hbox);
+
+	/* Add buttons */
+
+	if (first_button_text == NULL)
+		return dialog;
+
+	va_start (args, first_button_text);
+
+	text = first_button_text;
+	response_id = va_arg (args, gint);
+
+	while (text != NULL) {
+		gtk_dialog_add_button (GTK_DIALOG (dialog), text, response_id);
+
+		text = va_arg (args, char*);
+		if (text == NULL)
+			break;
+		response_id = va_arg (args, int);
+	}
+
+	va_end (args);
+
+	return dialog;
+}
+
+static GtkWidget *
+create_button (const char *icon_name,
+	       const char *text)
+{
+	GtkIconTheme *icon_theme;
+	GtkWidget    *button;
+
+	button = gtk_button_new_with_mnemonic (text);
+	icon_theme = gtk_icon_theme_get_default ();
+	if (gtk_icon_theme_has_icon (icon_theme, icon_name)) {
+		GtkWidget *image;
+		image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+		gtk_button_set_image (GTK_BUTTON (button), image);
+	}
+	gtk_widget_set_can_default (button, TRUE);
+
+	gtk_widget_show (button);
+
+	return button;
+}
+
+char *
+_gtk_request_dialog_run (GtkWindow        *parent,
+			 GtkDialogFlags    flags,
+			 const char       *title,
+			 const char       *message,
+			 const char       *default_value,
+			 int               max_length,
+			 const gchar      *no_button_text,
+			 const gchar      *yes_button_text)
+{
+	GtkWidget    *dialog;
+	GtkWidget    *label;
+	GtkWidget    *image;
+	GtkWidget    *hbox;
+	GtkWidget    *vbox;
+	GtkWidget    *entry;
+	GtkWidget    *button;
+	GtkWidget    *content_area;
+	char         *result;
+
+	dialog = gtk_dialog_new_with_buttons (title, parent, flags, NULL, NULL);
+	content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	/* Add label and image */
+
+	image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG);
+	gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+	gtk_widget_set_valign (image, GTK_ALIGN_START);
+
+	label = gtk_label_new_with_mnemonic (message);
+	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_label_set_selectable (GTK_LABEL (label), FALSE);
+	gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+	gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+
+	entry = gtk_entry_new ();
+	gtk_entry_set_width_chars (GTK_ENTRY (entry), 50);
+	gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
+	gtk_entry_set_max_length (GTK_ENTRY (entry), max_length);
+	gtk_entry_set_text (GTK_ENTRY (entry), default_value);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
+
+	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
+	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+
+	gtk_box_set_spacing (GTK_BOX (content_area), 14); /* 14 + 2 * 5 = 24 */
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+	gtk_box_set_spacing (GTK_BOX (vbox), 6);
+
+	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
+
+	gtk_widget_show_all (hbox);
+
+	/* Add buttons */
+
+	button = create_button ("process-stop", no_button_text);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+				      button,
+				      GTK_RESPONSE_CANCEL);
+
+	button = create_button ("gtk-ok", yes_button_text);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+				      button,
+				      GTK_RESPONSE_YES);
+
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+
+	/* Run dialog */
+
+	gtk_widget_grab_focus (entry);
+
+	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
+		result = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+	else
+		result = NULL;
+
+	gtk_widget_destroy (dialog);
+
+	return result;
+}
+
+GtkWidget*
+_gtk_error_dialog_new (GtkWindow        *parent,
+		       GtkDialogFlags    flags,
+		       GList            *row_output,
+		       const char       *primary_text,
+		       const char       *secondary_text,
+		       ...)
+{
+	GtkWidget     *dialog;
+	GtkWidget     *label;
+	GtkWidget     *image;
+	GtkWidget     *hbox;
+	GtkWidget     *vbox;
+	GtkWidget     *text_view;
+	GtkWidget     *scrolled = NULL;
+	GtkWidget     *expander;
+	GtkWidget     *content_area;
+	GtkWidget     *action_area;
+	GtkTextIter    iter;
+	GList         *scan;
+	char          *escaped_message, *markup_text;
+	gboolean       view_output = (row_output != NULL);
+
+	dialog = gtk_dialog_new_with_buttons ("",
+					      parent,
+					      flags,
+					      "gtk-ok", GTK_RESPONSE_OK,
+					      NULL);
+	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+	content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+
+	/* Add label and image */
+
+	image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_DIALOG);
+	gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+	gtk_widget_set_valign (image, GTK_ALIGN_START);
+
+	label = gtk_label_new ("");
+	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+	gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+	gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+
+	escaped_message = g_markup_escape_text (primary_text, -1);
+	if (secondary_text != NULL) {
+		va_list args;
+		char *secondary_message;
+		char *escaped_secondary_message;
+
+		va_start (args, secondary_text);
+		secondary_message = g_strdup_vprintf (secondary_text, args);
+		va_end (args);
+		escaped_secondary_message = g_markup_escape_text (secondary_message, -1);
+
+		markup_text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
+					       escaped_message,
+					       escaped_secondary_message);
+
+		g_free (escaped_secondary_message);
+		g_free (secondary_message);
+	}
+	else
+		markup_text = g_strdup (escaped_message);
+	gtk_label_set_markup (GTK_LABEL (label), markup_text);
+	g_free (markup_text);
+	g_free (escaped_message);
+
+	if (view_output) {
+		GtkTextBuffer *text_buf;
+
+		gtk_widget_set_size_request (dialog, 500, -1);
+
+		/* Expander */
+
+		expander = gtk_expander_new_with_mnemonic (_("Command _Line Output"));
+		gtk_expander_set_expanded (GTK_EXPANDER (expander), secondary_text == NULL);
+
+		/* Add text */
+
+		scrolled = gtk_scrolled_window_new (NULL, NULL);
+		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+						GTK_POLICY_AUTOMATIC,
+						GTK_POLICY_AUTOMATIC);
+		gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
+						     GTK_SHADOW_ETCHED_IN);
+		gtk_widget_set_size_request (scrolled, -1, 200);
+
+		text_buf = gtk_text_buffer_new (NULL);
+		gtk_text_buffer_create_tag (text_buf, "monospace",
+					    "family", "monospace", NULL);
+		gtk_text_buffer_get_iter_at_offset (text_buf, &iter, 0);
+		for (scan = row_output; scan; scan = scan->next) {
+			char *line = scan->data;
+			char *utf8_line;
+			gsize bytes_written;
+
+			utf8_line = g_locale_to_utf8 (line, -1, NULL, &bytes_written, NULL);
+			gtk_text_buffer_insert_with_tags_by_name (text_buf,
+								  &iter,
+								  utf8_line,
+								  bytes_written,
+								  "monospace", NULL);
+			g_free (utf8_line);
+
+			gtk_text_buffer_insert (text_buf, &iter, "\n", 1);
+		}
+		text_view = gtk_text_view_new_with_buffer (text_buf);
+		g_object_unref (text_buf);
+		gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
+		gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
+	}
+
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+
+	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+
+	if (view_output) {
+		gtk_container_add (GTK_CONTAINER (scrolled), text_view);
+		gtk_container_add (GTK_CONTAINER (expander), scrolled);
+		gtk_box_pack_start (GTK_BOX (vbox), expander, TRUE, TRUE, 0);
+	}
+
+	gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 0);
+
+	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+	gtk_box_set_spacing (GTK_BOX (content_area), 14); /* 14 + 2 * 5 = 24 */
+	gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+	gtk_box_set_spacing (GTK_BOX (action_area), 6);
+
+	gtk_widget_show_all (vbox);
+
+	return dialog;
+}
+
+void
+_gtk_error_dialog_run (GtkWindow        *parent,
+		       const gchar      *main_message,
+		       const gchar      *format,
+		       ...)
+{
+	GtkWidget *d;
+	char      *message;
+	va_list    args;
+
+	va_start (args, format);
+	message = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	d =  _gtk_message_dialog_new (parent,
+				      GTK_DIALOG_MODAL,
+				      "dialog-error",
+				      main_message,
+				      message,
+				      "gtk-close", GTK_RESPONSE_CANCEL,
+				      NULL);
+	g_free (message);
+
+	g_signal_connect (G_OBJECT (d), "response",
+			  G_CALLBACK (gtk_widget_destroy),
+			  NULL);
+
+	gtk_widget_show (d);
+}
+
+void
+_gtk_entry_set_locale_text (GtkEntry   *entry,
+			    const char *text)
+{
+	char *utf8_text;
+
+	if (text == NULL)
+		return;
+
+	utf8_text = g_locale_to_utf8 (text, -1, NULL, NULL, NULL);
+	if (utf8_text != NULL)
+		gtk_entry_set_text (entry, utf8_text);
+	else
+		gtk_entry_set_text (entry, "");
+	g_free (utf8_text);
+}
+
+char *
+_gtk_entry_get_locale_text (GtkEntry *entry)
+{
+	const char *utf8_text;
+	char       *text;
+
+	utf8_text = gtk_entry_get_text (entry);
+	if (utf8_text == NULL)
+		return NULL;
+
+	text = g_locale_from_utf8 (utf8_text, -1, NULL, NULL, NULL);
+
+	return text;
+}
+
+void
+_gtk_entry_set_filename_text (GtkEntry   *entry,
+			      const char *text)
+{
+	char *utf8_text;
+
+	utf8_text = g_filename_to_utf8 (text, -1, NULL, NULL, NULL);
+	if (utf8_text != NULL) {
+		gtk_entry_set_text (entry, utf8_text);
+		g_free (utf8_text);
+	} else
+		gtk_entry_set_text (entry, "");
+}
+
+static GdkPixbuf *
+get_themed_icon_pixbuf (GThemedIcon  *icon,
+		        int           size,
+		        GtkIconTheme *icon_theme)
+{
+	char        **icon_names;
+	GtkIconInfo  *icon_info;
+	GdkPixbuf    *pixbuf;
+	GError       *error = NULL;
+
+	g_object_get (icon, "names", &icon_names, NULL);
+
+	icon_info = gtk_icon_theme_choose_icon (icon_theme, (const char **)icon_names, size, 0);
+	if (icon_info == NULL)
+		icon_info = gtk_icon_theme_lookup_icon (icon_theme, "text-x-generic", size, GTK_ICON_LOOKUP_USE_BUILTIN);
+
+	pixbuf = gtk_icon_info_load_icon (icon_info, &error);
+	if (pixbuf == NULL) {
+		g_warning ("could not load icon pixbuf: %s\n", error->message);
+		g_clear_error (&error);
+	}
+
+	g_object_unref (icon_info);
+	g_strfreev (icon_names);
+
+	return pixbuf;
+}
+
+static GdkPixbuf *
+get_file_icon_pixbuf (GFileIcon *icon,
+		      int        size)
+{
+	GFile     *file;
+	char      *filename;
+	GdkPixbuf *pixbuf;
+
+	file = g_file_icon_get_file (icon);
+	filename = g_file_get_path (file);
+	pixbuf = gdk_pixbuf_new_from_file_at_size (filename, size, -1, NULL);
+	g_free (filename);
+	g_object_unref (file);
+
+	return pixbuf;
+}
+
+GdkPixbuf *
+get_icon_pixbuf (GIcon        *icon,
+		 int           size,
+		 GtkIconTheme *theme)
+{
+	if (icon == NULL)
+		return NULL;
+	if (G_IS_THEMED_ICON (icon))
+		return get_themed_icon_pixbuf (G_THEMED_ICON (icon), size, theme);
+	if (G_IS_FILE_ICON (icon))
+		return get_file_icon_pixbuf (G_FILE_ICON (icon), size);
+	return NULL;
+}
+
+GdkPixbuf *
+get_mime_type_pixbuf (const char   *mime_type,
+		      int           icon_size,
+		      GtkIconTheme *icon_theme)
+{
+	GdkPixbuf *pixbuf = NULL;
+	GIcon     *icon;
+
+	if (icon_theme == NULL)
+		icon_theme = gtk_icon_theme_get_default ();
+
+	icon = g_content_type_get_icon (mime_type);
+	pixbuf = get_icon_pixbuf (icon, icon_size, icon_theme);
+	g_object_unref (icon);
+
+	return pixbuf;
+}
+
+void
+show_help_dialog (GtkWindow  *parent,
+		  const char *section)
+{
+	char   *uri;
+	GError *error = NULL;
+
+	uri = g_strconcat ("help:engrampa", section ? "/" : NULL, section, NULL);
+	if (! gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, &error)) {
+		GtkWidget *dialog;
+
+		dialog = _gtk_message_dialog_new (parent,
+						  GTK_DIALOG_DESTROY_WITH_PARENT,
+						  "dialog-error",
+						  _("Could not display help"),
+						  error->message,
+						  "gtk-ok", GTK_RESPONSE_OK,
+						  NULL);
+		gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+		g_signal_connect (G_OBJECT (dialog), "response",
+				  G_CALLBACK (gtk_widget_destroy),
+				  NULL);
+
+		gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+		gtk_widget_show (dialog);
+
+		g_clear_error (&error);
+	}
+	g_free (uri);
+}
+
+int
+_gtk_widget_lookup_for_size (GtkWidget *widget,
+                             GtkIconSize icon_size)
+{
+	int w, h;
+	gtk_icon_size_lookup (icon_size,
+			      &w, &h);
+	return MAX (w, h);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/105.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/105.html new file mode 100644 index 0000000..7b3ef89 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/105.html @@ -0,0 +1,1119 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "java-utils.h"
+
+/*
+ * The following code conforms to the JVM specification.(Java 2 Platform)
+ * For further changes to the classfile structure, please update the
+ * following macros.
+ */
+
+/* Tags that identify structures */
+
+#define CONST_CLASS				 7
+#define CONST_FIELDREF				 9
+#define CONST_METHODREF				10
+#define CONST_INTERFACEMETHODREF		11
+#define CONST_STRING				 8
+#define CONST_INTEGER				 3
+#define CONST_FLOAT				 4
+#define CONST_LONG				 5
+#define CONST_DOUBLE				 6
+#define CONST_NAMEANDTYPE			12
+#define CONST_UTF8				 1
+
+/* Sizes of structures */
+
+#define CONST_FIELDREF_INFO			 4
+#define CONST_METHODREF_INFO	 		 4
+#define CONST_INTERFACEMETHODREF_INFO		 4
+#define CONST_STRING_INFO			 2
+#define CONST_INTEGER_INFO			 4
+#define CONST_FLOAT_INFO			 4
+#define CONST_LONG_INFO				 8
+#define CONST_DOUBLE_INFO			 8
+#define CONST_NAMEANDTYPE_INFO			 4
+
+/* represents the utf8 strings in class file */
+struct utf_string
+{
+	guint16  index;
+	guint16  length;
+	char    *str;
+};
+
+/* structure that holds class information in a class file */
+struct class_info
+{
+	guint16 index;
+	guint16 name_index; /* index into the utf_strings */
+};
+
+typedef struct {
+	int     fd;
+
+	guint32 magic_no;		/* 0xCAFEBABE (JVM Specification) :) */
+
+	guint16 major;			/* versions */
+	guint16 minor;
+
+	guint16 const_pool_count;
+	GSList *const_pool_class;	/* (const_pool_count - 1) elements of tye 'CONST_class_info' */
+	GSList *const_pool_utf;		/* (const_pool_count - 1) elements of type 'utf_strings' */
+
+	guint16 access_flags;
+	guint16 this_class;		/* the index of the class the file is named after. */
+
+#if 0 /* not needed */
+	guint16         super_class;
+	guint16         interfaces_count;
+	guint16        *interfaces;
+	guint16         fields_count;
+	field_info     *fields;
+	guint16         methods_count;
+	method_info    *methods;
+	guint16         attributes_count;
+	attribute_info *attributes;
+#endif
+} JavaClassFile;
+
+static JavaClassFile*
+java_class_file_new (void)
+{
+	JavaClassFile *cfile;
+
+	cfile = g_new0 (JavaClassFile, 1);
+	cfile->fd = -1;
+
+	return cfile;
+}
+
+static void
+java_class_file_free (JavaClassFile *cfile)
+{
+	GSList *scan;
+
+	if (cfile->const_pool_class != NULL)
+		g_slist_free_full (cfile->const_pool_class, g_free);
+
+	for (scan = cfile->const_pool_utf; scan ; scan = scan->next) {
+		struct utf_string *string = scan->data;
+		g_free (string->str);
+	}
+
+	if (cfile->const_pool_utf != NULL)
+		g_slist_free_full (cfile->const_pool_utf, g_free);
+
+	if (cfile->fd != -1)
+		close (cfile->fd);
+
+	g_free (cfile);
+}
+
+/* The following function loads the utf8 strings and class structures from the
+ * class file. */
+static void
+load_constant_pool_utfs (JavaClassFile *cfile)
+{
+	guint8  tag;
+	guint16 i = 0;		/* should be comparable with const_pool_count */
+
+	while ((i < cfile->const_pool_count - 1) && (read (cfile->fd, &tag, 1) != -1)) {
+		struct utf_string *txt = NULL;
+		struct class_info *class = NULL;
+
+		switch (tag) {
+		case CONST_CLASS:
+			class = g_new0 (struct class_info, 1);
+			class->index = i + 1;
+			if (read (cfile->fd, &class->name_index, 2) != 2) {
+				g_free (class);
+				return;	/* error reading */
+			}
+			class->name_index = GUINT16_FROM_BE (class->name_index);
+			cfile->const_pool_class = g_slist_append (cfile->const_pool_class, class);
+			break;
+
+		case CONST_FIELDREF:
+			lseek (cfile->fd, CONST_FIELDREF_INFO, SEEK_CUR);
+			break;
+
+		case CONST_METHODREF:
+			lseek (cfile->fd, CONST_METHODREF_INFO, SEEK_CUR);
+			break;
+
+		case CONST_INTERFACEMETHODREF:
+			lseek (cfile->fd, CONST_INTERFACEMETHODREF_INFO, SEEK_CUR);
+			break;
+
+		case CONST_STRING:
+			lseek (cfile->fd, CONST_STRING_INFO, SEEK_CUR);
+			break;
+
+		case CONST_INTEGER:
+			lseek (cfile->fd, CONST_INTEGER_INFO, SEEK_CUR);
+			break;
+
+		case CONST_FLOAT:
+			lseek (cfile->fd, CONST_FLOAT_INFO, SEEK_CUR);
+			break;
+
+		case CONST_LONG:
+			lseek (cfile->fd, CONST_LONG_INFO, SEEK_CUR);
+			break;
+
+		case CONST_DOUBLE:
+			lseek (cfile->fd, CONST_DOUBLE_INFO, SEEK_CUR);
+			break;
+
+		case CONST_NAMEANDTYPE:
+			lseek (cfile->fd, CONST_NAMEANDTYPE_INFO, SEEK_CUR);
+			break;
+
+		case CONST_UTF8:
+			txt = g_new0 (struct utf_string, 1);
+			txt->index = i + 1;
+			if (read (cfile->fd, &(txt->length), 2) == -1) {
+				g_free (txt);
+				return;	/* error while reading */
+			}
+			txt->length = GUINT16_FROM_BE (txt->length);
+			txt->str = g_new0 (char, txt->length);
+			if (read (cfile->fd, txt->str, txt->length) == -1) {
+				g_free (txt);
+				return;	/* error while reading */
+			}
+			cfile->const_pool_utf = g_slist_append (cfile->const_pool_utf, txt);
+			break;
+
+		default:
+			return;	/* error - unknown tag in class file */
+			break;
+		}
+		i++;
+	}
+
+#ifdef MATE_ENABLE_DEBUG
+	g_print( "Number of Entries: %d\n", i );
+#endif
+}
+
+static char*
+close_and_exit (JavaClassFile *cfile)
+{
+	java_class_file_free (cfile);
+	return NULL;
+}
+
+/* This function extracts the package name from a class file */
+char*
+get_package_name_from_class_file (char *fname)
+{
+	char          *package = NULL;
+	JavaClassFile *cfile;
+	guint16        length = 0, end = 0, utf_index = 0;
+	guint32        magic;
+	guint16        major, minor, count;
+	guint          i = 0;
+
+	if (! g_file_test (fname, G_FILE_TEST_EXISTS))
+		return NULL;
+
+	cfile = java_class_file_new ();
+	cfile->fd = open (fname, O_RDONLY);
+	if (cfile->fd == -1)
+		return close_and_exit (cfile);
+
+	if ((i = read (cfile->fd, &magic, 4)) != 4)
+		return close_and_exit (cfile);
+	cfile->magic_no = GUINT32_FROM_BE (magic);
+
+	if (read (cfile->fd, &major, 2 ) != 2)
+		return close_and_exit (cfile);
+	cfile->major = GUINT16_FROM_BE (major);
+
+	if (read (cfile->fd, &minor, 2) != 2)
+		return close_and_exit (cfile);
+	cfile->minor = GUINT16_FROM_BE (minor);
+
+	if (read (cfile->fd, &count, 2) != 2)
+		return close_and_exit (cfile);
+	cfile->const_pool_count = GUINT16_FROM_BE(count);
+	load_constant_pool_utfs (cfile);
+
+	if (read (cfile->fd, &cfile->access_flags, 2) != 2)
+		return close_and_exit (cfile);
+	cfile->access_flags = GUINT16_FROM_BE (cfile->access_flags);
+
+	if (read (cfile->fd, &cfile->this_class, 2) != 2)
+		return close_and_exit (cfile);
+	cfile->this_class = GUINT16_FROM_BE(cfile->this_class);
+
+	/* now search for the class structure with index = cfile->this_class */
+
+	for (i = 0; (i < g_slist_length (cfile->const_pool_class)) && (utf_index == 0); i++ ) {
+		struct class_info *class = g_slist_nth_data (cfile->const_pool_class, i);<--- Variable 'class' can be declared as pointer to const
+		if (class->index == cfile->this_class)
+			utf_index = class->name_index; /* terminates loop */
+	}
+
+	/* now search for the utf8 string with index = utf_index */
+
+	for (i = 0; i < g_slist_length (cfile->const_pool_utf); i++) {
+		struct utf_string *data = g_slist_nth_data (cfile->const_pool_utf, i);
+		if (data->index == utf_index) {
+			package = g_strndup (data->str, data->length);
+			length = data->length;
+			break;
+		}
+	}
+
+	if (package != NULL) {
+		int j;
+		for (j = (int) length; (j >= 0) && (end == 0); j--)
+			if (package[j] == '/')
+				end = (guint16) j;
+		char *package_padded = g_strndup (package, end);
+		g_free(package);
+		package = package_padded;
+	}
+
+	java_class_file_free (cfile);
+
+	return package;
+}
+
+/* This function consumes a comment from the java file
+ * multiline = TRUE implies that comment is multiline */
+static void
+consume_comment (int      fdesc,
+		 gboolean multiline)
+{
+	gboolean escaped = FALSE;
+	gboolean star = FALSE;
+	char     ch;
+
+	while (read (fdesc, &ch, 1) == 1) {
+		switch (ch) {
+		case '/':
+			if (escaped)
+				break;
+			else if (star)
+				return;
+			break;
+
+		case '\n':
+			if (! multiline)
+				return;
+			break;
+
+		case '*':
+			escaped = FALSE;
+			star = TRUE;
+			break;
+
+		case '\\':
+			escaped = ! escaped;
+			break;
+
+		default:
+			escaped = FALSE;
+			star = FALSE;
+			break;
+		}
+	}
+}
+
+/* This function extracts package name from a java file */
+char*
+get_package_name_from_java_file (char *fname)
+{
+	char          *package = NULL;
+	JavaClassFile *cfile;
+	gboolean       prev_char_is_bslash = FALSE;
+	gboolean       valid_char_found = FALSE;
+	char           ch;
+
+	if (! g_file_test (fname, G_FILE_TEST_EXISTS))
+		return NULL;
+
+	cfile = java_class_file_new ();
+	cfile->fd = open (fname, O_RDONLY);
+	if (cfile->fd == -1)
+		return close_and_exit (cfile);
+
+	while (! valid_char_found && (read (cfile->fd, &ch, 1) == 1)) {
+		switch (ch) {
+		case '/':
+			if (prev_char_is_bslash == TRUE) {
+				consume_comment (cfile->fd, FALSE);
+				prev_char_is_bslash = FALSE;
+			}
+			else
+				prev_char_is_bslash = TRUE;
+			break;
+
+		case '*':
+			if (prev_char_is_bslash == TRUE)
+				consume_comment (cfile->fd, TRUE);
+			prev_char_is_bslash = FALSE;
+			break;
+
+		case ' ':
+		case '\t':
+		case '\r':
+		case '\n':
+			prev_char_is_bslash = FALSE;
+			break;
+
+		default:
+			prev_char_is_bslash = FALSE;
+			valid_char_found = TRUE;
+			break;
+		}
+	}
+
+	if (ch == 'p')	{
+		char first_valid_word[8] = "";
+
+		first_valid_word[0] = 'p';
+		if (read (cfile->fd, &first_valid_word[1], 6) != 6)
+			return close_and_exit (cfile);
+
+		first_valid_word[7] = 0;
+		if (g_ascii_strcasecmp (first_valid_word, "package") == 0) {
+			char buffer[500];
+			int  index = 0;
+
+			while (read (cfile->fd, &ch, 1) == 1) {
+				if ((ch != ' ') && (ch != '\t'))
+					break;
+			}
+			do {
+				if (ch == ';')
+					break;
+				if (ch == '.') {
+					buffer[index++] = '/';
+				} else if (isalnum (ch) != 0) {
+					buffer[index++] = ch;
+				} else if ((ch == '_') || (ch == '$')) {
+					buffer[index++] = ch;
+				} else {
+					index = 0;
+					break;
+				}
+			} while (read (cfile->fd, &ch, 1) == 1);
+			buffer[index] = 0;
+			package = g_strdup (buffer);
+		}
+	}
+
+	java_class_file_free (cfile);
+
+	return package;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/106.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/106.html new file mode 100644 index 0000000..f0a3db9 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/106.html @@ -0,0 +1,953 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <signal.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggsmclient.h"<--- Include file: "eggsmclient.h" not found.
+
+#include "fr-init.h"
+
+static char **remaining_args;
+static char  *add_to = NULL;
+static int    add;
+static char  *extract_to = NULL;
+static int    extract;
+static int    extract_here;
+static char  *default_url = NULL;
+
+static void
+_print_version_and_exit (const gchar *option_name, const gchar *value, gpointer data, GError *error)
+{
+	g_print("%s %s\n", _("Engrampa Archive Manager"), VERSION);
+	exit (EXIT_SUCCESS);
+}
+
+/* argv[0] from main(); used as the command to restart the program */
+static const char *program_argv0 = NULL;
+
+static const GOptionEntry options[] = {
+	{ "add-to", 'a', 0, G_OPTION_ARG_STRING, &add_to,
+	  N_("Add files to the specified archive and quit the program"),
+	  N_("ARCHIVE") },
+
+	{ "add", 'd', 0, G_OPTION_ARG_NONE, &add,
+	  N_("Add files asking the name of the archive and quit the program"),
+	  NULL },
+
+	{ "extract-to", 'e', 0, G_OPTION_ARG_STRING, &extract_to,
+	  N_("Extract archives to the specified folder and quit the program"),
+	  N_("FOLDER") },
+
+	{ "extract", 'f', 0, G_OPTION_ARG_NONE, &extract,
+	  N_("Extract archives asking the destination folder and quit the program"),
+	  NULL },
+
+	{ "extract-here", 'h', 0, G_OPTION_ARG_NONE, &extract_here,
+	  N_("Extract the contents of the archives in the archive folder and quit the program"),
+	  NULL },
+
+	{ "default-dir", '\0', 0, G_OPTION_ARG_STRING, &default_url,
+	  N_("Default folder to use for the '--add' and '--extract' commands"),
+	  N_("FOLDER") },
+
+	{ "force", '\0', 0, G_OPTION_ARG_NONE, &ForceDirectoryCreation,
+	  N_("Create destination folder without asking confirmation"),
+	  NULL },
+
+	{ "version", 0, G_OPTION_FLAG_NO_ARG,
+	  G_OPTION_ARG_CALLBACK, _print_version_and_exit,
+	  N_("Show the application's version"),
+	  NULL },
+
+	{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args,
+	  NULL,
+	  NULL },
+
+	{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
+};
+
+static void
+fr_restore_session (EggSMClient *client)
+{
+	GKeyFile *state = NULL;
+	guint i;
+
+	state = egg_sm_client_get_state_file (client);
+
+	i = g_key_file_get_integer (state, "Session", "archives", NULL);
+
+	for (; i > 0; i--) {
+		GtkWidget *window;
+		gchar *key, *archive;
+
+		key = g_strdup_printf ("archive%d", i);
+		archive = g_key_file_get_string (state, "Session", key, NULL);
+		g_free (key);
+
+		window = fr_window_new ();
+		gtk_widget_show (window);
+		if (strlen (archive))
+			fr_window_archive_open (FR_WINDOW (window), archive, GTK_WINDOW (window));
+
+		g_free (archive);
+	}
+}
+
+static char *
+get_uri_from_command_line (const char *path)
+{
+	GFile *file;
+	char  *uri;
+
+	file = g_file_new_for_commandline_arg (path);
+	uri = g_file_get_uri (file);
+	g_object_unref (file);
+
+	return uri;
+}
+
+static void
+prepare_app (void)
+{
+	char        *extract_to_uri = NULL;
+	char        *add_to_uri = NULL;
+	EggSMClient *client = NULL;
+
+	client = egg_sm_client_get ();
+	if (egg_sm_client_is_resumed (client)) {
+		fr_restore_session (client);
+		return;
+	}
+
+	/**/
+
+	if (remaining_args == NULL) { /* No archive specified. */
+		fr_window_new ();
+		return;
+	}
+
+	if (extract_to != NULL)
+		extract_to_uri = get_uri_from_command_line (extract_to);
+
+	if (add_to != NULL)
+		add_to_uri = get_uri_from_command_line (add_to);
+
+	if ((add_to != NULL) || (add == 1)) { /* Add files to an archive */
+		GtkWidget   *window;
+		GList       *file_list = NULL;
+		const char  *filename;
+		int          i = 0;
+
+		window = fr_window_new ();
+		if (default_url != NULL)
+			fr_window_set_default_dir (FR_WINDOW (window), default_url, TRUE);
+
+		while ((filename = remaining_args[i++]) != NULL)
+			file_list = g_list_prepend (file_list, get_uri_from_command_line (filename));
+		file_list = g_list_reverse (file_list);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Compress"));
+		fr_window_set_batch__add (FR_WINDOW (window), add_to_uri, file_list);
+		fr_window_append_batch_action (FR_WINDOW (window),
+					       FR_BATCH_ACTION_QUIT,
+					       NULL,
+					       NULL);
+		fr_window_start_batch (FR_WINDOW (window));
+	}
+	else if ((extract_to != NULL) || (extract == 1) || (extract_here == 1)) {
+
+		/* Extract all archives. */
+
+		GtkWidget  *window;
+		const char *archive;
+		int         i = 0;
+
+		window = fr_window_new ();
+		if (default_url != NULL)
+			fr_window_set_default_dir (FR_WINDOW (window), default_url, TRUE);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
+		while ((archive = remaining_args[i++]) != NULL) {
+			char *archive_uri;
+
+			archive_uri = get_uri_from_command_line (archive);
+			if (extract_here == 1)
+				fr_window_set_batch__extract_here (FR_WINDOW (window),
+								   archive_uri);
+			else
+				fr_window_set_batch__extract (FR_WINDOW (window),
+							      archive_uri,
+							      extract_to_uri);
+			g_free (archive_uri);
+		}
+		fr_window_append_batch_action (FR_WINDOW (window),
+					       FR_BATCH_ACTION_QUIT,
+					       NULL,
+					       NULL);
+
+		fr_window_start_batch (FR_WINDOW (window));
+	}
+	else { /* Open each archive in a window */
+		const char *filename = NULL;
+
+		int i = 0;
+		while ((filename = remaining_args[i++]) != NULL) {
+			GtkWidget *window;
+			GFile     *file;
+			char      *uri;
+
+			window = fr_window_new ();
+
+			file = g_file_new_for_commandline_arg (filename);
+			uri = g_file_get_uri (file);
+			fr_window_archive_open (FR_WINDOW (window), uri, GTK_WINDOW (window));
+			g_free (uri);
+			g_object_unref (file);
+		}
+	}
+
+	g_free (add_to_uri);
+	g_free (extract_to_uri);
+}
+
+static void
+startup_cb (GApplication *application)
+{
+	initialize_data ();
+	prepare_app ();
+}
+
+static void
+activate_cb (GApplication *application)
+{
+	GList *link;
+
+	for (link = gtk_application_get_windows (GTK_APPLICATION (application));
+	     link != NULL;
+	     link = link->next)
+	{
+		if (! fr_window_is_batch_mode (FR_WINDOW (link->data)))
+			gtk_widget_show (GTK_WIDGET (link->data));
+	}
+}
+
+static void
+fr_save_state (EggSMClient *client, GKeyFile *state, gpointer user_data)
+{
+	/* discard command is automatically set by EggSMClient */
+
+	const char   *argv[2] = { NULL };
+	GApplication *application;
+	guint         i = 0;
+
+	/* restart command */
+	argv[0] = program_argv0;
+	argv[1] = NULL;
+
+	egg_sm_client_set_restart_command (client, 1, argv);
+
+	/* state */
+	application = g_application_get_default ();
+	if (application != NULL) {
+		GList *window;
+
+		for (window = gtk_application_get_windows (GTK_APPLICATION (application)), i = 0;
+		     window != NULL;
+		     window = window->next, i++)
+		{
+			FrWindow *session = window->data;
+			gchar *key;
+
+			key = g_strdup_printf ("archive%d", i+1);
+			if ((session->archive == NULL) || (session->archive->file == NULL)) {
+				g_key_file_set_string (state, "Session", key, "");
+			}
+			else {
+				gchar *uri;
+
+				uri = g_file_get_uri (session->archive->file);
+				g_key_file_set_string (state, "Session", key, uri);
+				g_free (uri);
+			}
+			g_free (key);
+		}
+	}
+
+	g_key_file_set_integer (state, "Session", "archives", i);
+}
+
+int
+main (int argc, char **argv)
+{
+	GOptionContext *context = NULL;
+	GError         *error = NULL;
+	GtkApplication *app = NULL;
+	EggSMClient    *client = NULL;
+	int             status;
+
+	program_argv0 = argv[0];
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new (N_("- Create and modify an archive"));
+#ifdef ENABLE_NLS
+	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	g_option_context_add_group (context, egg_sm_client_get_option_group ());
+
+	if (! g_option_context_parse (context, &argc, &argv, &error)) {
+		g_critical ("Failed to parse arguments: %s", error->message);
+		g_error_free (error);
+		g_option_context_free (context);
+		return EXIT_FAILURE;
+	}
+
+	g_option_context_free (context);
+
+	g_set_application_name (_("Engrampa"));
+	gtk_window_set_default_icon_name ("engrampa");
+
+	client = egg_sm_client_get ();
+	g_signal_connect (client, "save-state", G_CALLBACK (fr_save_state), NULL);
+
+	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+					   PKG_DATA_DIR G_DIR_SEPARATOR_S "icons");
+
+	app = gtk_application_new (NULL, G_APPLICATION_FLAGS_NONE);
+	g_signal_connect (app, "startup", G_CALLBACK (startup_cb), NULL);
+	g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
+
+	status = g_application_run (G_APPLICATION (app), argc, argv);
+
+	release_data ();
+
+	return status;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/107.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/107.html new file mode 100644 index 0000000..ac8c4bd --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/107.html @@ -0,0 +1,403 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001-2008 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "open-file.h"
+#include "file-utils.h"
+
+OpenFile*
+open_file_new (const char *path,
+	       const char *extracted_path,
+	       const char *temp_dir)
+{
+	OpenFile *ofile;
+
+	ofile = g_new0 (OpenFile, 1);
+	ofile->path = g_strdup (path);
+	ofile->extracted_uri = g_filename_to_uri (extracted_path, NULL, NULL);
+	if (! uri_exists (ofile->extracted_uri)) {
+		open_file_free (ofile);
+		return NULL;
+	}
+	ofile->temp_dir = g_strdup (temp_dir);
+	ofile->last_modified = get_file_mtime (ofile->extracted_uri);
+
+	return ofile;
+}
+
+void
+open_file_free (OpenFile *ofile)
+{
+	if (ofile == NULL)
+		return;
+	if (ofile->monitor != NULL)
+		g_object_unref (ofile->monitor);
+	g_free (ofile->path);
+	g_free (ofile->extracted_uri);
+	g_free (ofile->temp_dir);
+	g_free (ofile);
+}
+
+OpenFile *
+open_file_copy (OpenFile *src)
+{
+	OpenFile *ofile;
+
+	ofile = g_new0 (OpenFile, 1);
+	ofile->path = g_strdup (src->path);
+	ofile->extracted_uri = g_strdup (src->extracted_uri);
+	ofile->temp_dir = g_strdup (src->temp_dir);
+	ofile->last_modified = src->last_modified;
+
+	return ofile;
+}
+
+GType
+open_file_get_type (void)
+{
+	static GType type = 0;
+
+	if (type == 0)
+		type = g_boxed_type_register_static ("FROpenFile", (GBoxedCopyFunc) open_file_copy, (GBoxedFreeFunc) open_file_free);
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/108.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/108.html new file mode 100644 index 0000000..ac1e30c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/108.html @@ -0,0 +1,377 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "typedefs.h"
+#include "preferences.h"
+#include "fr-init.h"
+#include "file-utils.h"
+#include "fr-window.h"
+
+void
+pref_util_save_window_geometry (GtkWindow  *window,
+				const char *dialog_id)
+{
+	char *schema;
+	GSettings *settings;
+	int width;
+	int height;
+
+	schema = g_strconcat (ENGRAMPA_SCHEMA_DIALOGS, ".", dialog_id, NULL);
+	settings = g_settings_new (schema);
+
+	gtk_window_get_size (window, &width, &height);
+	g_settings_set_int (settings, "width", width);
+	g_settings_set_int (settings, "height", height);
+	g_object_unref (settings);
+	g_free (schema);
+}
+
+void
+pref_util_restore_window_geometry (GtkWindow  *window,
+				   const char *dialog_id)
+{
+	char *schema;
+	GSettings *settings;
+	int width;
+	int height;
+
+	schema = g_strconcat (ENGRAMPA_SCHEMA_DIALOGS, ".", dialog_id, NULL);
+	settings = g_settings_new (schema);
+
+	width = g_settings_get_int (settings, "width");
+	height = g_settings_get_int (settings, "height");
+	if ((width != -1) && (height != 1))
+		gtk_window_set_default_size (window, width, height);
+
+	gtk_window_present (window);
+
+	g_object_unref (settings);
+	g_free (schema);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/109.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/109.html new file mode 100644 index 0000000..4c42f13 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/109.html @@ -0,0 +1,503 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2011 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "fr-command.h"
+#include "gio-utils.h"
+#include "rar-utils.h"
+
+typedef enum {
+	FIRST_VOLUME_IS_000,
+	FIRST_VOLUME_IS_001,
+	FIRST_VOLUME_IS_RAR
+} FirstVolumeExtension;
+
+static char *
+get_first_volume_name (const char           *name,
+		       const char           *pattern,
+		       FirstVolumeExtension  extension_type)
+{
+	char   *volume_name = NULL;
+	GRegex *re;
+
+	re = g_regex_new (pattern, G_REGEX_CASELESS, 0, NULL);
+	if (g_regex_match (re, name, 0, NULL)) {
+		char **parts;
+		int    l, i;
+
+		parts = g_regex_split (re, name, 0);
+		l = strlen (parts[2]);
+		switch (extension_type) {
+		case FIRST_VOLUME_IS_000:
+			for (i = 0; i < l; i++)
+				parts[2][i] = '0';
+			break;
+
+		case FIRST_VOLUME_IS_001:
+			for (i = 0; i < l; i++)
+				parts[2][i] = (i < l - 1) ? '0' : '1';
+			break;
+
+		case FIRST_VOLUME_IS_RAR:
+			if (g_str_has_suffix (parts[1], "r")) {
+				parts[2][0] = 'a';
+				parts[2][1] = 'r';
+			}
+			else {
+				parts[2][0] = 'A';
+				parts[2][1] = 'R';
+			}
+			break;
+		}
+
+		volume_name = g_strjoinv ("", parts);
+
+		g_strfreev (parts);
+	}
+	g_regex_unref (re);
+
+	if (volume_name != NULL) {
+		char *tmp;
+
+		tmp = volume_name;
+		volume_name = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL);
+		g_free (tmp);
+	}
+
+	return volume_name;
+}
+
+void
+rar_check_multi_volume (FrCommand *comm)
+{
+	GFile *file;
+	char   buffer[11];
+
+	file = g_file_new_for_path (comm->filename);
+	if (! g_load_file_in_buffer (file, buffer, 11, NULL)) {
+		g_object_unref (file);
+		return;
+	}
+
+	if (memcmp (buffer, "Rar!", 4) != 0)
+		return;
+
+	if ((buffer[10] & 0x01) == 0x01) {
+		char   *volume_name = NULL;
+		char   *name;
+
+		name = g_filename_to_utf8 (file_name_from_path (comm->filename), -1, NULL, NULL, NULL);
+
+		volume_name = get_first_volume_name (name, "^(.*\\.part)([0-9]+)(\\.rar)$", FIRST_VOLUME_IS_001);
+		if (volume_name == NULL)
+			volume_name = get_first_volume_name (name, "^(.*\\.r)([0-9]+)$", FIRST_VOLUME_IS_RAR);
+		if (volume_name == NULL)
+			volume_name = get_first_volume_name (name, "^(.*\\.)([0-9]+)$", FIRST_VOLUME_IS_001);
+
+		if (volume_name != NULL) {
+			GFile *parent;
+			GFile *volume_file;
+
+			parent = g_file_get_parent (file);
+			volume_file = g_file_get_child (parent, volume_name);
+			fr_command_set_multi_volume (comm, volume_file);
+
+			g_object_unref (volume_file);
+			g_object_unref (parent);
+		}
+
+		g_free (name);
+	}
+
+	g_object_unref (file);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/11.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/11.html new file mode 100644 index 0000000..b96b350 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/11.html @@ -0,0 +1,2261 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "actions.h"
+#include "dlg-add-files.h"
+#include "dlg-add-folder.h"
+#include "dlg-extract.h"
+#include "dlg-delete.h"
+#include "dlg-new.h"
+#include "dlg-open-with.h"
+#include "dlg-password.h"
+#include "dlg-prop.h"
+#include "gtk-utils.h"
+#include "fr-window.h"
+#include "file-utils.h"
+#include "fr-process.h"
+#include "glib-utils.h"
+#include "fr-init.h"
+#include "typedefs.h"
+
+/* -- new archive -- */
+
+static struct
+{
+    const char *id;
+    void (* activate) (GtkMenuItem *menuitem,
+                       gpointer     user_data);
+} engramp_menu_popup [] = {
+    {"popup_open_item", activate_popup_open},
+    {"popup_open_select_item", activate_popup_open_select},
+    {"popup_extract_item", activate_popup_extract},
+    {"popup_cut_item", activate_popup_cut},
+    {"popup_paste_item", activate_popup_paste},
+    {"popup_rename_item", activate_popup_rename},
+    {"popup_delete_item", activate_popup_delete},
+    {"popup_open_item1", activate_popup_open_folder},
+    {"popup_extract_item1", activate_popup_extract},
+    {"popup_cut_item1", activate_popup_cut},
+    {"popup_copy_item1", activate_popup_copy},
+    {"popup_paste_item1", activate_popup_paste},
+    {"popup_rename_item1", activate_popup_rename},
+    {"popup_delete_item1", activate_popup_delete},
+    {"popup_open_item2", activate_popup_open_folder_from_sidebar},
+    {"popup_extract_item2", activate_popup_extract_folder_from_sidebar},
+    {"popup_cut_item2", activate_popup_cut_folder_from_sidebar},
+    {"popup_copy_item2", activate_popup_copy_folder_from_sidebar},
+    {"popup_paste_item2", activate_popup_paste_folder_from_sidebar},
+    {"popup_rename_item2", activate_popup_rename_folder_from_sidebar},
+    {"popup_delete_item2", activate_popup_delete_folder_from_sidebar},
+};
+
+static void
+new_archive (DlgNewData *data,
+         char       *uri)
+{
+    GtkWidget  *archive_window;
+    gboolean    new_window;
+    const char *password;
+    gboolean    encrypt_header;
+    int         volume_size;
+
+    new_window = fr_window_archive_is_present (data->window) && ! fr_window_is_batch_mode (data->window);
+    if (new_window)
+        archive_window = fr_window_new ();
+    else
+        archive_window = (GtkWidget *) data->window;
+
+    password = dlg_new_data_get_password (data);
+    encrypt_header = dlg_new_data_get_encrypt_header (data);
+    volume_size = dlg_new_data_get_volume_size (data);
+
+    fr_window_set_password (FR_WINDOW (archive_window), password);
+    fr_window_set_encrypt_header (FR_WINDOW (archive_window), encrypt_header);
+    fr_window_set_volume_size (FR_WINDOW (archive_window), volume_size);
+
+    if (fr_window_archive_new (FR_WINDOW (archive_window), uri)) {
+        gtk_widget_destroy (data->dialog);
+        if (! fr_window_is_batch_mode (FR_WINDOW (archive_window)))
+            gtk_window_present (GTK_WINDOW (archive_window));
+    }
+    else if (new_window)
+        gtk_widget_destroy (archive_window);
+}
+
+/* when on Automatic the user provided extension needs to be supported,
+   otherwise an existing unsupported archive can be deleted (if the user
+   provided name matches with its name) before we find out that the
+   archive is unsupported
+*/
+static gboolean
+is_supported_extension (GtkWidget *file_sel,
+            char      *filename,
+            int       *file_type)
+{
+    int i;
+    for (i = 0; file_type[i] != -1; i++)
+        if (file_extension_is (filename, mime_type_desc[file_type[i]].default_ext))
+            return TRUE;
+    return FALSE;
+}
+
+static char *
+get_full_uri (DlgNewData *data)
+{
+    char        *full_uri = NULL;
+    char        *uri;
+    const char  *filename;
+    int          idx;
+
+    uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+
+    if ((uri == NULL) || (*uri == 0))
+        return NULL;
+
+    filename = file_name_from_path (uri);
+    if ((filename == NULL) || (*filename == 0)) {
+        g_free (uri);
+        return NULL;
+    }
+
+    idx = egg_file_format_chooser_get_format (EGG_FILE_FORMAT_CHOOSER (data->format_chooser), uri);
+    if (idx > 0) {
+        const char *uri_ext;
+        const char *default_ext;
+
+        uri_ext = get_archive_filename_extension (uri);
+        default_ext = mime_type_desc[data->supported_types[idx-1]].default_ext;
+        if (g_strcmp0 (uri_ext, default_ext) != 0)
+            full_uri = g_strconcat (uri, default_ext, NULL);
+    }
+    if (full_uri == NULL)
+        full_uri = uri;
+    else
+        g_free (uri);
+
+    return full_uri;
+}
+
+static char *
+get_archive_filename_from_selector (DlgNewData *data)
+{
+    char      *uri = NULL;
+    GFile     *file, *dir;
+    GFileInfo *info;
+    GError    *err = NULL;
+
+    uri = get_full_uri (data);
+    if ((uri == NULL) || (*uri == 0)) {
+        GtkWidget *dialog;
+
+        g_free (uri);
+
+        dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                        NULL,
+                        _("Could not create the archive"),
+                        "%s",
+                        _("You have to specify an archive name."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+
+        return NULL;
+    }
+
+    file = g_file_new_for_uri (uri);
+
+    dir = g_file_get_parent (file);
+    info = g_file_query_info (dir,
+                  G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
+                  G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE ","<--- There is an unknown macro here somewhere. Configuration is required. If G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE is a macro then please configure it.
+                  G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
+                  0, NULL, &err);
+    if (err != NULL) {
+        g_warning ("Failed to get permission for extraction dir: %s",
+               err->message);
+        g_clear_error (&err);
+        g_object_unref (info);
+        g_object_unref (dir);
+        g_object_unref (file);
+        g_free (uri);
+        return NULL;
+    }
+
+    if (! g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+        GtkWidget *dialog;
+
+        g_object_unref (info);
+        g_object_unref (dir);
+        g_object_unref (file);
+        g_free (uri);
+
+        dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                        NULL,
+                        _("Could not create the archive"),
+                        "%s",
+                        _("You don't have permission to create an archive in this folder"));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+        return NULL;
+    }
+    g_object_unref (info);
+    g_object_unref (dir);
+    if ((data->original_file != NULL) && (g_file_equal (file, data->original_file))) {
+        GtkWidget *dialog;
+        dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+                        GTK_DIALOG_MODAL,
+                        NULL,
+                        _("Could not create the archive"),
+                        "%s",
+                        _("New name is the same as old one, please type other name."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+        g_object_unref (info);
+        g_object_unref (file);
+
+        return NULL;
+    }
+
+    /* if the user did not specify a valid extension use the filetype combobox current type
+     * or tar.gz if automatic is selected. */
+    if (get_archive_filename_extension (uri) == NULL) {
+        int   idx;
+        char *new_uri;
+        const char *ext = NULL;
+
+        idx = egg_file_format_chooser_get_format (EGG_FILE_FORMAT_CHOOSER (data->format_chooser), uri);
+        if (idx > 0)
+            ext = mime_type_desc[data->supported_types[idx-1]].default_ext;
+        else
+            ext = ".tar.gz";
+        new_uri = g_strconcat (uri, ext, NULL);
+        g_free (uri);
+        uri = new_uri;
+    }
+
+    debug (DEBUG_INFO, "create/save %s\n", uri);
+
+    if (uri_exists (uri)) {
+
+        if (! is_supported_extension (data->dialog, uri, data->supported_types)) {
+            GtkWidget *dialog;
+            dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+                            GTK_DIALOG_MODAL,
+                            NULL,
+                            _("Could not create the archive"),
+                            "%s",
+                            _("Archive type not supported."));
+            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_destroy (GTK_WIDGET (dialog));
+            g_free (uri);
+
+            return NULL;
+        }
+
+        g_file_delete (file, NULL, &err);
+        if (err != NULL) {
+            GtkWidget *dialog;
+            dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+                            GTK_DIALOG_DESTROY_WITH_PARENT,
+                            NULL,
+                            _("Could not delete the old archive."),
+                            "%s",
+                            err->message);
+            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_destroy (GTK_WIDGET (dialog));
+            g_error_free (err);
+            g_free (uri);
+            g_object_unref (file);
+            return NULL;
+        }
+    }
+
+    g_object_unref (file);
+
+    return uri;
+}
+
+static void
+new_file_response_cb (GtkWidget  *w,
+              int         response,
+              DlgNewData *data)
+{
+    char *path;
+
+    if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+        fr_archive_action_completed (data->window->archive,
+                         FR_ACTION_CREATING_NEW_ARCHIVE,
+                         FR_PROC_ERROR_STOPPED,
+                         NULL);
+        gtk_widget_destroy (data->dialog);
+        return;
+    }
+
+    if (response == GTK_RESPONSE_HELP) {
+        show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-create");
+        return;
+    }
+
+    path = get_archive_filename_from_selector (data);
+    if (path != NULL) {
+        new_archive (data, path);
+        g_free (path);
+    }
+}
+
+void
+init_engramp_menu_popup (FrWindow   *window,
+                         GtkBuilder *ui)
+{
+    int i;
+
+    int n_entries = G_N_ELEMENTS (engramp_menu_popup);
+
+    for (i = 0 ; i < n_entries; i++)
+    {
+        GtkWidget *widget = (GtkWidget *)gtk_builder_get_object (ui, engramp_menu_popup[i].id);
+
+        if (engramp_menu_popup[i].activate != NULL)
+            g_signal_connect (widget,
+                             "activate",
+                              G_CALLBACK (engramp_menu_popup[i].activate),
+                              window);
+    }
+}
+
+void
+show_new_archive_dialog (FrWindow   *window,
+             const char *archive_name)
+{
+    DlgNewData *data;
+
+    if (archive_name != NULL)
+        data = dlg_save_as (window, archive_name);
+    else
+        data = dlg_new (window);
+
+    g_signal_connect (G_OBJECT (data->dialog),
+              "response",
+              G_CALLBACK (new_file_response_cb),
+              data);
+    gtk_window_present (GTK_WINDOW (data->dialog));
+}
+
+void
+activate_action_new (GSimpleAction *action,
+                     GVariant      *parameter,
+                     gpointer       data)
+{
+    show_new_archive_dialog ((FrWindow*)data, NULL);
+}
+
+/* -- open archive -- */
+
+static void
+window_archive_loaded_cb (FrWindow  *window,
+              gboolean   success,
+              GtkWidget *file_sel)
+{
+    if (success) {
+        g_signal_handlers_disconnect_by_data (window, file_sel);
+        gtk_widget_destroy (file_sel);
+    }
+    else {
+        FrWindow *original_window =  g_object_get_data (G_OBJECT (file_sel), "fr_window");
+        if (window != original_window)
+            fr_window_destroy_with_error_dialog (window);
+    }
+}
+
+static void
+open_file_response_cb (GtkWidget *w,
+               int        response,
+               GtkWidget *file_sel)
+{
+    FrWindow *window = NULL;
+    char     *uri;
+
+    if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+        gtk_widget_destroy (file_sel);
+        return;
+    }
+
+    window = g_object_get_data (G_OBJECT (file_sel), "fr_window");
+    uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_sel));
+
+    if ((window == NULL) || (uri == NULL))
+        return;
+
+    if (fr_window_archive_is_present (window))
+        window = (FrWindow *) fr_window_new ();
+    g_signal_connect (G_OBJECT (window),
+              "archive_loaded",
+              G_CALLBACK (window_archive_loaded_cb),
+              file_sel);
+    fr_window_archive_open (window, uri, GTK_WINDOW (file_sel));
+
+    g_free (uri);
+}
+
+void
+activate_action_open (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       data)
+{
+    GtkWidget     *file_sel;
+    FrWindow      *window = data;
+    GtkFileFilter *filter;
+    int            i;
+
+    file_sel = gtk_file_chooser_dialog_new (_("Open"),
+                        GTK_WINDOW (window),
+                        GTK_FILE_CHOOSER_ACTION_OPEN,
+                        "gtk-cancel", GTK_RESPONSE_CANCEL,
+                        "gtk-open", GTK_RESPONSE_OK,
+                        NULL);
+    gtk_dialog_set_default_response (GTK_DIALOG (file_sel), GTK_RESPONSE_OK);
+    gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_sel), FALSE);
+    gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (file_sel), fr_window_get_open_default_dir (window));
+
+    filter = gtk_file_filter_new ();
+    gtk_file_filter_set_name (filter, _("All archives"));
+    for (i = 0; open_type[i] != -1; i++)
+        gtk_file_filter_add_mime_type (filter, mime_type_desc[open_type[i]].mime_type);
+    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_sel), filter);
+    gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (file_sel), filter);
+
+    filter = gtk_file_filter_new ();
+    gtk_file_filter_set_name (filter, _("All files"));
+    gtk_file_filter_add_pattern (filter, "*");
+    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_sel), filter);
+
+    /**/
+
+    g_object_set_data (G_OBJECT (file_sel), "fr_window", window);
+
+    g_signal_connect (G_OBJECT (file_sel),
+              "response",
+              G_CALLBACK (open_file_response_cb),
+              file_sel);
+
+    gtk_window_set_modal (GTK_WINDOW (file_sel), TRUE);
+    gtk_widget_show (file_sel);
+}
+
+/* -- save archive -- */
+
+static void
+save_file_response_cb (GtkWidget  *w,
+               gint        response,
+               DlgNewData *data)
+{
+    char       *path;
+    const char *password;
+    gboolean    encrypt_header;
+    int         volume_size;
+    GSettings  *settings;
+
+    if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+        gtk_widget_destroy (data->dialog);
+        return;
+    }
+
+    if (response == GTK_RESPONSE_HELP) {
+        show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-create#engrampa-convert-archive");
+        return;
+    }
+
+    path = get_archive_filename_from_selector (data);
+    if (path == NULL)
+        return;
+
+    password = dlg_new_data_get_password (data);
+    encrypt_header = dlg_new_data_get_encrypt_header (data);
+    volume_size = dlg_new_data_get_volume_size (data);
+
+    settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
+    g_settings_set_int (settings, PREF_BATCH_ADD_VOLUME_SIZE, volume_size);
+    g_object_unref (settings);
+
+    fr_window_archive_save_as (data->window, path, password, encrypt_header, volume_size);
+    gtk_widget_destroy (data->dialog);
+
+    g_free (path);
+}
+
+void
+activate_action_save_as (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       callback_data)
+{
+    FrWindow   *window = callback_data;
+    DlgNewData *data;
+    GFile      *file = NULL;
+    char       *archive_name = NULL;
+
+    if (fr_window_get_archive_uri (window)) {
+        const char *uri;
+        GFileInfo  *info;
+        GError     *err = NULL;
+
+        uri = fr_window_get_archive_uri (window);
+        file = g_file_new_for_uri (uri);
+        info = g_file_query_info (file,
+                      G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+                      0, NULL, &err);
+
+        if (err != NULL) {
+            g_warning ("Failed to get display name for uri %s: %s", uri, err->message);
+            g_clear_error (&err);
+        }
+        else
+            archive_name = g_strdup (g_file_info_get_display_name (info));
+
+        g_object_unref (info);
+    }
+
+    data = dlg_save_as (window, archive_name);
+    data->original_file = file;
+    g_signal_connect (G_OBJECT (data->dialog),
+              "response",
+              G_CALLBACK (save_file_response_cb),
+              data);
+    gtk_window_present (GTK_WINDOW (data->dialog));
+
+    g_free (archive_name);
+}
+
+void
+activate_action_test_archive (GSimpleAction *action,
+                              GVariant      *parameter,
+                              gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_archive_test (window);
+}
+
+void
+activate_action_properties (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       data)
+{
+    FrWindow *window = data;
+
+    dlg_prop (window);
+}
+
+void
+activate_action_close (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_close (window);
+}
+
+void
+activate_action_add_files (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       data)
+{
+    add_files_cb (NULL, data);
+}
+
+void
+activate_action_add_folder (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       data)
+{
+    add_folder_cb (NULL, data);
+}
+
+void
+activate_action_extract (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
+{
+    dlg_extract (NULL, data);
+}
+
+void
+activate_action_copy (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       data)
+{
+    fr_window_copy_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_action_cut (GSimpleAction *action,
+                     GVariant      *parameter,
+                     gpointer       data)
+{
+    fr_window_cut_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_action_paste (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       data)
+{
+    fr_window_paste_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_action_rename (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
+{
+    fr_window_rename_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_action_delete (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
+{
+    dlg_delete (NULL, data);
+}
+
+void
+activate_action_find (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_find (window);
+}
+
+void
+activate_action_select_all (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_select_all (window);
+}
+
+void
+activate_action_deselect_all (GSimpleAction *action,
+                              GVariant      *parameter,
+                              gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_unselect_all (window);
+}
+
+void
+activate_action_open_with (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       data)
+{
+    open_with_cb (NULL, (FrWindow*) data);
+}
+
+void
+activate_action_password (GSimpleAction *action,
+                          GVariant      *parameter,
+                          gpointer       data)
+{
+    dlg_password (NULL, (FrWindow*) data);
+}
+
+void
+activate_action_view_toolbar (GSimpleAction *action,
+                              GVariant      *state,
+                              gpointer       data)
+{
+    GSettings *settings;
+
+    settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+    g_settings_set_boolean (settings, PREF_UI_VIEW_TOOLBAR, g_variant_get_boolean (state));
+    g_simple_action_set_state (action, state);
+    g_object_unref (settings);
+}
+
+void
+activate_action_view_statusbar (GSimpleAction *action,
+                                GVariant      *state,
+                                gpointer       data)
+{
+    GSettings *settings;
+
+    settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+    g_settings_set_boolean (settings, PREF_UI_VIEW_STATUSBAR, g_variant_get_boolean (state));
+    g_simple_action_set_state (action, state);
+    g_object_unref (settings);
+}
+
+void
+activate_action_view_folders (GSimpleAction *action,
+                              GVariant      *state,
+                              gpointer       data)
+{
+    GSettings *settings;
+
+    settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+    g_settings_set_boolean (settings, PREF_UI_VIEW_FOLDERS, g_variant_get_boolean (state));
+    g_simple_action_set_state (action, state);
+    g_object_unref (settings);
+}
+
+void
+activate_action_stop (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_stop (window);
+}
+
+void
+activate_action_reload (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
+{
+    FrWindow *window = data;
+
+    fr_window_archive_reload (window);
+}
+
+void
+activate_action_last_output (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_view_last_output (window, _("Last Output"));
+}
+
+void
+activate_action_go_back (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_go_back (window);
+}
+
+void
+activate_action_go_forward (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_go_forward (window);
+}
+
+void
+activate_action_go_up (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_go_up_one_level (window);
+}
+
+void
+activate_action_go_home (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
+{
+    FrWindow *window = data;
+    fr_window_go_to_location (window, "/", FALSE);
+}
+
+void
+activate_action_manual (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
+{
+    FrWindow *window = data;
+
+    show_help_dialog (GTK_WINDOW (window) , NULL);
+}
+
+#define ABOUT_GROUP "About"
+#define EMAILIFY(string) (g_strdelimit ((string), "%", '@'))
+
+void
+activate_action_about (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       gp)
+{
+    FrWindow *window = gp;
+    const char *documenters [] = {
+        "Alexander Kirillov",
+        "Breda McColgan",
+        NULL
+    };
+    const char *license[] = {
+        N_("Engrampa is free software; you can redistribute it and/or modify "
+        "it under the terms of the GNU General Public License as published by "
+        "the Free Software Foundation; either version 2 of the License, or "
+        "(at your option) any later version."),
+        N_("Engrampa is distributed in the hope that it will be useful, "
+        "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+        "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
+        "GNU General Public License for more details."),
+        N_("You should have received a copy of the GNU General Public License "
+        "along with Engrampa; if not, write to the Free Software Foundation, Inc., "
+        "51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA")
+    };
+    char *license_text;
+    GKeyFile *key_file;
+    GBytes *bytes;
+    const guint8 *data;
+    gsize data_len;
+    GError *error = NULL;
+    char **authors;
+    gsize n_authors = 0, i;
+
+    bytes = g_resources_lookup_data (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "engrampa.about", G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+    g_assert_no_error (error);
+
+    data = g_bytes_get_data (bytes, &data_len);
+    key_file = g_key_file_new ();
+    g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error);
+    g_assert_no_error (error);
+
+    authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL);
+
+    g_key_file_free (key_file);
+    g_bytes_unref (bytes);
+
+    for (i = 0; i < n_authors; ++i)
+        authors[i] = EMAILIFY (authors[i]);
+
+    license_text =  g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL);
+
+    gtk_show_about_dialog (GTK_WINDOW (window),
+                   "version", VERSION,
+                   "copyright", _("Copyright \xc2\xa9 2001–2010 Free Software Foundation, Inc.\n"
+                                  "Copyright \xc2\xa9 2012–2021 The MATE developers"),
+                   "comments", _("Engrampa is an archive manager for the MATE Desktop Environment."),
+                   "authors", authors,
+                   "documenters", documenters,
+                   "translator-credits", _("translator-credits"),
+                   "logo-icon-name", "engrampa",
+                   "license", license_text,
+                   "wrap-license", TRUE,
+                   "website", PACKAGE_URL,
+                   NULL);
+
+    g_strfreev (authors);
+    g_free (license_text);
+}
+
+void
+activate_toggle (GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       user_data)
+{
+    GVariant *state;
+    state = g_action_get_state (G_ACTION (action));
+    g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+    g_variant_unref (state);
+}
+
+void
+activate_popup_open (GtkMenuItem *menuitem,
+                     gpointer     data)
+{
+    FrWindow *window = data;
+    GList    *file_list;
+
+    file_list = fr_window_get_file_list_selection (window, FALSE, NULL);
+    if (file_list == NULL)
+        return;
+    fr_window_open_files (window, file_list, FALSE);
+    path_list_free (file_list);
+
+}
+
+void
+activate_popup_open_select (GtkMenuItem *menuitem,
+                            gpointer     data)
+{
+    open_with_cb (NULL, (FrWindow*) data);
+}
+
+void
+activate_popup_extract (GtkMenuItem *menuitem,
+                        gpointer     data)
+{
+    dlg_extract (NULL, data);
+}
+
+void
+activate_popup_cut (GtkMenuItem *menuitem,
+                    gpointer     data)
+{
+    fr_window_cut_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_popup_paste (GtkMenuItem *menuitem,
+                      gpointer     data)
+{
+    fr_window_paste_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_popup_rename (GtkMenuItem *menuitem,
+                       gpointer     data)
+{
+    fr_window_rename_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_popup_delete (GtkMenuItem *menuitem,
+                       gpointer     data)
+{
+    dlg_delete (NULL, data);
+}
+
+void
+activate_popup_open_folder (GtkMenuItem *menuitem,
+                            gpointer     data)
+{
+    FrWindow *window = data;
+    fr_window_current_folder_activated (window, FALSE);
+}
+
+void
+activate_popup_copy (GtkMenuItem *menuitem,
+                     gpointer     data)
+{
+    fr_window_copy_selection ((FrWindow*) data, FALSE);
+}
+
+void
+activate_popup_open_folder_from_sidebar (GtkMenuItem *menuitem,
+                                         gpointer     data)
+{
+    FrWindow *window = data;
+    fr_window_current_folder_activated (window, TRUE);
+}
+
+void
+activate_popup_extract_folder_from_sidebar (GtkMenuItem *menuitem,
+                                            gpointer     data)
+{
+    dlg_extract_folder_from_sidebar (NULL, data);
+}
+
+void
+activate_popup_copy_folder_from_sidebar (GtkMenuItem *menuitem,
+                                         gpointer     data)
+{
+    fr_window_copy_selection ((FrWindow*) data, TRUE);
+}
+
+void
+activate_popup_cut_folder_from_sidebar (GtkMenuItem *menuitem,
+                                        gpointer     data)
+{
+    fr_window_cut_selection ((FrWindow*) data, TRUE);
+}
+
+void
+activate_popup_paste_folder_from_sidebar (GtkMenuItem *menuitem,
+                                          gpointer     data)
+{
+    fr_window_paste_selection ((FrWindow*) data, TRUE);
+}
+
+void
+activate_popup_rename_folder_from_sidebar (GtkMenuItem *menuitem,
+                                           gpointer     data)
+{
+    fr_window_rename_selection ((FrWindow*) data, TRUE);
+}
+
+void
+activate_popup_delete_folder_from_sidebar (GtkMenuItem *menuitem,
+                                           gpointer     data)
+{
+    dlg_delete_from_sidebar (NULL, data);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/110.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/110.html new file mode 100644 index 0000000..a6b0aff --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/110.html @@ -0,0 +1,1189 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "fr-init.h"
+
+#define FR_SERVICE_NAME "org.mate.Engrampa"
+#define FR_SERVICE_PATH "/org/mate/Engrampa"
+
+static const char introspection_xml[] =
+	"<node>"
+	"  <interface name='org.mate.ArchiveManager'>"
+
+	/**
+	 * GetSupportedTypes:
+	 *
+	 * Returns the supported archive types for a specific action.
+	 *
+	 * Input arguments:
+	 *
+	 * @action:
+	 *   Can be one of the following values:
+	 *   *) create: create an archive that can contain many files.
+	 *   *) create_single_file: create an archive that can contain a single file.
+	 *   *) extract: extract the content of an archive.
+	 *
+	 * Output arguments:
+	 *
+	 * @types:
+	 *   The supported archive types described as an array of hash tables,
+	 *   where each hash table has the following keys:
+	 *   *) mime-type: the mime type relative to the archive type.
+	 *   *) default-extension: the extension to use for newly created archives.
+	 *   *) description: a human readable description of the archive type.
+	 */
+
+	"    <method name='GetSupportedTypes'>"
+	"      <arg name='action' type='s' direction='in'/>"
+	"      <arg name='types' type='aa{ss}' direction='out'/>"
+	"    </method>"
+
+	/**
+	 * AddToArchive:
+	 *
+	 * Adds the specified files to an archive.  If the archive already
+	 * exists the archive is updated.
+	 *
+	 * Input arguments:
+	 *
+	 * @archive:
+	 *   The archive URI.
+	 * @files:
+	 *   The files to add to the archive, as an array of URIs.
+	 * @use_progress_dialog:
+	 *   Whether to show the progress dialog.
+	 */
+
+	"    <method name='AddToArchive'>"
+	"      <arg name='archive' type='s' direction='in'/>"
+	"      <arg name='files' type='as' direction='in'/>"
+	"      <arg name='use_progress_dialog' type='b' direction='in'/>"
+	"    </method>"
+
+	/**
+	 * Compress:
+	 *
+	 * Compresses a series of files in an archive. The user is asked to
+	 * enter an archive name, archive type and other options.  In this case
+	 * it's used the same dialog used by the "Compress..." command from the
+	 * Nautilus context menu.
+	 * If the user chooses an existing archive, the archive is updated.
+	 *
+	 * Input arguments:
+	 *
+	 * @files:
+	 *   The files to add to the archive, as an array of URIs.
+	 * @destination:
+	 *   An optional destination, if not specified the folder of the first
+	 *   file in @files is used.
+	 * @use_progress_dialog:
+	 *   Whether to show the progress dialog.
+	 */
+
+	"    <method name='Compress'>"
+	"      <arg name='files' type='as' direction='in'/>"
+	"      <arg name='destination' type='s' direction='in'/>"
+	"      <arg name='use_progress_dialog' type='b' direction='in'/>"
+	"    </method>"
+
+	/**
+	 * Extract:
+	 *
+	 * Extract an archive in a specified location.
+	 *
+	 * Input arguments:
+	 *
+	 * @archive:
+	 *   The archive to extract.
+	 * @destination:
+	 *   The location where to extract the archive.
+	 * @use_progress_dialog:
+	 *   Whether to show the progress dialog.
+	 */
+
+	"    <method name='Extract'>"
+	"      <arg name='archive' type='s' direction='in'/>"
+	"      <arg name='destination' type='s' direction='in'/>"
+	"      <arg name='use_progress_dialog' type='b' direction='in'/>"
+	"    </method>"
+
+	/**
+	 * ExtractHere:
+	 *
+	 * Extract an archive in a specified location.
+	 *
+	 * Input arguments:
+	 *
+	 * @archive:
+	 *   The archive to extract.
+	 * @use_progress_dialog:
+	 *   Whether to show the progress dialog.
+	 */
+
+	"    <method name='ExtractHere'>"
+	"      <arg name='archive' type='s' direction='in'/>"
+	"      <arg name='use_progress_dialog' type='b' direction='in'/>"
+	"    </method>"
+
+	/**
+	 * Progress (signal)
+	 *
+	 * Arguments:
+	 *
+	 * @fraction:
+	 *   number from 0.0 to 100.0 that indicates the percentage of
+	 *   completion of the operation.
+	 * @details:
+	 *   text message that describes the current operation.
+	 */
+
+	"    <signal name='Progress'>"
+	"      <arg name='fraction' type='d'/>"
+	"      <arg name='details' type='s'/>"
+	"    </signal>"
+
+	"  </interface>"
+	"</node>";
+
+static GDBusNodeInfo *introspection_data = NULL;
+
+static void
+window_ready_cb (GtkWidget *widget,
+		 GError    *error,
+		 gpointer   user_data)
+{
+	if (error == NULL)
+		g_dbus_method_invocation_return_value ((GDBusMethodInvocation *) user_data, NULL);
+	else
+		g_dbus_method_invocation_return_error ((GDBusMethodInvocation *) user_data,
+						       error->domain,
+						       error->code,
+						       "%s",
+						       error->message);
+}
+
+static gboolean
+window_progress_cb (FrWindow *window,
+		    double    fraction,
+		    char     *details,
+		    gpointer  user_data)
+{
+	GDBusConnection *connection = user_data;
+
+	g_dbus_connection_emit_signal (connection,
+				       NULL,
+				       FR_SERVICE_PATH,
+				       "org.mate.ArchiveManager",
+				       "Progress",
+				       g_variant_new ("(ds)",
+						      fraction,
+						      details),
+				       NULL);
+
+	return TRUE;
+}
+
+static void
+handle_method_call (GDBusConnection       *connection,
+		    const char            *sender,
+		    const char            *object_path,
+		    const char            *interface_name,
+		    const char            *method_name,
+		    GVariant              *parameters,
+		    GDBusMethodInvocation *invocation,
+		    gpointer               user_data)
+{
+	update_registered_commands_capabilities ();
+
+	if (g_strcmp0 (method_name, "GetSupportedTypes") == 0) {
+		char *action;
+		int  *supported_types = NULL;
+
+		g_variant_get (parameters, "(s)", &action);
+
+		if (g_strcmp0 (action, "create") == 0) {
+			supported_types = save_type;
+		}
+		else if (g_strcmp0 (action, "create_single_file") == 0) {
+			supported_types = single_file_save_type;
+		}
+		else if (g_strcmp0 (action, "extract") == 0) {
+			supported_types = open_type;
+		}
+
+		if (supported_types == NULL) {
+			g_dbus_method_invocation_return_error (invocation,
+							       G_IO_ERROR,
+							       G_IO_ERROR_INVALID_ARGUMENT,
+							       "Action not valid %s, valid values are: create, create_single_file, extract",
+							       action);
+		}
+		else {
+			GVariantBuilder builder;
+			int             i;
+
+			g_variant_builder_init (&builder, G_VARIANT_TYPE ("(aa{ss})"));
+			g_variant_builder_open (&builder, G_VARIANT_TYPE ("aa{ss}"));
+			for (i = 0; supported_types[i] != -1; i++) {
+				g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
+				g_variant_builder_add (&builder, "{ss}",
+						       "mime-type",
+						       mime_type_desc[supported_types[i]].mime_type);
+				g_variant_builder_add (&builder, "{ss}",
+						       "default-extension",
+						       mime_type_desc[supported_types[i]].default_ext);
+				g_variant_builder_add (&builder, "{ss}",
+						       "description",
+						       _(mime_type_desc[supported_types[i]].name));
+				g_variant_builder_close (&builder);
+			}
+			g_variant_builder_close (&builder);
+
+			g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
+		}
+
+		g_free (action);
+	}
+	else if (g_strcmp0 (method_name, "AddToArchive") == 0) {
+		char       *archive;
+		char      **files;
+		gboolean    use_progress_dialog;
+		int         i;
+		GList      *file_list = NULL;
+		GtkWidget  *window;
+
+		g_variant_get (parameters, "(s^asb)", &archive, &files, &use_progress_dialog);
+
+		for (i = 0; files[i] != NULL; i++)
+			file_list = g_list_prepend (file_list, files[i]);
+		file_list = g_list_reverse (file_list);
+
+		window = fr_window_new ();
+		fr_window_use_progress_dialog (FR_WINDOW (window), use_progress_dialog);
+
+		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
+		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Compress"));
+		fr_window_set_batch__add (FR_WINDOW (window), archive, file_list);
+		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
+		fr_window_start_batch (FR_WINDOW (window));
+
+		g_free (archive);
+
+		gtk_main ();
+	}
+	else if (g_strcmp0 (method_name, "Compress") == 0) {
+		char      **files;
+		char       *destination;
+		gboolean    use_progress_dialog;
+		int         i;
+		GList      *file_list = NULL;
+		GtkWidget  *window;
+
+		g_variant_get (parameters, "(^assb)", &files, &destination, &use_progress_dialog);
+
+		for (i = 0; files[i] != NULL; i++)
+			file_list = g_list_prepend (file_list, files[i]);
+		file_list = g_list_reverse (file_list);
+
+		if ((destination == NULL) || (strcmp (destination, "") == 0))
+			destination = remove_level_from_path (file_list->data);
+
+		window = fr_window_new ();
+		fr_window_use_progress_dialog (FR_WINDOW (window), use_progress_dialog);
+		fr_window_set_default_dir (FR_WINDOW (window), destination, TRUE);
+
+		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
+		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
+		fr_window_set_batch__add (FR_WINDOW (window), NULL, file_list);
+		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
+		fr_window_start_batch (FR_WINDOW (window));
+
+		g_free (destination);
+
+		gtk_main ();
+	}
+	else if (g_strcmp0 (method_name, "Extract") == 0) {
+		char      *archive;
+		char      *destination;
+		gboolean   use_progress_dialog;
+		GtkWidget *window;
+
+		g_variant_get (parameters, "(ssb)", &archive, &destination, &use_progress_dialog);
+
+		window = fr_window_new ();
+		fr_window_use_progress_dialog (FR_WINDOW (window), use_progress_dialog);
+		if ((destination != NULL) && (strcmp (destination, "") != 0))
+			fr_window_set_default_dir (FR_WINDOW (window), destination, TRUE);
+
+		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
+		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
+		fr_window_set_batch__extract (FR_WINDOW (window), archive, destination);
+		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
+		fr_window_start_batch (FR_WINDOW (window));
+
+		g_free (destination);
+		g_free (archive);
+
+		gtk_main ();
+	}
+	else if (g_strcmp0 (method_name, "ExtractHere") == 0) {
+		char      *archive;
+		gboolean   use_progress_dialog;
+		GtkWidget *window;
+
+		g_variant_get (parameters, "(sb)", &archive, &use_progress_dialog);
+
+		window = fr_window_new ();
+		fr_window_use_progress_dialog (FR_WINDOW (window), use_progress_dialog);
+
+		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
+		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
+
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
+		fr_window_set_batch__extract_here (FR_WINDOW (window), archive);
+		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
+		fr_window_start_batch (FR_WINDOW (window));
+
+		g_free (archive);
+
+		gtk_main ();
+	}
+}
+
+static const GDBusInterfaceVTable interface_vtable = {
+	handle_method_call,
+	NULL, 			/* handle_get_property */
+	NULL, 			/* handle_set_property */
+	{ 0 }
+};
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+		 const char      *name,
+		 gpointer         user_data)
+{
+	guint registration_id;
+
+	registration_id = g_dbus_connection_register_object (connection,
+							     FR_SERVICE_PATH,
+							     introspection_data->interfaces[0],
+							     &interface_vtable,
+							     NULL,
+							     NULL,  /* user_data_free_func */
+							     NULL); /* GError** */
+	g_assert (registration_id > 0);
+
+	initialize_data ();
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+		  const char      *name,
+		  gpointer         user_data)
+{
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+	      const char      *name,
+	      gpointer         user_data)
+{
+	gtk_main_quit ();
+}
+
+int
+main (int argc, char *argv[])
+{
+	GOptionContext *context = NULL;
+	GError         *error = NULL;
+	guint           owner_id;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new (N_("- Create and modify an archive"));
+#ifdef ENABLE_NLS
+	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+
+	if (! g_option_context_parse (context, &argc, &argv, &error)) {
+		g_critical ("Failed to parse arguments: %s", error->message);
+		g_error_free (error);
+		g_option_context_free (context);
+		return EXIT_FAILURE;
+	}
+
+	g_option_context_free (context);
+
+	g_set_application_name (_("Engrampa"));
+	gtk_window_set_default_icon_name ("engrampa");
+
+	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+					   PKG_DATA_DIR G_DIR_SEPARATOR_S "icons");
+
+	introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+	g_assert (introspection_data != NULL);
+
+	owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+				   FR_SERVICE_NAME,
+				   G_BUS_NAME_OWNER_FLAGS_NONE,
+				   on_bus_acquired,
+				   on_name_acquired,
+				   on_name_lost,
+				   NULL,
+				   NULL);
+
+	gtk_main ();
+
+	g_bus_unown_name (owner_id);
+	g_dbus_node_info_unref (introspection_data);
+
+	return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/111.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/111.html new file mode 100644 index 0000000..68f447c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/111.html @@ -0,0 +1,749 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2010 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+GMainLoop *loop;
+
+static void
+engrampa_getsupportedtypes_ready_cb (GObject      *source_object,
+				    GAsyncResult *res,
+				    gpointer      user_data)
+{
+	GDBusProxy *proxy;
+	GVariant   *values;
+	GError     *error = NULL;
+
+	proxy = G_DBUS_PROXY (source_object);
+	values = g_dbus_proxy_call_finish (proxy, res, &error);
+	if (values == NULL) {
+		g_error ("%s\n", error->message);
+	}
+	else {
+		GVariantIter  argument_iter;
+		GVariant     *array_of_types;
+		GVariantIter  type_iter;
+		GVariant     *supported_type;
+		int           n = 0;
+
+		g_variant_iter_init (&argument_iter, values);
+		array_of_types = g_variant_iter_next_value (&argument_iter);
+
+		g_variant_iter_init (&type_iter, array_of_types);
+		while ((supported_type = g_variant_iter_next_value (&type_iter))) {
+			char         *mime_type = NULL;
+			char         *default_ext = NULL;
+			char         *description = NULL;
+			char         *key;
+			char         *value;
+			GVariantIter  value_iter;
+
+			g_variant_iter_init (&value_iter, supported_type);
+			while (g_variant_iter_next (&value_iter, "{ss}", &key, &value)) {
+				if (g_strcmp0 (key, "mime-type") == 0)
+					mime_type = g_strdup (value);
+				else if (g_strcmp0 (key, "default-extension") == 0)
+					default_ext = g_strdup (value);
+				else if (g_strcmp0 (key, "description") == 0)
+					description = g_strdup (value);
+
+				g_free (key);
+				g_free (value);
+			}
+
+			n++;
+			g_print ("%d)\tmime-type: %s\n\tdefault-extension: %s\n\tdescription: %s\n", n, mime_type, default_ext, description);
+
+			g_free (description);
+			g_free (default_ext);
+			g_free (mime_type);
+			g_variant_unref (supported_type);
+		}
+
+		g_variant_unref (array_of_types);
+	}
+
+	g_object_unref (proxy);
+	g_main_loop_quit (loop);
+}
+
+static void
+engrampa_addtoarchive_ready_cb (GObject      *source_object,
+				  GAsyncResult *res,
+				  gpointer      user_data)
+{
+	GDBusProxy *proxy;
+	GVariant   *values;
+	GError     *error = NULL;
+
+	proxy = G_DBUS_PROXY (source_object);
+	values = g_dbus_proxy_call_finish (proxy, res, &error);
+	if (values == NULL) {
+		g_error ("%s\n", error->message);
+	}
+
+	if (values != NULL)
+		g_variant_unref (values);
+	g_object_unref (proxy);
+
+	g_main_loop_quit (loop);
+}
+
+static void
+on_signal (GDBusProxy *proxy,
+	   char       *sender_name,
+	   char       *signal_name,
+	   GVariant   *parameters,
+	   gpointer    user_data)
+{
+	if (g_strcmp0 (signal_name, "Progress") == 0) {
+		double  fraction;
+		char   *details;
+
+		g_variant_get (parameters, "(ds)", &fraction, &details);
+		g_print ("Progress: %f (%s)\n", fraction, details);
+
+		g_free (details);
+	}
+}
+
+int
+main (int argc, char *argv[])
+{
+	GDBusConnection *connection;
+	GError          *error = NULL;
+
+	connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+	if (connection != NULL) {
+		GDBusProxy *proxy;
+
+		proxy = g_dbus_proxy_new_sync (connection,
+					       G_DBUS_PROXY_FLAGS_NONE,
+					       NULL,
+					       "org.mate.Engrampa",
+					       "/org/mate/Engrampa",
+					       "org.mate.ArchiveManager",
+					       NULL,
+					       &error);
+
+		if (proxy != NULL) {
+
+			g_signal_connect (proxy,
+			                  "g-signal",
+			                  G_CALLBACK (on_signal),
+			                  NULL);
+
+#if 0
+			/* -- GetSupportedTypes -- */
+
+			g_dbus_proxy_call (proxy,
+					   "GetSupportedTypes",
+					   g_variant_new ("(s)", "create"),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   engrampa_getsupportedtypes_ready_cb,
+					   NULL);
+#endif
+
+			/* -- AddToArchive -- */
+
+			char  *archive;
+			char **files;
+
+			archive = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre.tar.gz");
+			files = g_new0 (char *, 2);
+			files[0] = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre");
+			files[1] = NULL;
+
+			g_dbus_proxy_call (proxy,
+					   "AddToArchive",
+					   g_variant_new ("(s^asb)",
+							  archive,
+							  files,
+							  FALSE),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   engrampa_addtoarchive_ready_cb,
+					   NULL);
+
+			g_free (archive);
+			g_strfreev (files);
+
+#if 0
+
+			/* -- Compress -- */
+
+			char **files;
+			char  *destination;
+
+			files = g_new0 (char *, 2);
+			files[0] = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre");
+			files[1] = NULL;
+			destination = g_strdup ("file:///home/paolo/Scrivania");
+
+			g_dbus_proxy_call (proxy,
+					   "Compress",
+					   g_variant_new ("(^assb)",
+							  files,
+							  destination,
+							  TRUE),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   engrampa_addtoarchive_ready_cb,
+					   NULL);
+
+			g_strfreev (files);
+			g_free (destination);
+
+			/* -- Extract -- */
+
+			g_dbus_proxy_call (proxy,
+					   "Extract",
+					   g_variant_new ("(ssb)",
+							  "file:///home/paolo/Scrivania/test.tar.gz",
+							  "file:///home/paolo/Scrivania",
+							  TRUE),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   engrampa_addtoarchive_ready_cb,
+					   NULL);
+
+			/* -- ExtractHere -- */
+
+			g_dbus_proxy_call (proxy,
+					   "ExtractHere",
+					   g_variant_new ("(sb)",
+					                  "file:///home/paolo/Scrivania/test.tar.gz",
+					                  TRUE),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   engrampa_addtoarchive_ready_cb,
+					   NULL);
+
+#endif
+
+		}
+	}
+
+	loop = g_main_loop_new (NULL, FALSE);
+	g_main_loop_run (loop);
+
+	return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/12.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/12.html new file mode 100644 index 0000000..0394fde --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/12.html @@ -0,0 +1,665 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef ACTIONS_H
+#define ACTIONS_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-window.h"
+
+void show_new_archive_dialog                    (FrWindow      *window,
+                                                 const char    *archive_name);
+
+void activate_action_new                        (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_open                       (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_save_as                    (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_test_archive               (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_properties                 (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_close                      (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_quit                       (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_add_files                  (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_add_folder                 (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_extract                    (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_copy                       (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_cut                        (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_paste                      (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_rename                     (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_delete                     (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_find                       (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_select_all                 (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_deselect_all               (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_open_with                  (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_password                   (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_view_toolbar               (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_view_statusbar             (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_view_folders               (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_stop                       (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_reload                     (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_last_output                (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_go_back                    (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_go_forward                 (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_go_up                      (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_go_home                    (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_manual                     (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_action_about                      (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       data);
+
+void activate_toggle                            (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       user_data);
+
+void activate_popup_open                        (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_open_select                 (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_extract                     (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_cut                         (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_paste                       (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_rename                      (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_delete                      (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void init_engramp_menu_popup                    (FrWindow      *window,
+                                                 GtkBuilder    *ui);
+
+void activate_popup_open_folder                 (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_copy                        (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_open_folder_from_sidebar    (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_extract_folder_from_sidebar (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_copy_folder_from_sidebar    (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_cut_folder_from_sidebar     (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_paste_folder_from_sidebar   (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_rename_folder_from_sidebar  (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+
+void activate_popup_delete_folder_from_sidebar  (GtkMenuItem   *menuitem,
+                                                 gpointer       data);
+#endif /* ACTIONS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/13.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/13.html new file mode 100644 index 0000000..957484b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/13.html @@ -0,0 +1,877 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2007 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_WINDOW_H
+#define FR_WINDOW_H
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "typedefs.h"
+#include "fr-archive.h"
+
+enum {
+	COLUMN_FILE_DATA,
+	COLUMN_ICON,
+	COLUMN_NAME,
+	COLUMN_EMBLEM,
+	COLUMN_SIZE,
+	COLUMN_TYPE,
+	COLUMN_TIME,
+	COLUMN_PATH,
+	NUMBER_OF_COLUMNS
+};
+
+enum {
+	TREE_COLUMN_PATH,
+	TREE_COLUMN_ICON,
+	TREE_COLUMN_NAME,
+	TREE_COLUMN_WEIGHT,
+	TREE_NUMBER_OF_COLUMNS
+};
+
+typedef enum {
+	FR_BATCH_ACTION_NONE,
+	FR_BATCH_ACTION_LOAD,
+	FR_BATCH_ACTION_OPEN,
+	FR_BATCH_ACTION_ADD,
+	FR_BATCH_ACTION_DELETE,
+	FR_BATCH_ACTION_EXTRACT,
+	FR_BATCH_ACTION_EXTRACT_HERE,
+	FR_BATCH_ACTION_EXTRACT_INTERACT,
+	FR_BATCH_ACTION_RENAME,
+	FR_BATCH_ACTION_PASTE,
+	FR_BATCH_ACTION_OPEN_FILES,
+	FR_BATCH_ACTION_SAVE_AS,
+	FR_BATCH_ACTION_TEST,
+	FR_BATCH_ACTION_CLOSE,
+	FR_BATCH_ACTION_QUIT,
+	FR_BATCH_ACTIONS
+} FrBatchActionType;
+
+/* -- FrWindow -- */
+
+#define FR_TYPE_WINDOW              (fr_window_get_type ())
+#define FR_WINDOW(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_WINDOW, FrWindow))
+#define FR_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), FR_WINDOW_TYPE, FrWindowClass))
+#define FR_IS_WINDOW(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_WINDOW))
+#define FR_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_WINDOW))
+#define FR_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_WINDOW, FrWindowClass))
+
+typedef struct _FrWindow            FrWindow;
+typedef struct _FrWindowClass       FrWindowClass;
+typedef struct _FrWindowPrivateData FrWindowPrivateData;
+
+struct _FrWindow
+{
+	GtkApplicationWindow __parent;
+	FrArchive *archive;
+	FrWindowPrivateData *priv;
+};
+
+struct _FrWindowClass
+{
+	GtkApplicationWindowClass __parent_class;
+
+	/*<signals>*/
+
+	void (*archive_loaded) (FrWindow   *window,
+				gboolean    success);
+	void (*progress)       (FrWindow   *window,
+			        double      fraction,
+			        const char *msg);
+	void (*ready)          (FrWindow   *window,
+				GError     *error);
+};
+
+GType       fr_window_get_type                  (void);
+GtkWidget * fr_window_new                       (void);
+void        fr_window_close                     (FrWindow      *window);
+
+/* archive operations */
+
+gboolean    fr_window_archive_new               (FrWindow      *window,
+						 const char    *uri);
+FrWindow *  fr_window_archive_open              (FrWindow      *window,
+						 const char    *uri,
+						 GtkWindow     *parent);
+void        fr_window_archive_close             (FrWindow      *window);
+const char *fr_window_get_archive_uri           (FrWindow      *window);
+const char *fr_window_get_paste_archive_uri     (FrWindow      *window);
+gboolean    fr_window_archive_is_present        (FrWindow      *window);
+void        fr_window_archive_save_as           (FrWindow      *window,
+						 const char    *filename,
+						 const char    *password,
+						 gboolean       encrypt_header,
+						 guint          volume_size);
+void        fr_window_archive_reload            (FrWindow      *window);
+void        fr_window_archive_add_files         (FrWindow      *window,
+						 GList         *file_list, /* GFile list */
+						 gboolean       update);
+void        fr_window_archive_add_with_wildcard (FrWindow      *window,
+						 const char    *include_files,
+						 const char    *exclude_files,
+						 const char    *exclude_folders,
+						 const char    *base_dir,
+						 const char    *dest_dir,
+						 gboolean       update,
+						 gboolean       follow_links);
+void        fr_window_archive_add_directory     (FrWindow      *window,
+						 const char    *directory,
+						 const char    *base_dir,
+						 const char    *dest_dir,
+						 gboolean       update);
+void        fr_window_archive_add_items         (FrWindow      *window,
+						 GList         *dir_list,
+						 const char    *base_dir,
+						 const char    *dest_dir,
+						 gboolean       update);
+void        fr_window_archive_add_dropped_items (FrWindow      *window,
+						 GList         *item_list,
+						 gboolean       update);
+void        fr_window_archive_remove            (FrWindow      *window,
+						 GList         *file_list);
+void        fr_window_archive_extract           (FrWindow      *window,
+						 GList         *file_list,
+						 const char    *extract_to_dir,
+						 const char    *sub_dir,
+						 const char    *base_dir,
+						 gboolean       skip_older,
+						 FrOverwrite    overwrite,
+						 gboolean       junk_paths,
+						 gboolean       ask_to_open_destination);
+void        fr_window_archive_extract_here      (FrWindow      *window,
+						 gboolean       skip_older,
+						 FrOverwrite    overwrite,
+						 gboolean       junk_paths);
+void        fr_window_archive_test	        (FrWindow      *window);
+
+/**/
+
+void        fr_window_set_password              (FrWindow      *window,
+						 const char    *password);
+void        fr_window_set_password_for_paste    (FrWindow      *window,
+					         const char    *password);
+const char *fr_window_get_password              (FrWindow      *window);
+void        fr_window_set_encrypt_header        (FrWindow      *window,
+						 gboolean       encrypt_header);
+gboolean    fr_window_get_encrypt_header        (FrWindow      *window);
+void        fr_window_set_compression 	        (FrWindow      *window,
+						 FrCompression  compression);
+FrCompression fr_window_get_compression 	(FrWindow      *window);
+void        fr_window_set_volume_size 	        (FrWindow      *window,
+						 guint          volume_size);
+guint       fr_window_get_volume_size 	        (FrWindow      *window);
+
+/**/
+
+void       fr_window_go_to_location             (FrWindow       *window,
+					 	 const char     *path,
+					 	 gboolean        force_update);
+const char*fr_window_get_current_location       (FrWindow       *window);
+void       fr_window_go_up_one_level            (FrWindow       *window);
+void       fr_window_go_back                    (FrWindow       *window);
+void       fr_window_go_forward                 (FrWindow       *window);
+void       fr_window_current_folder_activated   (FrWindow       *window,
+						 gboolean        from_sidebar);
+void       fr_window_set_list_mode              (FrWindow       *window,
+						 FrWindowListMode  list_mode);
+
+/**/
+
+void       fr_window_update_list_order            (FrWindow    *window);
+GList *    fr_window_get_file_list_selection      (FrWindow    *window,
+						   gboolean     recursive,
+						   gboolean    *has_dirs);
+GList *    fr_window_get_file_list_from_path_list (FrWindow    *window,
+						   GList       *path_list,
+						   gboolean    *has_dirs);
+GList *    fr_window_get_file_list_pattern        (FrWindow    *window,
+						   const char  *pattern);
+int        fr_window_get_n_selected_files         (FrWindow    *window);
+GList *    fr_window_get_folder_tree_selection    (FrWindow    *window,
+				     		   gboolean     recursive,
+				     		   gboolean    *has_dirs);
+GList *    fr_window_get_selection                (FrWindow    *window,
+		  	 			   gboolean     from_sidebar,
+		  	 			   char       **return_base_dir);
+GtkTreeModel *
+	   fr_window_get_list_store               (FrWindow    *window);
+void       fr_window_find                         (FrWindow    *window);
+void       fr_window_select_all                   (FrWindow    *window);
+void       fr_window_unselect_all                 (FrWindow    *window);
+/**/
+
+void       fr_window_rename_selection             (FrWindow    *window,
+						   gboolean     from_sidebar);
+void       fr_window_cut_selection                (FrWindow    *window,
+						   gboolean     from_sidebar);
+void       fr_window_copy_selection               (FrWindow    *window,
+						   gboolean     from_sidebar);
+void       fr_window_paste_selection              (FrWindow    *window,
+						   gboolean     from_sidebar);
+
+/**/
+
+void       fr_window_stop                         (FrWindow    *window);
+void       fr_window_start_activity_mode          (FrWindow    *window);
+void       fr_window_stop_activity_mode           (FrWindow    *window);
+
+/**/
+
+void        fr_window_view_last_output            (FrWindow   *window,
+						   const char *title);
+
+void        fr_window_open_files                  (FrWindow   *window,
+						   GList      *file_list,
+						   gboolean    ask_application);
+void        fr_window_open_files_with_command     (FrWindow   *window,
+						   GList      *file_list,
+						   char       *command);
+void        fr_window_open_files_with_application (FrWindow   *window,
+						   GList      *file_list,
+						   GAppInfo   *app);
+gboolean    fr_window_update_files                (FrWindow   *window,
+						   GList      *file_list);
+void        fr_window_update_columns_visibility   (FrWindow   *window);
+void        fr_window_update_history_list         (FrWindow   *window);
+void        fr_window_set_default_dir             (FrWindow   *window,
+						   const char *default_dir,
+						   gboolean    freeze);
+void        fr_window_set_open_default_dir        (FrWindow   *window,
+						   const char *default_dir);
+const char *fr_window_get_open_default_dir        (FrWindow   *window);
+void        fr_window_set_add_default_dir         (FrWindow   *window,
+						   const char *default_dir);
+const char *fr_window_get_add_default_dir         (FrWindow   *window);
+void        fr_window_set_extract_default_dir     (FrWindow   *window,
+						   const char *default_dir,
+						   gboolean    freeze);
+const char *fr_window_get_extract_default_dir     (FrWindow   *window);
+void        fr_window_push_message                (FrWindow   *window,
+						   const char *msg);
+void        fr_window_pop_message                 (FrWindow   *window);
+void        fr_window_set_toolbar_visibility      (FrWindow   *window,
+						   gboolean    value);
+void        fr_window_set_statusbar_visibility    (FrWindow   *window,
+						   gboolean    value);
+void        fr_window_set_folders_visibility      (FrWindow   *window,
+						   gboolean    value);
+void        fr_window_use_progress_dialog         (FrWindow   *window,
+						   gboolean    value);
+
+/* batch mode procedures. */
+
+void       fr_window_new_batch                    (FrWindow      *window,
+						   const char    *title);
+void       fr_window_set_current_batch_action     (FrWindow      *window,
+						   FrBatchActionType  action,
+						   void          *data,
+						   GFreeFunc      free_func);
+void       fr_window_reset_current_batch_action   (FrWindow      *window);
+void       fr_window_restart_current_batch_action (FrWindow      *window);
+void       fr_window_append_batch_action          (FrWindow      *window,
+						   FrBatchActionType  action,
+						   void          *data,
+						   GFreeFunc      free_func);
+void       fr_window_start_batch                  (FrWindow      *window);
+void       fr_window_stop_batch                   (FrWindow      *window);
+void       fr_window_resume_batch                 (FrWindow      *window);
+gboolean   fr_window_is_batch_mode                (FrWindow      *window);
+void       fr_window_set_batch__extract           (FrWindow      *window,
+						   const char    *filename,
+						   const char    *dest_dir);
+void       fr_window_set_batch__extract_here      (FrWindow      *window,
+						   const char    *filename);
+void       fr_window_set_batch__add               (FrWindow      *window,
+						   const char    *archive,
+						   GList         *file_list);
+void       fr_window_destroy_with_error_dialog    (FrWindow      *window);
+
+/**/
+
+gboolean   fr_window_file_list_drag_data_get (FrWindow         *window,
+					      GdkDragContext   *context,
+					      GtkSelectionData *selection_data,
+					      GList            *path_list);
+
+void       fr_window_update_dialog_closed    (FrWindow *window);
+
+void       fr_window_set_close_dialog        (FrWindow *window,
+				               gboolean  state);
+#endif /* FR_WINDOW_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/14.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/14.html new file mode 100644 index 0000000..23216f1 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/14.html @@ -0,0 +1,481 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef TYPEDEFS_H
+#define TYPEDEFS_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MEGABYTE (1024.0 * 1024.0)
+
+#define ADD_FOLDER_OPTIONS_DIR  "engrampa/options"
+
+typedef enum { /*< skip >*/
+	FR_WINDOW_SORT_BY_NAME = 0,
+	FR_WINDOW_SORT_BY_SIZE = 1,
+	FR_WINDOW_SORT_BY_TYPE = 2,
+	FR_WINDOW_SORT_BY_TIME = 3,
+	FR_WINDOW_SORT_BY_PATH = 4
+} FrWindowSortMethod;
+
+typedef enum { /*< skip >*/
+	FR_WINDOW_LIST_MODE_FLAT,
+	FR_WINDOW_LIST_MODE_AS_DIR
+} FrWindowListMode;
+
+typedef enum {
+	FR_COMPRESSION_VERY_FAST,
+	FR_COMPRESSION_FAST,
+	FR_COMPRESSION_NORMAL,
+	FR_COMPRESSION_MAXIMUM
+} FrCompression;
+
+typedef enum {
+	FR_OVERWRITE_YES,
+	FR_OVERWRITE_NO,
+	FR_OVERWRITE_ASK
+} FrOverwrite;
+
+typedef enum { /*< skip >*/
+	FR_PROC_ERROR_NONE,
+	FR_PROC_ERROR_GENERIC,
+	FR_PROC_ERROR_COMMAND_ERROR,
+	FR_PROC_ERROR_COMMAND_NOT_FOUND,
+	FR_PROC_ERROR_EXITED_ABNORMALLY,
+	FR_PROC_ERROR_SPAWN,
+	FR_PROC_ERROR_STOPPED,
+	FR_PROC_ERROR_ASK_PASSWORD,
+	FR_PROC_ERROR_MISSING_VOLUME,
+	FR_PROC_ERROR_IO_CHANNEL,
+	FR_PROC_ERROR_BAD_CHARSET,
+	FR_PROC_ERROR_UNSUPPORTED_FORMAT
+} FrProcErrorType;
+
+typedef struct {
+	FrProcErrorType  type;
+	int              status;
+	GError          *gerror;
+} FrProcError;
+
+typedef enum { /*< skip >*/
+	FR_COMMAND_CAN_DO_NOTHING = 0,
+	FR_COMMAND_CAN_READ = 1 << 0,
+	FR_COMMAND_CAN_WRITE = 1 << 1,
+	FR_COMMAND_CAN_ARCHIVE_MANY_FILES = 1 << 2,
+	FR_COMMAND_CAN_ENCRYPT = 1 << 3,
+	FR_COMMAND_CAN_ENCRYPT_HEADER = 1 << 4,
+	FR_COMMAND_CAN_CREATE_VOLUMES = 1 << 5
+} FrCommandCaps;
+
+#define FR_COMMAND_CAN_READ_WRITE (FR_COMMAND_CAN_READ | FR_COMMAND_CAN_WRITE)
+
+typedef struct {
+	const char    *mime_type;
+	FrCommandCaps  current_capabilities;
+	FrCommandCaps  potential_capabilities;
+} FrMimeTypeCap;
+
+typedef struct {
+	const char *mime_type;
+	const char *packages;
+} FrMimeTypePackages;
+
+typedef struct {
+	int        ref;
+	GType      type;
+	GPtrArray *caps;  /* array of FrMimeTypeCap */
+	GPtrArray *packages;  /* array of FrMimeTypePackages */
+} FrRegisteredCommand;
+
+typedef struct {
+	const char    *mime_type;
+	const char    *default_ext;
+	const char    *name;
+	FrCommandCaps  capabilities;
+} FrMimeTypeDescription;
+
+typedef struct {
+	const char *ext;
+	const char *mime_type;
+} FrExtensionType;
+
+#endif /* TYPEDEFS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/15.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/15.html new file mode 100644 index 0000000..aeb65c0 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/15.html @@ -0,0 +1,665 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_ARCHIVE_H
+#define FR_ARCHIVE_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-process.h"
+#include "fr-command.h"
+
+#define FR_TYPE_ARCHIVE            (fr_archive_get_type ())
+#define FR_ARCHIVE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_ARCHIVE, FrArchive))
+#define FR_ARCHIVE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_ARCHIVE, FrArchiveClass))
+#define FR_IS_ARCHIVE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_ARCHIVE))
+#define FR_IS_ARCHIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_ARCHIVE))
+#define FR_ARCHIVE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_ARCHIVE, FrArchiveClass))
+
+typedef struct _FrArchive         FrArchive;
+typedef struct _FrArchiveClass    FrArchiveClass;
+typedef struct _FrArchivePrivData FrArchivePrivData;
+
+typedef gboolean (*FakeLoadFunc) (FrArchive *archive, gpointer data);
+
+struct _FrArchive {
+	GObject  __parent;
+
+	GFile       *file;
+	GFile       *local_copy;
+	gboolean     is_remote;
+	const char  *content_type;
+	FrCommand   *command;
+	FrProcess   *process;
+	FrProcError  error;
+	gboolean     can_create_compressed_file;
+	gboolean     is_compressed_file;         /* Whether the file is not an
+						  * archive that can contain
+						  * many files but simply a
+						  * compressed file, for
+						  * example foo.txt.gz is a
+						  * compressed file, foo.zip
+						  * is not. */
+	gboolean     read_only;                  /* Whether archive is
+						  * read-only for whatever
+						  * reason. */
+	gboolean     have_permissions;           /* true if we have the
+						  * permissions to write the
+						  * file. */
+
+	FrArchivePrivData *priv;
+};
+
+struct _FrArchiveClass {
+	GObjectClass __parent_class;
+
+	/* -- Signals -- */
+
+	void (*start)            (FrArchive   *archive,
+			          FrAction     action);
+	void (*done)             (FrArchive   *archive,
+			          FrAction     action,
+			          FrProcError *error);
+	void (*progress)         (FrArchive   *archive,
+			          double       fraction);
+	void (*message)          (FrArchive   *archive,
+			          const char  *msg);
+	void (*stoppable)        (FrArchive   *archive,
+			          gboolean     value);
+	void (*working_archive)  (FrCommand   *comm,
+			          const char  *filename);
+};
+
+GType       fr_archive_get_type                  (void);
+FrArchive * fr_archive_new                       (void);
+void        fr_archive_set_fake_load_func        (FrArchive       *archive,
+						  FakeLoadFunc     func,
+						  gpointer         data);
+gboolean    fr_archive_fake_load                 (FrArchive       *archive);
+void        fr_archive_stoppable                 (FrArchive       *archive,
+						  gboolean         stoppable);
+void        fr_archive_stop	                 (FrArchive       *archive);
+void        fr_archive_action_completed          (FrArchive       *archive,
+						  FrAction         action,
+						  FrProcErrorType  error_type,
+						  const char      *error_details);
+
+/**/
+
+gboolean    fr_archive_create                    (FrArchive       *archive,
+						  const char      *uri);
+gboolean    fr_archive_load                      (FrArchive       *archive,
+						  const char      *uri,
+						  const char      *password);
+gboolean    fr_archive_load_local                (FrArchive       *archive,
+		       				  const char      *uri,
+		       				  const char      *password);
+void        fr_archive_reload                    (FrArchive       *archive,
+						  const char      *password);
+
+/**/
+
+void        fr_archive_add                       (FrArchive       *archive,
+						  GList           *file_list,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  gboolean         recursive,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_remove                    (FrArchive       *archive,
+						  GList           *file_list,
+						  FrCompression    compression);
+void        fr_archive_extract                   (FrArchive       *archive,
+						  GList           *file_list,
+						  const char      *dest_uri,
+						  const char      *base_dir,
+						  gboolean         skip_older,
+						  gboolean         overwrite,
+						  gboolean         junk_path,
+						  const char      *password);
+void        fr_archive_extract_to_local          (FrArchive       *archive,
+						  GList           *file_list,
+						  const char      *dest_path,
+						  const char      *base_dir,
+						  gboolean         skip_older,
+						  gboolean         overwrite,
+						  gboolean         junk_path,
+						  const char      *password);
+gboolean    fr_archive_extract_here              (FrArchive       *archive,
+						  gboolean         skip_older,
+						  gboolean         overwrite,
+						  gboolean         junk_path,
+						  const char      *password);
+const char *fr_archive_get_last_extraction_destination
+						 (FrArchive       *archive);
+
+/**/
+
+void        fr_archive_add_files                 (FrArchive       *archive,
+						  GList           *file_list,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_add_with_wildcard         (FrArchive       *archive,
+						  const char      *include_files,
+						  const char      *exclude_files,
+						  const char      *exclude_folders,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  gboolean         follow_links,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_add_directory             (FrArchive       *archive,
+						  const char      *directory,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_add_items                 (FrArchive       *archive,
+						  GList           *item_list,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_add_dropped_items         (FrArchive       *archive,
+						  GList           *item_list,
+						  const char      *base_dir,
+						  const char      *dest_dir,
+						  gboolean         update,
+						  const char      *password,
+						  gboolean         encrypt_header,
+						  FrCompression    compression,
+						  guint            volume_size);
+void        fr_archive_test                      (FrArchive       *archive,
+						  const char      *password);
+
+/* utilities */
+
+gboolean    uri_is_archive                       (const char      *uri);
+
+#endif /* FR_ARCHIVE_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/16.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/16.html new file mode 100644 index 0000000..9698859 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/16.html @@ -0,0 +1,511 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_PROCESS_H
+#define FR_PROCESS_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "typedefs.h"
+
+#define FR_TYPE_PROCESS            (fr_process_get_type ())
+#define FR_PROCESS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_PROCESS, FrProcess))
+#define FR_PROCESS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_PROCESS, FrProcessClass))
+#define FR_IS_PROCESS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_PROCESS))
+#define FR_IS_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_PROCESS))
+#define FR_PROCESS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_PROCESS, FrProcessClass))
+
+typedef struct _FrProcess        FrProcess;
+typedef struct _FrProcessClass   FrProcessClass;
+typedef struct _FrProcessPrivate FrProcessPrivate;
+
+typedef void     (*ProcFunc)     (gpointer data);
+typedef gboolean (*ContinueFunc) (gpointer data);
+typedef void     (*LineFunc)     (char *line, gpointer data);
+
+typedef struct {
+	GIOChannel *source;
+	GList      *raw;
+	LineFunc    line_func;
+	gpointer    line_data;
+	GIOStatus   status;
+	GError     *error;
+} FrChannelData;
+
+struct _FrProcess {
+	GObject  __parent;
+
+	/*< public >*/
+
+	gboolean          term_on_stop;  /* whether we must terminate the
+					  * command when calling
+					  * fr_process_stop. */
+
+	/*< public read-only >*/
+
+	FrChannelData     out;
+	FrChannelData     err;
+	FrProcError       error;
+
+	/*< protected >*/
+
+	gboolean          restart;       /* whether to restart the process
+			  		  * after an error. */
+
+	FrProcessPrivate *priv;
+};
+
+struct _FrProcessClass {
+	GObjectClass __parent_class;
+
+	/* -- Signals -- */
+
+	void (* start)         (FrProcess   *fr_proc);
+	void (* done)          (FrProcess   *fr_proc,
+				FrProcError *error);
+	void (* sticky_only)   (FrProcess   *fr_proc);
+};
+
+GType       fr_process_get_type             (void);
+FrProcess * fr_process_new                  (void);
+void        fr_process_clear                (FrProcess    *fr_proc);
+void        fr_process_begin_command        (FrProcess    *fr_proc,
+					     const char   *arg);
+void        fr_process_begin_command_at     (FrProcess    *fr_proc,
+					     const char   *arg,
+					     int           index);
+void        fr_process_add_arg              (FrProcess    *fr_proc,
+					     const char   *arg);
+void        fr_process_add_arg_concat       (FrProcess    *fr_proc,
+					     const char   *arg,
+					     ...) G_GNUC_NULL_TERMINATED;
+void        fr_process_add_arg_printf       (FrProcess    *fr_proc,
+					     const char   *format,
+					     ...) G_GNUC_PRINTF (2, 3);
+void        fr_process_set_arg_at           (FrProcess    *fr_proc,
+					     int           n_comm,
+					     int           n_arg,
+					     const char   *arg);
+void        fr_process_set_begin_func       (FrProcess    *fr_proc,
+					     ProcFunc      func,
+					     gpointer      func_data);
+void        fr_process_set_end_func         (FrProcess    *fr_proc,
+					     ProcFunc      func,
+					     gpointer      func_data);
+void        fr_process_set_continue_func    (FrProcess    *fr_proc,
+					     ContinueFunc  func,
+					     gpointer      func_data);
+void        fr_process_end_command          (FrProcess    *fr_proc);
+void        fr_process_set_working_dir      (FrProcess    *fr_proc,
+					     const char   *arg);
+void        fr_process_set_sticky           (FrProcess    *fr_proc,
+					     gboolean      sticky);
+void        fr_process_set_ignore_error     (FrProcess    *fr_proc,
+					     gboolean      ignore_error);
+void        fr_process_use_standard_locale  (FrProcess    *fr_proc,
+					     gboolean      use_stand_locale);
+void        fr_process_set_out_line_func    (FrProcess    *fr_proc,
+					     LineFunc      func,
+					     gpointer      func_data);
+void        fr_process_set_err_line_func    (FrProcess    *fr_proc,
+					     LineFunc      func,
+					     gpointer      func_data);
+void        fr_process_start                (FrProcess    *fr_proc);
+void        fr_process_stop                 (FrProcess    *fr_proc);
+int         start_switch_state              (FrProcess    *fr_proc);
+void        start_close_suspend_process     (FrProcess    *fr_proc);
+#endif /* FR_PROCESS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/17.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/17.html new file mode 100644 index 0000000..23a2418 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/17.html @@ -0,0 +1,691 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_H
+#define FR_COMMAND_H
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-process.h"
+
+#define PACKAGES(x) (x)
+
+#define FR_TYPE_COMMAND            (fr_command_get_type ())
+#define FR_COMMAND(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND, FrCommand))
+#define FR_COMMAND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND, FrCommandClass))
+#define FR_IS_COMMAND(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND))
+#define FR_IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND))
+#define FR_COMMAND_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND, FrCommandClass))
+
+typedef struct _FrCommand         FrCommand;
+typedef struct _FrCommandClass    FrCommandClass;
+
+typedef enum {
+	FR_ACTION_NONE,
+	FR_ACTION_CREATING_NEW_ARCHIVE,
+	FR_ACTION_LOADING_ARCHIVE,            /* loading the archive from a remote location */
+	FR_ACTION_LISTING_CONTENT,            /* listing the content of the archive */
+	FR_ACTION_DELETING_FILES,             /* deleting files from the archive */
+	FR_ACTION_TESTING_ARCHIVE,            /* testing the archive integrity */
+	FR_ACTION_GETTING_FILE_LIST,          /* getting the file list (when fr_archive_add_with_wildcard or
+						 fr_archive_add_directory are used, we need to scan a directory
+						 and collect the files to add to the archive, this
+						 may require some time to complete, so the operation
+						 is asynchronous) */
+	FR_ACTION_COPYING_FILES_FROM_REMOTE,  /* copying files to be added to the archive from a remote location */
+	FR_ACTION_ADDING_FILES,               /* adding files to an archive */
+	FR_ACTION_EXTRACTING_FILES,           /* extracting files */
+	FR_ACTION_COPYING_FILES_TO_REMOTE,    /* copying extracted files to a remote location */
+	FR_ACTION_CREATING_ARCHIVE,           /* creating a local archive */
+	FR_ACTION_SAVING_REMOTE_ARCHIVE       /* copying the archive to a remote location */
+} FrAction;
+
+#ifdef MATE_ENABLE_DEBUG
+const char * get_action_name (FrAction action);
+#endif
+
+struct _FrCommand
+{
+	GObject  __parent;
+
+	/*<public, read only>*/
+
+	GPtrArray     *files;           /* Array of FileData* */
+	int            n_regular_files;
+	FrProcess     *process;         /* the process object used to execute
+				         * commands. */
+	char          *filename;        /* archive file path. */
+	char          *e_filename;      /* escaped archive filename. */
+	const char    *mime_type;
+	gboolean       multi_volume;
+
+	/*<protected>*/
+
+	/* options */
+
+	char          *password;
+	gboolean       encrypt_header : 1;
+	FrCompression  compression;
+	guint          volume_size;
+	gboolean       creating_archive;
+
+	/* features. */
+
+	guint          propAddCanUpdate : 1;
+	guint          propAddCanReplace : 1;
+	guint          propAddCanStoreFolders : 1;
+	guint          propExtractCanAvoidOverwrite : 1;
+	guint          propExtractCanSkipOlder : 1;
+	guint          propExtractCanJunkPaths : 1;
+	guint          propPassword : 1;
+	guint          propTest : 1;
+	guint          propCanExtractAll : 1;
+	guint          propCanDeleteNonEmptyFolders : 1;
+	guint          propCanExtractNonEmptyFolders : 1;
+	guint          propListFromFile : 1;
+
+	/*<private>*/
+
+	FrCommandCaps  capabilities;
+	FrAction       action;        /* current action. */
+	gboolean       fake_load;     /* if TRUE does nothing when the list
+				       * operation is invoked. */
+
+	/* progress data */
+
+	int            n_file;
+	int            n_files;
+};
+
+struct _FrCommandClass
+{
+	GObjectClass __parent_class;
+
+	/*<virtual functions>*/
+
+	void          (*list)             (FrCommand     *comm);
+	void          (*add)              (FrCommand     *comm,
+					   const char    *from_file,
+				           GList         *file_list,
+				           const char    *base_dir,
+				           gboolean       update,
+				           gboolean       recursive);
+	void          (*delete)           (FrCommand     *comm,
+			                   const char    *from_file,
+				           GList         *file_list);
+	void          (*extract)          (FrCommand     *comm,
+			                   const char    *from_file,
+				           GList         *file_list,
+				           const char    *dest_dir,
+				           gboolean       overwrite,
+				           gboolean       skip_older,
+				           gboolean       junk_paths);
+	void          (*test)             (FrCommand     *comm);
+	void          (*uncompress)       (FrCommand     *comm);
+	void          (*recompress)       (FrCommand     *comm);
+	void          (*handle_error)     (FrCommand     *comm,
+				           FrProcError   *error);
+	const char ** (*get_mime_types)   (FrCommand     *comm);
+	FrCommandCaps (*get_capabilities) (FrCommand     *comm,
+					   const char    *mime_type,
+					   gboolean       check_command);
+	void          (*set_mime_type)    (FrCommand     *comm,
+				           const char    *mime_type);
+	const char *  (*get_packages)     (FrCommand     *comm,
+					   const char    *mime_type);
+
+	/*<signals>*/
+
+	void          (*start)            (FrCommand   *comm,
+			 	           FrAction     action);
+	void          (*done)             (FrCommand   *comm,
+				           FrAction     action,
+				           FrProcError *error);
+	void          (*progress)         (FrCommand   *comm,
+				           double       fraction);
+	void          (*message)          (FrCommand   *comm,
+				           const char  *msg);
+	void          (*working_archive)  (FrCommand   *comm,
+					   const char  *filename);
+};
+
+GType          fr_command_get_type            (void);
+void           fr_command_set_file            (FrCommand     *comm,
+					       GFile         *file);
+void           fr_command_set_multi_volume    (FrCommand     *comm,
+					       GFile         *file);
+void           fr_command_list                (FrCommand     *comm);
+void           fr_command_add                 (FrCommand     *comm,
+					       const char    *from_file,
+					       GList         *file_list,
+					       const char    *base_dir,
+					       gboolean       update,
+					       gboolean       recursive);
+void           fr_command_delete              (FrCommand     *comm,
+					       const char    *from_file,
+					       GList         *file_list);
+void           fr_command_extract             (FrCommand     *comm,
+					       const char    *from_file,
+					       GList         *file_list,
+					       const char    *dest_dir,
+					       gboolean       overwrite,
+					       gboolean       skip_older,
+					       gboolean       junk_paths);
+void           fr_command_test                (FrCommand     *comm);
+void           fr_command_uncompress          (FrCommand     *comm);
+void           fr_command_recompress          (FrCommand     *comm);
+gboolean       fr_command_is_capable_of       (FrCommand     *comm,
+					       FrCommandCaps  capabilities);
+const char **  fr_command_get_mime_types      (FrCommand     *comm);
+void           fr_command_update_capabilities (FrCommand     *comm);
+FrCommandCaps  fr_command_get_capabilities    (FrCommand     *comm,
+					       const char    *mime_type,
+					       gboolean       check_command);
+void           fr_command_set_mime_type       (FrCommand     *comm,
+					       const char    *mime_type);
+const char *   fr_command_get_packages        (FrCommand     *comm,
+					       const char    *mime_type);
+
+/* protected functions */
+
+void           fr_command_progress            (FrCommand     *comm,
+					       double         fraction);
+void           fr_command_message             (FrCommand     *comm,
+					       const char    *msg);
+void           fr_command_working_archive     (FrCommand     *comm,
+		                               const char    *archive_name);
+void           fr_command_set_n_files         (FrCommand     *comm,
+					       int            n_files);
+void           fr_command_add_file            (FrCommand     *comm,
+					       FileData      *fdata);
+
+/* private functions */
+
+void           fr_command_handle_error        (FrCommand     *comm,
+					       FrProcError   *error);
+
+#endif /* FR_COMMAND_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/18.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/18.html new file mode 100644 index 0000000..b3b003d --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/18.html @@ -0,0 +1,381 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FILE_DATA_H
+#define FILE_DATA_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct {
+	char       *original_path;    /* path read from command line. */
+	char       *full_path;        /* "/" + original_path. */
+	char       *link;
+	goffset     size;
+	time_t      modified;
+
+	char       *name;             /* The file name. */
+	char       *path;             /* The directory. */
+	gboolean    encrypted;        /* Whether the file is encrypted. */
+	gboolean    dir;              /* Whether this is a directory listed in the archive */
+	goffset     dir_size;
+	const char *content_type;
+
+	/* Additional data. */
+
+	gboolean    list_dir;         /* Whether this entry is used to show
+				       * a directory. */
+	char       *list_name;        /* The string visualized in the list
+				       * view. */
+	char       *sort_key;
+
+	/* Private data */
+
+	gboolean    free_original_path;
+} FileData;
+
+#define FR_TYPE_FILE_DATA (file_data_get_type ())
+
+GType           file_data_get_type            (void);
+FileData *      file_data_new                 (void);
+FileData *      file_data_copy                (FileData      *src);
+void            file_data_free                (FileData      *fdata);
+void            file_data_update_content_type (FileData      *fdata);
+gboolean        file_data_is_dir              (FileData      *fdata);
+void            file_data_set_list_name       (FileData      *fdata,
+					       const char    *value);
+int  file_data_compare_by_path                (gconstpointer  a,
+				               gconstpointer  b);
+int  find_path_in_file_data_array             (GPtrArray     *array,
+				               const char    *path);
+
+#endif /* FILE_DATA_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/19.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/19.html new file mode 100644 index 0000000..33cf34e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/19.html @@ -0,0 +1,297 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DLG_ADD_FILES_H
+#define DLG_ADD_FILES_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+void  add_files_cb (GtkWidget *widget, void *data);
+
+#endif /* DLG_ADD_FILES_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/2.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/2.html new file mode 100644 index 0000000..1b9833d --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/2.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Paolo Bacchilega <paobac@cvs.mate.org>
+ *
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libcaja-extension/caja-extension-types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libcaja-extension/caja-column-provider.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "caja-engrampa.h"
+
+void
+caja_module_initialize (GTypeModule*module)
+{
+	caja_fr_register_type (module);
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+}
+
+void
+caja_module_shutdown (void)
+{
+}
+
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+	static GType type_list[1];
+
+	type_list[0] = CAJA_TYPE_FR;
+	*types = type_list;
+	*num_types = 1;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/20.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/20.html new file mode 100644 index 0000000..bb58147 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/20.html @@ -0,0 +1,297 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DLG_ADD_FOLDER_H
+#define DLG_ADD_FOLDER_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+void  add_folder_cb (GtkWidget *widget, void *data);
+
+#endif /* DLG_ADD_FOLDER_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/21.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/21.html new file mode 100644 index 0000000..76025b6 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/21.html @@ -0,0 +1,353 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DLG_NEW_H
+#define DLG_NEW_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "eggfileformatchooser.h"
+#include "fr-window.h"
+
+typedef struct {
+	FrWindow   *window;
+	int        *supported_types;
+	gboolean    can_encrypt;
+	gboolean    can_encrypt_header;
+	gboolean    can_create_volumes;
+	GtkBuilder *builder;
+
+	GFile      *original_file;
+	GtkWidget  *dialog;
+	/*GtkWidget  *n_archive_type_combo_box;*/
+	GtkWidget  *n_other_options_expander;
+	GtkWidget  *n_password_entry;
+	GtkWidget  *n_password_label;
+	GtkWidget  *n_encrypt_header_checkbutton;
+	GtkWidget  *n_volume_checkbutton;
+	GtkWidget  *n_volume_spinbutton;
+	GtkWidget  *n_volume_box;
+	EggFileFormatChooser *format_chooser;
+} DlgNewData;
+
+DlgNewData *    dlg_new                          (FrWindow   *window);
+DlgNewData *    dlg_save_as                      (FrWindow   *window,
+	 		                          const char *default_name);
+const char *    dlg_new_data_get_password        (DlgNewData *data);
+gboolean        dlg_new_data_get_encrypt_header  (DlgNewData *data);
+int             dlg_new_data_get_volume_size     (DlgNewData *data);
+
+#endif /* DLG_NEW_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/22.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/22.html new file mode 100644 index 0000000..9545e54 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/22.html @@ -0,0 +1,407 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
/* EggFileFormatChooser
+ * Copyright (C) 2007 Mathias Hasselmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __EGG_FILE_FORMAT_CHOOSER_H__
+#define __EGG_FILE_FORMAT_CHOOSER_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_FILE_FORMAT_CHOOSER           (egg_file_format_chooser_get_type())
+#define EGG_FILE_FORMAT_CHOOSER(obj)           (G_TYPE_CHECK_INSTANCE_CAST(obj, EGG_TYPE_FILE_FORMAT_CHOOSER, EggFileFormatChooser))
+#define EGG_FILE_FORMAT_CHOOSER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST(klass, EGG_TYPE_FILE_FORMAT_CHOOSER, EggFileFormatChooserClass))
+#define EGG_IS_FILE_FORMAT_CHOOSER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE(obj, EGG_TYPE_FILE_FORMAT_CHOOSER))
+#define EGG_IS_FILE_FORMAT_CHOOSER_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE(obj, EGG_TYPE_FILE_FORMAT_CHOOSER))
+#define EGG_FILE_FORMAT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_FILE_FORMAT_CHOOSER, EggFileFormatChooserClass))
+
+typedef struct _EggFileFormatChooser        EggFileFormatChooser;
+typedef struct _EggFileFormatChooserClass   EggFileFormatChooserClass;
+typedef struct _EggFileFormatChooserPrivate EggFileFormatChooserPrivate;
+
+struct _EggFileFormatChooser
+{
+  GtkExpander parent;
+  EggFileFormatChooserPrivate *priv;
+};
+
+struct _EggFileFormatChooserClass
+{
+  GtkExpanderClass parent;
+
+  void (*selection_changed)(EggFileFormatChooser *self);
+};
+
+GType           egg_file_format_chooser_get_type           (void) G_GNUC_CONST;
+GtkWidget*      egg_file_format_chooser_new                (void);
+
+guint           egg_file_format_chooser_add_format         (EggFileFormatChooser *self,
+                                                            guint                 parent,
+                                                            const gchar          *name,
+                                                            const gchar          *icon,
+                                                            ...) G_GNUC_NULL_TERMINATED;
+void            egg_file_format_chooser_add_pixbuf_formats (EggFileFormatChooser *self,
+                                                            guint                 parent,
+                                                            guint               **formats);
+void            egg_file_format_chooser_remove_format      (EggFileFormatChooser *self,
+                                                            guint                 format);
+
+void            egg_file_format_chooser_set_format         (EggFileFormatChooser *self,
+                                                            guint                 format);
+guint           egg_file_format_chooser_get_format         (EggFileFormatChooser *self,
+                                                            const gchar          *filename);
+
+void            egg_file_format_chooser_set_format_data    (EggFileFormatChooser *self,
+                                                            guint                 format,
+                                                            gpointer              data,
+                                                            GDestroyNotify        destroy);
+gpointer        egg_file_format_chooser_get_format_data    (EggFileFormatChooser *self,
+                                                            guint                 format);
+
+gchar*          egg_file_format_chooser_append_extension   (EggFileFormatChooser *self,
+                                                            const gchar          *filename,
+                                                            guint                 format);
+void            egg_file_format_chooser_emit_size_changed  (EggFileFormatChooser *self);
+
+G_END_DECLS
+
+#endif /* __EGG_FILE_FORMAT_CHOOSER_H__ */
+
+/* vim: set sw=2 sta et: */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/23.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/23.html new file mode 100644 index 0000000..bf6dbb1 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/23.html @@ -0,0 +1,301 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DLG_OPEN_WITH_H
+#define DLG_OPEN_WITH_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-window.h"
+
+void  open_with_cb  (GtkWidget *widget, void *data);
+void  dlg_open_with (FrWindow *window, GList *file_list);
+
+#endif /* DLG_OPEN_WITH_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/24.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/24.html new file mode 100644 index 0000000..7b3a1c9 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/24.html @@ -0,0 +1,379 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GTK_UTILS_H
+#define GTK_UTILS_H
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+GtkWidget*  _gtk_message_dialog_new         (GtkWindow        *parent,
+					     GtkDialogFlags    flags,
+					     const char       *icon_name,
+					     const char       *message,
+					     const char       *secondary_message,
+					     const char       *first_button_text,
+					     ...);
+gchar*      _gtk_request_dialog_run         (GtkWindow        *parent,
+					     GtkDialogFlags    flags,
+					     const char       *title,
+					     const char       *message,
+					     const char       *default_value,
+					     int               max_length,
+					     const char       *no_button_text,
+					     const char       *yes_button_text);
+GtkWidget*  _gtk_error_dialog_new           (GtkWindow        *parent,<--- There is an unknown macro here somewhere. Configuration is required. If _gtk_error_dialog_new is a macro then please configure it.
+					     GtkDialogFlags    flags,
+					     GList            *row_output,
+					     const char       *primary_text,
+					     const char       *secondary_text,
+					     ...) G_GNUC_PRINTF (5, 6);
+void        _gtk_error_dialog_run           (GtkWindow        *parent,
+					     const gchar      *main_message,
+					     const gchar      *format,
+					     ...);
+void        _gtk_entry_set_locale_text      (GtkEntry   *entry,
+					     const char *text);
+char *      _gtk_entry_get_locale_text      (GtkEntry   *entry);
+void        _gtk_entry_set_filename_text    (GtkEntry   *entry,
+					     const char *text);
+GdkPixbuf * get_icon_pixbuf                 (GIcon        *icon,
+		 			     int           size,
+		 			     GtkIconTheme *icon_theme);
+GdkPixbuf * get_mime_type_pixbuf            (const char   *mime_type,
+		                             int           icon_size,
+		                             GtkIconTheme *icon_theme);
+void        show_help_dialog                (GtkWindow    *parent,
+					     const char   *section);
+
+int	    _gtk_widget_lookup_for_size	    (GtkWidget *widget,
+					     GtkIconSize icon_size);
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/25.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/25.html new file mode 100644 index 0000000..22ab2f1 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/25.html @@ -0,0 +1,475 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FILE_UTILS_H
+#define FILE_UTILS_H
+
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MIME_TYPE_DIRECTORY "folder"
+#define MIME_TYPE_ARCHIVE "application/x-archive"
+
+#define get_home_relative_path(x)        \
+	g_strconcat (g_get_home_dir (), \
+		     "/",               \
+		     (x),               \
+		     NULL)
+
+gboolean            uri_exists                   (const char  *uri);
+gboolean            uri_is_file                  (const char  *uri);
+gboolean            uri_is_dir                   (const char  *uri);
+gboolean            path_is_dir                  (const char  *path);
+gboolean            uri_is_local                 (const char  *uri);
+char *              get_dir_content_if_unique    (const char  *uri);
+gboolean            path_in_path                 (const char  *path_src,
+						  const char  *path_dest);
+goffset             get_file_size                (const char  *uri);
+goffset             get_file_size_for_path       (const char  *path);
+time_t              get_file_mtime               (const char  *uri);
+time_t              get_file_mtime_for_path      (const char  *path);
+gboolean            make_directory_tree          (GFile       *dir,
+		     				  mode_t       mode,
+		     				  GError     **error);
+gboolean            ensure_dir_exists            (const char  *uri,
+						  mode_t       mode,
+						  GError     **error);
+gboolean            make_directory_tree_from_path (const char  *path,
+		   	                           mode_t       mode,
+		   	                           GError     **error);
+const char* file_name_from_path(const char* path);
+char *              dir_name_from_path           (const char  *path);
+char *              remove_level_from_path       (const char  *path);
+char *              remove_ending_separator      (const char  *path);
+char *              build_uri                    (const char  *base, ...);
+char *              remove_extension_from_path   (const char  *path);
+const char *        get_file_extension           (const char  *filename);
+gboolean            file_extension_is            (const char  *filename,
+						  const char  *ext);
+gboolean            is_mime_type                 (const char  *type,
+						  const char  *pattern);
+const char*         get_file_mime_type           (const char  *uri,
+                    				  gboolean     fast_file_type);
+const char*         get_file_mime_type_for_path  (const char  *filename,
+                    				  gboolean     fast_file_type);
+guint64             get_dest_free_space          (const char  *path);
+gboolean            remove_directory             (const char  *uri);
+gboolean            remove_local_directory       (const char  *directory);
+char *              get_temp_work_dir            (const char  *parent_folder);
+gboolean            is_temp_work_dir             (const char *dir);
+gboolean            is_temp_dir                  (const char *dir);
+
+/* misc functions used to parse a command output lines. */
+
+gboolean            file_list__match_pattern     (const char *line,
+						  const char *pattern);
+int                 file_list__get_index_from_pattern (const char *line,
+						       const char *pattern);
+char*               file_list__get_prev_field    (const char *line,
+						  int         start_from,
+						  int         field_n);
+gboolean            check_permissions            (const char *path,
+						  int         mode);
+gboolean            check_file_permissions       (GFile      *file,
+						  int         mode);
+gboolean 	    is_program_in_path		 (const char *filename);
+gboolean 	    is_program_available	 (const char *filename,
+						  gboolean    check);
+
+/* URI utils */
+
+const char *        get_home_uri                 (void);
+GFile *             get_user_config_subdirectory (const char *child_name,
+						  gboolean    create_);
+int                 uricmp                       (const char *uri1,
+						  const char *uri2);
+char *              get_alternative_uri          (const char *folder,
+	     					  const char *name);
+char *              get_alternative_uri_for_uri  (const char *uri);
+
+void                path_list_free               (GList       *path_list);
+GList *             path_list_dup                (GList       *path_list);
+
+GList *             gio_file_list_dup               (GList *l);
+void                gio_file_list_free              (GList *l);
+void                g_key_file_save                 (GKeyFile *key_file,
+						     GFile    *file);
+
+#endif /* FILE_UTILS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/26.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/26.html new file mode 100644 index 0000000..0378545 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/26.html @@ -0,0 +1,397 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _GLIB_UTILS_H
+#define _GLIB_UTILS_H
+
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define g_signal_handlers_disconnect_by_data(instance, data) \
+    g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, \
+					  0, 0, NULL, NULL, (data))
+
+/* gobject utils */
+
+void _g_object_unref (gpointer object);
+
+/* string utils */
+
+gboolean            strchrs                      (const char *str,
+						  const char *chars);
+char *              str_substitute               (const char *str,
+						  const char *from_str,
+						  const char *to_str);
+char*               escape_str                   (const char  *str,
+						  const char  *meta_chars);
+gboolean            match_regexps                (GRegex     **regexps,
+						  const char  *string,
+						  GRegexMatchFlags match_options);
+char **             search_util_get_patterns     (const char  *pattern_string);
+GRegex **           search_util_get_regexps      (const char  *pattern_string,
+			                          GRegexCompileFlags  compile_options);
+void                free_regexps                 (GRegex     **regexps);
+const char *        eat_spaces                   (const char  *line);
+char **             split_line                   (const char  *line,
+						  int          n_fields);
+const char *        get_last_field               (const char  *line,
+						  int          last_field);
+const char *        get_static_string            (const char  *s);
+char*               g_uri_display_basename       (const char  *uri);
+
+/* path filename */
+
+const char *        _g_path_get_file_name          (const char          *path);
+const char *        _g_path_get_base_name          (const char          *path,
+						    const char          *base_dir,
+						    gboolean             junk_paths);
+
+/**/
+
+#ifndef __GNUC__
+#define __FUNCTION__ ""
+#endif
+
+#define DEBUG_INFO __FILE__, __LINE__, __FUNCTION__
+
+void     debug                     (const char *file,
+				    int         line,
+				    const char *function,
+				    const char *format, ...);
+
+#endif /* _GLIB_UTILS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/27.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/27.html new file mode 100644 index 0000000..8cbc453 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/27.html @@ -0,0 +1,415 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PREFERENCES_H
+#define PREFERENCES_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "typedefs.h"
+#include "fr-window.h"
+
+#define ENGRAMPA_SCHEMA			"org.mate.engrampa"
+#define ENGRAMPA_SCHEMA_LISTING		ENGRAMPA_SCHEMA	".listing"
+#define ENGRAMPA_SCHEMA_UI		ENGRAMPA_SCHEMA	".ui"
+#define ENGRAMPA_SCHEMA_GENERAL		ENGRAMPA_SCHEMA	".general"
+#define ENGRAMPA_SCHEMA_DIALOGS		ENGRAMPA_SCHEMA	".dialogs"
+#define ENGRAMPA_SCHEMA_ADD		ENGRAMPA_SCHEMA_DIALOGS	".add"
+#define ENGRAMPA_SCHEMA_BATCH_ADD 	ENGRAMPA_SCHEMA_DIALOGS ".batch-add"
+#define ENGRAMPA_SCHEMA_EXTRACT		ENGRAMPA_SCHEMA_DIALOGS ".extract"
+#define ENGRAMPA_SCHEMA_LAST_OUTPUT	ENGRAMPA_SCHEMA_DIALOGS ".last-output"
+
+#define PREF_LISTING_SORT_METHOD	"sort-method"
+#define PREF_LISTING_SORT_TYPE		"sort-type"
+#define PREF_LISTING_LIST_MODE		"list-mode"
+#define PREF_LISTING_SHOW_TYPE		"show-type"
+#define PREF_LISTING_SHOW_SIZE		"show-size"
+#define PREF_LISTING_SHOW_TIME		"show-time"
+#define PREF_LISTING_SHOW_PATH		"show-path"
+#define PREF_LISTING_USE_MIME_ICONS	"use-mime-icons"
+#define PREF_LISTING_NAME_COLUMN_WIDTH	"name-column-width"
+
+#define PREF_UI_WINDOW_WIDTH		"window-width"
+#define PREF_UI_WINDOW_HEIGHT		"window-height"
+#define PREF_UI_SIDEBAR_WIDTH		"sidebar-width"
+#define PREF_UI_HISTORY_LEN		"history-len"
+#define PREF_UI_VIEW_TOOLBAR		"view-toolbar"
+#define PREF_UI_VIEW_STATUSBAR		"view-statusbar"
+#define PREF_UI_VIEW_FOLDERS		"view-folders"
+
+#define PREF_GENERAL_EDITORS		"editors"
+#define PREF_GENERAL_COMPRESSION_LEVEL	"compression-level"
+#define PREF_GENERAL_ENCRYPT_HEADER	"encrypt-header"
+
+#define PREF_EXTRACT_OVERWRITE		"overwrite"
+#define PREF_EXTRACT_SKIP_NEWER		"skip-newer"
+#define PREF_EXTRACT_CLOSE_DIALOG	"close-dialog"
+#define PREF_EXTRACT_RECREATE_FOLDERS	"recreate-folders"
+#define PREF_EXTRACT_CREATE_SUBDIR	"create-subdirectory"
+
+#define PREF_ADD_CURRENT_FOLDER		"current-folder"
+#define PREF_ADD_FILENAME		"filename"
+#define PREF_ADD_INCLUDE_FILES		"include-files"
+#define PREF_ADD_EXCLUDE_FILES		"exclude-files"
+#define PREF_ADD_EXCLUDE_FOLDERS	"exclude-folders"
+#define PREF_ADD_UPDATE			"update"
+#define PREF_ADD_RECURSIVE		"recursive"
+#define PREF_ADD_NO_SYMLINKS		"no-symlinks"
+
+#define PREF_BATCH_ADD_DEFAULT_EXTENSION "default-extension"
+#define PREF_BATCH_ADD_OTHER_OPTIONS	 "other-options"
+#define PREF_BATCH_ADD_VOLUME_SIZE	 "volume-size"
+
+#define CAJA_SCHEMA			"org.mate.caja.preferences"
+#define CAJA_CLICK_POLICY		"click-policy"
+
+void pref_util_save_window_geometry (GtkWindow *window,
+                                     const char *dialog_id);
+void pref_util_restore_window_geometry (GtkWindow *window,
+                                       const char *dialog_id);
+
+#endif /* PREFERENCES_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/28.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/28.html new file mode 100644 index 0000000..ec24e73 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/28.html @@ -0,0 +1,571 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "fr-window.h"
+#include "gtk-utils.h"
+#include "preferences.h"
+#include "dlg-add-files.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef struct {
+	FrWindow  *window;
+	GSettings *settings;
+	GtkWidget *dialog;
+	GtkWidget *add_if_newer_checkbutton;
+} DialogData;
+
+static void
+open_file_destroy_cb (GtkWidget  *file_sel,
+		      DialogData *data)
+{
+	g_object_unref (data->settings);
+	g_free (data);
+}
+
+static int
+file_sel_response_cb (GtkWidget      *widget,
+		      int             response,
+		      DialogData     *data)
+{
+	GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget);
+	FrWindow       *window = data->window;
+	char           *current_folder;
+	char           *uri;
+	gboolean        update;
+	GSList         *selections, *iter;
+	GList          *item_list = NULL;
+
+	current_folder = gtk_file_chooser_get_current_folder_uri (file_sel);
+	uri = gtk_file_chooser_get_uri (file_sel);
+
+	if (current_folder != NULL) {
+		g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, current_folder);
+		fr_window_set_add_default_dir (window, current_folder);
+	}
+
+	if (uri != NULL)
+	{
+		g_settings_set_string (data->settings, PREF_ADD_FILENAME, uri);
+		g_free (uri);
+	}
+
+	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+		gtk_widget_destroy (data->dialog);
+		g_free (current_folder);
+		return TRUE;
+	}
+
+	if (response == GTK_RESPONSE_HELP) {
+		show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-add-options");
+		g_free (current_folder);
+		return TRUE;
+	}
+
+	/* check folder permissions. */
+
+	if (uri_is_dir (current_folder) && ! check_permissions (current_folder, R_OK)) {
+		GtkWidget *d;
+		char      *utf8_path;
+
+		utf8_path = g_filename_display_name (current_folder);
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_MODAL,
+					   NULL,
+					   _("Could not add the files to the archive"),
+					   _("You don't have the right permissions to read files from folder \"%s\""),
+					   utf8_path);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (utf8_path);
+		g_free (current_folder);
+		return FALSE;
+	}
+
+	update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));
+
+	/**/
+
+	selections = gtk_file_chooser_get_uris (file_sel);
+	for (iter = selections; iter != NULL; iter = iter->next)
+		item_list = g_list_prepend (item_list, g_file_new_for_uri (iter->data));
+
+	if (item_list != NULL)
+		fr_window_archive_add_files (window, item_list, update);
+
+	gio_file_list_free (item_list);
+	g_slist_free_full (selections, g_free);
+	g_free (current_folder);
+
+	gtk_widget_destroy (data->dialog);
+
+	return TRUE;
+}
+
+/* create the "add" dialog. */
+void
+add_files_cb (GtkWidget *widget,
+	      void      *callback_data)
+{
+	GtkBuilder *builder;
+	DialogData *data;
+	char       *folder;
+
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-add-files.ui");
+
+	data = g_new0 (DialogData, 1);
+	data->window = callback_data;
+	data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD);
+	data->dialog = GET_WIDGET ("dialog_add_files");
+	data->add_if_newer_checkbutton = GET_WIDGET ("add_if_newer_checkbutton");
+
+	/* set data */
+	folder = g_settings_get_string (data->settings, PREF_ADD_CURRENT_FOLDER);
+	if ((folder == NULL) || (strcmp (folder, "") == 0))
+		folder = g_strdup (fr_window_get_add_default_dir (data->window));
+	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (GTK_WIDGET (data->dialog)), folder);
+	g_free (folder);
+
+	/* signals */
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_dlg_add_files_destroy", G_CALLBACK (open_file_destroy_cb),
+	                                  "on_dlg_add_files_response", G_CALLBACK (file_sel_response_cb),
+	                                  NULL);
+	gtk_builder_connect_signals (builder, data);
+
+	g_object_unref (builder);
+
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+	gtk_widget_show (data->dialog);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/29.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/29.html new file mode 100644 index 0000000..b28c3c9 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/29.html @@ -0,0 +1,1693 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-add-folder.h"
+#include "file-utils.h"
+#include "fr-window.h"
+#include "gtk-utils.h"
+#include "preferences.h"
+
+#ifdef __GNUC__
+#define UNUSED_VARIABLE __attribute__ ((unused))
+#else
+#define UNUSED_VARIABLE
+#endif
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef struct {
+	FrWindow    *window;
+	GSettings   *settings;
+	GtkWidget   *dialog;
+	GtkWidget   *include_subfold_checkbutton;
+	GtkWidget   *exclude_symlinks;
+	GtkWidget   *add_if_newer_checkbutton;
+	GtkWidget   *include_files_entry;
+	GtkWidget   *exclude_files_entry;
+	GtkWidget   *exclude_folders_entry;
+	char        *last_options;
+} DialogData;
+
+static void
+open_file_destroy_cb (GtkWidget  *widget,
+		      DialogData *data)
+{
+	g_object_unref (data->settings);
+	g_free (data->last_options);
+	g_free (data);
+}
+
+static gboolean
+utf8_only_spaces (const char *text)
+{
+	const char *scan;
+
+	if (text == NULL)
+		return TRUE;
+
+	for (scan = text; *scan != 0; scan = g_utf8_next_char (scan)) {
+		gunichar c = g_utf8_get_char (scan);
+		if (! g_unichar_isspace (c))
+			return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void dlg_add_folder_save_last_options (DialogData *data);
+
+static int
+file_sel_response_cb (GtkWidget    *widget,
+		      int           response,
+		      DialogData   *data)
+{
+	GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget);
+	FrWindow       *window = data->window;
+	char           *selected_folder;
+	gboolean        update, UNUSED_VARIABLE recursive, follow_links;
+	const char     *include_files;
+	const char     *exclude_files;
+	const char     *exclude_folders;
+	char           *dest_dir;
+	char           *local_filename;
+
+	dlg_add_folder_save_last_options (data);
+
+	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+		gtk_widget_destroy (data->dialog);
+		return TRUE;
+	}
+
+	if (response == GTK_RESPONSE_HELP) {
+		show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-add-options");
+		return TRUE;
+	}
+
+	selected_folder = gtk_file_chooser_get_uri (file_sel);
+
+	/* check folder permissions. */
+
+	if (! check_permissions (selected_folder, R_OK)) {
+		GtkWidget *d;
+		char      *utf8_path;
+
+		utf8_path = g_filename_display_name (selected_folder);
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_MODAL,
+					   NULL,
+					   _("Could not add the files to the archive"),
+					   _("You don't have the right permissions to read files from folder \"%s\""),
+					   utf8_path);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (utf8_path);
+		g_free (selected_folder);
+
+		return FALSE;
+	}
+
+	update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));
+	recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton));
+	follow_links = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks));
+
+	include_files = gtk_entry_get_text (GTK_ENTRY (data->include_files_entry));
+	if (utf8_only_spaces (include_files))
+		include_files = "*";
+
+	exclude_files = gtk_entry_get_text (GTK_ENTRY (data->exclude_files_entry));
+	if (utf8_only_spaces (exclude_files))
+		exclude_files = NULL;
+
+	exclude_folders = gtk_entry_get_text (GTK_ENTRY (data->exclude_folders_entry));
+	if (utf8_only_spaces (exclude_folders))
+		exclude_folders = NULL;
+
+	local_filename = g_filename_from_uri (selected_folder, NULL, NULL);
+	dest_dir = build_uri (fr_window_get_current_location (window),
+			      file_name_from_path (local_filename),
+			      NULL);
+
+	fr_window_archive_add_with_wildcard (window,
+					     include_files,
+					     exclude_files,
+					     exclude_folders,
+					     selected_folder,
+					     dest_dir,
+					     update,
+					     follow_links);
+
+	g_free (local_filename);
+	g_free (dest_dir);
+	g_free (selected_folder);
+
+	gtk_widget_destroy (data->dialog);
+
+	return TRUE;
+}
+
+static int
+include_subfold_toggled_cb (GtkWidget *widget,
+			    gpointer   callback_data)
+{
+	DialogData *data = callback_data;
+
+	gtk_widget_set_sensitive (data->exclude_symlinks,
+	                          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
+
+	return FALSE;
+}
+
+static void load_options_cb (GtkWidget *w, DialogData *data);
+static void save_options_cb (GtkWidget *w, DialogData *data);
+static void clear_options_cb (GtkWidget *w, DialogData *data);
+static void dlg_add_folder_load_last_options (DialogData *data);
+
+/* create the "add" dialog. */
+void
+add_folder_cb (GtkWidget *widget,
+	       void      *callback_data)
+{
+	GtkBuilder  *builder;
+	DialogData  *data;
+
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-add-folder.ui");
+
+	data = g_new0 (DialogData, 1);
+	data->window = callback_data;
+	data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD);
+	data->dialog = GET_WIDGET ("dialog_add_folder");
+	data->add_if_newer_checkbutton = GET_WIDGET ("add_if_newer_checkbutton");
+	data->exclude_symlinks = GET_WIDGET ("exclude_symlinks");
+	data->include_subfold_checkbutton = GET_WIDGET ("include_subfold_checkbutton");
+	data->include_files_entry = GET_WIDGET ("include_files_entry");
+	data->exclude_files_entry = GET_WIDGET ("exclude_files_entry");
+	data->exclude_folders_entry = GET_WIDGET ("exclude_folders_entry");
+
+	/* set data */
+	dlg_add_folder_load_last_options (data);
+
+	/* signals */
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_dialog_add_folder_destroy",		G_CALLBACK (open_file_destroy_cb),
+	                                  "on_dialog_add_folder_response",		G_CALLBACK (file_sel_response_cb),
+	                                  "on_include_subfold_checkbutton_toggled",	G_CALLBACK (include_subfold_toggled_cb),
+	                                  "on_load_button_clicked",			G_CALLBACK (load_options_cb),
+	                                  "on_save_button_clicked",			G_CALLBACK (save_options_cb),
+	                                  "on_clear_button_clicked",			G_CALLBACK (clear_options_cb),
+	                                  NULL);
+	gtk_builder_connect_signals (builder, data);
+
+	g_object_unref (builder);
+
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+	gtk_widget_show (data->dialog);
+}
+
+/* load/save the dialog options */
+
+static void
+dlg_add_folder_save_last_used_options (DialogData *data,
+			               const char *options_path)
+{
+	g_free (data->last_options);
+	data->last_options = g_strdup (file_name_from_path (options_path));
+}
+
+static void
+sync_widgets_with_options (DialogData *data,
+			   const char *base_dir,
+			   const char *filename,
+			   const char *include_files,
+			   const char *exclude_files,
+			   const char *exclude_folders,
+			   gboolean    update,
+			   gboolean    recursive,
+			   gboolean    no_symlinks)
+{
+	if ((base_dir == NULL) || (strcmp (base_dir, "") == 0))
+		base_dir = fr_window_get_add_default_dir (data->window);
+
+	if ((filename != NULL) && (strcmp (filename, base_dir) != 0))
+		gtk_file_chooser_select_uri (GTK_FILE_CHOOSER (data->dialog), filename);
+	else
+		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), base_dir);
+
+	if (include_files != NULL)
+		gtk_entry_set_text (GTK_ENTRY (data->include_files_entry), include_files);
+	if (exclude_files != NULL)
+		gtk_entry_set_text (GTK_ENTRY (data->exclude_files_entry), exclude_files);
+	if (exclude_folders != NULL)
+		gtk_entry_set_text (GTK_ENTRY (data->exclude_folders_entry), exclude_folders);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton), update);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton), recursive);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks), no_symlinks);
+}
+
+static void
+clear_options_cb (GtkWidget  *w,
+		  DialogData *data)
+{
+	sync_widgets_with_options (data,
+				   gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (data->dialog)),
+				   gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog)),
+				   "",
+				   "",
+				   "",
+				   FALSE,
+				   TRUE,
+				   FALSE);
+}
+
+static gboolean
+dlg_add_folder_load_options (DialogData *data,
+			     const char *name)
+{
+	GFile     *options_dir;
+	GFile     *options_file;
+	char      *file_path;
+	GKeyFile  *key_file;
+	GError    *error = NULL;
+	char      *base_dir = NULL;
+	char      *filename = NULL;
+	char      *include_files = NULL;
+	char      *exclude_files = NULL;
+	char      *exclude_folders = NULL;
+	gboolean   update;
+	gboolean   recursive;
+	gboolean   no_symlinks;
+
+	options_dir = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, TRUE);
+	options_file = g_file_get_child (options_dir, name);
+	file_path = g_file_get_path (options_file);
+	key_file = g_key_file_new ();
+	if (! g_key_file_load_from_file (key_file, file_path, G_KEY_FILE_KEEP_COMMENTS, &error)) {
+		if (error->code != G_IO_ERROR_NOT_FOUND)
+			g_warning ("Could not load options file: %s\n", error->message);
+		g_clear_error (&error);
+		g_object_unref (options_file);
+		g_object_unref (options_dir);
+		g_key_file_free (key_file);
+		return FALSE;
+	}
+
+	base_dir = g_key_file_get_string (key_file, "Options", "base_dir", NULL);
+	filename = g_key_file_get_string (key_file, "Options", "filename", NULL);
+	include_files = g_key_file_get_string (key_file, "Options", "include_files", NULL);
+	exclude_files = g_key_file_get_string (key_file, "Options", "exclude_files", NULL);
+	exclude_folders = g_key_file_get_string (key_file, "Options", "exclude_folders", NULL);
+	update = g_key_file_get_boolean (key_file, "Options", "update", NULL);
+	recursive = g_key_file_get_boolean (key_file, "Options", "recursive", NULL);
+	no_symlinks = g_key_file_get_boolean (key_file, "Options", "no_symlinks", NULL);
+
+	sync_widgets_with_options (data,
+			   	   base_dir,
+			   	   filename,
+			   	   include_files,
+			   	   exclude_files,
+			   	   exclude_folders,
+			   	   update,
+			   	   recursive,
+			   	   no_symlinks);
+
+	dlg_add_folder_save_last_used_options (data, file_path);
+
+	g_free (base_dir);
+	g_free (filename);
+	g_free (include_files);
+	g_free (exclude_files);
+	g_free (exclude_folders);
+	g_key_file_free (key_file);
+	g_free (file_path);
+	g_object_unref (options_file);
+	g_object_unref (options_dir);
+
+	return TRUE;
+}
+
+static void
+dlg_add_folder_load_last_options (DialogData *data)
+{
+	char     *base_dir = NULL;
+	char     *filename = NULL;
+	char     *include_files = NULL;
+	char     *exclude_files = NULL;
+	char     *exclude_folders = NULL;
+	gboolean  update;
+	gboolean  recursive;
+	gboolean  no_symlinks;
+
+	base_dir = g_settings_get_string (data->settings, PREF_ADD_CURRENT_FOLDER);
+	filename = g_settings_get_string (data->settings, PREF_ADD_FILENAME);
+	include_files = g_settings_get_string (data->settings, PREF_ADD_INCLUDE_FILES);
+	exclude_files = g_settings_get_string (data->settings, PREF_ADD_EXCLUDE_FILES);
+	exclude_folders = g_settings_get_string (data->settings, PREF_ADD_EXCLUDE_FOLDERS);
+	update = g_settings_get_boolean (data->settings, PREF_ADD_UPDATE);
+	recursive = g_settings_get_boolean (data->settings, PREF_ADD_RECURSIVE);
+	no_symlinks = g_settings_get_boolean (data->settings, PREF_ADD_NO_SYMLINKS);
+
+	sync_widgets_with_options (data,
+			   	   base_dir,
+			   	   filename,
+			   	   include_files,
+			   	   exclude_files,
+			   	   exclude_folders,
+			   	   update,
+			   	   recursive,
+			   	   no_symlinks);
+
+	g_free (base_dir);
+	g_free (filename);
+	g_free (include_files);
+	g_free (exclude_files);
+	g_free (exclude_folders);
+}
+
+static void
+get_options_from_widgets (DialogData  *data,
+			  char       **base_dir,
+			  char       **filename,
+			  const char **include_files,
+			  const char **exclude_files,
+			  const char **exclude_folders,
+			  gboolean    *update,
+			  gboolean    *recursive,
+			  gboolean    *no_symlinks)
+{
+	*base_dir = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (data->dialog));
+	*filename = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+	*update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));
+	*recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton));
+	*no_symlinks = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks));
+
+	*include_files = gtk_entry_get_text (GTK_ENTRY (data->include_files_entry));
+	if (utf8_only_spaces (*include_files))
+		*include_files = "";
+
+	*exclude_files = gtk_entry_get_text (GTK_ENTRY (data->exclude_files_entry));
+	if (utf8_only_spaces (*exclude_files))
+		*exclude_files = "";
+
+	*exclude_folders = gtk_entry_get_text (GTK_ENTRY (data->exclude_folders_entry));
+	if (utf8_only_spaces (*exclude_folders))
+		*exclude_folders = "";
+}
+
+static void
+dlg_add_folder_save_current_options (DialogData *data,
+				     GFile      *options_file)
+{
+	char       *base_dir;
+	char       *filename;
+	const char *include_files;
+	const char *exclude_files;
+	const char *exclude_folders;
+	gboolean    update;
+	gboolean    recursive;
+	gboolean    no_symlinks;
+	GKeyFile   *key_file;
+
+	get_options_from_widgets (data,
+				  &base_dir,
+				  &filename,
+				  &include_files,
+				  &exclude_files,
+				  &exclude_folders,
+				  &update,
+				  &recursive,
+				  &no_symlinks);
+
+	fr_window_set_add_default_dir (data->window, base_dir);
+
+	key_file = g_key_file_new ();
+	g_key_file_set_string (key_file, "Options", "base_dir", base_dir);
+	g_key_file_set_string (key_file, "Options", "filename", filename);
+	g_key_file_set_string (key_file, "Options", "include_files", include_files);
+	g_key_file_set_string (key_file, "Options", "exclude_files", exclude_files);
+	g_key_file_set_string (key_file, "Options", "exclude_folders", exclude_folders);
+	g_key_file_set_boolean (key_file, "Options", "update", update);
+	g_key_file_set_boolean (key_file, "Options", "recursive", recursive);
+	g_key_file_set_boolean (key_file, "Options", "no_symlinks", no_symlinks);
+
+	g_key_file_save (key_file, options_file);
+
+	g_key_file_free (key_file);
+	g_free (base_dir);
+	g_free (filename);
+}
+
+static void
+dlg_add_folder_save_last_options (DialogData *data)
+{
+	char       *base_dir;
+	char       *filename;
+	const char *include_files;
+	const char *exclude_files;
+	const char *exclude_folders;
+	gboolean    update;
+	gboolean    recursive;
+	gboolean    no_symlinks;
+
+	get_options_from_widgets (data,
+				  &base_dir,
+				  &filename,
+				  &include_files,
+				  &exclude_files,
+				  &exclude_folders,
+				  &update,
+				  &recursive,
+				  &no_symlinks);
+
+	g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, base_dir);
+	g_settings_set_string (data->settings, PREF_ADD_FILENAME, filename);
+	g_settings_set_string (data->settings, PREF_ADD_INCLUDE_FILES, include_files);
+	g_settings_set_string (data->settings, PREF_ADD_EXCLUDE_FILES, exclude_files);
+	g_settings_set_string (data->settings, PREF_ADD_EXCLUDE_FOLDERS, exclude_folders);
+	g_settings_set_boolean (data->settings, PREF_ADD_UPDATE, update);
+	g_settings_set_boolean (data->settings, PREF_ADD_RECURSIVE, recursive);
+	g_settings_set_boolean (data->settings, PREF_ADD_NO_SYMLINKS, no_symlinks);
+
+	g_free (base_dir);
+	g_free (filename);
+}
+
+typedef struct {
+	DialogData   *data;
+	GtkWidget    *dialog;
+	GtkWidget    *aod_treeview;
+	GtkTreeModel *aod_model;
+} LoadOptionsDialogData;
+
+static void
+aod_destroy_cb (GtkWidget             *widget,
+		LoadOptionsDialogData *aod_data)
+{
+	g_free (aod_data);
+}
+
+static void
+aod_apply_cb (GtkWidget *widget,
+	      gpointer   callback_data)
+{
+	LoadOptionsDialogData *aod_data = callback_data;
+	DialogData            *data = aod_data->data;
+	GtkTreeSelection      *selection;
+	GtkTreeIter            iter;
+	char                  *options_name;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (aod_data->aod_treeview));
+	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
+		return;
+
+	gtk_tree_model_get (aod_data->aod_model, &iter, 1, &options_name, -1);
+
+	dlg_add_folder_load_options (data, options_name);
+	g_free (options_name);
+
+	gtk_widget_destroy (aod_data->dialog);
+}
+
+static void
+aod_activated_cb (GtkTreeView       *tree_view,
+		  GtkTreePath       *path,
+		  GtkTreeViewColumn *column,
+		  gpointer           callback_data)
+{
+	aod_apply_cb (NULL, callback_data);
+}
+
+static void
+aod_update_option_list (LoadOptionsDialogData *aod_data)
+{
+	GtkListStore    *list_store = GTK_LIST_STORE (aod_data->aod_model);
+	GFile           *options_dir;
+	GFileEnumerator *file_enum;
+	GFileInfo       *info;
+	GError          *err = NULL;
+
+	gtk_list_store_clear (list_store);
+
+	options_dir = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, TRUE);
+	make_directory_tree (options_dir, 0700, NULL);
+
+	file_enum = g_file_enumerate_children (options_dir, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &err);
+	if (err != NULL) {
+		g_warning ("Failed to enumerate children: %s", err->message);
+		g_clear_error (&err);
+		g_object_unref (options_dir);
+		return;
+	}
+
+	while ((info = g_file_enumerator_next_file (file_enum, NULL, &err)) != NULL) {
+		const char  *name;
+		char        *display_name;
+		GtkTreeIter  iter;
+
+		if (err != NULL) {
+			g_warning ("Failed to get info while enumerating: %s", err->message);
+			g_clear_error (&err);
+			continue;
+		}
+
+		name = g_file_info_get_name (info);
+		display_name = g_filename_display_name (name);
+
+		gtk_list_store_append (GTK_LIST_STORE (aod_data->aod_model), &iter);
+		gtk_list_store_set (GTK_LIST_STORE (aod_data->aod_model), &iter,
+				    0, name,
+				    1, display_name,
+				    -1);
+
+		g_free (display_name);
+		g_object_unref (info);
+	}
+
+	if (err != NULL) {
+		g_warning ("Failed to get info after enumeration: %s", err->message);
+		g_clear_error (&err);
+	}
+
+	g_object_unref (options_dir);
+}
+
+static void
+aod_remove_cb (GtkWidget             *widget,
+	       LoadOptionsDialogData *aod_data)
+{
+	GtkTreeSelection *selection;
+	GtkTreeIter       iter;
+	char             *filename;
+	GFile            *options_dir;
+	GFile            *options_file;
+	GError           *error = NULL;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (aod_data->aod_treeview));
+	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
+		return;
+
+	gtk_tree_model_get (aod_data->aod_model, &iter, 1, &filename, -1);
+	gtk_list_store_remove (GTK_LIST_STORE (aod_data->aod_model), &iter);
+
+	options_dir = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, TRUE);
+	options_file = g_file_get_child (options_dir, filename);
+	if (! g_file_delete (options_file, NULL, &error)) {
+		g_warning ("could not delete the options: %s", error->message);
+		g_clear_error (&error);
+	}
+
+	g_object_unref (options_file);
+	g_object_unref (options_dir);
+	g_free (filename);
+}
+
+static void
+load_options_cb (GtkWidget  *w,
+		 DialogData *data)
+{
+	LoadOptionsDialogData *aod_data;
+	GtkBuilder            *builder;
+	GtkCellRenderer       *renderer;
+	GtkTreeViewColumn     *column;
+
+	aod_data = g_new0 (LoadOptionsDialogData, 1);
+
+	aod_data->data = data;
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "add-options.ui");
+
+	/* Get the widgets. */
+
+	aod_data->dialog = GET_WIDGET ("add_options_dialog");
+	aod_data->aod_treeview = GET_WIDGET ("aod_treeview");
+
+	/* Set the signals handlers. */
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_add_options_dialog_destroy",	G_CALLBACK (aod_destroy_cb),
+	                                  "on_aod_treeview_row_activated",	G_CALLBACK (aod_activated_cb),
+	                                  "on_aod_ok_button_clicked",		G_CALLBACK (aod_apply_cb),
+	                                  "on_aod_cancel_button_clicked",	G_CALLBACK (aod_remove_cb),
+	                                  NULL);
+	gtk_builder_connect_signals (builder, aod_data);
+
+	g_signal_connect_swapped (gtk_builder_get_object (builder, "aod_cancelbutton"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  G_OBJECT (aod_data->dialog));
+
+	g_object_unref (builder);
+
+	/* Set data. */
+
+	aod_data->aod_model = GTK_TREE_MODEL (gtk_list_store_new (2,
+								  G_TYPE_STRING,
+								  G_TYPE_STRING));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (aod_data->aod_model),
+					      0,
+					      GTK_SORT_ASCENDING);
+	gtk_tree_view_set_model (GTK_TREE_VIEW (aod_data->aod_treeview),
+				 aod_data->aod_model);
+	g_object_unref (aod_data->aod_model);
+
+	/**/
+
+	renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (NULL,
+							   renderer,
+							   "text", 0,
+							   NULL);
+	gtk_tree_view_column_set_sort_column_id (column, 0);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (aod_data->aod_treeview),
+				     column);
+
+	aod_update_option_list (aod_data);
+
+	/* Run */
+
+	gtk_window_set_transient_for (GTK_WINDOW (aod_data->dialog),
+				      GTK_WINDOW (data->dialog));
+	gtk_window_set_modal (GTK_WINDOW (aod_data->dialog), TRUE);
+	gtk_widget_show (aod_data->dialog);
+}
+
+static void
+save_options_cb (GtkWidget  *w,
+		 DialogData *data)
+{
+	GFile *options_dir;
+	GFile *options_file;
+	char  *opt_filename;
+
+	options_dir = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, TRUE);
+	make_directory_tree (options_dir, 0700, NULL);
+
+	opt_filename = _gtk_request_dialog_run (
+				GTK_WINDOW (data->dialog),
+				GTK_DIALOG_MODAL,
+				_("Save Options"),
+				_("_Options Name:"),
+				(data->last_options != NULL) ? data->last_options : "",
+				1024,
+				_("_Cancel"),
+				_("_Save"));
+	if (opt_filename == NULL)
+		return;
+
+	options_file = g_file_get_child_for_display_name (options_dir, opt_filename, NULL);
+	dlg_add_folder_save_current_options (data, options_file);
+	dlg_add_folder_save_last_used_options (data, opt_filename);
+
+	g_free (opt_filename);
+	g_object_unref (options_file);
+	g_object_unref (options_dir);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/3.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/3.html new file mode 100644 index 0000000..8cdcc0e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/3.html @@ -0,0 +1,541 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
/* eggdesktopfile.h - Freedesktop.Org Desktop Files
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_DESKTOP_FILE_H__
+#define __EGG_DESKTOP_FILE_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef struct EggDesktopFile EggDesktopFile;
+
+typedef enum {
+    EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED,
+
+    EGG_DESKTOP_FILE_TYPE_APPLICATION,
+    EGG_DESKTOP_FILE_TYPE_LINK,
+    EGG_DESKTOP_FILE_TYPE_DIRECTORY
+} EggDesktopFileType;
+
+EggDesktopFile     *egg_desktop_file_new                   (const char   *desktop_file_path,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_data_dirs    (const char   *desktop_file_path,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_dirs         (const char   *desktop_file_path,
+                                                            const char  **search_dirs,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_key_file     (GKeyFile     *key_file,
+                                                            const char   *source,
+                                                            GError      **error);
+void                egg_desktop_file_free                  (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_source            (EggDesktopFile  *desktop_file);
+EggDesktopFileType  egg_desktop_file_get_desktop_file_type (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_name              (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_icon              (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_can_launch            (EggDesktopFile  *desktop_file,
+                                                            const char      *desktop_environment);
+gboolean            egg_desktop_file_accepts_documents     (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_accepts_multiple      (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_accepts_uris          (EggDesktopFile  *desktop_file);
+char               *egg_desktop_file_parse_exec            (EggDesktopFile  *desktop_file,
+                                                            GSList          *documents,
+                                                            GError         **error);
+gboolean            egg_desktop_file_launch                (EggDesktopFile  *desktop_file,
+                                                            GSList          *documents,
+                                                            GError         **error,
+                                                            ...) G_GNUC_NULL_TERMINATED;
+
+typedef enum {
+    EGG_DESKTOP_FILE_LAUNCH_CLEARENV = 1,
+    EGG_DESKTOP_FILE_LAUNCH_PUTENV,
+    EGG_DESKTOP_FILE_LAUNCH_SCREEN,
+    EGG_DESKTOP_FILE_LAUNCH_WORKSPACE,
+    EGG_DESKTOP_FILE_LAUNCH_DIRECTORY,
+    EGG_DESKTOP_FILE_LAUNCH_TIME,
+    EGG_DESKTOP_FILE_LAUNCH_FLAGS,
+    EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_PID,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID
+} EggDesktopFileLaunchOption;
+
+/* Standard Keys */
+#define EGG_DESKTOP_FILE_GROUP                  "Desktop Entry"
+
+#define EGG_DESKTOP_FILE_KEY_TYPE               "Type"
+#define EGG_DESKTOP_FILE_KEY_VERSION            "Version"
+#define EGG_DESKTOP_FILE_KEY_NAME               "Name"
+#define EGG_DESKTOP_FILE_KEY_GENERIC_NAME       "GenericName"
+#define EGG_DESKTOP_FILE_KEY_NO_DISPLAY         "NoDisplay"
+#define EGG_DESKTOP_FILE_KEY_COMMENT            "Comment"
+#define EGG_DESKTOP_FILE_KEY_ICON               "Icon"
+#define EGG_DESKTOP_FILE_KEY_HIDDEN             "Hidden"
+#define EGG_DESKTOP_FILE_KEY_ONLY_SHOW_IN       "OnlyShowIn"
+#define EGG_DESKTOP_FILE_KEY_NOT_SHOW_IN        "NotShowIn"
+#define EGG_DESKTOP_FILE_KEY_TRY_EXEC           "TryExec"
+#define EGG_DESKTOP_FILE_KEY_EXEC               "Exec"
+#define EGG_DESKTOP_FILE_KEY_PATH               "Path"
+#define EGG_DESKTOP_FILE_KEY_TERMINAL           "Terminal"
+#define EGG_DESKTOP_FILE_KEY_MIME_TYPE          "MimeType"
+#define EGG_DESKTOP_FILE_KEY_CATEGORIES         "Categories"
+#define EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY     "StartupNotify"
+#define EGG_DESKTOP_FILE_KEY_STARTUP_WM_CLASS   "StartupWMClass"
+#define EGG_DESKTOP_FILE_KEY_URL                "URL"
+
+/* Accessors */
+gboolean  egg_desktop_file_has_key                (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+char     *egg_desktop_file_get_string             (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error) G_GNUC_MALLOC;
+char     *egg_desktop_file_get_locale_string      (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   const char      *locale,
+                                                   GError         **error) G_GNUC_MALLOC;
+gboolean  egg_desktop_file_get_boolean            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+double    egg_desktop_file_get_numeric            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+int	      egg_desktop_file_get_integer            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+char    **egg_desktop_file_get_string_list        (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   gsize           *length,
+                                                   GError         **error) G_GNUC_MALLOC;
+char    **egg_desktop_file_get_locale_string_list (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   const char      *locale,
+                                                   gsize           *length,
+                                                   GError         **error) G_GNUC_MALLOC;
+
+/* Errors */
+#define EGG_DESKTOP_FILE_ERROR egg_desktop_file_error_quark()
+
+GQuark egg_desktop_file_error_quark (void);
+
+typedef enum {
+    EGG_DESKTOP_FILE_ERROR_INVALID,
+    EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+    EGG_DESKTOP_FILE_ERROR_UNRECOGNIZED_OPTION
+} EggDesktopFileError;
+
+/* Global application desktop file */
+void            egg_set_desktop_file (const char *desktop_file_path);
+void            egg_set_desktop_file_without_defaults (const char *desktop_file_path);
+EggDesktopFile *egg_get_desktop_file (void);
+
+G_END_DECLS
+
+#endif /* __EGG_DESKTOP_FILE_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/30.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/30.html new file mode 100644 index 0000000..ceab7a0 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/30.html @@ -0,0 +1,551 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-ask-password.h"
+#include "file-utils.h"
+#include "fr-window.h"
+#include "glib-utils.h"
+#include "gtk-utils.h"
+
+#define GET_LABEL(x) (GTK_LABEL (gtk_builder_get_object (builder, (x))))
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef enum {
+	FR_PASSWORD_TYPE_MAIN,
+	FR_PASSWORD_TYPE_PASTE_FROM
+} FrPasswordType;
+
+typedef struct {
+	FrWindow       *window;
+	FrPasswordType  pwd_type;
+	GtkWidget      *dialog;
+	GtkWidget      *pw_password_entry;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	g_free (data);
+}
+
+static void
+ask_password__response_cb (GtkWidget  *dialog,
+			   int         response_id,
+			   DialogData *data)
+{
+	char *password;
+
+	switch (response_id) {
+	case GTK_RESPONSE_OK:
+		password = _gtk_entry_get_locale_text (GTK_ENTRY (data->pw_password_entry));
+		if (data->pwd_type == FR_PASSWORD_TYPE_MAIN)
+			fr_window_set_password (data->window, password);
+		else if (data->pwd_type == FR_PASSWORD_TYPE_PASTE_FROM)
+			fr_window_set_password_for_paste (data->window, password);
+		g_free (password);
+		if (fr_window_is_batch_mode (data->window))
+			fr_window_resume_batch (data->window);
+		else
+			fr_window_restart_current_batch_action (data->window);
+		break;
+
+	default:
+		if (fr_window_is_batch_mode (data->window))
+			gtk_widget_destroy (GTK_WIDGET (data->window));
+		else
+			fr_window_reset_current_batch_action (data->window);
+		break;
+	}
+
+	gtk_widget_destroy (data->dialog);
+}
+
+static void
+dlg_ask_password__common (FrWindow       *window,
+			  FrPasswordType  pwd_type)
+{
+	GtkBuilder *builder;
+	DialogData *data;
+	char       *text;
+	char       *name = NULL;
+
+	data = g_new0 (DialogData, 1);
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-password.ui");
+	data->window = window;
+	data->pwd_type = pwd_type;
+
+	/* Get the widgets. */
+
+	data->dialog = GET_WIDGET ("password_dialog");
+	data->pw_password_entry = GET_WIDGET ("pw_password_entry");
+
+	/* Set widgets data. */
+
+	if (data->pwd_type == FR_PASSWORD_TYPE_MAIN)
+		name = g_uri_display_basename (fr_window_get_archive_uri (window));
+	else if (data->pwd_type == FR_PASSWORD_TYPE_PASTE_FROM)
+		name = g_uri_display_basename (fr_window_get_paste_archive_uri (window));
+        g_assert (name != NULL);
+	text = g_strdup_printf (_("Enter the password for the archive '%s'."), name);
+	gtk_label_set_label (GET_LABEL ("pw_password_label"), text);
+	g_free (text);
+
+	if (fr_window_get_password (window) != NULL)
+		_gtk_entry_set_locale_text (GTK_ENTRY (data->pw_password_entry),
+					    fr_window_get_password (window));
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_password_dialog_destroy", G_CALLBACK (destroy_cb),
+	                                  "on_password_dialog_response", G_CALLBACK (ask_password__response_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (builder, data);
+
+	g_object_unref (builder);
+
+	/* Run dialog. */
+
+	gtk_widget_grab_focus (data->pw_password_entry);
+	if (gtk_widget_get_realized (GTK_WIDGET (window))) {
+		gtk_window_set_transient_for (GTK_WINDOW (data->dialog),
+					      GTK_WINDOW (window));
+		gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+	}
+	else
+		gtk_window_set_title (GTK_WINDOW (data->dialog), name);
+	g_free (name);
+
+	gtk_widget_show (data->dialog);
+}
+
+void
+dlg_ask_password (FrWindow *window)
+{
+	dlg_ask_password__common (window, FR_PASSWORD_TYPE_MAIN);
+}
+
+void
+dlg_ask_password_for_paste_operation (FrWindow *window)
+{
+	dlg_ask_password__common (window, FR_PASSWORD_TYPE_PASTE_FROM);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/31.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/31.html new file mode 100644 index 0000000..60569c5 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/31.html @@ -0,0 +1,1377 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-batch-add.h"
+#include "file-utils.h"
+#include "fr-init.h"
+#include "fr-window.h"
+#include "gtk-utils.h"
+#include "glib-utils.h"
+#include "preferences.h"
+#include "typedefs.h"
+
+#define BAD_CHARS "/\\*"
+#define GET_ENTRY(x) (GTK_ENTRY (gtk_builder_get_object (data->builder, (x))))
+#define GET_FILE_CHOOSER(x) (GTK_FILE_CHOOSER (gtk_builder_get_object (data->builder, (x))))
+#define GET_TOGGLE_BUTTON(x) (GTK_TOGGLE_BUTTON (gtk_builder_get_object (data->builder, (x))))
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (data->builder, (x))))
+#define GET_WINDOW(x) (GTK_WINDOW (gtk_builder_get_object (data->builder, (x))))
+
+static gboolean has_password = FALSE;
+static gboolean can_encrypt_header = FALSE;
+
+typedef struct {
+	FrWindow   *window;
+	GSettings *settings;
+	GSettings *settings_general;
+	GtkBuilder *builder;
+	int        *supported_types;
+	GtkWidget  *archive_type_combo_box;
+	GList      *file_list;
+	gboolean    add_clicked;
+	const char *last_mime_type;
+	gboolean    single_file;
+} DialogData;
+
+static const char *
+get_ext (DialogData *data)
+{
+	int idx;
+
+	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
+
+	return mime_type_desc[data->supported_types[idx]].default_ext;
+}
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	g_settings_set_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
+	/*g_settings_set_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander"))));*/
+	g_settings_set_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER, gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton")));
+
+	if (! data->add_clicked) {
+		fr_window_pop_message (data->window);
+		fr_window_stop_batch (data->window);
+	}
+
+	g_object_unref (data->builder);
+	g_object_unref (data->settings_general);
+	g_object_unref (data->settings);
+	g_free (data);
+}
+
+static void
+set_archive_options (DialogData *data)
+{
+	int idx;
+
+	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
+	if (mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_ENCRYPT) {
+		const char *pwd;
+
+		pwd = gtk_entry_get_text (GET_ENTRY ("a_password_entry"));
+		if (pwd != NULL) {
+			if (strcmp (pwd, "") != 0) {
+				fr_window_set_password (data->window, pwd);
+				if (mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER)
+					fr_window_set_encrypt_header (data->window, gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton")));
+			}
+		}
+	}
+
+	if ((mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES)
+	    && gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("a_volume_checkbutton")))
+	{
+		double value;
+		int    size;
+
+		value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")));
+		size = (int) (value * MEGABYTE);
+		g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
+		fr_window_set_volume_size (data->window, (guint) size);
+	}
+}
+
+static void
+help_clicked_cb (GtkWidget  *widget,
+		 DialogData *data)
+{
+	show_help_dialog (GET_WINDOW ("dialog"), "engrampa-fmgr-add");
+}
+
+static void
+add_clicked_cb (GtkWidget  *widget,
+		DialogData *data)
+{
+	FrWindow   *window = data->window;
+	char       *archive_name;
+	char       *archive_dir;
+	char       *archive_file;
+	char       *tmp;
+	const char *archive_ext;
+	gboolean    do_not_add = FALSE;
+	GError     *error = NULL;
+
+	data->add_clicked = TRUE;
+
+	/* Collect data */
+
+	archive_name = g_uri_escape_string (gtk_entry_get_text (GET_ENTRY ("a_add_to_entry")), NULL, FALSE);
+
+	/* Check whether the user entered a valid archive name. */
+
+	if ((archive_name == NULL) || (*archive_name == '\0')) {
+		GtkWidget *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Could not create the archive"),
+					   "%s",
+					   _("You have to specify an archive name."));
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+		g_free (archive_name);
+
+		return;
+	}
+	else if (strchrs (archive_name, BAD_CHARS)) {
+		GtkWidget *d;
+		char      *utf8_name = g_filename_display_name (archive_name);
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Could not create the archive"),
+					   _("The name \"%s\" is not valid because it cannot contain the characters: %s\n\n%s"),
+					   utf8_name,
+					   BAD_CHARS,
+					   _("Please use a different name."));
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (utf8_name);
+		g_free (archive_name);
+
+		return;
+	}
+
+	/* Check directory existence. */
+
+	archive_dir = gtk_file_chooser_get_uri (GET_FILE_CHOOSER ("a_location_filechooserbutton"));
+	if (archive_dir == NULL) {
+		g_free (archive_dir);
+		g_free (archive_name);
+		return;
+	}
+
+	if (! check_permissions (archive_dir, R_OK|W_OK|X_OK)) {
+		GtkWidget  *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Could not create the archive"),
+					   "%s",
+					   _("You don't have the right permissions to create an archive in the destination folder."));
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (archive_dir);
+		g_free (archive_name);
+		return;
+	}
+
+	if (! uri_is_dir (archive_dir)) {
+		GtkWidget *d;
+		int        r;
+		char      *folder_name;
+		char      *msg;
+
+		folder_name = g_filename_display_name (archive_dir);
+		msg = g_strdup_printf (_("Destination folder \"%s\" does not exist.\n\nDo you want to create it?"), folder_name);
+		g_free (folder_name);
+
+		d = _gtk_message_dialog_new (GET_WINDOW ("dialog"),
+					     GTK_DIALOG_MODAL,
+					     "dialog-question",
+					     msg,
+					     NULL,
+					     "gtk-cancel", GTK_RESPONSE_CANCEL,
+					     _("Create _Folder"), GTK_RESPONSE_YES,
+					     NULL);
+
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
+		r = gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (msg);
+
+		do_not_add = (r != GTK_RESPONSE_YES);
+	}
+
+	if (! do_not_add && ! ensure_dir_exists (archive_dir, 0755, &error)) {
+		GtkWidget  *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Could not create the archive"),
+					   _("Could not create the destination folder: %s."),
+					   error->message);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_error_free (error);
+		g_free (archive_dir);
+		g_free (archive_name);
+		return;
+	}
+
+	if (do_not_add) {
+		GtkWidget *d;
+
+		d = _gtk_message_dialog_new (GTK_WINDOW (window),
+					     GTK_DIALOG_DESTROY_WITH_PARENT,
+					     "dialog-warning",
+					     _("Archive not created"),
+					     NULL,
+					     "gtk-ok", GTK_RESPONSE_OK,
+					     NULL);
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (archive_dir);
+		g_free (archive_name);
+
+		return;
+	}
+
+	/**/
+
+	archive_ext = get_ext (data);
+	tmp = archive_name;
+	archive_name = g_strconcat (tmp, archive_ext, NULL);
+	g_free (tmp);
+	archive_file = g_strconcat (archive_dir, "/", archive_name, NULL);
+
+	if (uri_is_dir (archive_file)) {
+		GtkWidget  *d;
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Could not create the archive"),
+					   "%s",
+					   _("You have to specify an archive name."));
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (archive_name);
+		g_free (archive_dir);
+		g_free (archive_file);
+
+		return;
+	}
+
+	if (uri_exists (archive_file)) {
+		GtkWidget *d;
+		int        r;
+
+		d = _gtk_message_dialog_new (GET_WINDOW ("dialog"),
+					     GTK_DIALOG_MODAL,
+					     "dialog-question",
+					     _("The archive is already present.  Do you want to overwrite it?"),
+					     NULL,
+					     "gtk-no", GTK_RESPONSE_NO,
+					     _("_Overwrite"), GTK_RESPONSE_YES,
+					     NULL);
+
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
+		r = gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		if (r == GTK_RESPONSE_YES) {
+			GFile  *file;
+			GError *err = NULL;
+
+			file = g_file_new_for_uri (archive_file);
+			g_file_delete (file, NULL, &err);
+			if (err != NULL) {
+				g_warning ("Failed to delete file %s: %s",
+					   archive_file,
+					   err->message);
+				g_clear_error (&err);
+			}
+			g_object_unref (file);
+		}
+		else {
+			g_free (archive_name);
+			g_free (archive_dir);
+			g_free (archive_file);
+			return;
+		}
+	}
+	set_archive_options (data);
+	gtk_widget_destroy (GET_WIDGET ("dialog"));
+
+	fr_window_archive_new (window, archive_file);
+
+	g_free (archive_name);
+	g_free (archive_dir);
+	g_free (archive_file);
+}
+
+static void
+update_sensitivity_for_mime_type (DialogData *data,
+				  const char *mime_type)
+{
+	int i;
+
+	if (mime_type == NULL) {
+		gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), FALSE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), FALSE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), FALSE);
+		gtk_toggle_button_set_inconsistent (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton"), TRUE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), FALSE);
+		return;
+	}
+
+	for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
+		if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
+			gboolean sensitive;
+
+			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT;
+			gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), sensitive);
+			gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), sensitive);
+
+			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER;
+			can_encrypt_header = sensitive;
+			gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), sensitive ? has_password : FALSE);
+			gtk_toggle_button_set_inconsistent (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton"), sensitive ? (!has_password) : TRUE);
+
+			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES;
+			gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), sensitive);
+
+			break;
+		}
+	}
+}
+
+static void
+archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
+				   DialogData  *data)
+{
+	const char *mime_type;
+	int         idx = gtk_combo_box_get_active (combo_box);
+	char       *icon_name;
+	char       *content_type;
+
+	mime_type = mime_type_desc[data->supported_types[idx]].mime_type;
+	content_type = g_content_type_from_mime_type (mime_type);
+	if ((icon_name = g_content_type_get_generic_icon_name (content_type)) != NULL) {
+		gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("archive_icon_image")),
+		                              icon_name, GTK_ICON_SIZE_DIALOG);
+
+		g_free (icon_name);
+	}
+
+	g_free (content_type);
+	update_sensitivity_for_mime_type (data, mime_type);
+}
+
+static void
+update_archive_type_combo_box_from_ext (DialogData  *data,
+					const char  *ext)
+{
+	int idx = 0;
+	int i;
+
+	if (ext == NULL) {
+		gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), 0);
+		return;
+	}
+
+	for (i = 0; data->supported_types[i] != -1; i++)
+		if (strcmp (ext, mime_type_desc[data->supported_types[i]].default_ext) == 0) {
+			idx = i;
+			break;
+		}
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), idx);
+}
+
+static void
+update_sensitivity (DialogData *data)
+{
+	const char *password;
+
+	gtk_widget_set_sensitive (GET_WIDGET ("a_volume_spinbutton"),
+				  gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("a_volume_checkbutton")));
+
+	password = gtk_entry_get_text (GET_ENTRY ("a_password_entry"));
+	has_password = (password != NULL) && (*password != '\0');
+	gtk_toggle_button_set_inconsistent (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton"), can_encrypt_header ? (!has_password) : TRUE);
+	gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), can_encrypt_header ? has_password : FALSE);
+}
+
+static void
+password_entry_notify_text_cb (GObject    *object,
+			       GParamSpec *spec,
+			       gpointer    user_data)
+{
+	update_sensitivity ((DialogData *) user_data);
+}
+
+static void
+volume_toggled_cb (GtkToggleButton *toggle_button,
+		   gpointer         user_data)
+{
+	update_sensitivity ((DialogData *) user_data);
+}
+
+void
+dlg_batch_add_files (FrWindow *window,
+		     GList    *file_list)
+{
+	DialogData   *data;
+	char         *automatic_name = NULL;
+	char         *default_ext;
+	const char   *first_filename;
+	char         *parent;
+	int           i;
+	int           size;
+
+	if (file_list == NULL)
+		return;
+
+	data = g_new0 (DialogData, 1);
+	data->settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
+	data->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+	data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-add-files.ui");
+	data->window = window;
+	data->file_list = file_list;
+	data->single_file = ((file_list->next == NULL) && uri_is_file ((char*) file_list->data));
+	data->add_clicked = FALSE;
+
+	/* Set widgets data. */
+
+	gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander")), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
+	gtk_toggle_button_set_active (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton"), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
+	size = g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE);
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")),
+	                           ((gdouble) size) / MEGABYTE);
+
+	first_filename = (char*) file_list->data;
+	parent = remove_level_from_path (first_filename);
+
+	if (file_list->next == NULL)
+		automatic_name = g_uri_unescape_string (file_name_from_path ((char*) file_list->data), NULL);
+	else {
+		automatic_name = g_uri_unescape_string (file_name_from_path (parent), NULL);
+		if ((automatic_name == NULL) || (automatic_name[0] == '\0')) {
+			g_free (automatic_name);
+			automatic_name = g_uri_unescape_string (file_name_from_path (first_filename), NULL);
+		}
+	}
+
+	_gtk_entry_set_filename_text (GET_ENTRY ("a_add_to_entry"), automatic_name);
+	g_free (automatic_name);
+
+	if (check_permissions (parent, R_OK | W_OK))
+		gtk_file_chooser_set_current_folder_uri (GET_FILE_CHOOSER ("a_location_filechooserbutton"), parent);
+	else
+		gtk_file_chooser_set_current_folder_uri (GET_FILE_CHOOSER ("a_location_filechooserbutton"), get_home_uri ());
+	g_free (parent);
+
+	/* archive type combobox */
+
+	data->archive_type_combo_box = gtk_combo_box_text_new ();
+	if (data->single_file)
+		data->supported_types = single_file_save_type;
+	else
+		data->supported_types = save_type;
+	sort_mime_types_by_extension (data->supported_types);
+
+	for (i = 0; data->supported_types[i] != -1; i++)
+		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->archive_type_combo_box),
+						mime_type_desc[data->supported_types[i]].default_ext);
+
+	gtk_box_pack_start (GTK_BOX (GET_WIDGET ("a_archive_type_box")), data->archive_type_combo_box, TRUE, TRUE, 0);
+	gtk_widget_show_all (GET_WIDGET ("a_archive_type_box"));
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (data->builder,
+	                                  "on_dialog_destroy", G_CALLBACK (destroy_cb),
+	                                  "on_a_add_button_clicked", G_CALLBACK (add_clicked_cb),
+	                                  "on_a_help_button_clicked", G_CALLBACK (help_clicked_cb),
+	                                  "on_a_volume_checkbutton_toggled", G_CALLBACK (volume_toggled_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (data->builder, data);
+
+	g_signal_connect_swapped (gtk_builder_get_object (data->builder, "a_cancel_button"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  gtk_builder_get_object (data->builder, "dialog"));
+	g_signal_connect (G_OBJECT (data->archive_type_combo_box),
+			  "changed",
+			  G_CALLBACK (archive_type_combo_box_changed_cb),
+			  data);
+	g_signal_connect (gtk_builder_get_object (data->builder, "a_password_entry"),
+			  "notify::text",
+			  G_CALLBACK (password_entry_notify_text_cb),
+			  data);
+
+	/* Run dialog. */
+
+	default_ext = g_settings_get_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION);
+	update_archive_type_combo_box_from_ext (data, default_ext);
+	g_free (default_ext);
+
+	gtk_widget_grab_focus (GET_WIDGET ("a_add_to_entry"));
+	gtk_editable_select_region (GTK_EDITABLE (GET_WIDGET ("a_add_to_entry")),
+				    0, -1);
+
+	update_sensitivity (data);
+
+	gtk_window_set_modal (GET_WINDOW ("dialog"), FALSE);
+	gtk_window_present (GET_WINDOW ("dialog"));
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/32.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/32.html new file mode 100644 index 0000000..81f69a2 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/32.html @@ -0,0 +1,579 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-window.h"
+#include "gtk-utils.h"
+#include "file-utils.h"
+#include "dlg-delete.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef struct {
+	FrWindow  *window;
+	GList     *selected_files;
+
+	GtkWidget *dialog;
+	GtkWidget *d_all_files_radio;
+	GtkWidget *d_selected_files_radio;
+	GtkWidget *d_files_radio;
+	GtkWidget *d_files_entry;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	path_list_free (data->selected_files);
+	g_free (data);
+}
+
+/* called when the "ok" button is pressed. */
+static void
+ok_clicked_cb (GtkWidget  *widget,
+	       DialogData *data)
+{
+	gboolean  selected_files;
+	gboolean  pattern_files;
+	FrWindow *window = data->window;
+	GList    *file_list = NULL;
+	gboolean  do_not_remove_if_null = FALSE;
+
+	selected_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->d_selected_files_radio));
+	pattern_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->d_files_radio));
+
+	/* create the file list. */
+
+	if (selected_files) {
+		file_list = data->selected_files;
+		data->selected_files = NULL;       /* do not the list when destroying the dialog. */
+	}
+	else if (pattern_files) {
+		const char *pattern;
+
+		pattern = gtk_entry_get_text (GTK_ENTRY (data->d_files_entry));
+		file_list = fr_window_get_file_list_pattern (window, pattern);
+		if (file_list == NULL)
+			do_not_remove_if_null = TRUE;
+	}
+
+	/* close the dialog. */
+
+	gtk_widget_destroy (data->dialog);
+
+	/* remove ! */
+
+	if (! do_not_remove_if_null || (file_list != NULL))
+		fr_window_archive_remove (window, file_list);
+
+	path_list_free (file_list);
+}
+
+static void
+entry_changed_cb (GtkWidget  *widget,
+		  DialogData *data)
+{
+	if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->d_files_radio)))
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->d_files_radio), TRUE);
+}
+
+static void
+dlg_delete__common (FrWindow *window,
+	            GList    *selected_files)
+{
+	GtkBuilder *builder;
+	DialogData *data;
+
+	data = g_new (DialogData, 1);
+	data->window = window;
+	data->selected_files = selected_files;
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "delete.ui");
+
+	/* Get the widgets. */
+
+	data->dialog = GET_WIDGET ("delete_dialog");
+	data->d_all_files_radio = GET_WIDGET ("d_all_files_radio");
+	data->d_selected_files_radio = GET_WIDGET ("d_selected_files_radio");
+	data->d_files_radio = GET_WIDGET ("d_files_radio");
+	data->d_files_entry = GET_WIDGET ("d_files_entry");
+
+	/* Set widgets data. */
+
+	if (data->selected_files != NULL)
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->d_selected_files_radio), TRUE);
+	else {
+		gtk_widget_set_sensitive (data->d_selected_files_radio, FALSE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->d_all_files_radio), TRUE);
+	}
+
+	/* Set the signals handlers. */
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_delete_dialog_destroy",	G_CALLBACK (destroy_cb),
+	                                  "on_d_ok_button_clicked",	G_CALLBACK (ok_clicked_cb),
+	                                  "on_d_files_entry_changed",	G_CALLBACK (entry_changed_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (builder, data);
+
+	g_signal_connect_swapped (gtk_builder_get_object (builder, "d_cancel_button"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  G_OBJECT (data->dialog));
+
+	g_object_unref (builder);
+
+	/* Run dialog. */
+
+	gtk_window_set_transient_for (GTK_WINDOW (data->dialog),
+				      GTK_WINDOW (window));
+	gtk_window_set_modal         (GTK_WINDOW (data->dialog), TRUE);
+
+	gtk_widget_show (data->dialog);
+}
+
+void
+dlg_delete (GtkWidget *widget,
+	    gpointer   callback_data)
+{
+	FrWindow *window = callback_data;
+	dlg_delete__common (window,
+			    fr_window_get_file_list_selection (window, TRUE, NULL));
+}
+
+void
+dlg_delete_from_sidebar (GtkWidget *widget,
+			 gpointer   callback_data)
+{
+	FrWindow *window = callback_data;
+	dlg_delete__common (window,
+			    fr_window_get_folder_tree_selection (window, TRUE, NULL));
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/33.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/33.html new file mode 100644 index 0000000..10440d0 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/33.html @@ -0,0 +1,1029 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "fr-init.h"
+#include "gtk-utils.h"
+#include "fr-window.h"
+#include "typedefs.h"
+#include "dlg-extract.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (data->builder, (x))))
+
+typedef struct {
+	FrWindow     *window;
+	GSettings    *settings;
+	GList        *selected_files;
+	char         *base_dir_for_selection;
+
+	GtkWidget    *dialog;
+
+	GtkBuilder   *builder;
+
+	gboolean      extract_clicked;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	if (! data->extract_clicked) {
+		fr_window_pop_message (data->window);
+		fr_window_stop_batch (data->window);
+	}
+	g_object_unref (data->builder);
+	path_list_free (data->selected_files);
+	g_free (data->base_dir_for_selection);
+	g_object_unref (data->settings);
+	g_free (data);
+}
+
+static int
+extract_cb (GtkWidget   *w,
+	    DialogData  *data)
+{
+	FrWindow   *window = data->window;
+	gboolean    do_not_extract = FALSE;
+	char       *extract_to_dir;
+	char       *sub_dir;
+	gboolean    extract_sub_dir;
+	gboolean    overwrite;
+	gboolean    skip_newer;
+	gboolean    selected_files;
+	gboolean    pattern_files;
+	gboolean    junk_paths;
+	GList      *file_list;
+	char       *base_dir = NULL;
+	GError     *error = NULL;
+
+	data->extract_clicked = TRUE;
+
+	/* collect extraction options. */
+
+	extract_to_dir = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+
+	/* check directory existence. */
+
+	if (! uri_is_dir (extract_to_dir)) {
+		if (! ForceDirectoryCreation) {
+			GtkWidget *d;
+			int        r;
+			char      *folder_name;
+			char      *msg;
+
+			folder_name = g_filename_display_name (extract_to_dir);
+			msg = g_strdup_printf (_("Destination folder \"%s\" does not exist.\n\nDo you want to create it?"), folder_name);
+			g_free (folder_name);
+
+			d = _gtk_message_dialog_new (GTK_WINDOW (data->dialog),
+						     GTK_DIALOG_MODAL,
+						     "dialog-question",
+						     msg,
+						     NULL,
+						     "gtk-cancel", GTK_RESPONSE_CANCEL,
+						     _("Create _Folder"), GTK_RESPONSE_YES,
+						     NULL);
+
+			gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
+			r = gtk_dialog_run (GTK_DIALOG (d));
+			gtk_widget_destroy (GTK_WIDGET (d));
+
+			g_free (msg);
+
+			if (r != GTK_RESPONSE_YES)
+				do_not_extract = TRUE;
+		}
+
+		if (! do_not_extract && ! ensure_dir_exists (extract_to_dir, 0755, &error)) {
+			GtkWidget  *d;
+
+			d = _gtk_error_dialog_new (GTK_WINDOW (window),
+						   GTK_DIALOG_DESTROY_WITH_PARENT,
+						   NULL,
+						   _("Extraction not performed"),
+						   _("Could not create the destination folder: %s."),
+						   error->message);
+			gtk_dialog_run (GTK_DIALOG (d));
+			gtk_widget_destroy (GTK_WIDGET (d));
+
+			g_error_free (error);
+
+			return FALSE;
+		}
+	}
+
+	if (do_not_extract) {
+		GtkWidget *d;
+
+		d = _gtk_message_dialog_new (GTK_WINDOW (window),
+					     GTK_DIALOG_DESTROY_WITH_PARENT,
+					     "dialog-warning",
+					     _("Extraction not performed"),
+					     NULL,
+					     "gtk-ok", GTK_RESPONSE_OK,
+					     NULL);
+		gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		if (fr_window_is_batch_mode (data->window))
+			gtk_widget_destroy (data->dialog);
+
+		return FALSE;
+	}
+
+	/* check extraction directory permissions. */
+
+	if (uri_is_dir (extract_to_dir)
+	    && ! check_permissions (extract_to_dir, R_OK | W_OK))
+	{
+		GtkWidget *d;
+		char      *utf8_path;
+
+		utf8_path = g_filename_display_name (extract_to_dir);
+
+		d = _gtk_error_dialog_new (GTK_WINDOW (window),
+					   GTK_DIALOG_DESTROY_WITH_PARENT,
+					   NULL,
+					   _("Extraction not performed"),
+					   _("You don't have the right permissions to extract archives in the folder \"%s\""),
+					   utf8_path);
+		gtk_dialog_run (GTK_DIALOG (d));
+		gtk_widget_destroy (GTK_WIDGET (d));
+
+		g_free (utf8_path);
+		g_free (extract_to_dir);
+
+		return FALSE;
+	}
+
+	overwrite = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton")));
+	skip_newer = ! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton"))) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton")));
+	junk_paths = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("recreate_dir_checkbutton")));
+	extract_sub_dir = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("create_subdir_checkbutton")));
+
+	g_settings_set_boolean (data->settings, PREF_EXTRACT_OVERWRITE, overwrite);
+	if (! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton"))))
+		g_settings_set_boolean (data->settings, PREF_EXTRACT_SKIP_NEWER, skip_newer);
+	g_settings_set_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS, ! junk_paths);
+	g_settings_set_boolean (data->settings, PREF_EXTRACT_CREATE_SUBDIR, extract_sub_dir);
+
+	fr_window_set_extract_default_dir (window, extract_to_dir, !extract_sub_dir);
+
+	selected_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("selected_files_radiobutton")));
+	pattern_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("file_pattern_radiobutton")));
+
+	/* create the file list. */
+
+	file_list = NULL;
+
+	if (selected_files) {
+		file_list = data->selected_files;
+		data->selected_files = NULL;       /* do not the list when destroying the dialog. */
+	}
+	else if (pattern_files) {
+		const char *pattern;
+
+		pattern = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("file_pattern_entry")));
+		file_list = fr_window_get_file_list_pattern (window, pattern);
+		if (file_list == NULL) {
+			gtk_widget_destroy (data->dialog);
+			g_free (extract_to_dir);
+			return FALSE;
+		}
+	}
+
+	if (selected_files) {
+		base_dir = data->base_dir_for_selection;
+		data->base_dir_for_selection = NULL;
+	}
+	else
+		base_dir = NULL;
+
+	if (extract_sub_dir)
+		sub_dir = remove_extension_from_path (g_filename_display_basename (fr_window_get_archive_uri (window)));
+	else
+		sub_dir = NULL;
+
+	/* close the dialog. */
+
+	gtk_widget_destroy (data->dialog);
+
+	/* extract ! */
+
+	fr_window_archive_extract (window,
+				   file_list,
+				   extract_to_dir,
+				   sub_dir,
+				   base_dir,
+				   skip_newer,
+				   overwrite ? FR_OVERWRITE_YES : FR_OVERWRITE_NO,
+				   junk_paths,
+				   TRUE);
+
+	path_list_free (file_list);
+	g_free (extract_to_dir);
+	g_free (sub_dir);
+	g_free (base_dir);
+
+	return TRUE;
+}
+
+static int
+file_sel_response_cb (GtkWidget    *widget,
+		      int           response,
+		      DialogData   *data)
+{
+	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+		gtk_widget_destroy (data->dialog);
+		return TRUE;
+	}
+
+	if (response == GTK_RESPONSE_HELP) {
+		show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-extract-options");
+		return TRUE;
+	}
+
+	if (response == GTK_RESPONSE_OK)
+		return extract_cb (widget, data);
+
+	return FALSE;
+}
+
+static void
+files_entry_changed_cb (GtkWidget  *widget,
+			DialogData *data)
+{
+	if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("file_pattern_radiobutton"))))
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("file_pattern_radiobutton")), TRUE);
+}
+
+static void
+overwrite_toggled_cb (GtkToggleButton *button,
+		      DialogData      *data)
+{
+	gboolean active = gtk_toggle_button_get_active (button);
+	gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton")), !active);
+	gtk_widget_set_sensitive (GET_WIDGET ("not_newer_checkbutton"), active);
+}
+
+static void
+close_dialog_changed_cb (GtkToggleButton *button,
+                         FrWindow        *window)
+{
+	gboolean active = gtk_toggle_button_get_active (button);
+	fr_window_set_close_dialog (window, active);
+}
+
+static void
+dlg_extract__common (FrWindow *window,
+	             GList    *selected_files,
+	             char     *base_dir_for_selection)
+{
+	DialogData *data;
+	GtkWidget  *button;
+	const char *extract_default_dir;
+
+	data = g_new0 (DialogData, 1);
+	data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-extract.ui");
+	data->settings = g_settings_new (ENGRAMPA_SCHEMA_EXTRACT);
+	data->window = window;
+	data->selected_files = selected_files;
+	data->base_dir_for_selection = base_dir_for_selection;
+	data->extract_clicked = FALSE;
+	data->dialog = GET_WIDGET ("dialog_extract");
+
+	/* Set widgets data. */
+
+	extract_default_dir = fr_window_get_extract_default_dir (window);
+	if (uri_is_local (extract_default_dir))
+	{
+		extract_default_dir  = g_filename_from_uri (extract_default_dir, NULL, NULL);
+	}
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (data->dialog), extract_default_dir);
+
+	if (data->selected_files != NULL)
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("selected_files_radiobutton")), TRUE);
+	else {
+		gtk_widget_set_sensitive (GET_WIDGET ("selected_files_radiobutton"), FALSE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("all_files_radiobutton")), TRUE);
+	}
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_OVERWRITE));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_SKIP_NEWER));
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton")))) {
+		gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton")), TRUE);
+		gtk_widget_set_sensitive (GET_WIDGET ("not_newer_checkbutton"), FALSE);
+	}
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("recreate_dir_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("create_subdir_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_CREATE_SUBDIR));
+
+	button = GET_WIDGET ("close_dialog_checkbutton");
+	g_settings_bind (data->settings,
+                   PREF_EXTRACT_CLOSE_DIALOG,
+                   GTK_TOGGLE_BUTTON (button),
+                  "active",
+                   G_SETTINGS_BIND_GET);
+	g_signal_connect (button,
+			  "toggled",
+			  G_CALLBACK (close_dialog_changed_cb),
+			  window);
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (data->builder,
+	                                  "on_dialog_extract_destroy", G_CALLBACK (destroy_cb),
+	                                  "on_dialog_extract_response", G_CALLBACK (file_sel_response_cb),
+	                                  "on_overwrite_checkbutton_toggled", G_CALLBACK (overwrite_toggled_cb),
+	                                  "on_file_pattern_entry_changed", G_CALLBACK (files_entry_changed_cb),
+	                                  NULL);
+	gtk_builder_connect_signals (data->builder, data);
+
+	/* Run dialog. */
+
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+	gtk_widget_show (data->dialog);
+}
+
+void
+dlg_extract (GtkWidget *widget,
+	     gpointer   callback_data)
+{
+	FrWindow *window = callback_data;
+	GList    *files;
+	char     *base_dir;
+
+	files = fr_window_get_selection (window, FALSE, &base_dir);
+	dlg_extract__common (window, files, base_dir);
+}
+
+void
+dlg_extract_folder_from_sidebar (GtkWidget *widget,
+	     			 gpointer   callback_data)
+{
+	FrWindow *window = callback_data;
+	GList    *files;
+	char     *base_dir;
+
+	files = fr_window_get_selection (window, TRUE, &base_dir);
+	dlg_extract__common (window, files, base_dir);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/34.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/34.html new file mode 100644 index 0000000..4d44ba2 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/34.html @@ -0,0 +1,1153 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-new.h"
+#include "file-utils.h"
+#include "gtk-utils.h"
+#include "fr-init.h"
+#include "preferences.h"
+#include "typedefs.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+#define DEFAULT_EXTENSION ".tar.gz"
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DlgNewData *data)
+{
+	if (data->original_file != NULL)
+		g_object_unref (data->original_file);
+	g_free (data);
+}
+
+static void
+update_sensitivity (DlgNewData *data)
+{
+	gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton), ! data->can_encrypt_header);
+	gtk_widget_set_sensitive (data->n_encrypt_header_checkbutton, data->can_encrypt_header);
+	gtk_widget_set_sensitive (data->n_volume_spinbutton, ! data->can_create_volumes || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->n_volume_checkbutton)));
+}
+
+static void
+update_sensitivity_for_ext (DlgNewData *data,
+			    const char *ext)
+{
+	const char *mime_type;
+	int         i;
+
+	data->can_encrypt = FALSE;
+	data->can_encrypt_header = FALSE;
+	data->can_create_volumes = FALSE;
+
+	mime_type = get_mime_type_from_extension (ext);
+
+	if (mime_type == NULL) {
+		gtk_widget_set_sensitive (data->n_password_entry, FALSE);
+		gtk_widget_set_sensitive (data->n_password_label, FALSE);
+		gtk_widget_set_sensitive (data->n_encrypt_header_checkbutton, FALSE);
+		gtk_widget_set_sensitive (data->n_volume_box, FALSE);
+		return;
+	}
+
+	for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
+		if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
+			data->can_encrypt = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT;
+			gtk_widget_set_sensitive (data->n_password_entry, data->can_encrypt);
+			gtk_widget_set_sensitive (data->n_password_label, data->can_encrypt);
+
+			data->can_encrypt_header = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER;
+			gtk_widget_set_sensitive (data->n_encrypt_header_checkbutton, data->can_encrypt_header);
+
+			data->can_create_volumes = mime_type_desc[i].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES;
+			gtk_widget_set_sensitive (data->n_volume_box, data->can_create_volumes);
+
+			break;
+		}
+	}
+
+	update_sensitivity (data);
+}
+
+static int
+get_archive_type (DlgNewData *data)
+{
+	const char *uri;
+	const char *ext;
+
+	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+	if (uri == NULL)
+		return -1;
+
+	ext = get_archive_filename_extension (uri);
+	if (ext == NULL) {
+		int idx;
+
+		idx = egg_file_format_chooser_get_format (EGG_FILE_FORMAT_CHOOSER (data->format_chooser), uri);
+		/*idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->n_archive_type_combo_box)) - 1;*/
+		if (idx >= 0)
+			return data->supported_types[idx];
+
+		ext = DEFAULT_EXTENSION;
+	}
+
+	return get_mime_type_index (get_mime_type_from_extension (ext));
+}
+
+/* FIXME
+static void
+archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
+				   DlgNewData  *data)
+{
+	const char *uri;
+	const char *ext;
+	int         idx;
+
+	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+
+	ext = get_archive_filename_extension (uri);
+	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->n_archive_type_combo_box)) - 1;
+	if ((ext == NULL) && (idx >= 0))
+		ext = mime_type_desc[data->supported_types[idx]].default_ext;
+
+	update_sensitivity_for_ext (data, ext);
+
+	if ((idx >= 0) && (uri != NULL)) {
+		const char *new_ext;
+		const char *basename;
+		char       *basename_noext;
+		char       *new_basename;
+		char       *new_basename_uft8;
+
+		new_ext = mime_type_desc[data->supported_types[idx]].default_ext;
+		basename = file_name_from_path (uri);
+		if (g_str_has_suffix (basename, ext))
+			basename_noext = g_strndup (basename, strlen (basename) - strlen (ext));
+		else
+			basename_noext = g_strdup (basename);
+		new_basename = g_strconcat (basename_noext, new_ext, NULL);
+		new_basename_uft8 = g_uri_unescape_string (new_basename, NULL);
+
+		gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->dialog), new_basename_uft8);
+		update_sensitivity_for_ext (data, new_ext);
+
+		g_free (new_basename_uft8);
+		g_free (new_basename);
+		g_free (basename_noext);
+	}
+}
+*/
+
+static void
+password_entry_changed_cb (GtkEditable *editable,
+			   gpointer     user_data)
+{
+	update_sensitivity ((DlgNewData *) user_data);
+}
+
+static void
+volume_toggled_cb (GtkToggleButton *toggle_button,
+		   gpointer         user_data)
+{
+	update_sensitivity ((DlgNewData *) user_data);
+}
+
+static void
+format_chooser_selection_changed_cb (EggFileFormatChooser *format_chooser,
+				     DlgNewData           *data)
+{
+	const char *uri;
+	const char *ext;
+	int         n_format;
+
+	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
+	if (uri == NULL)
+		return;
+
+	ext = get_archive_filename_extension (uri);
+	n_format = egg_file_format_chooser_get_format (EGG_FILE_FORMAT_CHOOSER (data->format_chooser), uri);
+	if (ext == NULL)
+		ext = mime_type_desc[data->supported_types[n_format - 1]].default_ext;
+
+	update_sensitivity_for_ext (data, ext);
+
+	if (uri != NULL) {
+		const char *new_ext;
+		const char *basename;
+		char       *basename_noext;
+		char       *new_basename;
+		char       *new_basename_uft8;
+
+		new_ext = mime_type_desc[data->supported_types[n_format - 1]].default_ext;
+		basename = file_name_from_path (uri);
+		if (g_str_has_suffix (basename, ext))
+			basename_noext = g_strndup (basename, strlen (basename) - strlen (ext));
+		else
+			basename_noext = g_strdup (basename);
+		new_basename = g_strconcat (basename_noext, new_ext, NULL);
+		new_basename_uft8 = g_uri_unescape_string (new_basename, NULL);
+
+		gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->dialog), new_basename_uft8);
+		update_sensitivity_for_ext (data, new_ext);
+
+		g_free (new_basename_uft8);
+		g_free (new_basename);
+		g_free (basename_noext);
+	}
+}
+
+static char *
+get_icon_name_for_type (const char *mime_type)
+{
+	char *name = NULL;
+
+	if (mime_type != NULL) {
+		char *s;
+
+		name = g_strconcat ("mate-mime-", mime_type, NULL);
+		for (s = name; *s; ++s)
+			if (! g_ascii_isalpha (*s))
+				*s = '-';
+	}
+
+	if ((name == NULL) || ! gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), name)) {
+		g_free (name);
+		name = g_strdup ("package-x-generic");
+	}
+
+	return name;
+}
+
+static void
+options_expander_unmap_cb (GtkWidget *widget,
+			   gpointer   user_data)
+{
+	egg_file_format_chooser_emit_size_changed ((EggFileFormatChooser *) user_data);
+}
+
+static DlgNewData *
+dlg_new_archive (FrWindow  *window,
+		int        *supported_types,
+		const char *default_name)
+{
+	GtkBuilder    *builder;
+	DlgNewData    *data;
+	GSettings     *settings;
+	int            i;
+	int            size;
+
+	data = g_new0 (DlgNewData, 1);
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "new.ui");
+	data->window = window;
+	data->supported_types = supported_types;
+	sort_mime_types_by_description (data->supported_types);
+
+	/* Get the widgets. */
+
+	data->dialog = GET_WIDGET ("dialog");
+
+	data->n_password_entry = GET_WIDGET ("n_password_entry");
+	data->n_password_label = GET_WIDGET ("n_password_label");
+	data->n_other_options_expander = GET_WIDGET ("n_other_options_expander");
+	data->n_encrypt_header_checkbutton = GET_WIDGET ("n_encrypt_header_checkbutton");
+
+	data->n_volume_checkbutton = GET_WIDGET ("n_volume_checkbutton");
+	data->n_volume_spinbutton = GET_WIDGET ("n_volume_spinbutton");
+	data->n_volume_box = GET_WIDGET ("n_volume_box");
+
+	/* Set widgets data. */
+
+	gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
+	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), fr_window_get_open_default_dir (window));
+
+	if (default_name != NULL)
+		gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->dialog), default_name);
+
+	/**/
+
+	gtk_expander_set_expanded (GTK_EXPANDER (data->n_other_options_expander), FALSE);
+	settings = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton), g_settings_get_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER));
+        g_object_unref (settings);
+
+        settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
+        size = g_settings_get_int (settings, PREF_BATCH_ADD_VOLUME_SIZE);
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton),
+                                   ((gdouble) size) / MEGABYTE);
+        g_object_unref (settings);
+
+	/* format chooser */
+
+	data->format_chooser = (EggFileFormatChooser *) egg_file_format_chooser_new ();
+	for (i = 0; data->supported_types[i] != -1; i++) {
+		int   idx = data->supported_types[i];
+		const char *exts[4];
+		int   e;
+		int   n_exts;
+		char *icon_name;
+
+		n_exts = 0;
+		for (e = 0; (n_exts < 4) && file_ext_type[e].ext != NULL; e++) {
+			if (strcmp (file_ext_type[e].ext, mime_type_desc[idx].default_ext) == 0)
+				continue;
+			if (strcmp (file_ext_type[e].mime_type, mime_type_desc[idx].mime_type) == 0)
+				exts[n_exts++] = file_ext_type[e].ext;
+		}
+		while (n_exts < 4)
+			exts[n_exts++] = NULL;
+
+		/* g_print ("%s => %s, %s, %s, %s\n", mime_type_desc[idx].mime_type, exts[0], exts[1], exts[2], exts[3]); */
+
+		icon_name = get_icon_name_for_type (mime_type_desc[idx].mime_type);
+		egg_file_format_chooser_add_format (data->format_chooser,
+						    0,
+						    _(mime_type_desc[idx].name),
+						    icon_name,
+						    mime_type_desc[idx].default_ext,
+						    exts[0],
+						    exts[1],
+						    exts[2],
+						    exts[3],
+						    NULL);
+
+		g_free (icon_name);
+	}
+	egg_file_format_chooser_set_format (data->format_chooser, 0);
+	gtk_widget_show (GTK_WIDGET (data->format_chooser));
+	gtk_box_pack_start (GTK_BOX (GET_WIDGET ("format_chooser_box")), GTK_WIDGET (data->format_chooser), TRUE, TRUE, 0);
+	gtk_widget_set_vexpand (GET_WIDGET ("extra_widget"), FALSE);
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_dialog_destroy", G_CALLBACK (destroy_cb),
+	                                  "on_n_password_entry_changed", G_CALLBACK (password_entry_changed_cb),
+	                                  "on_n_volume_checkbutton_toggled", G_CALLBACK (volume_toggled_cb),
+	                                  NULL);
+	gtk_builder_connect_signals (builder, data);
+
+	g_signal_connect (G_OBJECT (data->format_chooser),
+			  "selection-changed",
+			  G_CALLBACK (format_chooser_selection_changed_cb),
+			  data);
+
+	g_signal_connect_after (GET_WIDGET ("other_oprtions_alignment"),
+				"unmap",
+				G_CALLBACK (options_expander_unmap_cb),
+				data->format_chooser);
+
+	g_object_unref (builder);
+
+	/* Run dialog. */
+
+	update_sensitivity (data);
+
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+	gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->window));
+	/*gtk_window_present (GTK_WINDOW (data->dialog));*/
+
+	return data;
+}
+
+DlgNewData *
+dlg_new (FrWindow *window)
+{
+	DlgNewData *data;
+
+	data = dlg_new_archive (window, create_type, NULL);
+	gtk_window_set_title (GTK_WINDOW (data->dialog), C_("File", "New"));
+
+	return data;
+}
+
+DlgNewData *
+dlg_save_as (FrWindow   *window,
+	     const char *default_name)
+{
+	DlgNewData *data;
+
+	data = dlg_new_archive (window, save_type, default_name);
+	gtk_window_set_title (GTK_WINDOW (data->dialog), C_("File", "Save"));
+
+	return data;
+}
+
+const char *
+dlg_new_data_get_password (DlgNewData *data)
+{
+	const char *password = NULL;
+	int         idx;
+
+	idx = get_archive_type (data);
+	if (idx < 0)
+		return NULL;
+
+	if (mime_type_desc[idx].capabilities & FR_COMMAND_CAN_ENCRYPT)
+		password = (char*) gtk_entry_get_text (GTK_ENTRY (data->n_password_entry));
+
+	return password;
+}
+
+gboolean
+dlg_new_data_get_encrypt_header (DlgNewData *data)
+{
+	gboolean encrypt_header = FALSE;
+	int      idx;
+
+	idx = get_archive_type (data);
+	if (idx < 0)
+		return FALSE;
+
+	if (mime_type_desc[idx].capabilities & FR_COMMAND_CAN_ENCRYPT) {
+		const char *password = gtk_entry_get_text (GTK_ENTRY (data->n_password_entry));
+		if (password != NULL) {
+			if (strcmp (password, "") != 0) {
+				if (mime_type_desc[idx].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER)
+					encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton));
+			}
+		}
+	}
+
+	return encrypt_header;
+}
+
+int
+dlg_new_data_get_volume_size (DlgNewData *data)
+{
+	int idx;
+
+	idx = get_archive_type (data);
+	if (idx < 0)
+		return 0;
+
+	if ((mime_type_desc[idx].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES)
+	    && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->n_volume_checkbutton)))
+	{
+		double value;
+
+		value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton));
+		return (int) (value * MEGABYTE);
+
+	}
+
+	return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/35.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/35.html new file mode 100644 index 0000000..d3a3dd3 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/35.html @@ -0,0 +1,447 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "gtk-utils.h"
+#include "fr-init.h"
+#include "fr-window.h"
+#include "dlg-open-with.h"
+
+typedef struct {
+	FrWindow *window;
+	GList    *file_list;
+} OpenData;
+
+static void
+app_chooser_response_cb (GtkDialog *dialog,
+			 int        response_id,
+			 gpointer   user_data)
+{
+	OpenData *o_data = user_data;
+	GAppInfo *app_info;
+
+	switch (response_id) {
+	case GTK_RESPONSE_OK:
+		app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
+		if (app_info != NULL) {
+			fr_window_open_files_with_application (o_data->window, o_data->file_list, app_info);
+			g_object_unref (app_info);
+		}
+		g_free (o_data);
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+
+	case GTK_RESPONSE_CANCEL:
+	case GTK_RESPONSE_DELETE_EVENT:
+		g_free (o_data);
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+
+	default:
+		break;
+	}
+}
+
+void
+dlg_open_with (FrWindow *window,
+	       GList    *file_list)
+{
+	OpenData  *o_data;
+	GtkWidget *app_chooser;
+	GFile     *first_file;
+
+	o_data = g_new0 (OpenData, 1);
+	o_data->window = window;
+	o_data->file_list = file_list;
+
+	first_file = g_file_new_for_path (file_list->data);
+	app_chooser = gtk_app_chooser_dialog_new (GTK_WINDOW (window),
+						  GTK_DIALOG_MODAL,
+						  first_file);
+	g_signal_connect (app_chooser,
+			  "response",
+			  G_CALLBACK (app_chooser_response_cb),
+			  o_data);
+	gtk_widget_show (app_chooser);
+}
+
+void
+open_with_cb (GtkWidget *widget,
+	      void      *callback_data)
+{
+	FrWindow *window = callback_data;
+	GList    *file_list;
+
+	file_list = fr_window_get_file_list_selection (window, FALSE, NULL);
+	if (file_list == NULL)
+		return;
+
+	fr_window_open_files (window, file_list, TRUE);
+	path_list_free (file_list);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/36.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/36.html new file mode 100644 index 0000000..f1e86e7 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/36.html @@ -0,0 +1,903 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001-2009 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-package-installer.h"
+#include "gtk-utils.h"
+#include "fr-init.h"
+
+typedef struct {
+	FrWindow   *window;
+	FrArchive  *archive;
+	FrAction    action;
+	const char *packages;
+} InstallerData;
+
+static void
+installer_data_free (InstallerData *idata)
+{
+	g_object_unref (idata->archive);
+	g_object_unref (idata->window);
+	g_free (idata);
+}
+
+static void
+package_installer_terminated (InstallerData   *idata,
+			      FrProcErrorType  error_type,
+			      const char      *error_message)
+{
+	GdkWindow *window;
+
+	window = gtk_widget_get_window (GTK_WIDGET (idata->window));
+	if (window != NULL)
+		gdk_window_set_cursor (window, NULL);
+
+	if (error_type != FR_PROC_ERROR_NONE) {
+		fr_archive_action_completed (idata->archive,
+					     idata->action,
+					     error_type,
+					     error_message);
+	}
+	else {
+		update_registered_commands_capabilities ();
+		if (fr_window_is_batch_mode (idata->window))
+			fr_window_resume_batch (idata->window);
+		else
+			fr_window_restart_current_batch_action (idata->window);
+	}
+
+	installer_data_free (idata);
+}
+
+#ifdef ENABLE_PACKAGEKIT
+
+static void
+packagekit_install_package_names_ready_cb (GObject      *source_object,
+					   GAsyncResult *res,
+					   gpointer      user_data)
+{
+	InstallerData   *idata = user_data;
+	GDBusProxy      *proxy;
+	GVariant        *values;
+	GError          *error = NULL;
+	FrProcErrorType  error_type = FR_PROC_ERROR_NONE;
+	char            *error_message = NULL;
+
+	proxy = G_DBUS_PROXY (source_object);
+	values = g_dbus_proxy_call_finish (proxy, res, &error);
+	if (values == NULL) {
+		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)
+		    || (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)
+			&& (error->message != NULL)
+			&& (strstr (error->message, "org.freedesktop.Packagekit.Modify.Cancelled") != NULL)))
+		{
+			error_type = FR_PROC_ERROR_STOPPED;
+			error_message = NULL;
+		}
+		else {
+			error_type = FR_PROC_ERROR_GENERIC;
+			error_message = g_strdup_printf ("%s\n%s",
+							 _("There was an internal error trying to search for applications:"),
+							 error->message);
+		}
+		g_clear_error (&error);
+	}
+
+	package_installer_terminated (idata, error_type, error_message);
+
+	g_free (error_message);
+	if (values != NULL)
+		g_variant_unref (values);
+	g_object_unref (proxy);
+}
+
+static char **
+get_packages_real_names (char **names)
+{
+	char     **real_names;
+	GKeyFile  *key_file;
+	int        i;
+
+	real_names = g_new0 (char *, g_strv_length (names));
+	key_file = g_key_file_new ();
+	g_key_file_load_from_file (key_file,
+	                           PRIVDATADIR "/packages.match",
+	                           G_KEY_FILE_NONE, NULL);
+
+	for (i = 0; names[i] != NULL; i++) {
+		char *real_name;
+
+		real_name = g_key_file_get_string (key_file, "Package Matches", names[i], NULL);
+		if (real_name != NULL)
+			real_name = g_strstrip (real_name);
+		if ((real_name == NULL) || (strncmp (real_name, "", 1) == 0)) {
+			g_free (real_name);
+			real_name = g_strdup (names[i]);
+		}
+		real_names[i] = real_name;
+		real_name = NULL;
+	}
+
+	g_key_file_free (key_file);
+
+	return real_names;
+}
+
+static void
+install_packages (InstallerData *idata)
+{
+	GDBusConnection *connection;
+	GError          *error = NULL;
+
+	connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+	if (connection != NULL) {
+		GdkWindow  *window;
+		GDBusProxy *proxy;
+
+		window = gtk_widget_get_window (GTK_WIDGET (idata->window));
+		if (window != NULL) {
+			GdkCursor *cursor;
+			GdkDisplay *display;
+
+			display = gtk_widget_get_display (GTK_WIDGET (idata));
+			cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
+			gdk_window_set_cursor (window, cursor);
+			g_object_unref (cursor);
+		}
+
+		proxy = g_dbus_proxy_new_sync (connection,
+					       G_DBUS_PROXY_FLAGS_NONE,
+					       NULL,
+					       "org.freedesktop.PackageKit",
+					       "/org/freedesktop/PackageKit",
+					       "org.freedesktop.PackageKit.Modify",
+					       NULL,
+					       &error);
+
+		if (proxy != NULL) {
+			guint   xid;
+			char  **names;
+			char  **real_names;
+
+			if (window != NULL)
+				xid = GDK_WINDOW_XID (window);
+			else
+				xid = 0;
+
+			names = g_strsplit (idata->packages, ",", -1);
+			real_names = get_packages_real_names (names);
+
+			g_dbus_proxy_call (proxy,
+					   "InstallPackageNames",
+					   g_variant_new ("(u^ass)",
+							  xid,
+							  real_names,
+							  "hide-confirm-search,hide-finished,hide-warning"),
+					   G_DBUS_CALL_FLAGS_NONE,
+					   G_MAXINT,
+					   NULL,
+					   packagekit_install_package_names_ready_cb,
+					   idata);
+
+			g_strfreev (real_names);
+			g_strfreev (names);
+		}
+	}
+
+	if (error != NULL) {
+		char *message;
+
+		message = g_strdup_printf ("%s\n%s",
+					   _("There was an internal error trying to search for applications:"),
+					   error->message);
+		package_installer_terminated (idata, FR_PROC_ERROR_GENERIC, message);
+
+		g_clear_error (&error);
+	}
+}
+
+static void
+confirm_search_dialog_response_cb (GtkDialog *dialog,
+				   int        response_id,
+				   gpointer   user_data)
+{
+	InstallerData *idata = user_data;
+
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+
+	if (response_id == GTK_RESPONSE_YES) {
+		install_packages (idata);
+	}
+	else {
+		fr_window_stop_batch (idata->window);
+		installer_data_free (idata);
+	}
+}
+
+static GtkWidget *
+create_button (const char *icon_name,
+	       const char *text)
+{
+	GtkIconTheme *icon_theme;
+	GtkWidget    *button;
+
+	button = gtk_button_new_with_mnemonic (text);
+	icon_theme = gtk_icon_theme_get_default ();
+	if (gtk_icon_theme_has_icon (icon_theme, icon_name)) {
+		GtkWidget *image;
+		image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+		gtk_button_set_image (GTK_BUTTON (button), image);
+	}
+	gtk_widget_set_can_default (button, TRUE);
+
+	gtk_widget_show (button);
+
+	return button;
+}
+
+#endif /* ENABLE_PACKAGEKIT */
+
+void
+dlg_package_installer (FrWindow  *window,
+		       FrArchive *archive,
+		       FrAction   action)
+{
+	InstallerData   *idata;
+	GType            command_type;
+	FrCommand       *command;
+
+	idata = g_new0 (InstallerData, 1);
+	idata->window = g_object_ref (window);
+	idata->archive = g_object_ref (archive);
+	idata->action = action;
+
+	command_type = get_preferred_command_for_mime_type (idata->archive->content_type, FR_COMMAND_CAN_READ_WRITE);
+	if (command_type == 0)
+		command_type = get_preferred_command_for_mime_type (idata->archive->content_type, FR_COMMAND_CAN_READ);
+	if (command_type == 0) {
+		package_installer_terminated (idata, FR_PROC_ERROR_GENERIC, _("Archive type not supported."));
+		return;
+	}
+
+	command = g_object_new (command_type, 0);
+	idata->packages = fr_command_get_packages (command, idata->archive->content_type);
+	g_object_unref (command);
+
+	if (idata->packages == NULL) {
+		package_installer_terminated (idata, FR_PROC_ERROR_GENERIC, _("Archive type not supported."));
+		return;
+	}
+
+#ifdef ENABLE_PACKAGEKIT
+
+	{
+		char      *secondary_text;
+		GtkWidget *dialog;
+		char      *description;
+
+		description = g_content_type_get_description (idata->archive->content_type);
+		secondary_text = g_strdup_printf (_("There is no command installed for %s files.\nDo you want to search for a command to open this file?"),
+		                                  description);
+		dialog = _gtk_message_dialog_new (GTK_WINDOW (idata->window),
+						  GTK_DIALOG_MODAL,
+						  "dialog-error",
+						  _("Could not open this file type"),
+						  secondary_text,
+						  NULL);
+
+		gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+		                              create_button ("process-stop", _("_Cancel")),
+		                              GTK_RESPONSE_NO);
+
+		gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+		                              create_button ("edit-find", _("_Search Command")),
+		                              GTK_RESPONSE_YES);
+
+		gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+
+		g_signal_connect (dialog, "response", G_CALLBACK (confirm_search_dialog_response_cb), idata);
+		gtk_widget_show (dialog);
+
+		g_free (description);
+		g_free (secondary_text);
+	}
+
+#else /* ! ENABLE_PACKAGEKIT */
+
+	package_installer_terminated (idata, FR_PROC_ERROR_GENERIC, _("Archive type not supported."));
+
+#endif /* ENABLE_PACKAGEKIT */
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/37.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/37.html new file mode 100644 index 0000000..eec5c9c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/37.html @@ -0,0 +1,479 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-window.h"
+#include "gtk-utils.h"
+#include "preferences.h"
+#include "dlg-password.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef struct {
+	FrWindow  *window;
+	GtkWidget *dialog;
+	GtkWidget *pw_password_entry;
+	GtkWidget *pw_encrypt_header_checkbutton;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	g_free (data);
+}
+
+static void
+response_cb (GtkWidget  *dialog,
+	     int         response_id,
+	     DialogData *data)
+{
+	char     *password;
+	gboolean  encrypt_header;
+
+	switch (response_id) {
+	case GTK_RESPONSE_OK:
+		password = _gtk_entry_get_locale_text (GTK_ENTRY (data->pw_password_entry));
+		fr_window_set_password (data->window, password);
+		g_free (password);
+
+		encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton));
+		{
+			GSettings *settings;
+
+			settings = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+			g_settings_set_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER, encrypt_header);
+			g_object_unref (settings);
+		}
+		fr_window_set_encrypt_header (data->window, encrypt_header);
+		break;
+	default:
+		break;
+	}
+
+	gtk_widget_destroy (data->dialog);
+}
+
+void
+dlg_password (GtkWidget *widget,
+	      gpointer   callback_data)
+{
+	GtkBuilder *builder;
+	FrWindow   *window = callback_data;
+	DialogData *data;
+
+	data = g_new0 (DialogData, 1);
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "password.ui");
+	data->window = window;
+
+	/* Get the widgets. */
+
+	data->dialog = GET_WIDGET ("password_dialog");
+	data->pw_password_entry = GET_WIDGET ("pw_password_entry");
+	data->pw_encrypt_header_checkbutton = GET_WIDGET ("pw_encrypt_header_checkbutton");
+
+	/* Set widgets data. */
+
+	_gtk_entry_set_locale_text (GTK_ENTRY (data->pw_password_entry), fr_window_get_password (window));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton), fr_window_get_encrypt_header (window));
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_password_dialog_destroy", G_CALLBACK (destroy_cb),
+	                                  "on_password_dialog_response", G_CALLBACK (response_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (builder, data);
+	g_object_unref (builder);
+
+	/* Run dialog. */
+
+	gtk_widget_grab_focus (data->pw_password_entry);
+	if (gtk_widget_get_realized (GTK_WIDGET (window)))
+		gtk_window_set_transient_for (GTK_WINDOW (data->dialog),
+					      GTK_WINDOW (window));
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+
+	gtk_widget_show (data->dialog);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/38.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/38.html new file mode 100644 index 0000000..fad5228 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/38.html @@ -0,0 +1,587 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "glib-utils.h"
+#include "file-utils.h"
+#include "gtk-utils.h"
+#include "fr-window.h"
+#include "dlg-prop.h"
+
+#define GET_LABEL(x) (GTK_LABEL (gtk_builder_get_object (builder, (x))))
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+typedef struct {
+	GtkWidget *dialog;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+destroy_cb (GtkWidget  *widget,
+	    DialogData *data)
+{
+	g_free (data);
+}
+
+static int
+help_cb (GtkWidget   *w,
+	 DialogData  *data)
+{
+	show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-view-archive-properties");
+	return TRUE;
+}
+
+void
+dlg_prop (FrWindow *window)
+{
+	GtkBuilder       *builder;
+	DialogData       *data;
+	GFile            *parent;
+	char             *uri;
+	char             *markup;
+	char             *s;
+	goffset           size, uncompressed_size;
+	char             *utf8_name;
+	char             *title_txt;
+	double            ratio;
+
+	data = g_new (DialogData, 1);
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "properties.ui");
+
+	/* Get the widgets. */
+
+	data->dialog = GET_WIDGET ("prop_dialog");
+
+	/* Set widgets data. */
+
+	uri = remove_level_from_path (fr_window_get_archive_uri (window));
+	parent = g_file_new_for_uri (uri);
+	utf8_name = g_file_get_parse_name (parent);
+	markup = g_strdup_printf ("<a href=\"%s\">%s</a>", uri, utf8_name);
+	gtk_label_set_markup (GET_LABEL ("p_path_label"), markup);
+
+	g_free (markup);
+	g_free (utf8_name);
+	g_free (uri);
+	g_object_unref (parent);
+
+	/**/
+
+	utf8_name = g_uri_display_basename (fr_window_get_archive_uri (window));
+	gtk_label_set_text (GET_LABEL ("p_name_label"), utf8_name);
+
+	title_txt = g_strdup_printf (_("%s Properties"), utf8_name);
+	gtk_window_set_title (GTK_WINDOW (data->dialog), title_txt);
+	g_free (title_txt);
+
+	g_free (utf8_name);
+
+	/**/
+
+	GDateTime *date_time;
+	date_time = g_date_time_new_from_unix_local (get_file_mtime (fr_window_get_archive_uri (window)));
+	s = g_date_time_format (date_time, _("%d %B %Y, %H:%M"));
+	g_date_time_unref (date_time);
+	gtk_label_set_text (GET_LABEL ("p_date_label"), s);
+	g_free (s);
+
+	/**/
+
+	size = get_file_size (fr_window_get_archive_uri (window));
+	s = g_format_size_full (size, G_FORMAT_SIZE_LONG_FORMAT);
+	gtk_label_set_text (GET_LABEL ("p_size_label"), s);
+	g_free (s);
+
+	/**/
+
+	uncompressed_size = 0;
+	if (fr_window_archive_is_present (window)) {
+		guint i;
+
+		for (i = 0; i < window->archive->command->files->len; i++) {
+			FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+			uncompressed_size += fd->size;
+		}
+	}
+
+	s = g_format_size_full (uncompressed_size, G_FORMAT_SIZE_LONG_FORMAT);
+	gtk_label_set_text (GET_LABEL ("p_uncomp_size_label"), s);
+	g_free (s);
+
+	/**/
+
+	if (uncompressed_size != 0)
+		ratio = (double) uncompressed_size / size;
+	else
+		ratio = 0.0;
+	s = g_strdup_printf ("%0.2f", ratio);
+	gtk_label_set_text (GET_LABEL ("p_cratio_label"), s);
+	g_free (s);
+
+	/**/
+
+	s = g_strdup_printf ("%d", window->archive->command->n_regular_files);
+	gtk_label_set_text (GET_LABEL ("p_files_label"), s);
+	g_free (s);
+
+	/**/
+
+	gtk_label_set_text (GET_LABEL ("p_mime_type_label"), window->archive->command->mime_type);
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_prop_dialog_destroy",	G_CALLBACK (destroy_cb),
+	                                  "on_p_help_button_clicked",	G_CALLBACK (help_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (builder, data);
+
+	g_signal_connect_swapped (gtk_builder_get_object (builder, "p_ok_button"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  G_OBJECT (data->dialog));
+
+	g_object_unref (builder);
+
+	/* Run dialog. */
+
+	gtk_window_set_transient_for (GTK_WINDOW (data->dialog),
+				      GTK_WINDOW (window));
+	gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
+
+	gtk_widget_show (data->dialog);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/39.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/39.html new file mode 100644 index 0000000..6b9ae66 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/39.html @@ -0,0 +1,1005 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "dlg-update.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "gtk-utils.h"
+#include "fr-init.h"
+#include "fr-window.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+enum {
+	IS_SELECTED_COLUMN,
+	NAME_COLUMN,
+	DATA_COLUMN,
+	N_COLUMNS
+};
+
+typedef struct {
+	FrWindow     *window;
+
+	GtkWidget    *update_file_dialog;
+	GtkWidget    *update_file_primary_text_label;
+	GtkWidget    *update_file_secondary_text_label;
+
+	GtkWidget    *update_files_dialog;
+	GtkWidget    *update_files_primary_text_label;
+	GtkWidget    *update_files_secondary_text_label;
+	GtkWidget    *update_files_treeview;
+	GtkWidget    *update_files_ok_button;
+
+	GList        *file_list;
+	GtkTreeModel *list_model;
+} DialogData;
+
+/* called when the main dialog is closed. */
+static void
+dlg_update__destroy_cb (GtkWidget  *widget,
+		        DialogData *data)
+{
+	fr_window_update_dialog_closed (data->window);
+	if (data->file_list != NULL)
+		g_list_free (data->file_list);
+	g_free (data);
+}
+
+static GList*
+get_selected_files (DialogData *data)
+{
+	GList       *selection = NULL;
+	GtkTreeIter  iter;
+
+	if (! gtk_tree_model_get_iter_first (data->list_model, &iter))
+		return NULL;
+
+	do {
+		gboolean  is_selected;
+		OpenFile *file;
+
+                gtk_tree_model_get (data->list_model, &iter,
+                		    IS_SELECTED_COLUMN, &is_selected,
+                		    DATA_COLUMN, &file,
+                		    -1);
+                if (is_selected)
+                	selection = g_list_prepend (selection, file);
+	} while (gtk_tree_model_iter_next (data->list_model, &iter));
+
+	return g_list_reverse (selection);
+}
+
+static void
+update_cb (GtkWidget *widget,
+	   gpointer   callback_data)
+{
+	DialogData *data = callback_data;
+	GList      *selection;
+
+	selection = get_selected_files (data);
+	if (fr_window_update_files (data->window, selection)) {
+		int n_files;
+
+		n_files = g_list_length (data->file_list);
+		if (n_files == 1)
+			gtk_widget_destroy (data->update_file_dialog);
+		else
+			gtk_widget_destroy (data->update_files_dialog);
+	}
+	if (selection != NULL)
+		g_list_free (selection);
+}
+
+static void
+update_file_list (DialogData *data)
+{
+	guint        n_files;
+	GList       *scan;
+	GtkTreeIter  iter;
+
+	n_files = g_list_length (data->file_list);
+
+	/* update the file list */
+
+	gtk_list_store_clear (GTK_LIST_STORE (data->list_model));
+	for (scan = data->file_list; scan; scan = scan->next) {
+		char     *utf8_name;
+		OpenFile *file = scan->data;
+
+		gtk_list_store_append (GTK_LIST_STORE (data->list_model),
+				       &iter);
+
+		utf8_name = g_filename_display_name (file_name_from_path (file->path));
+		gtk_list_store_set (GTK_LIST_STORE (data->list_model),
+				    &iter,
+				    IS_SELECTED_COLUMN, TRUE,
+				    NAME_COLUMN, utf8_name,
+				    DATA_COLUMN, file,
+				    -1);
+		g_free (utf8_name);
+	}
+
+	/* update the labels */
+
+	if (n_files == 1) {
+		OpenFile *file = data->file_list->data;
+		char     *file_name;
+		char     *unescaped;
+		char     *archive_name;
+		char     *label;
+		char     *markup;
+
+		/* primary text */
+
+		file_name = g_filename_display_name (file_name_from_path (file->path));
+		unescaped = g_uri_unescape_string (fr_window_get_archive_uri (data->window), NULL);
+		archive_name = g_path_get_basename (unescaped);
+		label = g_markup_printf_escaped (_("Update the file \"%s\" in the archive \"%s\"?"), file_name, archive_name);
+		markup = g_strdup_printf ("<big><b>%s</b></big>", label);
+		gtk_label_set_markup (GTK_LABEL (data->update_file_primary_text_label), markup);
+
+		g_free (markup);
+		g_free (label);
+		g_free (archive_name);
+		g_free (unescaped);
+		g_free (file_name);
+
+		/* secondary text */
+
+		label = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+		                                      "The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.",
+		                                      "%u files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.",
+		                                      (gulong) n_files),
+		                         n_files);
+		gtk_label_set_text (GTK_LABEL (data->update_file_secondary_text_label), label);
+		g_free (label);
+	}
+	else if (n_files > 1) {
+		char *unescaped;
+		char *archive_name;
+		char *label;
+		char *markup;
+
+		/* primary text */
+
+		unescaped = g_uri_unescape_string (fr_window_get_archive_uri (data->window), NULL);
+		archive_name = g_path_get_basename (unescaped);
+		label = g_markup_printf_escaped (_("Update the files in the archive \"%s\"?"), archive_name);
+		markup = g_strdup_printf ("<big><b>%s</b></big>", label);
+		gtk_label_set_markup (GTK_LABEL (data->update_files_primary_text_label), markup);
+
+		g_free (markup);
+		g_free (label);
+		g_free (archive_name);
+		g_free (unescaped);
+
+		/* secondary text */
+
+		label = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+		                                      "The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.",
+		                                      "%u files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.",
+		                                      (gulong) n_files),
+		                         n_files);
+		gtk_label_set_text (GTK_LABEL (data->update_files_secondary_text_label), label);
+		g_free (label);
+	}
+
+	/* show the appropriate dialog */
+
+	if (n_files == 1) {
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_files_dialog), FALSE);*/
+		gtk_widget_hide (data->update_files_dialog);
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_file_dialog), TRUE);*/
+		gtk_widget_show (data->update_file_dialog);
+	}
+	else if (n_files > 1) {
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_file_dialog), FALSE);*/
+		gtk_widget_hide (data->update_file_dialog);
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_files_dialog), TRUE);*/
+		gtk_widget_show (data->update_files_dialog);
+	}
+	else { /* n_files == 0 */
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_files_dialog), FALSE);*/
+		gtk_widget_hide (data->update_files_dialog);
+		/*gtk_window_set_modal (GTK_WINDOW (data->update_file_dialog), FALSE);*/
+		gtk_widget_hide (data->update_file_dialog);
+	}
+}
+
+static int
+n_selected (DialogData *data)
+{
+	int         n = 0;
+	GtkTreeIter iter;
+
+	if (! gtk_tree_model_get_iter_first (data->list_model, &iter))
+		return 0;
+
+	do {
+		gboolean is_selected;
+                gtk_tree_model_get (data->list_model, &iter, IS_SELECTED_COLUMN, &is_selected, -1);
+                if (is_selected)
+                	n++;
+	} while (gtk_tree_model_iter_next (data->list_model, &iter));
+
+	return n;
+}
+
+static void
+is_selected_toggled (GtkCellRendererToggle *cell,
+		     char                  *path_string,
+		     gpointer               callback_data)
+{
+	DialogData   *data  = callback_data;
+	GtkTreeModel *model = GTK_TREE_MODEL (data->list_model);
+	GtkTreeIter   iter;
+	GtkTreePath  *path = gtk_tree_path_new_from_string (path_string);
+	guint         value;
+
+	gtk_tree_model_get_iter (model, &iter, path);
+	value = ! gtk_cell_renderer_toggle_get_active (cell);
+	gtk_list_store_set (GTK_LIST_STORE (model), &iter, IS_SELECTED_COLUMN, value, -1);
+
+	gtk_tree_path_free (path);
+
+	gtk_widget_set_sensitive (data->update_files_ok_button, n_selected (data) > 0);
+}
+
+gpointer
+dlg_update (FrWindow *window)
+{
+	GtkBuilder        *builder;
+	DialogData        *data;
+	GtkCellRenderer   *renderer;
+	GtkTreeViewColumn *column;
+
+	data = g_new0 (DialogData, 1);
+	builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "update.ui");
+	data->file_list = NULL;
+	data->window = window;
+
+	/* Get the widgets. */
+
+	data->update_file_dialog = GET_WIDGET ("update_file_dialog");
+	data->update_file_primary_text_label = GET_WIDGET ("update_file_primary_text_label");
+	data->update_file_secondary_text_label = GET_WIDGET ("update_file_secondary_text_label");
+
+	data->update_files_dialog = GET_WIDGET ("update_files_dialog");
+	data->update_files_primary_text_label = GET_WIDGET ("update_files_primary_text_label");
+	data->update_files_secondary_text_label = GET_WIDGET ("update_files_secondary_text_label");
+	data->update_files_treeview = GET_WIDGET ("update_files_treeview");
+	data->update_files_ok_button = GET_WIDGET ("update_files_ok_button");
+
+	/* Set the signals handlers. */
+
+	gtk_builder_add_callback_symbols (builder,
+	                                  "on_update_file_dialog_destroy",	G_CALLBACK (dlg_update__destroy_cb),
+	                                  "on_update_file_ok_button_clicked",	G_CALLBACK (update_cb),
+	                                  "on_update_files_dialog_destroy",	G_CALLBACK (dlg_update__destroy_cb),
+	                                  "on_update_files_ok_button_clicked",	G_CALLBACK (update_cb),
+	                                  NULL);
+
+	gtk_builder_connect_signals (builder, data);
+
+	g_signal_connect_swapped (gtk_builder_get_object (builder, "update_file_cancel_button"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  G_OBJECT (data->update_file_dialog));
+
+	g_signal_connect_swapped (gtk_builder_get_object (builder, "update_files_cancel_button"),
+				  "clicked",
+				  G_CALLBACK (gtk_widget_destroy),
+				  G_OBJECT (data->update_files_dialog));
+
+	g_object_unref (builder);
+
+	/* Set dialog data. */
+
+	data->list_model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS,
+							       G_TYPE_BOOLEAN,
+							       G_TYPE_STRING,
+							       G_TYPE_POINTER));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->list_model),
+					      NAME_COLUMN,
+					      GTK_SORT_ASCENDING);
+	gtk_tree_view_set_model (GTK_TREE_VIEW (data->update_files_treeview),
+				 data->list_model);
+	g_object_unref (G_OBJECT (data->list_model));
+
+	column = gtk_tree_view_column_new ();
+
+	renderer = gtk_cell_renderer_toggle_new ();
+        g_signal_connect (G_OBJECT (renderer),
+                          "toggled",
+                          G_CALLBACK (is_selected_toggled),
+                          data);
+        gtk_tree_view_column_pack_start (column, renderer, FALSE);
+        gtk_tree_view_column_set_attributes (column, renderer,
+                                             "active", IS_SELECTED_COLUMN,
+                                             NULL);
+
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_tree_view_column_pack_start (column, renderer, TRUE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+					     "text", NAME_COLUMN,
+					     NULL);
+
+	gtk_tree_view_append_column (GTK_TREE_VIEW (data->update_files_treeview), column);
+
+	/* Run dialog. */
+
+	gtk_window_set_transient_for (GTK_WINDOW (data->update_file_dialog),
+				      GTK_WINDOW (window));
+	gtk_window_set_transient_for (GTK_WINDOW (data->update_files_dialog),
+				      GTK_WINDOW (window));
+
+	update_file_list (data);
+
+	return data;
+}
+
+void
+dlg_update_add_file (gpointer  dialog,
+		     OpenFile *file)
+{
+	DialogData *data = dialog;
+	GList      *scan;
+
+	/* avoid duplicates */
+
+	for (scan = data->file_list; scan; scan = scan->next) {
+		OpenFile *test = scan->data;
+		if (uricmp (test->extracted_uri, file->extracted_uri) == 0)
+			return;
+	}
+
+	/**/
+
+	data->file_list = g_list_append (data->file_list, file);
+	update_file_list (data);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/4.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/4.html new file mode 100644 index 0000000..b6f2e6a --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/4.html @@ -0,0 +1,3385 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
/* eggdesktopfile.c - Freedesktop.Org Desktop Files
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * Based on mate-desktop-item.c
+ * Copyright (C) 1999, 2000 Red Hat Inc.
+ * Copyright (C) 2001 George Lebl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include "eggdesktopfile.h"
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+struct EggDesktopFile {
+  GKeyFile           *key_file;
+  char               *source;
+
+  char               *name, *icon;
+  EggDesktopFileType  type;
+  char                document_code;
+};
+
+/**
+ * egg_desktop_file_new:
+ * @desktop_file_path: path to a Freedesktop-style Desktop file
+ * @error: error pointer
+ *
+ * Creates a new #EggDesktopFile for @desktop_file.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new (const char *desktop_file_path, GError **error)
+{
+  GKeyFile *key_file;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, desktop_file_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  return egg_desktop_file_new_from_key_file (key_file, desktop_file_path,
+					     error);
+}
+
+/**
+ * egg_desktop_file_new_from_data_dirs:
+ * @desktop_file_path: relative path to a Freedesktop-style Desktop file
+ * @error: error pointer
+ *
+ * Looks for @desktop_file_path in the paths returned from
+ * g_get_user_data_dir() and g_get_system_data_dirs(), and creates
+ * a new #EggDesktopFile from it.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_data_dirs (const char  *desktop_file_path,
+				     GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  GKeyFile *key_file;
+  char *full_path;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_data_dirs (key_file, desktop_file_path,
+				       &full_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  desktop_file = egg_desktop_file_new_from_key_file (key_file,
+						     full_path,
+						     error);
+  g_free (full_path);
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_new_from_dirs:
+ * @desktop_file_path: relative path to a Freedesktop-style Desktop file
+ * @search_dirs: NULL-terminated array of directories to search
+ * @error: error pointer
+ *
+ * Looks for @desktop_file_path in the paths returned from
+ * g_get_user_data_dir() and g_get_system_data_dirs(), and creates
+ * a new #EggDesktopFile from it.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_dirs (const char  *desktop_file_path,
+				const char **search_dirs,
+				GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  GKeyFile *key_file;
+  char *full_path;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_dirs (key_file, desktop_file_path, search_dirs,
+				  &full_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  desktop_file = egg_desktop_file_new_from_key_file (key_file,
+						     full_path,
+						     error);
+  g_free (full_path);
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_new_from_key_file:
+ * @key_file: a #GKeyFile representing a desktop file
+ * @source: the path or URI that @key_file was loaded from, or %NULL
+ * @error: error pointer
+ *
+ * Creates a new #EggDesktopFile for @key_file. Assumes ownership of
+ * @key_file (on success or failure); you should consider @key_file to
+ * be freed after calling this function.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_key_file (GKeyFile    *key_file,
+				    const char  *source,
+				    GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  char *version, *type;
+
+  if (!g_key_file_has_group (key_file, EGG_DESKTOP_FILE_GROUP))
+    {
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_INVALID,
+		   _("File is not a valid .desktop file"));
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  version = g_key_file_get_value (key_file, EGG_DESKTOP_FILE_GROUP,
+				  EGG_DESKTOP_FILE_KEY_VERSION,
+				  NULL);
+  if (version)
+    {
+      double version_num;
+      char *end;
+
+      version_num = g_ascii_strtod (version, &end);
+      if (*end)
+	{
+	  g_warning ("Invalid Version string '%s' in %s",
+		     version, source ? source : "(unknown)");
+	}
+      else if (version_num > 1.0)
+	{
+      /* Translators: Version here is capitalized because it refers to a
+       * field in the desktop file */
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_INVALID,
+		       _("Unrecognized desktop file Version '%s'"), version);
+	  g_free (version);
+	  g_key_file_free (key_file);
+	  return NULL;
+	}
+      g_free (version);
+    }
+
+  desktop_file = g_new0 (EggDesktopFile, 1);
+  desktop_file->key_file = key_file;
+
+  if (g_path_is_absolute (source))
+    desktop_file->source = g_filename_to_uri (source, NULL, NULL);
+  else
+    desktop_file->source = g_strdup (source);
+
+  desktop_file->name = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
+					      EGG_DESKTOP_FILE_KEY_NAME, error);
+  if (!desktop_file->name)
+    {
+      egg_desktop_file_free (desktop_file);
+      return NULL;
+    }
+
+  type = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_TYPE, error);
+  if (!type)
+    {
+      egg_desktop_file_free (desktop_file);
+      return NULL;
+    }
+
+  if (!strcmp (type, "Application"))
+    {
+      char *exec, *p;
+
+      desktop_file->type = EGG_DESKTOP_FILE_TYPE_APPLICATION;
+
+      exec = g_key_file_get_string (key_file,
+				    EGG_DESKTOP_FILE_GROUP,
+				    EGG_DESKTOP_FILE_KEY_EXEC,
+				    error);
+      if (!exec)
+	{
+	  egg_desktop_file_free (desktop_file);
+	  g_free (type);
+	  return NULL;
+	}
+
+      /* See if it takes paths or URIs or neither */
+      for (p = exec; *p; p++)
+	{
+	  if (*p == '%')
+	    {
+	      if (p[1] == '\0' || strchr ("FfUu", p[1]))
+		{
+		  desktop_file->document_code = p[1];
+		  break;
+		}
+	      p++;
+	    }
+	}
+
+      g_free (exec);
+    }
+  else if (!strcmp (type, "Link"))
+    {
+      char *url;
+
+      desktop_file->type = EGG_DESKTOP_FILE_TYPE_LINK;
+
+      url = g_key_file_get_string (key_file,
+				   EGG_DESKTOP_FILE_GROUP,
+				   EGG_DESKTOP_FILE_KEY_URL,
+				   error);
+      if (!url)
+	{
+	  egg_desktop_file_free (desktop_file);
+	  g_free (type);
+	  return NULL;
+	}
+      g_free (url);
+    }
+  else if (!strcmp (type, "Directory"))
+    desktop_file->type = EGG_DESKTOP_FILE_TYPE_DIRECTORY;
+  else
+    desktop_file->type = EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED;
+
+  g_free (type);
+
+  /* Check the Icon key */
+  desktop_file->icon = g_key_file_get_string (key_file,
+					      EGG_DESKTOP_FILE_GROUP,
+					      EGG_DESKTOP_FILE_KEY_ICON,
+					      NULL);
+  if (desktop_file->icon && !g_path_is_absolute (desktop_file->icon))
+    {
+      char *ext;
+
+      /* Lots of .desktop files still get this wrong */
+      ext = strrchr (desktop_file->icon, '.');
+      if (ext && (!strcmp (ext, ".png") ||
+		  !strcmp (ext, ".xpm") ||
+		  !strcmp (ext, ".svg")))
+	{
+	  g_warning ("Desktop file '%s' has malformed Icon key '%s'"
+		     "(should not include extension)",
+		     source ? source : "(unknown)",
+		     desktop_file->icon);
+	  *ext = '\0';
+	}
+    }
+
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_free:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Frees @desktop_file.
+ **/
+void
+egg_desktop_file_free (EggDesktopFile *desktop_file)
+{
+  g_key_file_free (desktop_file->key_file);
+  g_free (desktop_file->source);
+  g_free (desktop_file->name);
+  g_free (desktop_file->icon);
+  g_free (desktop_file);
+}
+
+/**
+ * egg_desktop_file_get_source:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the URI that @desktop_file was loaded from.
+ *
+ * Return value: @desktop_file's source URI
+ **/
+const char *
+egg_desktop_file_get_source (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->source;
+}
+
+/**
+ * egg_desktop_file_get_desktop_file_type:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the desktop file type of @desktop_file.
+ *
+ * Return value: @desktop_file's type
+ **/
+EggDesktopFileType
+egg_desktop_file_get_desktop_file_type (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->type;
+}
+
+/**
+ * egg_desktop_file_get_name:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the (localized) value of @desktop_file's "Name" key.
+ *
+ * Return value: the application/link name
+ **/
+const char *
+egg_desktop_file_get_name (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->name;
+}
+
+/**
+ * egg_desktop_file_get_icon:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the value of @desktop_file's "Icon" key.
+ *
+ * If the icon string is a full path (that is, if g_path_is_absolute()
+ * returns %TRUE when called on it), it points to a file containing an
+ * unthemed icon. If the icon string is not a full path, it is the
+ * name of a themed icon, which can be looked up with %GtkIconTheme,
+ * or passed directly to a theme-aware widget like %GtkImage or
+ * %GtkCellRendererPixbuf.
+ *
+ * Return value: the icon path or name
+ **/
+const char *
+egg_desktop_file_get_icon (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->icon;
+}
+
+gboolean
+egg_desktop_file_has_key (EggDesktopFile  *desktop_file,
+			  const char      *key,
+			  GError         **error)
+{
+  return g_key_file_has_key (desktop_file->key_file,
+			     EGG_DESKTOP_FILE_GROUP, key,
+			     error);
+}
+
+char *
+egg_desktop_file_get_string (EggDesktopFile  *desktop_file,
+			     const char      *key,
+			     GError         **error)
+{
+  return g_key_file_get_string (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP, key,
+				error);
+}
+
+char *
+egg_desktop_file_get_locale_string (EggDesktopFile  *desktop_file,
+				    const char      *key,
+				    const char      *locale,
+				    GError         **error)
+{
+  return g_key_file_get_locale_string (desktop_file->key_file,
+				       EGG_DESKTOP_FILE_GROUP, key, locale,
+				       error);
+}
+
+gboolean
+egg_desktop_file_get_boolean (EggDesktopFile  *desktop_file,
+			      const char      *key,
+			      GError         **error)
+{
+  return g_key_file_get_boolean (desktop_file->key_file,
+				 EGG_DESKTOP_FILE_GROUP, key,
+				 error);
+}
+
+double
+egg_desktop_file_get_numeric (EggDesktopFile  *desktop_file,
+			      const char      *key,
+			      GError         **error)
+{
+  return g_key_file_get_double (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP, key,
+				error);
+}
+
+int
+egg_desktop_file_get_integer (EggDesktopFile *desktop_file,
+                              const char		*key,
+                              GError		   **error)
+{
+  return g_key_file_get_integer (desktop_file->key_file,
+                                 EGG_DESKTOP_FILE_GROUP, key,
+                                 error);
+}
+
+char **
+egg_desktop_file_get_string_list (EggDesktopFile  *desktop_file,
+				  const char      *key,
+				  gsize           *length,
+				  GError         **error)
+{
+  return g_key_file_get_string_list (desktop_file->key_file,
+				     EGG_DESKTOP_FILE_GROUP, key, length,
+				     error);
+}
+
+char **
+egg_desktop_file_get_locale_string_list (EggDesktopFile  *desktop_file,
+					 const char      *key,
+					 const char      *locale,
+					 gsize           *length,
+					 GError         **error)
+{
+  return g_key_file_get_locale_string_list (desktop_file->key_file,
+					    EGG_DESKTOP_FILE_GROUP, key,
+					    locale, length,
+					    error);
+}
+
+/**
+ * egg_desktop_file_can_launch:
+ * @desktop_file: an #EggDesktopFile
+ * @desktop_environment: the name of the running desktop environment,
+ * or %NULL
+ *
+ * Tests if @desktop_file can/should be launched in the current
+ * environment. If @desktop_environment is non-%NULL, @desktop_file's
+ * "OnlyShowIn" and "NotShowIn" keys are checked to make sure that
+ * this desktop_file is appropriate for the named environment.
+ *
+ * Furthermore, if @desktop_file has type
+ * %EGG_DESKTOP_FILE_TYPE_APPLICATION, its "TryExec" key (if any) is
+ * also checked, to make sure the binary it points to exists.
+ *
+ * egg_desktop_file_can_launch() does NOT check the value of the
+ * "Hidden" key.
+ *
+ * Return value: %TRUE if @desktop_file can be launched
+ **/
+gboolean
+egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
+			     const char     *desktop_environment)
+{
+  char *try_exec, *found_program;
+  char **only_show_in, **not_show_in;
+  gboolean found;
+  int i;
+
+  if (desktop_file->type != EGG_DESKTOP_FILE_TYPE_APPLICATION &&
+      desktop_file->type != EGG_DESKTOP_FILE_TYPE_LINK)
+    return FALSE;
+
+  if (desktop_environment)
+    {
+      only_show_in = g_key_file_get_string_list (desktop_file->key_file,
+						 EGG_DESKTOP_FILE_GROUP,
+						 EGG_DESKTOP_FILE_KEY_ONLY_SHOW_IN,
+						 NULL, NULL);
+      if (only_show_in)
+	{
+	  for (i = 0, found = FALSE; only_show_in[i] && !found; i++)
+	    {
+	      if (!strcmp (only_show_in[i], desktop_environment))
+		found = TRUE;
+	    }
+
+	  g_strfreev (only_show_in);
+
+	  if (!found)
+	    return FALSE;
+	}
+
+      not_show_in = g_key_file_get_string_list (desktop_file->key_file,
+						EGG_DESKTOP_FILE_GROUP,
+						EGG_DESKTOP_FILE_KEY_NOT_SHOW_IN,
+						NULL, NULL);
+      if (not_show_in)
+	{
+	  for (i = 0, found = FALSE; not_show_in[i] && !found; i++)
+	    {
+	      if (!strcmp (not_show_in[i], desktop_environment))
+		found = TRUE;
+	    }
+
+	  g_strfreev (not_show_in);
+
+	  if (found)
+	    return FALSE;
+	}
+    }
+
+  if (desktop_file->type == EGG_DESKTOP_FILE_TYPE_APPLICATION)
+    {
+      try_exec = g_key_file_get_string (desktop_file->key_file,
+					EGG_DESKTOP_FILE_GROUP,
+					EGG_DESKTOP_FILE_KEY_TRY_EXEC,
+					NULL);
+      if (try_exec)
+	{
+	  found_program = g_find_program_in_path (try_exec);
+	  g_free (try_exec);
+
+	  if (!found_program)
+	    return FALSE;
+	  g_free (found_program);
+	}
+    }
+
+  return TRUE;
+}
+
+/**
+ * egg_desktop_file_accepts_documents:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file represents an application that can accept
+ * documents on the command line.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_documents (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->document_code != 0;
+}
+
+/**
+ * egg_desktop_file_accepts_multiple:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file can accept multiple documents at once.
+ *
+ * If this returns %FALSE, you can still pass multiple documents to
+ * egg_desktop_file_launch(), but that will result in multiple copies
+ * of the application being launched. See egg_desktop_file_launch()
+ * for more details.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_multiple (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return (desktop_file->document_code == 'F' ||
+	  desktop_file->document_code == 'U');
+}
+
+/**
+ * egg_desktop_file_accepts_uris:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file can accept (non-"file:") URIs as documents to
+ * open.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_uris (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return (desktop_file->document_code == 'U' ||
+	  desktop_file->document_code == 'u');
+}
+
+static void
+append_quoted_word (GString    *str,
+		    const char *s,
+		    gboolean    in_single_quotes,
+		    gboolean    in_double_quotes)
+{
+  const char *p;
+
+  if (!in_single_quotes && !in_double_quotes)
+    g_string_append_c (str, '\'');
+  else if (!in_single_quotes && in_double_quotes)
+    g_string_append (str, "\"'");
+
+  if (!strchr (s, '\''))
+    g_string_append (str, s);
+  else
+    {
+      for (p = s; *p != '\0'; p++)
+	{
+	  if (*p == '\'')
+	    g_string_append (str, "'\\''");
+	  else
+	    g_string_append_c (str, *p);
+	}
+    }
+
+  if (!in_single_quotes && !in_double_quotes)
+    g_string_append_c (str, '\'');
+  else if (!in_single_quotes && in_double_quotes)
+    g_string_append (str, "'\"");
+}
+
+static void
+do_percent_subst (EggDesktopFile *desktop_file,<--- Parameter 'desktop_file' can be declared as pointer to const
+		  char            code,
+		  GString        *str,
+		  GSList        **documents,
+		  gboolean        in_single_quotes,
+		  gboolean        in_double_quotes)
+{
+  GSList *d;
+  char *doc;<--- Variable 'doc' can be declared as pointer to const
+
+  switch (code)
+    {
+    case '%':
+      g_string_append_c (str, '%');
+      break;
+
+    case 'F':
+    case 'U':
+      for (d = *documents; d; d = d->next)
+	{
+	  doc = d->data;
+	  g_string_append (str, " ");
+	  append_quoted_word (str, doc, in_single_quotes, in_double_quotes);
+	}
+      *documents = NULL;
+      break;
+
+    case 'f':
+    case 'u':
+      if (*documents)
+	{
+	  doc = (*documents)->data;
+	  g_string_append (str, " ");
+	  append_quoted_word (str, doc, in_single_quotes, in_double_quotes);
+	  *documents = (*documents)->next;
+	}
+      break;
+
+    case 'i':
+      if (desktop_file->icon)
+	{
+	  g_string_append (str, "--icon ");
+	  append_quoted_word (str, desktop_file->icon,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'c':
+      if (desktop_file->name)
+	{
+	  append_quoted_word (str, desktop_file->name,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'k':
+      if (desktop_file->source)
+	{
+	  append_quoted_word (str, desktop_file->source,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'D':
+    case 'N':
+    case 'd':
+    case 'n':
+    case 'v':
+    case 'm':
+      /* Deprecated; skip */
+      break;
+
+    default:
+      g_warning ("Unrecognized %%-code '%%%c' in Exec", code);
+      break;
+    }
+}
+
+static char *
+parse_exec (EggDesktopFile  *desktop_file,
+	    GSList         **documents,
+	    GError         **error)
+{
+  char *exec, *p, *command;
+  gboolean escape, single_quot, double_quot;
+  GString *gs;
+
+  exec = g_key_file_get_string (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_EXEC,
+				error);
+  if (!exec)
+    return NULL;
+
+  /* Build the command */
+  gs = g_string_new (NULL);
+  escape = single_quot = double_quot = FALSE;
+
+  for (p = exec; *p != '\0'; p++)
+    {
+      if (escape)
+	{
+	  escape = FALSE;
+	  g_string_append_c (gs, *p);
+	}
+      else if (*p == '\\')
+	{
+	  if (!single_quot)
+	    escape = TRUE;
+	  g_string_append_c (gs, *p);
+	}
+      else if (*p == '\'')
+	{
+	  g_string_append_c (gs, *p);
+	  if (!single_quot && !double_quot)
+	    single_quot = TRUE;
+	  else if (single_quot)
+	    single_quot = FALSE;
+	}
+      else if (*p == '"')
+	{
+	  g_string_append_c (gs, *p);
+	  if (!single_quot && !double_quot)
+	    double_quot = TRUE;
+	  else if (double_quot)
+	    double_quot = FALSE;
+	}
+      else if (*p == '%' && p[1])
+	{
+	  do_percent_subst (desktop_file, p[1], gs, documents,
+			    single_quot, double_quot);
+	  p++;
+	}
+      else
+	g_string_append_c (gs, *p);
+    }
+
+  g_free (exec);
+  command = g_string_free (gs, FALSE);
+
+  /* Prepend "xdg-terminal " if needed (FIXME: use gvfs) */
+  if (g_key_file_has_key (desktop_file->key_file,
+			  EGG_DESKTOP_FILE_GROUP,
+			  EGG_DESKTOP_FILE_KEY_TERMINAL,
+			  NULL))
+    {
+      GError *terminal_error = NULL;
+      gboolean use_terminal =
+	g_key_file_get_boolean (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_TERMINAL,
+				&terminal_error);
+      if (terminal_error)
+	{
+	  g_free (command);
+	  g_propagate_error (error, terminal_error);
+	  return NULL;
+	}
+
+      if (use_terminal)
+	{
+	  gs = g_string_new ("xdg-terminal ");
+	  append_quoted_word (gs, command, FALSE, FALSE);
+	  g_free (command);
+	  command = g_string_free (gs, FALSE);
+	}
+    }
+
+  return command;
+}
+
+static GSList *
+translate_document_list (EggDesktopFile *desktop_file, GSList *documents)
+{
+  gboolean accepts_uris = egg_desktop_file_accepts_uris (desktop_file);
+  GSList *ret, *d;
+
+  for (d = documents, ret = NULL; d; d = d->next)
+    {
+      const char *document = d->data;
+      gboolean is_uri = !g_path_is_absolute (document);
+      char *translated;
+
+      if (accepts_uris)
+	{
+	  if (is_uri)
+	    translated = g_strdup (document);
+	  else
+	    translated = g_filename_to_uri (document, NULL, NULL);
+	}
+      else
+	{
+	  if (is_uri)
+	    translated = g_filename_from_uri (document, NULL, NULL);
+	  else
+	    translated = g_strdup (document);
+	}
+
+      if (translated)
+	ret = g_slist_prepend (ret, translated);
+    }
+
+  return g_slist_reverse (ret);
+}
+
+static void
+free_document_list (GSList *documents)
+{
+  GSList *d;
+
+  for (d = documents; d; d = d->next)
+    g_free (d->data);
+  g_slist_free (documents);
+}
+
+/**
+ * egg_desktop_file_parse_exec:
+ * @desktop_file: a #EggDesktopFile
+ * @documents: a list of document paths or URIs
+ * @error: error pointer
+ *
+ * Parses @desktop_file's Exec key, inserting @documents into it, and
+ * returns the result.
+ *
+ * If @documents contains non-file: URIs and @desktop_file does not
+ * accept URIs, those URIs will be ignored. Likewise, if @documents
+ * contains more elements than @desktop_file accepts, the extra
+ * documents will be ignored.
+ *
+ * Return value: the parsed Exec string
+ **/
+char *
+egg_desktop_file_parse_exec (EggDesktopFile  *desktop_file,
+			     GSList          *documents,
+			     GError         **error)
+{
+  GSList *translated, *docs;
+  char *command;
+
+  docs = translated = translate_document_list (desktop_file, documents);
+  command = parse_exec (desktop_file, &docs, error);
+  free_document_list (translated);
+
+  return command;
+}
+
+static gboolean
+parse_link (EggDesktopFile  *desktop_file,
+	    EggDesktopFile **app_desktop_file,
+	    GSList         **documents,
+	    GError         **error)
+{
+  char *url;
+  GKeyFile *key_file;
+
+  url = g_key_file_get_string (desktop_file->key_file,
+			       EGG_DESKTOP_FILE_GROUP,
+			       EGG_DESKTOP_FILE_KEY_URL,
+			       error);
+  if (!url)
+    return FALSE;
+  *documents = g_slist_prepend (NULL, url);
+
+  /* FIXME: use gvfs */
+  key_file = g_key_file_new ();
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_NAME,
+			 "xdg-open");
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_TYPE,
+			 "Application");
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_EXEC,
+			 "xdg-open %u");
+  *app_desktop_file = egg_desktop_file_new_from_key_file (key_file, NULL, NULL);
+  return TRUE;
+}
+
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+static char *
+start_startup_notification (GdkDisplay     *display,
+			    EggDesktopFile *desktop_file,
+			    const char     *argv0,
+			    int             screen,
+			    int             workspace,
+			    guint32         launch_time)
+{
+  static int sequence = 0;
+  char *startup_id;
+  char *description, *wmclass;
+  char *screen_str, *workspace_str;
+
+  g_assert(GDK_IS_X11_DISPLAY (display));
+
+  if (g_key_file_has_key (desktop_file->key_file,
+			  EGG_DESKTOP_FILE_GROUP,
+			  EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY,
+			  NULL))
+    {
+      if (!g_key_file_get_boolean (desktop_file->key_file,
+				   EGG_DESKTOP_FILE_GROUP,
+				   EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY,
+				   NULL))
+	return NULL;
+      wmclass = NULL;
+    }
+  else
+    {
+      wmclass = g_key_file_get_string (desktop_file->key_file,
+				       EGG_DESKTOP_FILE_GROUP,
+				       EGG_DESKTOP_FILE_KEY_STARTUP_WM_CLASS,
+				       NULL);
+      if (!wmclass)
+	return NULL;
+    }
+
+  if (launch_time == (guint32)-1)
+    launch_time = gdk_x11_display_get_user_time (display);
+  startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
+				g_get_prgname (),
+				(unsigned long)getpid (),
+				g_get_host_name (),
+				argv0,
+				sequence++,
+				(unsigned long)launch_time);
+
+  description = g_strdup_printf (_("Starting %s"), desktop_file->name);
+  screen_str = g_strdup_printf ("%d", screen);
+  workspace_str = workspace == -1 ? NULL : g_strdup_printf ("%d", workspace);
+
+  gdk_x11_display_broadcast_startup_message (display, "new",
+					     "ID", startup_id,
+					     "NAME", desktop_file->name,
+					     "SCREEN", screen_str,
+					     "BIN", argv0,
+					     "ICON", desktop_file->icon,
+					     "DESKTOP", workspace_str,
+					     "DESCRIPTION", description,
+					     "WMCLASS", wmclass,
+					     NULL);
+
+  g_free (description);
+  g_free (wmclass);
+  g_free (screen_str);
+  g_free (workspace_str);
+
+  return startup_id;
+}
+
+static void
+end_startup_notification (GdkDisplay *display,
+			  const char *startup_id)
+{
+  gdk_x11_display_broadcast_startup_message (display, "remove",
+					     "ID", startup_id,
+					     NULL);
+}
+
+#define EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH (30 /* seconds */)
+
+typedef struct {
+  GdkDisplay *display;
+  char *startup_id;
+} StartupNotificationData;
+
+static gboolean
+startup_notification_timeout (gpointer data)
+{
+  StartupNotificationData *sn_data = data;
+
+  end_startup_notification (sn_data->display, sn_data->startup_id);
+  g_object_unref (sn_data->display);
+  g_free (sn_data->startup_id);
+  g_free (sn_data);
+
+  return FALSE;
+}
+
+static void
+set_startup_notification_timeout (GdkDisplay *display,
+				  const char *startup_id)
+{
+  StartupNotificationData *sn_data;
+
+  sn_data = g_new (StartupNotificationData, 1);
+  sn_data->display = g_object_ref (display);
+  sn_data->startup_id = g_strdup (startup_id);
+
+  g_timeout_add_seconds (EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH,
+			 startup_notification_timeout, sn_data);
+}
+#endif // GDK_WINDOWING_X11
+
+static GPtrArray *
+array_putenv (GPtrArray *env, char *variable)
+{
+  guint i, keylen;
+
+  if (!env)
+    {
+      char **envp;
+
+      env = g_ptr_array_new ();
+
+      envp = g_listenv ();
+      for (i = 0; envp[i]; i++)
+        {
+          const char *value;
+
+          value = g_getenv (envp[i]);
+          g_ptr_array_add (env, g_strdup_printf ("%s=%s", envp[i],
+                                                 value ? value : ""));
+        }
+      g_strfreev (envp);
+    }
+
+  keylen = strcspn (variable, "=");
+
+  /* Remove old value of key */
+  for (i = 0; i < env->len; i++)
+    {
+      char *envvar = env->pdata[i];
+
+      if (!strncmp (envvar, variable, keylen) && envvar[keylen] == '=')
+	{
+	  g_free (envvar);
+	  g_ptr_array_remove_index_fast (env, i);
+	  break;
+	}
+    }
+
+  /* Add new value */
+  g_ptr_array_add (env, g_strdup (variable));
+
+  return env;
+}
+
+static gboolean
+egg_desktop_file_launchv (EggDesktopFile *desktop_file,
+			  GSList *documents, va_list args,
+			  GError **error)
+{
+  EggDesktopFileLaunchOption option;
+  GSList *translated_documents = NULL, *docs = NULL;
+  char *command, **argv;
+  int argc, i;
+  gboolean success, current_success;
+  GdkDisplay *display;
+  char *startup_id;
+
+  GPtrArray   *env = NULL;
+  char       **variables = NULL;
+  GdkScreen   *screen = NULL;
+  int          workspace = -1;
+  const char  *directory = NULL;
+  guint32      launch_time = (guint32)-1;
+  GSpawnFlags  flags = G_SPAWN_SEARCH_PATH;
+  GSpawnChildSetupFunc setup_func = NULL;
+  gpointer     setup_data = NULL;
+
+  GPid        *ret_pid = NULL;
+  int         *ret_stdin = NULL, *ret_stdout = NULL, *ret_stderr = NULL;
+  char       **ret_startup_id = NULL;
+
+  if (documents && desktop_file->document_code == 0)
+    {
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		   _("Application does not accept documents on command line"));
+      return FALSE;
+    }
+
+  /* Read the options: technically it's incorrect for the caller to
+   * NULL-terminate the list of options (rather than 0-terminating
+   * it), but NULL-terminating lets us use G_GNUC_NULL_TERMINATED,
+   * it's more consistent with other glib/gtk methods, and it will
+   * work as long as sizeof (int) <= sizeof (NULL), and NULL is
+   * represented as 0. (Which is true everywhere we care about.)
+   */
+  while ((option = va_arg (args, EggDesktopFileLaunchOption)))
+    {
+      switch (option)
+	{
+	case EGG_DESKTOP_FILE_LAUNCH_CLEARENV:
+	  if (env)
+	    g_ptr_array_free (env, TRUE);
+	  env = g_ptr_array_new ();
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_PUTENV:
+	  variables = va_arg (args, char **);
+	  for (i = 0; variables[i]; i++)
+	    env = array_putenv (env, variables[i]);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_SCREEN:
+	  screen = va_arg (args, GdkScreen *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_WORKSPACE:
+	  workspace = va_arg (args, int);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_DIRECTORY:
+	  directory = va_arg (args, const char *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_TIME:
+	  launch_time = va_arg (args, guint32);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_FLAGS:
+	  flags |= va_arg (args, GSpawnFlags);
+	  /* Make sure they didn't set any flags that don't make sense. */
+	  flags &= ~G_SPAWN_FILE_AND_ARGV_ZERO;
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC:
+	  setup_func = va_arg (args, GSpawnChildSetupFunc);
+	  setup_data = va_arg (args, gpointer);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_PID:
+	  ret_pid = va_arg (args, GPid *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE:
+	  ret_stdin = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE:
+	  ret_stdout = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE:
+	  ret_stderr = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID:
+	  ret_startup_id = va_arg (args, char **);
+	  break;
+
+	default:
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_UNRECOGNIZED_OPTION,
+		       _("Unrecognized launch option: %d"),
+		       GPOINTER_TO_INT (option));
+	  success = FALSE;
+	  goto out;
+	}
+    }
+
+  if (screen)
+    {
+      display = gdk_screen_get_display (screen);
+      char *display_name = g_strdup (gdk_display_get_name (display));
+      char *display_env = g_strdup_printf ("DISPLAY=%s", display_name);
+      env = array_putenv (env, display_env);
+      g_free (display_name);
+      g_free (display_env);
+    }
+  else
+    {
+      display = gdk_display_get_default ();
+      screen = gdk_display_get_default_screen (display);
+    }
+
+  translated_documents = translate_document_list (desktop_file, documents);
+  docs = translated_documents;
+
+  success = FALSE;
+
+  do
+    {
+      command = parse_exec (desktop_file, &docs, error);
+      if (!command)
+	goto out;
+
+      if (!g_shell_parse_argv (command, &argc, &argv, error))
+	{
+	  g_free (command);
+	  goto out;
+	}
+      g_free (command);
+
+      startup_id = NULL;
+
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+      if (GDK_IS_X11_DISPLAY (display))
+        {
+	  int screen_num;
+
+	  screen_num = gdk_x11_screen_get_screen_number (screen);
+      startup_id = start_startup_notification (display, desktop_file,
+					       argv[0], screen_num,
+					       workspace, launch_time);
+      if (startup_id)
+	{
+	  char *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s",
+						  startup_id);
+	  env = array_putenv (env, startup_id_env);
+	  g_free (startup_id_env);
+	}
+        }
+#else
+      // Suppress unused variable warnings when not compiling with X
+      (void)workspace;
+      (void)launch_time;
+#endif
+
+      if (env != NULL)
+	g_ptr_array_add (env, NULL);
+
+      current_success =
+	g_spawn_async_with_pipes (directory,
+				  argv,
+				  env ? (char **)(env->pdata) : NULL,
+				  flags,
+				  setup_func, setup_data,
+				  ret_pid,
+				  ret_stdin, ret_stdout, ret_stderr,
+				  error);
+      g_strfreev (argv);
+
+      if (startup_id)
+	{
+	  if (current_success)
+	    {
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+	      if (GDK_IS_X11_DISPLAY (display))
+		{
+	      set_startup_notification_timeout (display, startup_id);
+		}
+#endif
+
+	      if (ret_startup_id)
+		*ret_startup_id = startup_id;
+	      else
+		g_free (startup_id);
+	    }
+	  else
+	    g_free (startup_id);
+	}
+      else if (ret_startup_id)
+	*ret_startup_id = NULL;
+
+      if (current_success)
+	{
+	  /* If we successfully launch any instances of the app, make
+	   * sure we return TRUE and don't set @error.
+	   */
+	  success = TRUE;
+	  error = NULL;
+
+	  /* Also, only set the output params on the first one */
+	  ret_pid = NULL;
+	  ret_stdin = ret_stdout = ret_stderr = NULL;
+	  ret_startup_id = NULL;
+	}
+    }
+  while (docs && current_success);
+
+ out:
+  if (env)
+    {
+      g_ptr_array_set_free_func (env, g_free);
+      g_ptr_array_free (env, TRUE);
+    }
+  free_document_list (translated_documents);
+
+  return success;
+}
+
+/**
+ * egg_desktop_file_launch:
+ * @desktop_file: an #EggDesktopFile
+ * @documents: a list of URIs or paths to documents to open
+ * @error: error pointer
+ * @...: additional options
+ *
+ * Launches @desktop_file with the given arguments. Additional options
+ * can be specified as follows:
+ *
+ *   %EGG_DESKTOP_FILE_LAUNCH_CLEARENV: (no arguments)
+ *       clears the environment in the child process
+ *   %EGG_DESKTOP_FILE_LAUNCH_PUTENV: (char **variables)
+ *       adds the NAME=VALUE strings in the given %NULL-terminated
+ *       array to the child process's environment
+ *   %EGG_DESKTOP_FILE_LAUNCH_SCREEN: (GdkScreen *screen)
+ *       causes the application to be launched on the given screen
+ *   %EGG_DESKTOP_FILE_LAUNCH_WORKSPACE: (int workspace)
+ *       causes the application to be launched on the given workspace
+ *   %EGG_DESKTOP_FILE_LAUNCH_DIRECTORY: (char *dir)
+ *       causes the application to be launched in the given directory
+ *   %EGG_DESKTOP_FILE_LAUNCH_TIME: (guint32 launch_time)
+ *       sets the "launch time" for the application. If the user
+ *       interacts with another window after @launch_time but before
+ *       the launched application creates its first window, the window
+ *       manager may choose to not give focus to the new application.
+ *       Passing 0 for @launch_time will explicitly request that the
+ *       application not receive focus.
+ *   %EGG_DESKTOP_FILE_LAUNCH_FLAGS (GSpawnFlags flags)
+ *       Sets additional #GSpawnFlags to use. See g_spawn_async() for
+ *       more details.
+ *   %EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC (GSpawnChildSetupFunc, gpointer)
+ *       Sets the child setup callback and the data to pass to it.
+ *       (See g_spawn_async() for more details.)
+ *
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_PID (GPid **pid)
+ *       On a successful launch, sets *@pid to the PID of the launched
+ *       application.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID (char **startup_id)
+ *       On a successful launch, sets *@startup_id to the Startup
+ *       Notification "startup id" of the launched application.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stdin.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stdout.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stderr.
+ *
+ * The options should be terminated with a single %NULL.
+ *
+ * If @documents contains multiple documents, but
+ * egg_desktop_file_accepts_multiple() returns %FALSE for
+ * @desktop_file, then egg_desktop_file_launch() will actually launch
+ * multiple instances of the application. In that case, the return
+ * value (as well as any values passed via
+ * %EGG_DESKTOP_FILE_LAUNCH_RETURN_PID, etc) will only reflect the
+ * first instance of the application that was launched (but the
+ * %EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC will be called for each
+ * instance).
+ *
+ * Return value: %TRUE if the application was successfully launched.
+ **/
+gboolean
+egg_desktop_file_launch (EggDesktopFile *desktop_file,
+			 GSList *documents, GError **error,
+			 ...)
+{
+  va_list args;
+  gboolean success;
+  EggDesktopFile *app_desktop_file;
+
+  switch (desktop_file->type)
+    {
+    case EGG_DESKTOP_FILE_TYPE_APPLICATION:
+      va_start (args, error);
+      success = egg_desktop_file_launchv (desktop_file, documents,
+					  args, error);
+      va_end (args);
+      break;
+
+    case EGG_DESKTOP_FILE_TYPE_LINK:
+      if (documents)
+	{
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		       _("Can't pass document URIs to a 'Type=Link' desktop entry"));
+	  return FALSE;
+	}
+
+      if (!parse_link (desktop_file, &app_desktop_file, &documents, error))
+	return FALSE;
+
+      va_start (args, error);
+      success = egg_desktop_file_launchv (app_desktop_file, documents,
+					  args, error);
+      va_end (args);
+
+      egg_desktop_file_free (app_desktop_file);
+      free_document_list (documents);
+      break;
+
+    case EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED:
+    case EGG_DESKTOP_FILE_TYPE_DIRECTORY:
+    default:
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		   _("Not a launchable item"));
+      success = FALSE;
+      break;
+    }
+
+  return success;
+}
+
+
+GQuark
+egg_desktop_file_error_quark (void)
+{
+  return g_quark_from_static_string ("egg-desktop_file-error-quark");
+}
+
+
+G_LOCK_DEFINE_STATIC (egg_desktop_file);
+static EggDesktopFile *egg_desktop_file;
+
+static void
+egg_set_desktop_file_internal (const char *desktop_file_path,
+                               gboolean set_defaults)
+{
+  GError *error = NULL;
+
+  G_LOCK (egg_desktop_file);
+  if (egg_desktop_file)
+    egg_desktop_file_free (egg_desktop_file);
+
+  egg_desktop_file = egg_desktop_file_new (desktop_file_path, &error);
+  if (error)
+    {
+      g_warning ("Could not load desktop file '%s': %s",
+		 desktop_file_path, error->message);
+      g_error_free (error);
+    }
+
+  if (set_defaults && egg_desktop_file != NULL) {
+    /* Set localized application name and default window icon */
+    if (egg_desktop_file->name)
+      g_set_application_name (egg_desktop_file->name);
+    if (egg_desktop_file->icon)
+      {
+        if (g_path_is_absolute (egg_desktop_file->icon))
+          gtk_window_set_default_icon_from_file (egg_desktop_file->icon, NULL);
+        else
+          gtk_window_set_default_icon_name (egg_desktop_file->icon);
+      }
+  }
+
+  G_UNLOCK (egg_desktop_file);
+}
+
+/**
+ * egg_set_desktop_file:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path. This will also call g_set_application_name()
+ * with the localized application name from the desktop file, and
+ * gtk_window_set_default_icon_name() or
+ * gtk_window_set_default_icon_from_file() with the application's
+ * icon. Other code may use additional information from the desktop
+ * file.
+ * See egg_set_desktop_file_without_defaults() for a variant of this
+ * function that does not set the application name and default window
+ * icon.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file_without_defaults().
+ **/
+void
+egg_set_desktop_file (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, TRUE);
+}
+
+/**
+ * egg_set_desktop_file_without_defaults:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path.
+ * See egg_set_desktop_file() for a variant of this function that
+ * sets the application name and default window icon from the information
+ * in the desktop file.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file().
+ **/
+void
+egg_set_desktop_file_without_defaults (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, FALSE);
+}
+
+/**
+ * egg_get_desktop_file:
+ *
+ * Gets the application's #EggDesktopFile, as set by
+ * egg_set_desktop_file().
+ *
+ * Return value: the #EggDesktopFile, or %NULL if it hasn't been set.
+ **/
+EggDesktopFile *
+egg_get_desktop_file (void)
+{
+  EggDesktopFile *retval;
+
+  G_LOCK (egg_desktop_file);
+  retval = egg_desktop_file;
+  G_UNLOCK (egg_desktop_file);
+
+  return retval;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/40.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/40.html new file mode 100644 index 0000000..a411c32 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/40.html @@ -0,0 +1,305 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DLG_UPDATE_H
+#define DLG_UPDATE_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-window.h"
+#include "open-file.h"
+
+gpointer  dlg_update          (FrWindow  *window);
+void      dlg_update_add_file (gpointer   dialog,
+			       OpenFile  *file);
+
+#endif /* DLG_UPDATE_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/41.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/41.html new file mode 100644 index 0000000..d2feaae --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/41.html @@ -0,0 +1,333 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001-2008 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef OPEN_FILE_H
+#define OPEN_FILE_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct {
+	char         *path;
+	char         *extracted_uri;
+	char         *temp_dir;
+	time_t        last_modified;
+	GFileMonitor *monitor;
+} OpenFile;
+
+#define FR_TYPE_OPEN_FILE (open_file_get_type ())
+
+GType       open_file_get_type (void);
+OpenFile *  open_file_new      (const char *path,
+			        const char *extracted_path,
+			        const char *temp_dir);
+OpenFile *  open_file_copy     (OpenFile   *src);
+void        open_file_free     (OpenFile   *ofile);
+
+#endif /* OPEN_FILE_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/42.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/42.html new file mode 100644 index 0000000..2f41d2a --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/42.html @@ -0,0 +1,543 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
/**
+ * Useful macros.
+ *
+ * Author:
+ *   Darin Adler <darin@bentspoon.com>
+ *
+ * Copyright 2001 Ben Tea Spoons, Inc.
+ */
+#ifndef _EGG_MACROS_H_
+#define _EGG_MACROS_H_
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* Macros for defining classes.  Ideas taken from Caja and GOB. */
+
+/* Define the boilerplate type stuff to reduce typos and code size.  Defines
+ * the get_type method and the parent_class static variable. */
+
+#define EGG_BOILERPLATE(type, type_as_function, corba_type,		\
+			   parent_type, parent_type_macro,		\
+			   register_type_macro)				\
+static void type_as_function ## _class_init    (type ## Class *klass);	\
+static void type_as_function ## _instance_init (type          *object);	\
+static parent_type ## Class *parent_class = NULL;			\
+static void								\
+type_as_function ## _class_init_trampoline (gpointer klass,		\
+					    gpointer data)		\
+{									\
+	parent_class = (parent_type ## Class *)g_type_class_ref (	\
+		parent_type_macro);					\
+	type_as_function ## _class_init ((type ## Class *)klass);	\
+}									\
+GType									\
+type_as_function ## _get_type (void)					\
+{									\
+	static GType object_type = 0;					\
+	if (object_type == 0) {						\
+		static const GTypeInfo object_info = {			\
+		    sizeof (type ## Class),				\
+		    NULL,		/* base_init */			\
+		    NULL,		/* base_finalize */		\
+		    type_as_function ## _class_init_trampoline,		\
+		    NULL,		/* class_finalize */		\
+		    NULL,               /* class_data */		\
+		    sizeof (type),					\
+		    0,                  /* n_preallocs */		\
+		    (GInstanceInitFunc) type_as_function ## _instance_init \
+		};							\
+		object_type = register_type_macro			\
+			(type, type_as_function, corba_type,		\
+			 parent_type, parent_type_macro);		\
+	}								\
+	return object_type;						\
+}
+
+/* Just call the parent handler.  This assumes that there is a variable
+ * named parent_class that points to the (duh!) parent class.  Note that
+ * this macro is not to be used with things that return something, use
+ * the _WITH_DEFAULT version for that */
+#define EGG_CALL_PARENT(parent_class_cast, name, args)		\
+	((parent_class_cast(parent_class)->name != NULL) ?		\
+	 parent_class_cast(parent_class)->name args : (void)0)
+
+/* Same as above, but in case there is no implementation, it evaluates
+ * to def_return */
+#define EGG_CALL_PARENT_WITH_DEFAULT(parent_class_cast,		\
+					name, args, def_return)		\
+	((parent_class_cast(parent_class)->name != NULL) ?		\
+	 parent_class_cast(parent_class)->name args : def_return)
+
+/* Call a virtual method */
+#define EGG_CALL_VIRTUAL(object, get_class_cast, method, args) \
+    (get_class_cast (object)->method ? (* get_class_cast (object)->method) args : (void)0)
+
+/* Call a virtual method with default */
+#define EGG_CALL_VIRTUAL_WITH_DEFAULT(object, get_class_cast, method, args, default) \
+    (get_class_cast (object)->method ? (* get_class_cast (object)->method) args : default)
+
+#define EGG_CLASS_BOILERPLATE(type, type_as_function,		\
+				 parent_type, parent_type_macro)	\
+	EGG_BOILERPLATE(type, type_as_function, type,		\
+			   parent_type, parent_type_macro,		\
+			   EGG_REGISTER_TYPE)
+
+#define EGG_REGISTER_TYPE(type, type_as_function, corba_type,		\
+			    parent_type, parent_type_macro)		\
+	g_type_register_static (parent_type_macro, #type, &object_info, 0)
+
+#define EGG_DEFINE_BOXED_TYPE(TN, t_n) \
+EGG_DEFINE_BOXED_TYPE_WITH_CODE(TN, t_n, {});
+
+#define EGG_DEFINE_BOXED_TYPE_WITH_CODE(TN, t_n, _C_) \
+\
+static gpointer t_n##_copy (gpointer boxed); \
+static void t_n##_free (gpointer boxed); \
+\
+EGG_DEFINE_BOXED_TYPE_EXTENDED(TN, t_n, t_n##_copy, t_n##_free, _C_);
+
+#define EGG_DEFINE_BOXED_TYPE_EXTENDED(TN, t_n, b_c, b_f, _C_) \
+\
+_EGG_DEFINE_BOXED_TYPE_EXTENDED_BEGIN(TN, t_n, b_c, b_f) {_C_;} \
+_EGG_DEFINE_BOXED_TYPE_EXTENDED_END()
+
+#define _EGG_DEFINE_BOXED_TYPE_EXTENDED_BEGIN(TypeName, type_name, boxed_copy, boxed_free) \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+  static volatile gsize g_define_type_id__volatile = 0; \
+  if (g_once_init_enter (&g_define_type_id__volatile)) \
+    { \
+      GType g_define_type_id = \
+        g_boxed_type_register_static (g_intern_static_string (#TypeName), \
+                                      boxed_copy, boxed_free); \
+      { /* custom code follows */
+#define _EGG_DEFINE_BOXED_TYPE_EXTENDED_END() \
+        /* following custom code */ \
+      }	\
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+    } \
+  return g_define_type_id__volatile; \
+} /* closes type_name##_get_type() */
+
+#define EGG_DEFINE_QUARK(QN, q_n) \
+\
+GQuark \
+q_n##_quark (void) \
+{ \
+  static volatile gsize g_define_quark__volatile = 0; \
+  if (g_once_init_enter (&g_define_quark__volatile)) \
+    { \
+      GQuark g_define_quark = g_quark_from_string (#QN); \
+      g_once_init_leave (&g_define_quark__volatile, g_define_quark); \
+    } \
+  return g_define_quark__volatile; \
+}
+
+#define EGG_IS_POSITIVE_RESPONSE(response_id) \
+  ((response_id) == GTK_RESPONSE_ACCEPT || \
+   (response_id) == GTK_RESPONSE_OK     || \
+   (response_id) == GTK_RESPONSE_YES    || \
+   (response_id) == GTK_RESPONSE_APPLY)
+
+#define EGG_IS_NEGATIVE_RESPONSE(response_id) \
+  ((response_id) == GTK_RESPONSE_REJECT || \
+   (response_id) == GTK_RESPONSE_CANCEL || \
+   (response_id) == GTK_RESPONSE_NO)
+
+G_END_DECLS
+
+#endif /* _EGG_MACROS_H_ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/43.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/43.html new file mode 100644 index 0000000..ddc508e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/43.html @@ -0,0 +1,2647 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
/* EggFileFormatChooser
+ * Copyright (C) 2007 Mathias Hasselmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "eggfileformatchooser.h"
+#include "egg-macros.h"
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct _EggFileFormatFilterInfo EggFileFormatFilterInfo;
+typedef struct _EggFileFormatSearch EggFileFormatSearch;
+
+enum
+{
+  MODEL_COLUMN_ID,
+  MODEL_COLUMN_NAME,
+  MODEL_COLUMN_ICON,
+  MODEL_COLUMN_EXTENSIONS,
+  MODEL_COLUMN_FILTER,
+  MODEL_COLUMN_DATA,
+  MODEL_COLUMN_DESTROY
+};
+
+enum
+{
+  SIGNAL_SELECTION_CHANGED,
+  SIGNAL_LAST
+};
+
+struct _EggFileFormatChooserPrivate
+{
+  GtkTreeStore *model;
+  GtkTreeSelection *selection;
+  guint idle_hack;
+  guint last_id;
+  gulong size_changed_event;
+
+  GtkFileChooser *chooser;
+  GtkFileFilter *all_files;
+  GtkFileFilter *supported_files;
+};
+
+struct _EggFileFormatFilterInfo
+{
+  GHashTable *extension_set;
+  GSList *extension_list;
+  gboolean show_extensions;
+  gchar *name;
+};
+
+struct _EggFileFormatSearch
+{
+  gboolean success;
+  GtkTreeIter iter;
+
+  guint format;
+  const gchar *extension;
+};
+
+static guint signals[SIGNAL_LAST] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (EggFileFormatChooser,
+                            egg_file_format_chooser,
+                            GTK_TYPE_EXPANDER);
+static EGG_DEFINE_QUARK (EggFileFormatFilterInfo,
+                         egg_file_format_filter_info);
+
+static EggFileFormatFilterInfo*
+egg_file_format_filter_info_new (const gchar *name,
+                                 gboolean     show_extensions)
+{
+  EggFileFormatFilterInfo *self;
+
+  self = g_new0 (EggFileFormatFilterInfo, 1);
+  self->extension_set = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  self->show_extensions = show_extensions;
+  self->name = g_strdup (name);
+
+  return self;
+}
+
+static void
+egg_file_format_filter_info_free (gpointer boxed)
+{
+  if (boxed)
+    {
+      EggFileFormatFilterInfo *self = boxed;
+
+      g_hash_table_unref (self->extension_set);
+      g_slist_free_full (self->extension_list, g_free);
+      g_free (self->name);
+      g_free (self);
+    }
+}
+
+static gboolean
+egg_file_format_filter_find (gpointer key,
+                             gpointer value G_GNUC_UNUSED,
+                             gpointer data)
+{
+  const GtkFileFilterInfo *info = data;
+  const gchar *pattern = key;
+
+  return g_str_has_suffix (info->filename, pattern + 1);
+}
+
+static gboolean
+egg_file_format_filter_filter (const GtkFileFilterInfo *info,
+                               gpointer                 data)
+{
+  EggFileFormatFilterInfo *self = data;
+
+  return NULL != g_hash_table_find (self->extension_set,
+                                    egg_file_format_filter_find,
+                                    (gpointer) info);
+}
+
+static GtkFileFilter*
+egg_file_format_filter_new (const gchar *name,
+                            gboolean     show_extensions)
+{
+  GtkFileFilter *filter;
+  EggFileFormatFilterInfo *info;
+
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, name);
+
+  info = egg_file_format_filter_info_new (name, show_extensions);
+
+  gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
+                              egg_file_format_filter_filter,
+                              info, NULL);
+  g_object_set_qdata_full (G_OBJECT (filter),
+                           egg_file_format_filter_info_quark (),
+                           info, egg_file_format_filter_info_free);
+
+  return filter;
+}
+
+static void
+egg_file_format_filter_add_extensions (GtkFileFilter *filter,
+                                       const gchar   *extensions)
+{
+  EggFileFormatFilterInfo *info;
+  GString *filter_name;
+  gchar **strings;
+  gchar **ptr;
+
+  g_assert (NULL != extensions);
+
+  info = g_object_get_qdata (G_OBJECT (filter),
+                             egg_file_format_filter_info_quark ());
+
+  info->extension_list = g_slist_prepend (info->extension_list,
+                                          g_strdup (extensions));
+
+  if (info->show_extensions)
+    {
+      filter_name = g_string_new (info->name);
+      g_string_append (filter_name, " (");
+    }
+  else
+    filter_name = NULL;
+
+  strings = g_strsplit (extensions, ", ", -1);
+  for (ptr = strings; *ptr; ptr++)
+    {
+      gchar *pattern = g_strdup_printf ("*%s", *ptr);
+
+      if (filter_name)
+        {
+          if (ptr != strings)
+            g_string_append (filter_name, ", ");
+
+          g_string_append (filter_name, pattern);
+        }
+
+      g_hash_table_replace (info->extension_set, pattern, pattern);
+    }
+  g_strfreev (strings);
+
+  if (filter_name)
+    {
+      g_string_append (filter_name, ")");
+      gtk_file_filter_set_name (filter, filter_name->str);
+      g_string_free (filter_name, TRUE);
+    }
+}
+
+static void
+selection_changed_cb (GtkTreeSelection     *selection,
+                      EggFileFormatChooser *self)
+{
+  gchar *name;
+
+  GtkFileFilter *filter;
+  GtkTreeModel *model;
+  GtkTreeIter parent;
+  GtkTreeIter iter;
+
+  if (gtk_tree_selection_get_selected (selection, &model, &iter))
+    {
+      gchar *label;
+
+      gtk_tree_model_get (model, &iter, MODEL_COLUMN_NAME, &name, -1);
+
+      label = g_strdup_printf (_("File _Format: %s"), name);
+      gtk_expander_set_use_underline (GTK_EXPANDER (self), TRUE);
+      gtk_expander_set_label (GTK_EXPANDER (self), label);
+
+      g_free (name);
+      g_free (label);
+
+      if (self->priv->chooser)
+        {
+          while (gtk_tree_model_iter_parent (model, &parent, &iter))
+            iter = parent;
+
+          gtk_tree_model_get (model, &iter, MODEL_COLUMN_FILTER, &filter, -1);
+          gtk_file_chooser_set_filter (self->priv->chooser, filter);
+          g_object_unref (filter);
+        }
+
+      g_signal_emit (self, signals[SIGNAL_SELECTION_CHANGED], 0);
+    }
+}
+
+/* XXX This hack is needed, as gtk_expander_set_label seems
+ * not to work from egg_file_format_chooser_init */
+static gboolean
+select_default_file_format (gpointer data)
+{
+  EggFileFormatChooser *self = EGG_FILE_FORMAT_CHOOSER (data);
+  egg_file_format_chooser_set_format (self, 0);
+  self->priv->idle_hack = 0;
+  return FALSE;
+}
+
+static gboolean
+find_by_format (GtkTreeModel *model,
+                GtkTreePath  *path G_GNUC_UNUSED,
+                GtkTreeIter  *iter,
+                gpointer      data)
+{
+  EggFileFormatSearch *search = data;
+  guint id;
+
+  gtk_tree_model_get (model, iter, MODEL_COLUMN_ID, &id, -1);
+
+  if (id == search->format)
+    {
+      search->success = TRUE;
+      search->iter = *iter;
+    }
+
+  return search->success;
+}
+
+static gboolean
+find_in_list (gchar       *list,
+              const gchar *needle)
+{
+  gchar *saveptr;
+  gchar *token;
+
+  for (token = strtok_r (list, ",", &saveptr); NULL != token;
+       token = strtok_r (NULL, ",", &saveptr))
+    {
+      token = g_strstrip (token);
+
+      if (strcasecmp (needle, token) == 0)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+accept_filename (gchar       *extensions,
+                 const gchar *filename)
+{
+  gchar *saveptr;
+  gchar *token;
+  gsize length;
+
+  length = strlen (filename);
+
+  for (token = strtok_r (extensions, ",", &saveptr); NULL != token;
+       token = strtok_r (NULL, ",", &saveptr))
+    {
+      const gchar *extptr;
+
+      token = g_strstrip (token);
+      extptr = filename + length - strlen (token) - 1;
+
+      if (extptr > filename && '.' == *extptr &&
+          !strcmp (extptr + 1, token))
+          return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+find_by_extension (GtkTreeModel *model,
+                   GtkTreePath  *path G_GNUC_UNUSED,
+                   GtkTreeIter  *iter,
+                   gpointer      data)
+{
+  EggFileFormatSearch *search = data;
+
+  gchar *extensions = NULL;
+  guint format = 0;
+
+  gtk_tree_model_get (model, iter,
+                      MODEL_COLUMN_EXTENSIONS, &extensions,
+                      MODEL_COLUMN_ID, &format,
+                      -1);
+
+  if (extensions && find_in_list (extensions, search->extension))
+    {
+      search->format = format;
+      search->success = TRUE;
+      search->iter = *iter;
+    }
+
+  g_free (extensions);
+  return search->success;
+}
+
+static int
+emit_default_size_changed (gpointer user_data)
+{
+  EggFileFormatChooser *self = user_data;
+
+  self->priv->size_changed_event = 0;
+  g_signal_emit_by_name (self->priv->chooser, "default-size-changed");
+  return FALSE;
+}
+
+static void
+expander_unmap_cb (GtkWidget *widget,
+		   gpointer   user_data)
+{
+  EggFileFormatChooser *self = user_data;
+
+  if (self->priv->size_changed_event == 0)
+    self->priv->size_changed_event = gdk_threads_add_idle (emit_default_size_changed, self);
+}
+
+static void
+egg_file_format_chooser_init (EggFileFormatChooser *self)
+{
+  GtkWidget *scroller;
+  GtkWidget *view;
+
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *cell;
+  GtkTreeIter iter;
+
+  self->priv = egg_file_format_chooser_get_instance_private(self);
+
+  self->priv->size_changed_event = 0;
+
+/* file filters */
+
+  self->priv->all_files = g_object_ref_sink (gtk_file_filter_new ());
+  gtk_file_filter_set_name (self->priv->all_files, _("All Files"));
+  self->priv->supported_files = egg_file_format_filter_new (_("All Supported Files"), FALSE);
+
+/* tree model */
+
+  self->priv->model = gtk_tree_store_new (7, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                                             GTK_TYPE_FILE_FILTER, G_TYPE_POINTER, G_TYPE_POINTER);
+
+  gtk_tree_store_append (self->priv->model, &iter, NULL);
+  gtk_tree_store_set (self->priv->model, &iter,
+                      MODEL_COLUMN_NAME, _("By Extension"),
+                      MODEL_COLUMN_FILTER, self->priv->supported_files,
+                      MODEL_COLUMN_ID, 0,
+                      -1);
+
+/* tree view */
+
+  view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (self->priv->model));
+  self->priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+
+/* file format column */
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_column_set_expand (column, TRUE);
+  gtk_tree_view_column_set_title (column, _("File Format"));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+
+  cell = gtk_cell_renderer_pixbuf_new ();
+  gtk_tree_view_column_pack_start (column, cell, FALSE);
+  gtk_tree_view_column_set_attributes (column, cell,
+                                       "icon-name", MODEL_COLUMN_ICON,
+                                       NULL);
+
+  cell = gtk_cell_renderer_text_new ();
+  gtk_tree_view_column_pack_start (column, cell, TRUE);
+  gtk_tree_view_column_set_attributes (column, cell,
+                                       "text", MODEL_COLUMN_NAME,
+                                       NULL);
+
+/* extensions column */
+
+  column = gtk_tree_view_column_new_with_attributes (
+    _("Extension(s)"), gtk_cell_renderer_text_new (),
+    "text", MODEL_COLUMN_EXTENSIONS, NULL);
+  gtk_tree_view_column_set_expand (column, FALSE);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+
+/* selection */
+
+  gtk_tree_selection_set_mode (self->priv->selection, GTK_SELECTION_BROWSE);
+  g_signal_connect (self->priv->selection, "changed",
+                    G_CALLBACK (selection_changed_cb), self);
+  self->priv->idle_hack = g_idle_add (select_default_file_format, self);
+
+/* scroller */
+
+  scroller = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
+                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller),
+                                       GTK_SHADOW_IN);
+  gtk_widget_set_size_request (scroller, -1, 150);
+  gtk_container_add (GTK_CONTAINER (scroller), view);
+  gtk_widget_show_all (scroller);
+
+  gtk_container_add (GTK_CONTAINER (self), scroller);
+
+  g_signal_connect_after (scroller, "unmap", G_CALLBACK (expander_unmap_cb), self);
+}
+
+static void
+reset_model (EggFileFormatChooser *self)
+{
+  GtkTreeModel *model = GTK_TREE_MODEL (self->priv->model);
+  GtkTreeIter iter;
+
+  if (gtk_tree_model_get_iter_first (model, &iter))
+    {
+      do
+        {
+          GDestroyNotify destroy = NULL;
+          gpointer data = NULL;
+
+          gtk_tree_model_get (model, &iter,
+                              MODEL_COLUMN_DESTROY, &destroy,
+                              MODEL_COLUMN_DATA, &data,
+                              -1);
+
+          if (destroy)
+            destroy (data);
+        }
+      while (gtk_tree_model_iter_next (model, &iter));
+    }
+
+  gtk_tree_store_clear (self->priv->model);
+}
+
+static void
+egg_file_format_chooser_dispose (GObject *obj)
+{
+  EggFileFormatChooser *self = EGG_FILE_FORMAT_CHOOSER (obj);
+
+  if (NULL != self)
+    {
+      if (self->priv->idle_hack)
+        {
+          g_source_remove (self->priv->idle_hack);
+          self->priv->idle_hack = 0;
+        }
+      if (self->priv->size_changed_event != 0)
+        {
+          g_source_remove (self->priv->size_changed_event);
+          self->priv->size_changed_event = 0;
+        }
+    }
+
+  G_OBJECT_CLASS (egg_file_format_chooser_parent_class)->dispose (obj);
+}
+
+static void
+egg_file_format_chooser_finalize (GObject *obj)
+{
+  EggFileFormatChooser *self = EGG_FILE_FORMAT_CHOOSER (obj);
+
+  if (NULL != self)
+    {
+      if (self->priv->model)
+        {
+          reset_model (self);
+
+          g_object_unref (self->priv->model);
+          self->priv->model = NULL;
+
+          g_object_unref (self->priv->all_files);
+          self->priv->all_files = NULL;
+        }
+    }
+
+  G_OBJECT_CLASS (egg_file_format_chooser_parent_class)->finalize (obj);
+}
+
+static void
+filter_changed_cb (GObject    *object,
+                   GParamSpec *spec,
+                   gpointer    data)
+{
+  EggFileFormatChooser *self;
+
+  GtkFileFilter *current_filter;
+  GtkFileFilter *format_filter;
+
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  GtkTreeIter parent;
+
+  self = EGG_FILE_FORMAT_CHOOSER (data);
+
+  format_filter = NULL;
+  current_filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (object));
+  model = GTK_TREE_MODEL (self->priv->model);
+
+  if (gtk_tree_selection_get_selected (self->priv->selection, &model, &iter))
+    {
+      while (gtk_tree_model_iter_parent (model, &parent, &iter))
+        iter = parent;
+
+      gtk_tree_model_get (model, &iter,
+                          MODEL_COLUMN_FILTER,
+                          &format_filter, -1);
+      g_object_unref (format_filter);
+    }
+
+  if (current_filter && current_filter != format_filter &&
+      gtk_tree_model_get_iter_first (model, &iter))
+    {
+      if (current_filter == self->priv->all_files)
+        format_filter = current_filter;
+      else
+        {
+          format_filter = NULL;
+
+          do
+            {
+              gtk_tree_model_get (model, &iter,
+                                  MODEL_COLUMN_FILTER,
+                                  &format_filter, -1);
+              g_object_unref (format_filter);
+
+              if (format_filter == current_filter)
+                break;
+            }
+          while (gtk_tree_model_iter_next (model, &iter));
+        }
+
+      if (format_filter)
+        gtk_tree_selection_select_iter (self->priv->selection, &iter);
+    }
+}
+
+/* Shows an error dialog set as transient for the specified window */
+static void
+error_message_with_parent (GtkWindow  *parent,
+			   const char *msg,
+			   const char *detail)
+{
+  GtkWidget *dialog;
+
+  g_warning ("%s: Merge with the code in Gtk{File,Recent}ChooserDefault.", G_STRLOC);
+
+  dialog = gtk_message_dialog_new (parent,
+				   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   "%s",
+				   msg);
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    "%s", detail);
+
+  if (gtk_window_get_group (parent))
+    gtk_window_group_add_window (gtk_window_get_group (parent), GTK_WINDOW (dialog));
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+/* Returns a toplevel GtkWindow, or NULL if none */
+static GtkWindow *
+get_toplevel (GtkWidget *widget)
+{
+  GtkWidget *toplevel;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!gtk_widget_is_toplevel (toplevel))
+    return NULL;
+  else
+    return GTK_WINDOW (toplevel);
+}
+
+/* Shows an error dialog for the file chooser */
+static void
+error_message (EggFileFormatChooser *impl,
+	       const char           *msg,
+	       const char           *detail)
+{
+  error_message_with_parent (get_toplevel (GTK_WIDGET (impl)), msg, detail);
+}
+
+static void
+chooser_response_cb (GtkDialog *dialog,
+                     gint       response_id,
+                     gpointer   data)
+{
+  EggFileFormatChooser *self;
+
+  self = EGG_FILE_FORMAT_CHOOSER (data);
+
+  if (EGG_IS_POSITIVE_RESPONSE (response_id))
+    {
+      gchar *filename, *basename;
+      guint format;
+
+      filename = gtk_file_chooser_get_filename (self->priv->chooser);
+      basename = g_filename_display_basename (filename);
+      g_free (filename);
+
+      format = egg_file_format_chooser_get_format (self, basename);
+      g_print ("%s: %s - %d\n", G_STRFUNC, basename, format);
+
+      if (0 == format)
+        {
+          gchar *message;
+
+          message = g_strdup_printf (
+            _("The program was not able to find out the file format "
+              "you want to use for `%s'. Please make sure to use a "
+              "known extension for that file or manually choose a "
+              "file format from the list below."),
+              basename);
+
+          error_message (self,
+		         _("File format not recognized"),
+                        message);
+
+          g_free (message);
+
+          g_signal_stop_emission_by_name (dialog, "response");
+        }
+      else
+        {
+          filename = egg_file_format_chooser_append_extension (self, basename, format);
+
+          if (strcmp (filename, basename))
+            {
+              gtk_file_chooser_set_current_name (self->priv->chooser, filename);
+              g_signal_stop_emission_by_name (dialog, "response");
+            }
+
+          g_free (filename);
+        }
+
+      g_free (basename);
+    }
+
+}
+
+static void
+egg_file_format_chooser_realize (GtkWidget *widget)
+{
+  EggFileFormatChooser *self;
+  GtkWidget *parent;
+
+  GtkFileFilter *filter;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  GTK_WIDGET_CLASS (egg_file_format_chooser_parent_class)->realize (widget);
+
+  self = EGG_FILE_FORMAT_CHOOSER (widget);
+
+  g_return_if_fail (NULL == self->priv->chooser);
+
+  parent = gtk_widget_get_parent (widget);
+  while ((parent != NULL) && !GTK_IS_FILE_CHOOSER (parent))
+    parent = gtk_widget_get_parent (parent);
+
+  self->priv->chooser = GTK_FILE_CHOOSER (parent);
+
+  g_return_if_fail (GTK_IS_FILE_CHOOSER (self->priv->chooser));
+  g_return_if_fail (gtk_file_chooser_get_action (self->priv->chooser) ==
+                    GTK_FILE_CHOOSER_ACTION_SAVE);
+
+  g_object_ref (self->priv->chooser);
+
+  g_signal_connect (self->priv->chooser, "notify::filter",
+                    G_CALLBACK (filter_changed_cb), self);
+  gtk_file_chooser_add_filter (self->priv->chooser, self->priv->all_files);
+
+  model = GTK_TREE_MODEL (self->priv->model);
+
+  if (gtk_tree_model_get_iter_first (model, &iter))
+    {
+      do
+        {
+          gtk_tree_model_get (model, &iter, MODEL_COLUMN_FILTER, &filter, -1);
+          gtk_file_chooser_add_filter (self->priv->chooser, filter);
+          g_object_unref (filter);
+        }
+      while (gtk_tree_model_iter_next (model, &iter));
+    }
+
+  gtk_file_chooser_set_filter (self->priv->chooser,
+                               self->priv->supported_files);
+
+  if (GTK_IS_DIALOG (self->priv->chooser))
+    g_signal_connect (self->priv->chooser, "response",
+                      G_CALLBACK (chooser_response_cb), self);
+}
+
+static void
+egg_file_format_chooser_unrealize (GtkWidget *widget)
+{
+  EggFileFormatChooser *self;
+
+  GtkFileFilter *filter;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  GTK_WIDGET_CLASS (egg_file_format_chooser_parent_class)->unrealize (widget);
+
+  self = EGG_FILE_FORMAT_CHOOSER (widget);
+  model = GTK_TREE_MODEL (self->priv->model);
+
+  g_signal_handlers_disconnect_by_func (self->priv->chooser,
+                                        filter_changed_cb, self);
+  g_signal_handlers_disconnect_by_func (self->priv->chooser,
+                                        chooser_response_cb, self);
+
+  if (gtk_tree_model_get_iter_first (model, &iter))
+    {
+      do
+        {
+          gtk_tree_model_get (model, &iter, MODEL_COLUMN_FILTER, &filter, -1);
+          gtk_file_chooser_remove_filter (self->priv->chooser, filter);
+          g_object_unref (filter);
+        }
+      while (gtk_tree_model_iter_next (model, &iter));
+    }
+
+  gtk_file_chooser_remove_filter (self->priv->chooser, self->priv->all_files);
+  g_object_unref (self->priv->chooser);
+}
+
+static void
+egg_file_format_chooser_class_init (EggFileFormatChooserClass *cls)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (cls);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (cls);
+
+  object_class->dispose = egg_file_format_chooser_dispose;
+  object_class->finalize = egg_file_format_chooser_finalize;
+
+  widget_class->realize = egg_file_format_chooser_realize;
+  widget_class->unrealize = egg_file_format_chooser_unrealize;
+
+  signals[SIGNAL_SELECTION_CHANGED] = g_signal_new (
+    "selection-changed", EGG_TYPE_FILE_FORMAT_CHOOSER, G_SIGNAL_RUN_FIRST,
+    G_STRUCT_OFFSET (EggFileFormatChooserClass, selection_changed),
+    NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+GtkWidget*
+egg_file_format_chooser_new (void)
+{
+  return g_object_new (EGG_TYPE_FILE_FORMAT_CHOOSER, NULL);
+}
+
+static guint
+egg_file_format_chooser_add_format_impl (EggFileFormatChooser *self,
+                                         guint                 parent,
+                                         const gchar          *name,
+                                         const gchar          *icon,
+                                         const gchar          *extensions)
+{
+  EggFileFormatSearch search;
+  GtkFileFilter *filter;
+  GtkTreeIter iter;
+
+  search.success = FALSE;
+  search.format = parent;
+  filter = NULL;
+
+  if (parent > 0)
+    {
+      gtk_tree_model_foreach (GTK_TREE_MODEL (self->priv->model),
+                              find_by_format, &search);
+      g_return_val_if_fail (search.success, -1);
+    }
+  else
+    filter = egg_file_format_filter_new (name, TRUE);
+
+  gtk_tree_store_append (self->priv->model, &iter,
+                         parent > 0 ? &search.iter : NULL);
+
+  gtk_tree_store_set (self->priv->model, &iter,
+                      MODEL_COLUMN_ID, ++self->priv->last_id,
+                      MODEL_COLUMN_EXTENSIONS, extensions,
+                      MODEL_COLUMN_FILTER, filter,
+                      MODEL_COLUMN_NAME, name,
+                      MODEL_COLUMN_ICON, icon,
+                      -1);
+
+  if (extensions)
+    {
+      if (parent > 0)
+        gtk_tree_model_get (GTK_TREE_MODEL (self->priv->model), &search.iter,
+                            MODEL_COLUMN_FILTER, &filter, -1);
+
+      egg_file_format_filter_add_extensions (self->priv->supported_files, extensions);
+      egg_file_format_filter_add_extensions (filter, extensions);
+
+      if (parent > 0)
+        g_object_unref (filter);
+    }
+
+  return self->priv->last_id;
+}
+
+guint
+egg_file_format_chooser_add_format (EggFileFormatChooser *self,
+                                    guint                 parent,
+                                    const gchar          *name,
+                                    const gchar          *icon,
+                                    ...)
+{
+  GString *buffer = NULL;
+  const gchar* extptr;
+  va_list extensions;
+  guint id;
+
+  g_return_val_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self), 0);
+  g_return_val_if_fail (NULL != name, 0);
+
+  va_start (extensions, icon);
+
+  while (NULL != (extptr = va_arg (extensions, const gchar*)))
+    {
+      if (NULL == buffer)
+        buffer = g_string_new (NULL);
+      else
+        g_string_append (buffer, ", ");
+
+      g_string_append (buffer, extptr);
+    }
+
+  va_end (extensions);
+
+  id = egg_file_format_chooser_add_format_impl (self, parent, name, icon,
+                                                buffer ? buffer->str : NULL);
+
+  if (buffer)
+    g_string_free (buffer, TRUE);
+
+  return id;
+}
+
+static gchar*
+get_icon_name (const gchar *mime_type)
+{
+  static gboolean first_call = TRUE;
+  gchar *name = NULL;
+
+  if (first_call)
+    {
+      g_warning ("%s: Replace by g_content_type_get_icon "
+                 "when GVFS is merged into GLib.", G_STRLOC);
+      first_call = FALSE;
+    }
+
+  if (mime_type)
+    {
+      gchar *s;
+
+      name = g_strconcat ("mate-mime-", mime_type, NULL);
+
+      for(s = name; *s; ++s)
+        {
+          if (!isalpha (*s) || !isascii (*s))
+            *s = '-';
+        }
+    }
+
+  if (!name ||
+      !gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), name))
+    {
+      g_free (name);
+      name = g_strdup ("mate-mime-image");
+    }
+
+  return name;
+}
+
+void
+egg_file_format_chooser_add_pixbuf_formats (EggFileFormatChooser *self,
+                                            guint                 parent G_GNUC_UNUSED,
+                                            guint               **formats)
+{
+  GSList *pixbuf_formats = NULL;
+  GSList *iter;
+  gint i;
+
+  g_return_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self));
+
+  pixbuf_formats = gdk_pixbuf_get_formats ();
+
+  if (formats)
+    *formats = g_new0 (guint, g_slist_length (pixbuf_formats) + 1);
+
+  for(iter = pixbuf_formats, i = 0; iter; iter = iter->next, ++i)
+    {
+      GdkPixbufFormat *format = iter->data;
+
+      gchar *description, *name, *extensions, *icon;
+      gchar **mime_types, **extension_list;
+      guint id;
+
+      if (gdk_pixbuf_format_is_disabled (format) ||
+         !gdk_pixbuf_format_is_writable (format))
+        continue;
+
+      mime_types = gdk_pixbuf_format_get_mime_types (format);
+      icon = get_icon_name (mime_types[0]);
+      g_strfreev (mime_types);
+
+      extension_list = gdk_pixbuf_format_get_extensions (format);
+      extensions = g_strjoinv (", ", extension_list);
+      g_strfreev (extension_list);
+
+      description = gdk_pixbuf_format_get_description (format);
+      name = gdk_pixbuf_format_get_name (format);
+
+      id = egg_file_format_chooser_add_format_impl (self, parent, description,
+                                                    icon, extensions);
+
+      g_free (description);
+      g_free (extensions);
+      g_free (icon);
+
+      egg_file_format_chooser_set_format_data (self, id, name, g_free);
+
+      if (formats)
+        *formats[i] = id;
+    }
+
+  g_slist_free (pixbuf_formats);
+}
+
+void
+egg_file_format_chooser_remove_format (EggFileFormatChooser *self,
+                                       guint                 format)
+{
+  GDestroyNotify destroy = NULL;
+  gpointer data = NULL;
+
+  EggFileFormatSearch search;
+  GtkFileFilter *filter;
+  GtkTreeModel *model;
+
+  g_return_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self));
+
+  search.success = FALSE;
+  search.format = format;
+
+  model = GTK_TREE_MODEL (self->priv->model);
+  gtk_tree_model_foreach (model, find_by_format, &search);
+
+  g_return_if_fail (search.success);
+
+  gtk_tree_model_get (model, &search.iter,
+                      MODEL_COLUMN_FILTER, &filter,
+                      MODEL_COLUMN_DESTROY, &destroy,
+                      MODEL_COLUMN_DATA, &data,
+                      -1);
+
+  if (destroy)
+    destroy (data);
+
+  if (filter)
+    {
+      if (self->priv->chooser)
+        gtk_file_chooser_remove_filter (self->priv->chooser, filter);
+
+      g_object_unref (filter);
+    }
+  else
+    g_warning ("TODO: Remove extensions from parent filter");
+
+  gtk_tree_store_remove (self->priv->model, &search.iter);
+}
+
+void
+egg_file_format_chooser_set_format (EggFileFormatChooser *self,
+                                    guint                 format)
+{
+  EggFileFormatSearch search;
+
+  GtkTreeModel *model;
+  GtkTreePath *path;
+  GtkTreeView *view;
+
+  g_return_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self));
+
+  search.success = FALSE;
+  search.format = format;
+
+  model = GTK_TREE_MODEL (self->priv->model);
+  gtk_tree_model_foreach (model, find_by_format, &search);
+
+  g_return_if_fail (search.success);
+
+  path = gtk_tree_model_get_path (model, &search.iter);
+  view = gtk_tree_selection_get_tree_view (self->priv->selection);
+
+  gtk_tree_view_expand_to_path (view, path);
+  gtk_tree_selection_unselect_all (self->priv->selection);
+  gtk_tree_selection_select_path (self->priv->selection, path);
+
+  gtk_tree_path_free (path);
+
+  if (self->priv->idle_hack > 0)
+    {
+      g_source_remove (self->priv->idle_hack);
+      self->priv->idle_hack = 0;
+    }
+}
+
+guint
+egg_file_format_chooser_get_format (EggFileFormatChooser *self,
+                                    const gchar          *filename)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  guint format = 0;
+
+  g_return_val_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self), -1);
+
+  if (gtk_tree_selection_get_selected (self->priv->selection, &model, &iter))
+    gtk_tree_model_get (model, &iter, MODEL_COLUMN_ID, &format, -1);
+
+  if (0 == format && NULL != filename)
+    {
+      EggFileFormatSearch search;
+
+      search.extension = strrchr(filename, '.');
+      search.success = FALSE;
+
+      if (search.extension++)
+        gtk_tree_model_foreach (model, find_by_extension, &search);
+      if (search.success)
+        format = search.format;<--- Uninitialized struct member: search.format
+    }
+
+  return format;
+}
+
+void
+egg_file_format_chooser_set_format_data (EggFileFormatChooser *self,
+                                         guint                 format,
+                                         gpointer              data,
+                                         GDestroyNotify        destroy)
+{
+  EggFileFormatSearch search;
+
+  g_return_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self));
+
+  search.success = FALSE;
+  search.format = format;
+
+  gtk_tree_model_foreach (GTK_TREE_MODEL (self->priv->model),
+                          find_by_format, &search);
+
+  g_return_if_fail (search.success);
+
+  gtk_tree_store_set (self->priv->model, &search.iter,
+                      MODEL_COLUMN_DESTROY, destroy,
+                      MODEL_COLUMN_DATA, data,
+                      -1);
+}
+
+gpointer
+egg_file_format_chooser_get_format_data (EggFileFormatChooser *self,
+                                         guint                 format)
+{
+  EggFileFormatSearch search;
+  gpointer data = NULL;
+  GtkTreeModel *model;
+
+  g_return_val_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self), NULL);
+
+  search.success = FALSE;
+  search.format = format;
+
+  model = GTK_TREE_MODEL (self->priv->model);
+  gtk_tree_model_foreach (model, find_by_format, &search);
+
+  g_return_val_if_fail (search.success, NULL);
+
+  gtk_tree_model_get (model, &search.iter,
+                      MODEL_COLUMN_DATA, &data,
+                      -1);
+  return data;
+}
+
+gchar*
+egg_file_format_chooser_append_extension (EggFileFormatChooser *self,
+                                          const gchar          *filename,
+                                          guint                 format)
+{
+  EggFileFormatSearch search;
+  GtkTreeModel *model;
+  GtkTreeIter child;
+
+  gchar *extensions;
+  gchar *result;
+
+  g_return_val_if_fail (EGG_IS_FILE_FORMAT_CHOOSER (self), NULL);
+  g_return_val_if_fail (NULL != filename, NULL);
+
+  if (0 == format)
+    format = egg_file_format_chooser_get_format (self, NULL);
+
+  if (0 == format)
+    {
+      g_warning ("%s: No file format selected. Cannot append extension.", G_STRFUNC);
+      return NULL;
+    }
+
+  search.success = FALSE;
+  search.format = format;
+
+  model = GTK_TREE_MODEL (self->priv->model);
+  gtk_tree_model_foreach (model, find_by_format, &search);
+
+  g_return_val_if_fail (search.success, NULL);
+
+  gtk_tree_model_get (model, &search.iter,
+                      MODEL_COLUMN_EXTENSIONS, &extensions,
+                      -1);
+
+  if (NULL == extensions &&
+      gtk_tree_model_iter_nth_child (model, &child, &search.iter, 0))
+    {
+      gtk_tree_model_get (model, &child,
+                          MODEL_COLUMN_EXTENSIONS, &extensions,
+                          -1);
+    }
+
+  if (NULL == extensions)
+    {
+      g_warning ("%s: File format %d doesn't provide file extensions. "
+                 "Cannot append extension.", G_STRFUNC, format);
+      return NULL;
+    }
+
+  if (accept_filename (extensions, filename))
+    result = g_strdup (filename);
+  else
+    result = g_strconcat (filename, ".", extensions, NULL);
+
+  g_assert (NULL == strchr(extensions, ','));
+  g_free (extensions);
+  return result;
+}
+
+void
+egg_file_format_chooser_emit_size_changed (EggFileFormatChooser *self)
+{
+  if (self->priv->size_changed_event == 0)
+    self->priv->size_changed_event = gdk_threads_add_idle (emit_default_size_changed, self);
+}
+
+/* vim: set sw=2 sta et: */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/44.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/44.html new file mode 100644 index 0000000..d16c099 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/44.html @@ -0,0 +1,1175 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
/*
+ * Engrampa
+ *
+ * Copyright (C) 2005 Free Software Foundation, Inc.
+ * Author: Paolo Bacchilega
+ */
+
+/* eggtreemultidnd.c
+ * Copyright (C) 2001  Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "eggtreemultidnd.h"
+
+#define EGG_TREE_MULTI_DND_STRING "EggTreeMultiDndString"
+
+static GtkTargetEntry target_table[] = {
+        { "XdndDirectSave0", 0, 0 },
+        { "XdndEngrampa0", 0, 1 }
+};
+
+typedef struct
+{
+  guint   pressed_button;
+  gint    x;
+  gint    y;
+  guint   motion_notify_handler;
+  guint   button_release_handler;
+  guint   drag_data_get_handler;
+  GSList *event_list;
+  gboolean pending_event;
+} EggTreeMultiDndData;
+
+GType
+egg_tree_multi_drag_source_get_type (void)
+{
+  static GType our_type = 0;
+
+  if (!our_type)
+    {
+      static const GTypeInfo our_info =
+	{
+	  sizeof (EggTreeMultiDragSourceIface), /* class_size */
+	  NULL,		/* base_init */
+	  NULL,		/* base_finalize */
+	  NULL,
+	  NULL,		/* class_finalize */
+	  NULL,		/* class_data */
+	  0,
+	  0,            /* n_preallocs */
+	  NULL,
+	  NULL
+	};
+
+      our_type = g_type_register_static (G_TYPE_INTERFACE,
+					 "EggTreeMultiDragSource",
+					 &our_info,
+					 0);
+    }
+
+  return our_type;
+}
+
+/**
+ * egg_tree_multi_drag_source_row_draggable:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row on which user is initiating a drag
+ *
+ * Asks the #EggTreeMultiDragSource whether a particular row can be used as
+ * the source of a DND operation. If the source doesn't implement
+ * this interface, the row is assumed draggable.
+ *
+ * Return value: %TRUE if the row can be dragged
+ **/
+gboolean
+egg_tree_multi_drag_source_row_draggable (EggTreeMultiDragSource *drag_source,
+					  GList                  *path_list)
+{
+  EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+  g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+  g_return_val_if_fail (iface->row_draggable != NULL, FALSE);
+  g_return_val_if_fail (path_list != NULL, FALSE);
+
+  if (iface->row_draggable)
+    return (* iface->row_draggable) (drag_source, path_list);
+  else
+    return TRUE;
+}
+
+/**
+ * egg_tree_multi_drag_source_drag_data_delete:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was being dragged
+ *
+ * Asks the #EggTreeMultiDragSource to delete the row at @path, because
+ * it was moved somewhere else via drag-and-drop. Returns %FALSE
+ * if the deletion fails because @path no longer exists, or for
+ * some model-specific reason. Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if the row was successfully deleted
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+					     GList                  *path_list)
+{
+  EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+  g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+  g_return_val_if_fail (iface->drag_data_delete != NULL, FALSE);
+  g_return_val_if_fail (path_list != NULL, FALSE);
+
+  return (* iface->drag_data_delete) (drag_source, path_list);
+}
+
+/**
+ * egg_tree_multi_drag_source_drag_data_get:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was dragged
+ * @selection_data: a #EggSelectionData to fill with data from the dragged row
+ *
+ * Asks the #EggTreeMultiDragSource to fill in @selection_data with a
+ * representation of the row at @path. @selection_data->target gives
+ * the required type of the data.  Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if data of the required type was provided
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_get (EggTreeMultiDragSource *drag_source,
+					  GdkDragContext         *context,
+					  GtkSelectionData       *selection_data,
+					  GList                  *path_list)
+{
+  EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+  g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+  g_return_val_if_fail (iface->drag_data_get != NULL, FALSE);
+  g_return_val_if_fail (path_list != NULL, FALSE);
+  g_return_val_if_fail (selection_data != NULL, FALSE);
+
+  return (* iface->drag_data_get) (drag_source, context, selection_data, path_list);
+}
+
+static void
+stop_drag_check (GtkWidget *widget)
+{
+  EggTreeMultiDndData *priv_data;
+  GSList *l;
+
+  priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+  for (l = priv_data->event_list; l != NULL; l = l->next)
+    gdk_event_free (l->data);
+
+  g_slist_free (priv_data->event_list);
+  priv_data->event_list = NULL;
+  priv_data->pending_event = FALSE;
+
+  if (priv_data->motion_notify_handler) {
+    g_signal_handler_disconnect (widget, priv_data->motion_notify_handler);
+    priv_data->motion_notify_handler = 0;
+  }
+  if (priv_data->button_release_handler) {
+    g_signal_handler_disconnect (widget, priv_data->button_release_handler);
+    priv_data->button_release_handler = 0;
+  }
+}
+
+static gboolean
+egg_tree_multi_drag_button_release_event (GtkWidget      *widget,
+					  GdkEventButton *event,
+					  gpointer        data)
+{
+  EggTreeMultiDndData *priv_data;
+  GSList *l;
+
+  priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+  for (l = priv_data->event_list; l != NULL; l = l->next)
+    gtk_propagate_event (widget, l->data);
+
+  stop_drag_check (widget);
+
+  return FALSE;
+}
+
+static void
+selection_foreach (GtkTreeModel *model,
+		   GtkTreePath  *path,
+		   GtkTreeIter  *iter,
+		   gpointer      data)
+{
+  GList **list_ptr;
+
+  list_ptr = (GList **) data;
+
+  *list_ptr = g_list_prepend (*list_ptr, gtk_tree_row_reference_new (model, path));
+}
+
+static void
+path_list_free (GList *path_list)
+{
+  g_list_foreach (path_list, (GFunc) gtk_tree_row_reference_free, NULL);
+  g_list_free (path_list);
+}
+
+static void
+set_context_data (GdkDragContext *context,
+		  GList          *path_list)
+{
+  g_object_set_data_full (G_OBJECT (context),
+                          "egg-tree-view-multi-source-row",
+                          path_list,
+                          (GDestroyNotify) path_list_free);
+}
+
+static GList *
+get_context_data (GdkDragContext *context)
+{
+  return g_object_get_data (G_OBJECT (context),
+			    "egg-tree-view-multi-source-row");
+}
+
+static gboolean
+egg_tree_multi_drag_drag_data_get (GtkWidget        *widget,
+				   GdkDragContext   *context,
+				   GtkSelectionData *selection_data,
+				   guint             info,
+				   guint             time)
+{
+  GtkTreeView  *tree_view;
+  GtkTreeModel *model;
+  GList        *path_list;
+
+  tree_view = GTK_TREE_VIEW (widget);
+  model = gtk_tree_view_get_model (tree_view);
+  if (model == NULL)
+    return FALSE;
+
+  path_list = get_context_data (context);
+  if (path_list == NULL)
+    return FALSE;
+
+  /* We can implement the GTK_TREE_MODEL_ROW target generically for
+   * any model; for DragSource models there are some other targets
+   * we also support.
+   */
+
+  if (! EGG_IS_TREE_MULTI_DRAG_SOURCE (model))
+    return FALSE;
+
+  return egg_tree_multi_drag_source_drag_data_get (EGG_TREE_MULTI_DRAG_SOURCE (model),
+      						   context,
+						   selection_data,
+						   path_list);
+}
+
+static gboolean
+egg_tree_multi_drag_motion_event (GtkWidget      *widget,
+				  GdkEventMotion *event,
+				  gpointer        data)
+{
+  EggTreeMultiDndData *priv_data;
+
+  priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+  if (gtk_drag_check_threshold (widget,
+				priv_data->x,
+				priv_data->y,
+				(gint) event->x,
+				(gint) event->y))
+    {
+      GList            *path_list = NULL;
+      GtkTreeSelection *selection;
+      GtkTreeModel     *model;
+
+      stop_drag_check (widget);
+
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+      gtk_tree_selection_selected_foreach (selection, selection_foreach, &path_list);
+      if (path_list == NULL)
+	      return FALSE;
+
+      path_list = g_list_reverse (path_list);
+
+      model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+      if (egg_tree_multi_drag_source_row_draggable (EGG_TREE_MULTI_DRAG_SOURCE (model), path_list))
+	{
+	  GdkDragContext *context;
+	  GtkTargetList  *target_list;
+	  GtkTreePath    *tree_path;
+	  int             cell_x;
+	  int             cell_y;
+
+	  target_list = gtk_target_list_new (target_table, G_N_ELEMENTS (target_table));
+	  context = gtk_drag_begin_with_coordinates (widget,
+	                                             target_list,
+	                                             GDK_ACTION_COPY,
+	                                             priv_data->pressed_button,
+	                                             (GdkEvent*) event,
+	                                             (gint) event->x,
+	                                             (gint) event->y);
+	  set_context_data (context, path_list);
+
+	  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
+					     priv_data->x,
+					     priv_data->y,
+					     &tree_path,
+					     NULL,
+					     &cell_x,
+					     &cell_y))
+	  {
+		  cairo_surface_t *drag_icon;
+
+		  drag_icon = gtk_tree_view_create_row_drag_icon (GTK_TREE_VIEW (widget), tree_path);
+		  cairo_surface_set_device_offset (drag_icon, -cell_x, -cell_y);
+		  gtk_drag_set_icon_surface (context, drag_icon);
+
+		  cairo_surface_destroy (drag_icon);
+		  gtk_tree_path_free (tree_path);
+	  }
+	  else
+		  gtk_drag_set_icon_default (context);
+
+	  gtk_target_list_unref (target_list);
+	}
+      else
+	{
+	  path_list_free (path_list);
+	}
+    }
+
+  return TRUE;
+}
+
+static gboolean
+egg_tree_multi_drag_button_press_event (GtkWidget      *widget,
+					GdkEventButton *event,
+					gpointer        data)
+{
+  GtkTreeView         *tree_view;
+  GtkTreePath         *path = NULL;
+  GtkTreeViewColumn   *column = NULL;
+  gint                 cell_x, cell_y;
+  GtkTreeSelection    *selection;
+  EggTreeMultiDndData *priv_data;
+
+  if (event->window != gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)))
+    return FALSE;
+
+  if (event->button == 3)
+    return FALSE;
+
+  tree_view = GTK_TREE_VIEW (widget);
+  priv_data = g_object_get_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING);
+  if (priv_data == NULL)
+    {
+      priv_data = g_new0 (EggTreeMultiDndData, 1);
+      priv_data->pending_event = FALSE;
+      g_object_set_data (G_OBJECT (tree_view),
+			 EGG_TREE_MULTI_DND_STRING,
+			 priv_data);
+    }
+
+  if (g_slist_find (priv_data->event_list, event))
+    return FALSE;
+
+  if (priv_data->pending_event)
+    {
+      /* save the event to be propagated in order */
+      priv_data->event_list = g_slist_append (priv_data->event_list,
+					      gdk_event_copy ((GdkEvent*)event));
+      return TRUE;
+    }
+
+  if (event->type == GDK_2BUTTON_PRESS)
+    return FALSE;
+
+  gtk_tree_view_get_path_at_pos (tree_view,
+				 (gint) event->x, (gint) event->y,
+				 &path, &column,
+				 &cell_x, &cell_y);
+
+  selection = gtk_tree_view_get_selection (tree_view);
+
+  if (path)
+    {
+      gboolean call_parent = (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK) ||
+			      !gtk_tree_selection_path_is_selected (selection, path) ||
+			      event->button != 1);
+
+      if (call_parent)
+	(GTK_WIDGET_GET_CLASS (tree_view))->button_press_event (widget, event);
+
+      if (gtk_tree_selection_path_is_selected (selection, path))
+    {
+      priv_data->pressed_button = event->button;
+      priv_data->x = (gint) event->x;
+      priv_data->y = (gint) event->y;
+
+      priv_data->pending_event = TRUE;
+      if (!call_parent)
+	priv_data->event_list = g_slist_append (priv_data->event_list,
+						gdk_event_copy ((GdkEvent*)event));
+
+      if (priv_data->motion_notify_handler == 0)
+        {
+          priv_data->motion_notify_handler =
+	    g_signal_connect (G_OBJECT (tree_view),
+	  		      "motion_notify_event",
+			      G_CALLBACK (egg_tree_multi_drag_motion_event),
+			      NULL);
+        }
+
+      if (priv_data->button_release_handler == 0)
+        {
+          priv_data->button_release_handler =
+	    g_signal_connect (G_OBJECT (tree_view),
+	 		      "button_release_event",
+			      G_CALLBACK (egg_tree_multi_drag_button_release_event),
+			      NULL);
+        }
+
+      if (priv_data->drag_data_get_handler == 0)
+	{
+	  priv_data->drag_data_get_handler =
+	    g_signal_connect (G_OBJECT (tree_view),
+			      "drag_data_get",
+			      G_CALLBACK (egg_tree_multi_drag_drag_data_get),
+			      NULL);
+	}
+    }
+
+      gtk_tree_path_free (path);
+      /* We called the default handler so we don't let the default handler run */
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+void
+egg_tree_multi_drag_add_drag_support (GtkTreeView *tree_view)
+{
+  g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+  g_signal_connect (G_OBJECT (tree_view),
+		    "button_press_event",
+		    G_CALLBACK (egg_tree_multi_drag_button_press_event),
+		    NULL);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/45.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/45.html new file mode 100644 index 0000000..2bb4846 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/45.html @@ -0,0 +1,385 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
/* eggtreednd.h
+ * Copyright (C) 2001  Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_TREE_MULTI_DND_H__
+#define __EGG_TREE_MULTI_DND_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_TREE_MULTI_DRAG_SOURCE            (egg_tree_multi_drag_source_get_type ())
+#define EGG_TREE_MULTI_DRAG_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSource))
+#define EGG_IS_TREE_MULTI_DRAG_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE))
+#define EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSourceIface))
+
+typedef struct _EggTreeMultiDragSource      EggTreeMultiDragSource; /* Dummy typedef */
+typedef struct _EggTreeMultiDragSourceIface EggTreeMultiDragSourceIface;
+
+struct _EggTreeMultiDragSourceIface
+{
+  GTypeInterface g_iface;
+
+  /* VTable - not signals */
+  gboolean  (* row_draggable)     (EggTreeMultiDragSource *drag_source,
+				   GList                  *path_list);
+
+  gboolean  (* drag_data_get)     (EggTreeMultiDragSource *drag_source,
+				   GdkDragContext         *context,
+				   GtkSelectionData       *selection_data,
+				   GList                  *path_list);
+
+  gboolean  (* drag_data_delete)  (EggTreeMultiDragSource *drag_source,
+				   GList                  *path_list);
+};
+
+GType    egg_tree_multi_drag_source_get_type         (void) G_GNUC_CONST;
+
+/* Returns whether the given row can be dragged */
+gboolean egg_tree_multi_drag_source_row_draggable    (EggTreeMultiDragSource *drag_source,
+						      GList                  *path_list);
+
+/* Deletes the given row, or returns FALSE if it can't */
+gboolean egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+						      GList                  *path_list);
+
+/* Fills in selection_data with type selection_data->target based on the row
+ * denoted by path, returns TRUE if it does anything
+ */
+gboolean egg_tree_multi_drag_source_drag_data_get    (EggTreeMultiDragSource *drag_source,
+						      GdkDragContext         *context,
+						      GtkSelectionData       *selection_data,
+						      GList                  *path_list);
+
+void     egg_tree_multi_drag_add_drag_support        (GtkTreeView            *tree_view);
+
+G_END_DECLS
+
+#endif /* __EGG_TREE_MULTI_DND_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/46.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/46.html new file mode 100644 index 0000000..fab0e4b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/46.html @@ -0,0 +1,613 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001-2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "glib-utils.h"
+#include "file-utils.h"
+#include "file-data.h"
+
+FileData *
+file_data_new (void)
+{
+	FileData *fdata;
+
+	fdata = g_new0 (FileData, 1);
+	fdata->content_type = NULL;
+	fdata->free_original_path = FALSE;
+	fdata->dir_size = 0;
+
+	return fdata;
+}
+
+void
+file_data_free (FileData *fdata)
+{
+	if (fdata == NULL)
+		return;
+	if (fdata->free_original_path)
+		g_free (fdata->original_path);
+	g_free (fdata->full_path);
+	g_free (fdata->name);
+	g_free (fdata->path);
+	g_free (fdata->link);
+	g_free (fdata->list_name);
+	g_free (fdata->sort_key);
+	g_free (fdata);
+}
+
+FileData *
+file_data_copy (FileData *src)
+{
+	FileData *fdata;
+
+	fdata = g_new0 (FileData, 1);
+
+	fdata->original_path = g_strdup (src->original_path);
+	fdata->free_original_path = TRUE;
+
+	fdata->full_path = g_strdup (src->full_path);
+	fdata->link = g_strdup (src->link);
+	fdata->size = src->size;
+	fdata->modified = src->modified;
+	fdata->name = g_strdup (src->name);
+	fdata->path = g_strdup (src->path);
+	fdata->content_type = src->content_type;
+	fdata->encrypted = src->encrypted;
+	fdata->dir = src->dir;
+	fdata->dir_size = src->dir_size;
+
+	fdata->list_dir = src->list_dir;
+	fdata->list_name = g_strdup (src->list_name);
+	fdata->sort_key = g_strdup (src->sort_key);
+
+	return fdata;
+}
+
+GType
+file_data_get_type (void)
+{
+	static GType type = 0;
+
+	if (type == 0)
+		type = g_boxed_type_register_static ("FRFileData", (GBoxedCopyFunc) file_data_copy, (GBoxedFreeFunc) file_data_free);
+
+	return type;
+}
+
+void
+file_data_update_content_type (FileData *fdata)
+{
+	if (fdata->dir) {
+		fdata->content_type = MIME_TYPE_DIRECTORY;
+	} else {
+		char *content_type;
+
+		content_type = g_content_type_guess (fdata->full_path, NULL, 0, NULL);
+		fdata->content_type = get_static_string (content_type);
+		g_free (content_type);
+	}
+}
+
+gboolean
+file_data_is_dir (FileData *fdata)<--- Parameter 'fdata' can be declared as pointer to const
+{
+	return fdata->dir || fdata->list_dir;
+}
+
+void
+file_data_set_list_name (FileData   *fdata,
+			 const char *value)
+{
+	g_free (fdata->list_name);
+	fdata->list_name = g_strdup (value);
+
+	g_free (fdata->sort_key);
+	if (fdata->list_name != NULL)
+		fdata->sort_key = g_utf8_collate_key_for_filename (fdata->list_name, -1);
+	else
+		fdata->sort_key = NULL;
+}
+
+int
+file_data_compare_by_path (gconstpointer a,
+			   gconstpointer b)
+{
+	FileData *data_a = *((FileData **) a);<--- Variable 'data_a' can be declared as pointer to const
+	FileData *data_b = *((FileData **) b);<--- Variable 'data_b' can be declared as pointer to const
+
+	return strcmp (data_a->full_path, data_b->full_path);
+}
+
+int
+find_path_in_file_data_array (GPtrArray  *array,
+			      const char *path)
+{
+	int path_l;
+	int left;
+	int right;
+
+	if (path == NULL)
+		return -1;
+
+	path_l = strlen (path);
+	left = 0;
+	right = array->len;
+	while (left < right) {
+		FileData *fd;<--- Variable 'fd' can be declared as pointer to const
+		int p;
+		int cmp;
+
+		p = left + ((right - left) / 2);
+		fd = (FileData *) g_ptr_array_index (array, p);
+		cmp = strcmp (path, fd->original_path);
+		if (cmp != 0) {
+			/* consider '/path/to/dir' and '/path/to/dir/' the same path */
+			int original_path_l;
+
+			original_path_l = strlen (fd->original_path);
+
+			if ((path_l == original_path_l - 1) && (fd->original_path[original_path_l - 1] == '/')) {
+				int cmp2;
+
+				cmp2  = strncmp (path, fd->original_path, original_path_l - 1);
+				if (cmp2 == 0)
+					cmp = cmp2;
+			}
+		}
+
+		if (cmp == 0)
+			return p;
+		else if (cmp < 0)
+			right = p;
+		else
+			left = p + 1;
+	}
+
+	return -1;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/47.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/47.html new file mode 100644 index 0000000..e61d2f0 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/47.html @@ -0,0 +1,2597 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE 700
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <pwd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <strings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/param.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-init.h"
+
+#define SPECIAL_DIR(x) ((strcmp ((x), "..") == 0) || (strcmp ((x), ".") == 0))
+
+gboolean
+uri_exists (const char *uri)
+{
+	GFile     *file;
+	gboolean   exists;
+
+	if (uri == NULL)
+		return FALSE;
+
+	file = g_file_new_for_uri (uri);
+	exists = g_file_query_exists (file, NULL);
+	g_object_unref (file);
+
+	return exists;
+}
+
+static gboolean
+uri_is_filetype (const char *uri,
+		 GFileType   file_type)
+{
+	gboolean   result = FALSE;
+	GFile     *file;
+	GFileInfo *info;
+	GError    *error = NULL;
+
+	file = g_file_new_for_uri (uri);
+
+	if (! g_file_query_exists (file, NULL)) {
+		g_object_unref (file);
+		return FALSE;
+	}
+
+	info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, &error);
+	if (error == NULL) {
+		result = (g_file_info_get_file_type (info) == file_type);
+	}
+	else {
+		g_warning ("Failed to get file type for uri %s: %s", uri, error->message);
+		g_error_free (error);
+	}
+
+	g_object_unref (info);
+	g_object_unref (file);
+
+	return result;
+}
+
+gboolean
+uri_is_file (const char *uri)
+{
+	return uri_is_filetype (uri, G_FILE_TYPE_REGULAR);
+}
+
+gboolean
+uri_is_dir (const char *uri)
+{
+	return uri_is_filetype (uri, G_FILE_TYPE_DIRECTORY);
+}
+
+gboolean
+path_is_dir (const char *path)
+{
+	char     *uri;
+	gboolean  result;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = uri_is_dir (uri);
+	g_free (uri);
+
+	return result;
+}
+
+gboolean
+uri_is_local (const char  *uri)
+{
+	return strncmp (uri, "file://", 7) == 0;
+}
+
+char *
+get_dir_content_if_unique (const char  *uri)
+{
+	GFile           *file;
+	GFileEnumerator *file_enum;
+	GFileInfo       *info;
+	GError          *err = NULL;
+	char            *content_uri = NULL;
+
+	file = g_file_new_for_uri (uri);
+
+	if (! g_file_query_exists (file, NULL)) {
+		g_object_unref (file);
+		return NULL;
+	}
+
+	file_enum = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &err);
+	if (err != NULL) {
+		g_warning ("Failed to enumerate children of %s: %s", uri, err->message);
+		g_error_free (err);
+		return NULL;
+	}
+
+	while ((info = g_file_enumerator_next_file (file_enum, NULL, &err)) != NULL) {
+		const char *name;
+		char *new_name;
+
+		if (err != NULL) {
+			g_warning ("Failed to get info while enumerating children: %s", err->message);
+			g_clear_error (&err);
+			g_object_unref (info);
+			continue;
+		}
+
+		name = g_file_info_get_name (info);
+		if ((strcmp (name, ".") == 0) || (strcmp (name, "..") == 0)) {
+			g_object_unref (info);
+			continue;
+		}
+
+		if (content_uri != NULL) {
+			g_free (content_uri);
+			g_object_unref (info);
+			content_uri = NULL;
+			break;
+		}
+
+		new_name = g_uri_escape_string (name, NULL, TRUE);
+		content_uri = build_uri (uri, new_name, NULL);
+		g_object_unref (info);
+		g_free (new_name);
+	}
+
+	if (err != NULL) {
+		g_warning ("Failed to get info after enumerating children: %s", err->message);
+		g_clear_error (&err);
+	}
+
+	g_object_unref (file_enum);
+	g_object_unref (file);
+
+	return content_uri;
+}
+
+/* Check whether the dirname is contained in filename */
+gboolean
+path_in_path (const char *dirname,
+	      const char *filename)
+{
+	int dirname_l, filename_l, separator_position;
+
+	if ((dirname == NULL) || (filename == NULL))
+		return FALSE;
+
+	dirname_l = strlen (dirname);
+	filename_l = strlen (filename);
+
+	if ((dirname_l == filename_l + 1)
+	     && (dirname[dirname_l - 1] == '/'))
+		return FALSE;
+
+	if ((filename_l == dirname_l + 1)
+	     && (filename[filename_l - 1] == '/'))
+		return FALSE;
+
+	if (dirname[dirname_l - 1] == '/')
+		separator_position = dirname_l - 1;
+	else
+		separator_position = dirname_l;
+
+	return ((filename_l > dirname_l)
+		&& (strncmp (dirname, filename, dirname_l) == 0)
+		&& (filename[separator_position] == '/'));
+}
+
+goffset
+get_file_size (const char *uri)
+{
+	goffset    size = 0;
+	GFile     *file;
+	GFileInfo *info;
+	GError    *err = NULL;
+
+	if ((uri == NULL) || (*uri == '\0'))
+		return 0;
+
+	file = g_file_new_for_uri (uri);
+	info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, &err);
+	if (err == NULL) {
+		size = g_file_info_get_size (info);
+	}
+	else {
+		g_warning ("Failed to get file size for %s: %s", uri, err->message);
+		g_error_free (err);
+	}
+
+	g_object_unref (info);
+	g_object_unref (file);
+
+	return size;
+}
+
+goffset
+get_file_size_for_path (const char *path)
+{
+	char    *uri;
+	goffset  result;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = get_file_size (uri);
+	g_free (uri);
+
+	return result;
+}
+
+static time_t
+get_file_time_type (const char *uri,
+		    const char *type)
+{
+	time_t     result = 0;
+	GFile     *file;
+	GFileInfo *info;
+	GError    *err = NULL;
+
+	if ((uri == NULL) || (*uri == '\0'))
+ 		return 0;
+
+	file = g_file_new_for_uri (uri);
+	info = g_file_query_info (file, type, 0, NULL, &err);
+	if (err == NULL) {
+		result = (time_t) g_file_info_get_attribute_uint64 (info, type);
+	}
+	else {
+		g_warning ("Failed to get %s: %s", type, err->message);
+		g_error_free (err);
+		result = 0;
+	}
+
+	g_object_unref (info);
+	g_object_unref (file);
+
+	return result;
+}
+
+time_t
+get_file_mtime (const char *uri)
+{
+	return get_file_time_type (uri, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+}
+
+time_t
+get_file_mtime_for_path (const char *path)
+{
+	char   *uri;
+	time_t  result;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = get_file_mtime (uri);
+	g_free (uri);
+
+	return result;
+}
+
+/* like g_path_get_basename but does not warn about NULL and does not
+ * alloc a new string. */
+const gchar* file_name_from_path(const gchar *file_name)
+{
+	register char   *base;
+	register gssize  last_char;
+
+	if (file_name == NULL)
+		return NULL;
+
+	if ((file_name[0] == '\0') || (strlen (file_name) == 0))
+		return "";
+
+	last_char = strlen (file_name) - 1;
+
+	if (file_name [last_char] == G_DIR_SEPARATOR)
+		return "";
+
+	base = g_utf8_strrchr (file_name, -1, G_DIR_SEPARATOR);
+	if (! base)
+		return file_name;
+
+	return base + 1;
+}
+
+char *
+dir_name_from_path (const gchar *path)
+{
+	register gssize base;
+	register gssize last_char;
+
+	if (path == NULL)
+		return NULL;
+
+	if (path[0] == '\0')
+		return g_strdup ("");
+
+	last_char = strlen (path) - 1;
+	if (path[last_char] == G_DIR_SEPARATOR)
+		last_char--;
+
+	base = last_char;
+	while ((base >= 0) && (path[base] != G_DIR_SEPARATOR))
+		base--;
+
+	return g_strndup (path + base + 1, last_char - base);
+}
+
+gchar *
+remove_level_from_path (const gchar *path)
+{
+	int         p;
+	const char *ptr = path;
+	char       *new_path;
+
+	if (path == NULL)
+		return NULL;
+
+	p = strlen (path) - 1;
+	if (p < 0)
+		return NULL;
+
+	while ((p > 0) && (ptr[p] != '/'))
+		p--;
+	if ((p == 0) && (ptr[p] == '/'))
+		p++;
+	new_path = g_strndup (path, (guint)p);
+
+	return new_path;
+}
+
+char *
+remove_ending_separator (const char *path)
+{
+	gint len, copy_len;
+
+	if (path == NULL)
+		return NULL;
+
+	copy_len = len = strlen (path);
+	if ((len > 1) && (path[len - 1] == '/'))
+		copy_len--;
+
+	return g_strndup (path, copy_len);
+}
+
+char *
+build_uri (const char *base, ...)
+{
+	va_list     args;
+	const char *child;
+	GString    *uri;
+
+	uri = g_string_new (base);
+
+	va_start (args, base);
+        while ((child = va_arg (args, const char *)) != NULL) {
+        	if (! g_str_has_suffix (uri->str, "/") && ! g_str_has_prefix (child, "/"))
+        		g_string_append (uri, "/");
+        	g_string_append (uri, child);
+        }
+	va_end (args);
+
+	return g_string_free (uri, FALSE);
+}
+
+gchar *
+remove_extension_from_path (const gchar *path)
+{
+        const char *ext;
+
+        if (path == NULL)
+                return NULL;
+
+        ext = get_archive_filename_extension (path);
+        if (ext == NULL || strlen (ext) == strlen (path))
+                return g_strdup (path);
+        else
+                return g_strndup (path, strlen (path) - strlen (ext));
+}
+
+gboolean
+make_directory_tree (GFile    *dir,
+		     mode_t    mode,
+		     GError  **error)
+{
+	gboolean  success = TRUE;
+	GFile    *parent;
+
+	if ((dir == NULL) || g_file_query_exists (dir, NULL))
+		return TRUE;
+
+	parent = g_file_get_parent (dir);
+	if (parent != NULL) {
+		success = make_directory_tree (parent, mode, error);
+		g_object_unref (parent);
+		if (! success)
+			return FALSE;
+	}
+
+	success = g_file_make_directory (dir, NULL, error);
+	if ((error != NULL) && (*error != NULL) && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
+		g_clear_error (error);
+		success = TRUE;
+	}
+
+	if (success)
+		g_file_set_attribute_uint32 (dir,
+					     G_FILE_ATTRIBUTE_UNIX_MODE,
+					     mode,
+					     0,
+					     NULL,
+					     NULL);
+
+	return success;
+}
+
+gboolean
+ensure_dir_exists (const char  *uri,
+		   mode_t       mode,
+		   GError     **error)
+{
+	GFile  *dir;
+	GError *priv_error = NULL;
+
+	if (uri == NULL)
+		return FALSE;
+
+	if (error == NULL)
+		error = &priv_error;
+
+	dir = g_file_new_for_uri (uri);
+	if (! make_directory_tree (dir, mode, error)) {
+		g_warning ("could create directory %s: %s", uri, (*error)->message);
+		if (priv_error != NULL)
+			g_clear_error (&priv_error);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
+make_directory_tree_from_path (const char  *path,
+		   	       mode_t       mode,
+		   	       GError     **error)
+{
+	char     *uri;
+	gboolean  result;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = ensure_dir_exists (uri, mode, error);
+	g_free (uri);
+
+	return result;
+}
+
+const char *
+get_file_extension (const char *filename)
+{
+	const char *ptr = filename;
+	int         len;
+	int         p;
+	const char *ext;
+	const char *tar_exts[] = {".7z", ".br", ".bz", ".bz2", ".gz", ".lrz", ".lz", ".lzma", ".lzo", ".xz", ".Z", ".xst", NULL};
+
+	if (filename == NULL)
+		return NULL;
+
+	len = strlen (filename);
+	if (len <= 1)
+		return NULL;
+
+	p = len - 1;
+	while ((p >= 0) && (ptr[p] != '.'))
+		p--;
+	if (p < 0)
+		return NULL;
+
+	ext = filename + p;
+	p = 0;
+	if (ext - 4 > filename) {
+		const char *test = ext - 4;
+		if (strncmp (test, ".tar", 4) == 0) {
+			while (tar_exts[p] != NULL) {
+				if (strcmp (ext, tar_exts[p]) == 0)
+					ext = ext - 4;
+				p++;
+			}
+		}
+	}
+	return ext;
+}
+
+gboolean
+file_extension_is (const char *filename,
+		   const char *ext)
+{
+	int filename_l, ext_l;
+
+	filename_l = strlen (filename);
+	ext_l = strlen (ext);
+
+	if (filename_l < ext_l)
+		return FALSE;
+	return strcasecmp (filename + filename_l - ext_l, ext) == 0;
+}
+
+gboolean
+is_mime_type (const char *mime_type,
+	      const char *pattern)
+{
+	return g_content_type_equals (mime_type, pattern);
+}
+
+const char*
+get_file_mime_type (const char *uri,
+                    gboolean    fast_file_type)
+{
+	GFile      *file;
+	GFileInfo  *info;
+	GError     *err = NULL;
+ 	const char *result = NULL;
+
+ 	file = g_file_new_for_uri (uri);
+	info = g_file_query_info (file,
+				  fast_file_type ?
+				  G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE :
+				  G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+				  0, NULL, &err);
+	if (info == NULL) {
+		g_warning ("could not get content type for %s: %s", uri, err->message);
+		g_clear_error (&err);
+	}
+	else {
+		result = get_static_string (g_file_info_get_content_type (info));
+		g_object_unref (info);
+	}
+
+	g_object_unref (file);
+
+	return result;
+}
+
+const char*
+get_file_mime_type_for_path (const char  *filename,
+                    	     gboolean     fast_file_type)
+{
+	char       *uri;
+	const char *mime_type;
+
+	uri = g_filename_to_uri (filename, NULL, NULL);
+	mime_type = get_file_mime_type (uri, fast_file_type);
+	g_free (uri);
+
+	return mime_type;
+}
+
+void
+path_list_free (GList *path_list)
+{
+	if (path_list == NULL)
+		return;
+	g_list_free_full (path_list, g_free);
+}
+
+GList *
+path_list_dup (GList *path_list)
+{
+	GList *new_list = NULL;
+	GList *scan;
+
+	for (scan = path_list; scan; scan = scan->next)
+		new_list = g_list_prepend (new_list, g_strdup (scan->data));
+
+	return g_list_reverse (new_list);
+}
+
+guint64
+get_dest_free_space (const char *path)
+{
+	guint64    freespace = 0;
+	GFile     *file;
+	GFileInfo *info;
+	GError    *err = NULL;
+
+	file = g_file_new_for_path (path);
+	info = g_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &err);
+	if (info != NULL) {
+		freespace = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+		g_object_unref (info);
+	}
+	else {
+		g_warning ("Could not get filesystem free space on volume that contains %s: %s", path, err->message);
+		g_error_free (err);
+	}
+	g_object_unref (file);
+
+	return freespace;
+}
+
+static gboolean
+delete_directory_recursive (GFile   *dir,
+			    GError **error)
+{
+	char            *uri;
+	GFileEnumerator *file_enum;
+	GFileInfo       *info;
+	gboolean         error_occurred = FALSE;
+
+	if (error != NULL)
+		*error = NULL;
+
+	file_enum = g_file_enumerate_children (dir,
+					       G_FILE_ATTRIBUTE_STANDARD_NAME ","
+					       G_FILE_ATTRIBUTE_STANDARD_TYPE,
+					       0, NULL, error);
+
+	uri = g_file_get_uri (dir);
+	while (! error_occurred && (info = g_file_enumerator_next_file (file_enum, NULL, error)) != NULL) {
+		char  *child_uri;
+		GFile *child;
+
+		child_uri = build_uri (uri, g_file_info_get_name (info), NULL);
+		child = g_file_new_for_uri (child_uri);
+
+		switch (g_file_info_get_file_type (info)) {
+		case G_FILE_TYPE_DIRECTORY:
+			if (! delete_directory_recursive (child, error))
+				error_occurred = TRUE;
+			break;
+		default:
+			if (! g_file_delete (child, NULL, error))
+				error_occurred = TRUE;
+			break;
+		}
+
+		g_object_unref (child);
+		g_free (child_uri);
+		g_object_unref (info);
+	}
+	g_free (uri);
+
+	if (! error_occurred && ! g_file_delete (dir, NULL, error))
+ 		error_occurred = TRUE;
+
+	g_object_unref (file_enum);
+
+	return ! error_occurred;
+}
+
+gboolean
+remove_directory (const char *uri)
+{
+	GFile     *dir;
+	gboolean   result;
+	GError    *error = NULL;
+
+	dir = g_file_new_for_uri (uri);
+	result = delete_directory_recursive (dir, &error);
+	if (! result) {
+		g_warning ("Cannot delete %s: %s", uri, error->message);
+		g_clear_error (&error);
+	}
+	g_object_unref (dir);
+
+	return result;
+}
+
+gboolean
+remove_local_directory (const char *path)
+{
+	char     *uri;
+	gboolean  result;
+
+	if (path == NULL)
+		return TRUE;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = remove_directory (uri);
+	g_free (uri);
+
+	return result;
+}
+
+static const char *try_folder[] = { "cache", "~", "tmp", NULL };
+
+static char *
+ith_temp_folder_to_try (int n)
+{
+	const char *folder;
+
+	folder = try_folder[n];
+	if (strcmp (folder, "cache") == 0)
+		folder = g_get_user_cache_dir ();
+	else if (strcmp (folder, "~") == 0)
+		folder = g_get_home_dir ();
+	else if (strcmp (folder, "tmp") == 0)
+		folder = g_get_tmp_dir ();
+
+	return g_strdup (folder);
+}
+
+char *
+get_temp_work_dir (const char *parent_folder)
+{
+	guint64  max_size = 0;
+	char    *best_folder = NULL;
+	char    *template;
+	char    *result = NULL;
+
+	if (parent_folder == NULL) {
+		/* find the folder with more free space. */
+		int i;
+
+		for (i = 0; try_folder[i] != NULL; i++) {
+			char    *folder;
+			guint64  size;
+
+			folder = ith_temp_folder_to_try (i);
+			size = get_dest_free_space (folder);
+			if (max_size < size) {
+				max_size = size;
+				g_free (best_folder);
+				best_folder = folder;
+			}
+			else
+				g_free (folder);
+		}
+	}
+	else
+		best_folder = g_strdup (parent_folder);
+
+	if (best_folder == NULL)
+		return NULL;
+
+	template = g_strconcat (best_folder, "/.fr-XXXXXX", NULL);
+	result = mkdtemp (template);
+
+	if ((result == NULL) || (*result == '\0')) {
+		g_free (template);
+		result = NULL;
+	}
+
+	return result;
+}
+
+gboolean
+is_temp_work_dir (const char *dir)
+{
+	int i;
+	char *folder = NULL;
+
+	if (strncmp (dir, "file://", 7) == 0)
+		dir = dir + 7;
+	else if (dir[0] != '/')
+		return FALSE;
+
+	for (i = 0; try_folder[i] != NULL; i++) {
+		folder = ith_temp_folder_to_try (i);
+		if (strncmp (dir, folder, strlen (folder)) == 0)
+			if (strncmp (dir + strlen (folder), "/.fr-", 5) == 0) {
+				g_free (folder);
+				return TRUE;
+			}
+		g_free (folder);
+	}
+
+	return FALSE;
+}
+
+gboolean
+is_temp_dir (const char *dir)
+{
+	if (strncmp (dir, "file://", 7) == 0)
+		dir = dir + 7;
+	if (strcmp (g_get_tmp_dir (), dir) == 0)
+		return TRUE;
+	if (path_in_path (g_get_tmp_dir (), dir))
+		return TRUE;
+	else
+		return is_temp_work_dir (dir);
+}
+
+/* file list utils */
+
+gboolean
+file_list__match_pattern (const char *line,
+			  const char *pattern)
+{
+	const char *l = line, *p = pattern;
+
+	for (; (*p != 0) && (*l != 0); p++, l++) {
+		if (*p != '%') {
+			if (*p != *l)
+				return FALSE;
+		}
+		else {
+			p++;
+			switch (*p) {
+			case 'a':
+				break;
+			case 'n':
+				if (!isdigit (*l))
+					return FALSE;
+				break;
+			case 'c':
+				if (!isalpha (*l))
+					return FALSE;
+				break;
+			default:
+				return FALSE;
+			}
+		}
+	}
+
+	return (*p == 0);
+}
+
+int
+file_list__get_index_from_pattern (const char *line,
+				   const char *pattern)
+{
+	int         line_l, pattern_l;
+	const char *l;
+
+	line_l = strlen (line);
+	pattern_l = strlen (pattern);
+
+	if ((pattern_l == 0) || (line_l == 0))
+		return -1;
+
+	for (l = line; *l != 0; l++)
+		if (file_list__match_pattern (l, pattern))
+			return (l - line);
+
+	return -1;
+}
+
+char*
+file_list__get_prev_field (const char *line,
+			   int         start_from,
+			   int         field_n)
+{
+	const char *f_start, *f_end;
+
+	f_start = line + start_from - 1;
+	while ((*f_start == ' ') && (*f_start != *line))
+		f_start--;
+	f_end = f_start;
+
+	while ((field_n > 0) && (*f_start != *line)) {
+		if (*f_start == ' ') {
+			field_n--;
+			if (field_n != 0) {
+				while ((*f_start == ' ') && (*f_start != *line))
+					f_start--;
+				f_end = f_start;
+			}
+		} else
+			f_start--;
+	}
+
+	return g_strndup (f_start + 1, f_end - f_start);
+}
+
+gboolean
+check_permissions (const char *uri,
+		   int         mode)
+{
+	GFile    *file;
+	gboolean  result;
+
+	file = g_file_new_for_uri (uri);
+	result = check_file_permissions (file, mode);
+
+	g_object_unref (file);
+
+	return result;
+}
+
+gboolean
+check_file_permissions (GFile *file,
+		        int    mode)
+{
+	gboolean   result = TRUE;
+	GFileInfo *info;
+	GError    *err = NULL;
+	gboolean   default_permission_when_unknown = TRUE;
+
+	info = g_file_query_info (file, "access::*", 0, NULL, &err);
+	if (err != NULL) {
+		g_clear_error (&err);
+		result = FALSE;
+	}
+	else {
+		if ((mode & R_OK) == R_OK) {
+			if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
+				result = (result && g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ));
+			else
+				result = (result && default_permission_when_unknown);
+		}
+
+		if ((mode & W_OK) == W_OK) {
+			if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+				result = (result && g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE));
+			else
+				result = (result && default_permission_when_unknown);
+		}
+
+		if ((mode & X_OK) == X_OK) {
+			if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))
+				result = (result && g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE));
+			else
+				result = (result && default_permission_when_unknown);
+		}
+
+		g_object_unref (info);
+	}
+
+	return result;
+}
+
+gboolean
+is_program_in_path (const char *filename)
+{
+	char *str;
+	char *value;<--- Variable 'value' can be declared as pointer to const
+	int   result = FALSE;
+
+	value = g_hash_table_lookup (ProgramsCache, filename);
+	if (value != NULL) {
+		result = (strcmp (value, "1") == 0);
+		return result;
+	}
+
+	str = g_find_program_in_path (filename);
+	if (str != NULL) {
+		g_free (str);
+		result = TRUE;
+	}
+
+	g_hash_table_insert (ProgramsCache,
+			     g_strdup (filename),
+			     result ? "1" : "0");
+
+	return result;
+}
+
+gboolean
+is_program_available (const char *filename,
+		      gboolean    check)
+{
+	return ! check || is_program_in_path (filename);
+}
+
+const char *
+get_home_uri (void)
+{
+	static char *home_uri = NULL;
+	if (home_uri == NULL)
+		home_uri = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
+	return home_uri;
+}
+
+GFile *
+get_user_config_subdirectory (const char *child_name,
+			      gboolean    create_child)
+{
+	char   *full_path;
+	GFile  *file;
+	GError *error = NULL;
+
+	full_path = g_strconcat (g_get_user_config_dir (), "/", child_name, NULL);
+	file = g_file_new_for_path (full_path);
+	g_free (full_path);
+
+	if  (create_child && ! make_directory_tree (file, 0700, &error)) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+		g_object_unref (file);
+		file = NULL;
+	}
+
+	return file;
+}
+
+int
+uricmp (const char *uri1,
+	const char *uri2)
+{
+	return g_strcmp0 (uri1, uri2);
+}
+
+/**
+ * get_alternative_uri:
+ * @folder_uri: The URI of the containing folder
+ * @escaped_name: The URI-escaped name of the member to find a name for
+ *
+ * Tries to find an unused name for @escaped_name in @folder_uri.
+ *
+ * Returns: The full URI for the free slot (including directory)
+ */
+char *
+get_alternative_uri (const char *folder_uri,
+	     const char *escaped_name)
+{
+	char *new_uri = NULL;
+	int   n = 1;
+
+	do {
+		g_free (new_uri);
+		if (n == 1)
+			new_uri = g_strconcat (folder_uri, "/", escaped_name, NULL);
+		else
+			new_uri = g_strdup_printf ("%s/%s%%20(%d)", folder_uri, escaped_name, n);
+		n++;
+	} while (uri_exists (new_uri));
+
+	return new_uri;
+}
+
+char *
+get_alternative_uri_for_uri (const char *uri)
+{
+	char *base_uri;
+	char *new_uri;
+
+	base_uri = remove_level_from_path (uri);
+	new_uri = get_alternative_uri (base_uri, file_name_from_path (uri));
+	g_free (base_uri);
+
+	return new_uri;
+}
+
+GList *
+gio_file_list_dup (GList *l)
+{
+	GList *r = NULL, *scan;
+	for (scan = l; scan; scan = scan->next)
+		r = g_list_prepend (r, g_file_dup ((GFile*)scan->data));
+	return g_list_reverse (r);
+}
+
+void
+gio_file_list_free (GList *l)
+{
+	GList *scan;
+	for (scan = l; scan; scan = scan->next)
+		g_object_unref (scan->data);
+	g_list_free (l);
+}
+
+void
+g_key_file_save (GKeyFile *key_file,
+	         GFile    *file)
+{
+	char   *file_data;
+	gsize   size;
+	GError *error = NULL;
+
+	file_data = g_key_file_to_data (key_file, &size, &error);
+	if (error != NULL) {
+		g_warning ("Could not save options: %s\n", error->message);
+		g_clear_error (&error);
+	}
+	else {
+		GFileOutputStream *stream;
+
+		stream = g_file_replace (file, NULL, FALSE, 0, NULL, &error);
+		if (stream == NULL) {
+			g_warning ("Could not save options: %s\n", error->message);
+			g_clear_error (&error);
+		}
+		else if (! g_output_stream_write_all (G_OUTPUT_STREAM (stream), file_data, size, NULL, NULL, &error)) {
+			g_warning ("Could not save options: %s\n", error->message);
+			g_clear_error (&error);
+		}
+		else if (! g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, &error)) {
+			g_warning ("Could not save options: %s\n", error->message);
+			g_clear_error (&error);
+		}
+
+		g_object_unref (stream);
+	}
+
+	g_free (file_data);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/48.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/48.html new file mode 100644 index 0000000..b2dcde2 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/48.html @@ -0,0 +1,6941 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2007, 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/param.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "glib-utils.h"
+#include "file-utils.h"
+#include "gio-utils.h"
+#include "file-data.h"
+#include "fr-archive.h"
+#include "fr-command.h"
+#include "fr-error.h"
+#include "fr-marshal.h"
+#include "fr-proc-error.h"
+#include "fr-process.h"
+#include "fr-init.h"
+
+#ifdef ENABLE_MAGIC
+#include <magic.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#ifndef NCARGS
+#define NCARGS _POSIX_ARG_MAX
+#endif
+
+/* -- DroppedItemsData -- */
+
+typedef struct {
+	FrArchive     *archive;
+	GList         *item_list;
+	char          *base_dir;
+	char          *dest_dir;
+	gboolean       update;
+	char          *password;
+	gboolean       encrypt_header;
+	FrCompression  compression;
+	guint          volume_size;
+} DroppedItemsData;
+
+static DroppedItemsData *
+dropped_items_data_new (FrArchive     *archive,
+			GList         *item_list,
+			const char    *base_dir,
+			const char    *dest_dir,
+			gboolean       update,
+			const char    *password,
+			gboolean       encrypt_header,
+			FrCompression  compression,
+			guint          volume_size)
+{
+	DroppedItemsData *data;
+
+	data = g_new0 (DroppedItemsData, 1);
+	data->archive = archive;
+	data->item_list = path_list_dup (item_list);
+	if (base_dir != NULL)
+		data->base_dir = g_strdup (base_dir);
+	if (dest_dir != NULL)
+		data->dest_dir = g_strdup (dest_dir);
+	data->update = update;
+	if (password != NULL)
+		data->password = g_strdup (password);
+	data->encrypt_header = encrypt_header;
+	data->compression = compression;
+	data->volume_size = volume_size;
+
+	return data;
+}
+
+static void
+dropped_items_data_free (DroppedItemsData *data)
+{
+	if (data == NULL)
+		return;
+	path_list_free (data->item_list);
+	g_free (data->base_dir);
+	g_free (data->dest_dir);
+	g_free (data->password);
+	g_free (data);
+}
+
+struct _FrArchivePrivData {
+	FakeLoadFunc         fake_load_func;                /* If returns TRUE, archives are not read when
+							     * fr_archive_load is invoked, used
+							     * in batch mode. */
+	gpointer             fake_load_data;
+	GCancellable        *cancellable;
+	char                *temp_dir;
+	gboolean             continue_adding_dropped_items;
+	DroppedItemsData    *dropped_items_data;
+
+	char                *temp_extraction_dir;
+	char                *extraction_destination;
+	gboolean             remote_extraction;
+	gboolean             extract_here;
+};
+
+typedef struct {
+	FrArchive      *archive;
+	char           *uri;
+	FrAction        action;
+	GList          *file_list;
+	char           *base_uri;
+	char           *dest_dir;
+	gboolean        update;
+	char           *tmp_dir;
+	guint           source_id;
+	char           *password;
+	gboolean        encrypt_header;
+	FrCompression   compression;
+	guint           volume_size;
+} XferData;
+
+static void
+xfer_data_free (XferData *data)
+{
+	if (data == NULL)
+		return;
+
+	g_free (data->uri);
+	g_free (data->password);
+	path_list_free (data->file_list);
+	g_free (data->base_uri);
+	g_free (data->dest_dir);
+	g_free (data->tmp_dir);
+	g_free (data);
+}
+
+#define MAX_CHUNK_LEN (NCARGS * 2 / 3) /* Max command line length */
+#define NO_BACKUP_FILES (TRUE)
+#define NO_DOT_FILES (FALSE)
+#define IGNORE_CASE (FALSE)
+#define LIST_LENGTH_TO_USE_FILE 10 /* FIXME: find a good value */
+
+enum {
+	START,
+	DONE,
+	PROGRESS,
+	MESSAGE,
+	STOPPABLE,
+	WORKING_ARCHIVE,
+	LAST_SIGNAL
+};
+
+static GObjectClass *parent_class;
+static guint fr_archive_signals[LAST_SIGNAL] = { 0 };
+
+static void fr_archive_class_init (FrArchiveClass *class);
+static void fr_archive_init       (FrArchive *archive);
+static void fr_archive_finalize   (GObject *object);
+
+GType
+fr_archive_get_type (void)
+{
+	static GType type = 0;
+
+	if (! type) {
+		static const GTypeInfo type_info = {
+			sizeof (FrArchiveClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_archive_class_init,
+			NULL,
+			NULL,
+			sizeof (FrArchive),
+			0,
+			(GInstanceInitFunc) fr_archive_init,
+			NULL
+		};
+
+		type = g_type_register_static (G_TYPE_OBJECT,
+					       "FrArchive",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+static void
+fr_archive_class_init (FrArchiveClass *class)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+
+	parent_class = g_type_class_peek_parent (class);
+
+	gobject_class->finalize = fr_archive_finalize;
+
+	class->start = NULL;
+	class->done = NULL;
+	class->progress = NULL;
+	class->message = NULL;
+	class->working_archive = NULL;
+
+	/* signals */
+
+	fr_archive_signals[START] =
+		g_signal_new ("start",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, start),
+			      NULL, NULL,
+			      fr_marshal_VOID__INT,
+			      G_TYPE_NONE,
+			      1, G_TYPE_INT);
+	fr_archive_signals[DONE] =
+		g_signal_new ("done",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, done),
+			      NULL, NULL,
+			      fr_marshal_VOID__INT_BOXED,
+			      G_TYPE_NONE, 2,
+			      G_TYPE_INT,
+			      FR_TYPE_PROC_ERROR);
+	fr_archive_signals[PROGRESS] =
+		g_signal_new ("progress",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, progress),
+			      NULL, NULL,
+			      fr_marshal_VOID__DOUBLE,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_DOUBLE);
+	fr_archive_signals[MESSAGE] =
+		g_signal_new ("message",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, message),
+			      NULL, NULL,
+			      fr_marshal_VOID__STRING,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_STRING);
+	fr_archive_signals[STOPPABLE] =
+		g_signal_new ("stoppable",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, stoppable),
+			      NULL, NULL,
+			      fr_marshal_VOID__BOOLEAN,
+			      G_TYPE_NONE,
+			      1, G_TYPE_BOOLEAN);
+	fr_archive_signals[WORKING_ARCHIVE] =
+		g_signal_new ("working_archive",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrArchiveClass, working_archive),
+			      NULL, NULL,
+			      fr_marshal_VOID__STRING,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_STRING);
+}
+
+void
+fr_archive_stoppable (FrArchive *archive,
+		      gboolean   stoppable)
+{
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[STOPPABLE],
+		       0,
+		       stoppable);
+}
+
+void
+fr_archive_stop (FrArchive *archive)
+{
+	if (archive->process != NULL) {
+		fr_process_stop (archive->process);
+		return;
+	}
+
+	if (! g_cancellable_is_cancelled (archive->priv->cancellable))
+		g_cancellable_cancel (archive->priv->cancellable);
+}
+
+void
+fr_archive_action_completed (FrArchive       *archive,
+			     FrAction         action,
+			     FrProcErrorType  error_type,
+			     const char      *error_details)
+{
+	archive->error.type = error_type;
+	archive->error.status = 0;
+	g_clear_error (&archive->error.gerror);
+	if (error_details != NULL)
+		archive->error.gerror = g_error_new_literal (fr_error_quark (),
+							     0,
+							     error_details);
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[DONE],
+		       0,
+		       action,
+		       &archive->error);
+}
+
+static gboolean
+archive_sticky_only_cb (FrProcess *process,
+			FrArchive *archive)
+{
+	fr_archive_stoppable (archive, FALSE);
+	return TRUE;
+}
+
+static void
+fr_archive_init (FrArchive *archive)
+{
+	archive->file = NULL;
+	archive->local_copy = NULL;
+	archive->is_remote = FALSE;
+	archive->command = NULL;
+	archive->is_compressed_file = FALSE;
+	archive->can_create_compressed_file = FALSE;
+
+	archive->priv = g_new0 (FrArchivePrivData, 1);
+	archive->priv->fake_load_func = NULL;
+	archive->priv->fake_load_data = NULL;
+
+	archive->priv->extraction_destination = NULL;
+	archive->priv->temp_extraction_dir = NULL;
+	archive->priv->cancellable = g_cancellable_new ();
+
+	archive->process = fr_process_new ();
+	g_signal_connect (G_OBJECT (archive->process),
+			  "sticky_only",
+			  G_CALLBACK (archive_sticky_only_cb),
+			  archive);
+}
+
+FrArchive *
+fr_archive_new (void)
+{
+	return FR_ARCHIVE (g_object_new (FR_TYPE_ARCHIVE, NULL));
+}
+
+static GFile *
+get_local_copy_for_file (GFile *remote_file)
+{
+	char  *temp_dir;
+	GFile *local_copy = NULL;
+
+	temp_dir = get_temp_work_dir (NULL);
+	if (temp_dir != NULL) {
+		char  *archive_name;
+		char  *local_path;
+
+		archive_name = g_file_get_basename (remote_file);
+		local_path = g_build_filename (temp_dir, archive_name, NULL);
+		local_copy = g_file_new_for_path (local_path);
+
+		g_free (local_path);
+		g_free (archive_name);
+	}
+	g_free (temp_dir);
+
+	return local_copy;
+}
+
+static void
+fr_archive_set_uri (FrArchive  *archive,
+		    const char *uri)
+{
+	if ((archive->local_copy != NULL) && archive->is_remote) {
+		GFile  *temp_folder;
+		GError *err = NULL;
+
+		g_file_delete (archive->local_copy, NULL, &err);
+		if (err != NULL) {
+			g_warning ("Failed to delete the local copy: %s", err->message);
+			g_clear_error (&err);
+		}
+
+		temp_folder = g_file_get_parent (archive->local_copy);
+		g_file_delete (temp_folder, NULL, &err);
+		if (err != NULL) {
+			g_warning ("Failed to delete temp folder: %s", err->message);
+			g_clear_error (&err);
+		}
+
+		g_object_unref (temp_folder);
+	}
+
+	if (archive->file != NULL) {
+		g_object_unref (archive->file);
+		archive->file = NULL;
+	}
+	if (archive->local_copy != NULL) {
+		g_object_unref (archive->local_copy);
+		archive->local_copy = NULL;
+	}
+	archive->content_type = NULL;
+
+	if (uri == NULL)
+		return;
+
+	archive->file = g_file_new_for_uri (uri);
+	archive->is_remote = ! g_file_has_uri_scheme (archive->file, "file");
+	if (archive->is_remote)
+		archive->local_copy = get_local_copy_for_file (archive->file);
+	else
+		archive->local_copy = g_file_dup (archive->file);
+}
+
+static void
+fr_archive_remove_temp_work_dir (FrArchive *archive)
+{
+	if (archive->priv->temp_dir == NULL)
+		return;
+	remove_local_directory (archive->priv->temp_dir);
+	g_free (archive->priv->temp_dir);
+	archive->priv->temp_dir = NULL;
+}
+
+static void
+fr_archive_finalize (GObject *object)
+{
+	FrArchive *archive;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_ARCHIVE (object));
+
+	archive = FR_ARCHIVE (object);
+
+	fr_archive_set_uri (archive, NULL);
+	fr_archive_remove_temp_work_dir (archive);
+	if (archive->command != NULL)
+		g_object_unref (archive->command);
+	g_object_unref (archive->process);
+	if (archive->priv->dropped_items_data != NULL) {
+		dropped_items_data_free (archive->priv->dropped_items_data);
+		archive->priv->dropped_items_data = NULL;
+	}
+	g_free (archive->priv->temp_extraction_dir);
+	g_free (archive->priv->extraction_destination);
+	g_free (archive->priv);
+
+	/* Chain up */
+
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static const char *
+get_mime_type_from_content (GFile *file)
+{
+	GFileInfo  *info;
+	GError     *err = NULL;
+ 	const char *content_type = NULL;
+
+	info = g_file_query_info (file,
+				  G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+				  0, NULL, &err);
+	if (info == NULL) {
+		g_warning ("could not get content type: %s", err->message);
+		g_clear_error (&err);
+	}
+	else {
+		content_type = get_static_string (g_file_info_get_content_type (info));
+		g_object_unref (info);
+	}
+
+	return content_type;
+}
+
+static const char *
+get_mime_type_from_magic_numbers (GFile *file)
+{
+#ifdef ENABLE_MAGIC
+	static magic_t magic = NULL;
+
+	if (! magic) {
+		magic = magic_open (MAGIC_MIME_TYPE);
+		if (magic)
+			magic_load (magic, NULL);
+		else
+			g_warning ("unable to open magic database");
+	}
+
+	if (magic) {
+		const char * mime_type = NULL;
+		char * filepath = g_file_get_path (file);
+
+		if (filepath) {
+			mime_type = magic_file (magic, filepath);
+			g_free (filepath);
+		}
+
+		if (mime_type)
+			return mime_type;
+
+		g_warning ("unable to detect filetype from magic: %s",
+			   magic_error (magic));
+	}
+#else
+	static const struct magic {
+		const unsigned int off;
+		const unsigned int len;
+		const char * const id;
+		const char * const mime_type;
+	} magic_ids [] = {
+		/* magic ids taken from magic/Magdir/archive from the file-4.21 tarball */
+		{ 0, 21, "!<arch>" "\x0a" "debian-binary",       "application/vnd.debian.binary-package" },
+		{ 0,  8, "!<arch>" "\x0a",                       "application/x-archive"       },
+		{ 0,  6, "7z\274\257\047\034",                   "application/x-7z-compressed" },
+		{ 7,  7, "**ACE**",                              "application/x-ace"           },
+		{ 0,  2, "\x60\xea",                             "application/x-arj"           },
+		{ 0,  4, "\xce\xb2\xcf\x81",                     "application/x-brotli"        },
+		{ 0,  3, "BZh",                                  "application/x-bzip2"         },
+		{ 0,  2, "\037\213",                             "application/x-gzip"          },
+		{ 2,  3, "-lh",                                  "application/x-lzh-compressed"},
+		{ 0,  4, "LZIP",                                 "application/x-lzip"          },
+		{ 0,  9, "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a", "application/x-lzop",         },
+		{ 0,  4, "Rar!",                                 "application/x-rar"           },
+		{ 0,  4, "\xed\xab\xee\xdb",                     "application/x-rpm"           },
+		{ 0,  4, "RZIP",                                 "application/x-rzip"          },
+		{ 0,  6, "\3757zXZ\000",                         "application/x-xz"            },
+		{ 20, 4, "\xdc\xa7\xc4\xfd",                     "application/x-zoo",          },
+		{ 0,  4, "PK\003\004",                           "application/zip"             },
+		{ 0,  8, "PK00PK\003\004",                       "application/zip"             },
+		{ 0,  4, "LRZI",                                 "application/x-lrzip"         },
+		{ 0,  2, "\x1f\x9d",                             "application/x-compress"      }, /* using Lempel-Ziv-Welch   algorithm */
+		{ 0,  2, "\x1f\xa0",                             "application/x-compress"      }, /* using Lempel-Ziv-Huffman algorithm */
+	};
+
+	char   buffer[32];
+	size_t i;
+
+	if (! g_load_file_in_buffer (file, buffer, sizeof (buffer), NULL))
+		return NULL;
+
+	for (i = 0; i < G_N_ELEMENTS (magic_ids); i++) {
+		const struct magic * const magic = &magic_ids[i];
+
+		if (sizeof (buffer) < (magic->off + magic->len))
+			g_warning ("buffer underrun for mime type '%s' magic",
+				   magic->mime_type);
+		else if (! memcmp (buffer + magic->off, magic->id, magic->len))
+			return magic->mime_type;
+	}
+#endif
+
+	return NULL;
+}
+
+static const char *
+get_mime_type_from_filename (GFile *file)
+{
+	const char *mime_type = NULL;
+	char       *filename;
+
+	if (file == NULL)
+		return NULL;
+
+	filename = g_file_get_path (file);
+	mime_type = get_mime_type_from_extension (get_file_extension (filename));
+	g_free (filename);
+
+	return mime_type;
+}
+
+static gboolean
+create_command_from_type (FrArchive     *archive,
+			  const char    *mime_type,
+		          GType          command_type,
+		          FrCommandCaps  requested_capabilities)
+{
+	if (command_type == 0)
+		return FALSE;
+
+	archive->command = FR_COMMAND (g_object_new (command_type,
+					             "process", archive->process,
+					             "mime-type", mime_type,
+					             NULL));
+
+	if (! fr_command_is_capable_of (archive->command, requested_capabilities)) {
+		g_object_unref (archive->command);
+		archive->command = NULL;
+		archive->is_compressed_file = FALSE;
+	}
+	else
+		archive->is_compressed_file = ! fr_command_is_capable_of (archive->command, FR_COMMAND_CAN_ARCHIVE_MANY_FILES);
+
+	return (archive->command != NULL);
+}
+
+static gboolean
+create_command_to_load_archive (FrArchive  *archive,
+			        const char *mime_type)
+{
+	FrCommandCaps requested_capabilities = FR_COMMAND_CAN_DO_NOTHING;
+	GType         command_type;
+
+	if (mime_type == NULL)
+		return FALSE;
+
+	/* try with the WRITE capability even when loading, this way we give
+	 * priority to the commands that can read and write over commands
+	 * that can only read a specific file format. */
+
+	requested_capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	command_type = get_command_type_from_mime_type (mime_type, requested_capabilities);
+
+	/* if no command was found, remove the write capability and try again */
+
+	if (command_type == 0) {
+		requested_capabilities ^= FR_COMMAND_CAN_WRITE;
+		command_type = get_command_type_from_mime_type (mime_type, requested_capabilities);
+	}
+
+	return create_command_from_type (archive,
+					 mime_type,
+					 command_type,
+					 requested_capabilities);
+}
+
+static gboolean
+create_command_to_create_archive (FrArchive  *archive,
+			          const char *mime_type)
+{
+	FrCommandCaps requested_capabilities = FR_COMMAND_CAN_DO_NOTHING;
+	GType         command_type;
+
+	if (mime_type == NULL)
+		return FALSE;
+
+	requested_capabilities |= FR_COMMAND_CAN_WRITE;
+	command_type = get_command_type_from_mime_type (mime_type, requested_capabilities);
+
+	return create_command_from_type (archive,
+					 mime_type,
+					 command_type,
+					 requested_capabilities);
+}
+
+static void
+action_started (FrCommand *command,
+		FrAction   action,
+		FrArchive *archive)
+{
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [START] (FR::Archive)\n", get_action_name (action));
+#endif
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       action);
+}
+
+/* -- copy_to_remote_location -- */
+
+static void
+fr_archive_copy_done (FrArchive *archive,
+		      FrAction   action,
+		      GError    *error)
+{
+	FrProcErrorType  error_type = FR_PROC_ERROR_NONE;
+	const char      *error_details = NULL;
+
+	if (error != NULL) {
+		error_type = (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ? FR_PROC_ERROR_STOPPED : FR_PROC_ERROR_GENERIC);
+		error_details = error->message;
+	}
+	fr_archive_action_completed (archive, action, error_type, error_details);
+}
+
+static void
+copy_to_remote_location_done (GError   *error,
+			      gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	fr_archive_copy_done (xfer_data->archive, xfer_data->action, error);
+	xfer_data_free (xfer_data);
+}
+
+static void
+copy_to_remote_location_progress (goffset   current_file,
+                                  goffset   total_files,
+                                  GFile    *source,
+                                  GFile    *destination,
+                                  goffset   current_num_bytes,
+                                  goffset   total_num_bytes,
+                                  gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	g_signal_emit (G_OBJECT (xfer_data->archive),
+		       fr_archive_signals[PROGRESS],
+		       0,
+		       (double) current_num_bytes / total_num_bytes);
+}
+
+static void
+copy_to_remote_location (FrArchive  *archive,
+			 FrAction    action)
+{
+	XferData *xfer_data;
+
+	xfer_data = g_new0 (XferData, 1);
+	xfer_data->archive = archive;
+	xfer_data->action = action;
+
+	g_copy_file_async (archive->local_copy,
+			   archive->file,
+			   G_FILE_COPY_OVERWRITE,
+			   G_PRIORITY_DEFAULT,
+			   archive->priv->cancellable,
+			   copy_to_remote_location_progress,
+			   xfer_data,
+			   copy_to_remote_location_done,
+			   xfer_data);
+}
+
+/* -- copy_extracted_files_to_destination -- */
+
+static void
+move_here (FrArchive *archive)
+{
+	char   *content_uri;
+	char   *parent;
+	char   *parent_parent;
+	char   *new_content_uri;
+	GFile  *source, *destination, *parent_file;
+	GError *error = NULL;
+
+	content_uri = get_dir_content_if_unique (archive->priv->extraction_destination);
+	if (content_uri == NULL)
+		return;
+
+	parent = remove_level_from_path (content_uri);
+
+	if (uricmp (parent, archive->priv->extraction_destination) == 0) {
+		char *new_uri;
+
+		new_uri = get_alternative_uri_for_uri (archive->priv->extraction_destination);
+
+		source = g_file_new_for_uri (archive->priv->extraction_destination);
+		destination = g_file_new_for_uri (new_uri);
+		if (! g_file_move (source, destination, 0, NULL, NULL, NULL, &error)) {
+			g_warning ("could not rename %s to %s: %s", archive->priv->extraction_destination, new_uri, error->message);
+			g_clear_error (&error);
+		}
+		g_object_unref (source);
+		g_object_unref (destination);
+
+		g_free (archive->priv->extraction_destination);
+		archive->priv->extraction_destination = new_uri;
+
+		g_free (parent);
+
+		content_uri = get_dir_content_if_unique (archive->priv->extraction_destination);
+		if (content_uri == NULL)
+			return;
+
+		parent = remove_level_from_path (content_uri);
+	}
+
+	parent_parent = remove_level_from_path (parent);
+	new_content_uri = get_alternative_uri (parent_parent, file_name_from_path (content_uri));
+
+	source = g_file_new_for_uri (content_uri);
+	destination = g_file_new_for_uri (new_content_uri);
+	if (! g_file_move (source, destination, 0, NULL, NULL, NULL, &error)) {
+		g_warning ("could not rename %s to %s: %s", content_uri, new_content_uri, error->message);
+		g_clear_error (&error);
+	}
+
+	parent_file = g_file_new_for_uri (parent);
+	if (! g_file_delete (parent_file, NULL, &error)) {
+		g_warning ("could not remove directory %s: %s", parent, error->message);
+		g_clear_error (&error);
+	}
+	g_object_unref (parent_file);
+
+	g_free (archive->priv->extraction_destination);
+	archive->priv->extraction_destination = new_content_uri;
+
+	g_free (parent_parent);
+	g_free (parent);
+	g_free (content_uri);
+}
+
+static void
+copy_extracted_files_done (GError   *error,
+			   gpointer  user_data)
+{
+	FrArchive *archive = user_data;
+
+	remove_local_directory (archive->priv->temp_extraction_dir);
+	g_free (archive->priv->temp_extraction_dir);
+	archive->priv->temp_extraction_dir = NULL;
+
+	fr_archive_action_completed (archive,
+				     FR_ACTION_COPYING_FILES_TO_REMOTE,
+				     FR_PROC_ERROR_NONE,
+				     NULL);
+
+	if ((error == NULL) && (archive->priv->extract_here))
+		move_here (archive);
+
+	fr_archive_copy_done (archive, FR_ACTION_EXTRACTING_FILES, error);
+}
+
+static void
+copy_extracted_files_progress (goffset   current_file,
+                               goffset   total_files,
+                               GFile    *source,
+                               GFile    *destination,
+                               goffset   current_num_bytes,
+                               goffset   total_num_bytes,
+                               gpointer  user_data)
+{
+	FrArchive *archive = user_data;
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[PROGRESS],
+		       0,
+		       (double) current_file / (total_files + 1));
+}
+
+static void
+copy_extracted_files_to_destination (FrArchive *archive)
+{
+	g_directory_copy_async (archive->priv->temp_extraction_dir,
+				archive->priv->extraction_destination,
+				G_FILE_COPY_OVERWRITE,
+				G_PRIORITY_DEFAULT,
+				archive->priv->cancellable,
+				copy_extracted_files_progress,
+				archive,
+				copy_extracted_files_done,
+				archive);
+}
+
+static void add_dropped_items (DroppedItemsData *data);
+
+static void
+fr_archive_change_name (FrArchive  *archive,
+		        const char *filename)
+{
+	const char *name;
+	GFile      *parent;
+
+	name = file_name_from_path (filename);
+
+	parent = g_file_get_parent (archive->file);
+	g_object_unref (archive->file);
+	archive->file = g_file_get_child (parent, name);
+	g_object_unref (parent);
+
+	parent = g_file_get_parent (archive->local_copy);
+	g_object_unref (archive->local_copy);
+	archive->local_copy = g_file_get_child (parent, name);
+	g_object_unref (parent);
+}
+
+static void
+action_performed (FrCommand   *command,
+		  FrAction     action,
+		  FrProcError *error,
+		  FrArchive   *archive)
+{
+#ifdef MATE_ENABLE_DEBUG
+	debug (DEBUG_INFO, "%s [DONE] (FR::Archive)\n", get_action_name (action));
+#endif
+
+	switch (action) {
+	case FR_ACTION_DELETING_FILES:
+		if (error->type == FR_PROC_ERROR_NONE) {
+			if (! g_file_has_uri_scheme (archive->file, "file")) {
+				copy_to_remote_location (archive, action);
+				return;
+			}
+		}
+		break;
+
+	case FR_ACTION_ADDING_FILES:
+		if (error->type == FR_PROC_ERROR_NONE) {
+			fr_archive_remove_temp_work_dir (archive);
+			if (archive->priv->continue_adding_dropped_items) {
+				add_dropped_items (archive->priv->dropped_items_data);
+				return;
+			}
+			if (archive->priv->dropped_items_data != NULL) {
+				dropped_items_data_free (archive->priv->dropped_items_data);
+				archive->priv->dropped_items_data = NULL;
+			}
+			/* the name of the volumes are different from the
+			 * original name */
+			if (archive->command->multi_volume)
+				fr_archive_change_name (archive, archive->command->filename);
+			if (! g_file_has_uri_scheme (archive->file, "file")) {
+				copy_to_remote_location (archive, action);
+				return;
+			}
+		}
+		break;
+
+	case FR_ACTION_EXTRACTING_FILES:
+		if (error->type == FR_PROC_ERROR_NONE) {
+			if (archive->priv->remote_extraction) {
+				copy_extracted_files_to_destination (archive);
+				return;
+			}
+			else if (archive->priv->extract_here)
+				move_here (archive);
+		}
+		else {
+			/* if an error occurred during extraction remove the
+			 * temp extraction dir, if used. */
+			g_print ("action_performed: ERROR!\n");
+
+			if ((archive->priv->remote_extraction) && (archive->priv->temp_extraction_dir != NULL)) {
+				remove_local_directory (archive->priv->temp_extraction_dir);
+				g_free (archive->priv->temp_extraction_dir);
+				archive->priv->temp_extraction_dir = NULL;
+			}
+
+			if (archive->priv->extract_here)
+				remove_directory (archive->priv->extraction_destination);
+		}
+		break;
+
+	case FR_ACTION_LISTING_CONTENT:
+		/* the name of the volumes are different from the
+		 * original name */
+		if (archive->command->multi_volume)
+			fr_archive_change_name (archive, archive->command->filename);
+		fr_command_update_capabilities (archive->command);
+		if (! fr_command_is_capable_of (archive->command, FR_COMMAND_CAN_WRITE))
+			archive->read_only = TRUE;
+		break;
+
+	default:
+		/* nothing */
+		break;
+	}
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[DONE],
+		       0,
+		       action,
+		       error);
+}
+
+static gboolean
+archive_progress_cb (FrCommand *command,
+		     double     fraction,
+		     FrArchive *archive)
+{
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[PROGRESS],
+		       0,
+		       fraction);
+	return TRUE;
+}
+
+static gboolean
+archive_message_cb  (FrCommand  *command,
+		     const char *msg,
+		     FrArchive  *archive)
+{
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[MESSAGE],
+		       0,
+		       msg);
+	return TRUE;
+}
+
+static gboolean
+archive_working_archive_cb  (FrCommand  *command,
+			     const char *archive_filename,
+			     FrArchive  *archive)
+{
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[WORKING_ARCHIVE],
+		       0,
+		       archive_filename);
+	return TRUE;
+}
+
+static void
+fr_archive_connect_to_command (FrArchive *archive)
+{
+	g_signal_connect (G_OBJECT (archive->command),
+			  "start",
+			  G_CALLBACK (action_started),
+			  archive);
+	g_signal_connect (G_OBJECT (archive->command),
+			  "done",
+			  G_CALLBACK (action_performed),
+			  archive);
+	g_signal_connect (G_OBJECT (archive->command),
+			  "progress",
+			  G_CALLBACK (archive_progress_cb),
+			  archive);
+	g_signal_connect (G_OBJECT (archive->command),
+			  "message",
+			  G_CALLBACK (archive_message_cb),
+			  archive);
+	g_signal_connect (G_OBJECT (archive->command),
+			  "working_archive",
+			  G_CALLBACK (archive_working_archive_cb),
+			  archive);
+}
+
+gboolean
+fr_archive_create (FrArchive  *archive,
+		   const char *uri)
+{
+	FrCommand  *tmp_command;
+	const char *mime_type;
+
+	if (uri == NULL)
+		return FALSE;
+
+	fr_archive_set_uri (archive, uri);
+
+	tmp_command = archive->command;
+
+	mime_type = get_mime_type_from_filename (archive->local_copy);
+	if (! create_command_to_create_archive (archive, mime_type)) {
+		archive->command = tmp_command;
+		return FALSE;
+	}
+
+	if (tmp_command != NULL) {
+		g_signal_handlers_disconnect_by_data (tmp_command, archive);
+		g_object_unref (G_OBJECT (tmp_command));
+	}
+
+	fr_archive_connect_to_command (archive);
+	archive->read_only = FALSE;
+
+	return TRUE;
+}
+
+void
+fr_archive_set_fake_load_func (FrArchive    *archive,
+			       FakeLoadFunc  func,
+			       gpointer      data)
+{
+	archive->priv->fake_load_func = func;
+	archive->priv->fake_load_data = data;
+}
+
+gboolean
+fr_archive_fake_load (FrArchive *archive)
+{
+	if (archive->priv->fake_load_func != NULL)
+		return (*archive->priv->fake_load_func) (archive, archive->priv->fake_load_data);
+	else
+		return FALSE;
+}
+
+/* -- fr_archive_load -- */
+
+static void
+load_local_archive (FrArchive  *archive,
+		    const char *password)
+{
+	FrCommand  *old_command;
+	const char *mime_type;
+
+	if (! g_file_query_exists (archive->file, archive->priv->cancellable)) {
+		fr_archive_action_completed (archive,
+					     FR_ACTION_LOADING_ARCHIVE,
+					     FR_PROC_ERROR_GENERIC,
+					     _("File not found."));
+		return;
+	}
+
+	archive->have_permissions = check_file_permissions (archive->file, W_OK);
+	archive->read_only = ! archive->have_permissions;
+
+	old_command = archive->command;
+
+	mime_type = get_mime_type_from_filename (archive->local_copy);
+
+	if (! create_command_to_load_archive (archive, mime_type)) {
+		mime_type = get_mime_type_from_content (archive->local_copy);
+		if (! create_command_to_load_archive (archive, mime_type)) {
+			mime_type = get_mime_type_from_magic_numbers (archive->local_copy);
+			if (! create_command_to_load_archive (archive, mime_type)) {
+				archive->command = old_command;
+				archive->content_type = mime_type;
+				fr_archive_action_completed (archive,
+							     FR_ACTION_LOADING_ARCHIVE,
+							     FR_PROC_ERROR_UNSUPPORTED_FORMAT,
+							     _("Archive type not supported."));
+				return;
+			}
+		}
+	}
+
+	if (old_command != NULL) {
+		g_signal_handlers_disconnect_by_data (old_command, archive);
+		g_object_unref (old_command);
+	}
+
+	fr_archive_connect_to_command (archive);
+	archive->content_type = mime_type;
+	if (! fr_command_is_capable_of (archive->command, FR_COMMAND_CAN_WRITE))
+		archive->read_only = TRUE;
+	fr_archive_stoppable (archive, TRUE);
+	archive->command->fake_load = fr_archive_fake_load (archive);
+
+	fr_archive_action_completed (archive,
+				     FR_ACTION_LOADING_ARCHIVE,
+				     FR_PROC_ERROR_NONE,
+				     NULL);
+
+	/**/
+
+	fr_process_clear (archive->process);
+	g_object_set (archive->command,
+		      "file", archive->local_copy,
+		      "password", password,
+		      NULL);
+	fr_command_list (archive->command);
+}
+
+static void
+copy_remote_file_done (GError   *error,
+		       gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	if (error != NULL)
+		fr_archive_copy_done (xfer_data->archive, FR_ACTION_LOADING_ARCHIVE, error);
+	else
+		load_local_archive (xfer_data->archive, xfer_data->password);
+	xfer_data_free (xfer_data);
+}
+
+static void
+copy_remote_file_progress (goffset   current_file,
+                           goffset   total_files,
+                           GFile    *source,
+                           GFile    *destination,
+                           goffset   current_num_bytes,
+                           goffset   total_num_bytes,
+                           gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	g_signal_emit (G_OBJECT (xfer_data->archive),
+		       fr_archive_signals[PROGRESS],
+		       0,
+		       (double) current_num_bytes / total_num_bytes);
+}
+
+static gboolean
+copy_remote_file_done_cb (gpointer user_data)
+{
+	XferData *xfer_data = user_data;
+
+	g_source_remove (xfer_data->source_id);
+	copy_remote_file_done (NULL, xfer_data);
+	return FALSE;
+}
+
+static void
+copy_remote_file (FrArchive  *archive,
+		  const char *password)
+{
+	XferData *xfer_data;
+
+	if (! g_file_query_exists (archive->file, archive->priv->cancellable)) {
+		GError *error;
+
+		error = g_error_new (G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("Archive not found"));
+		fr_archive_copy_done (archive, FR_ACTION_LOADING_ARCHIVE, error);
+		g_error_free (error);
+
+		return;
+	}
+
+	xfer_data = g_new0 (XferData, 1);
+	xfer_data->archive = archive;
+	xfer_data->uri = g_file_get_uri (archive->file);
+	if (password != NULL)
+		xfer_data->password = g_strdup (password);
+
+	if (! archive->is_remote) {
+		xfer_data->source_id = g_idle_add (copy_remote_file_done_cb, xfer_data);
+		return;
+	}
+
+	g_copy_file_async (archive->file,
+			   archive->local_copy,
+			   G_FILE_COPY_OVERWRITE,
+			   G_PRIORITY_DEFAULT,
+			   archive->priv->cancellable,
+			   copy_remote_file_progress,
+			   xfer_data,
+			   copy_remote_file_done,
+			   xfer_data);
+}
+
+gboolean
+fr_archive_load (FrArchive  *archive,
+		 const char *uri,
+		 const char *password)
+{
+	g_return_val_if_fail (archive != NULL, FALSE);
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_LOADING_ARCHIVE);
+
+	fr_archive_set_uri (archive, uri);
+	copy_remote_file (archive, password);
+
+	return TRUE;
+}
+
+gboolean
+fr_archive_load_local (FrArchive  *archive,
+		       const char *uri,
+		       const char *password)
+{
+	g_return_val_if_fail (archive != NULL, FALSE);
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_LOADING_ARCHIVE);
+
+	fr_archive_set_uri (archive, uri);
+	copy_remote_file (archive, password);
+
+	return TRUE;
+}
+
+void
+fr_archive_reload (FrArchive  *archive,
+		   const char *password)
+{
+	char *uri;
+
+	g_return_if_fail (archive != NULL);
+	g_return_if_fail (archive->file != NULL);
+
+	fr_archive_stoppable (archive, TRUE);
+	archive->command->fake_load = fr_archive_fake_load (archive);
+
+	uri = g_file_get_uri (archive->file);
+	fr_archive_load (archive, uri, password);
+	g_free (uri);
+}
+
+/* -- add -- */
+
+static char *
+create_tmp_base_dir (const char *base_dir,
+		     const char *dest_path)
+{
+	char *dest_dir;
+	char *temp_dir;
+	char *tmp;
+	char *parent_dir;
+	char *dir;
+
+	if ((dest_path == NULL)
+	    || (*dest_path == '\0')
+	    || (strcmp (dest_path, "/") == 0))
+	{
+		return g_strdup (base_dir);
+	}
+
+	dest_dir = g_strdup (dest_path);
+	if (dest_dir[strlen (dest_dir) - 1] == G_DIR_SEPARATOR)
+		dest_dir[strlen (dest_dir) - 1] = 0;
+
+	debug (DEBUG_INFO, "base_dir: %s\n", base_dir);
+	debug (DEBUG_INFO, "dest_dir: %s\n", dest_dir);
+
+	temp_dir = get_temp_work_dir (NULL);
+	tmp = remove_level_from_path (dest_dir);
+	parent_dir =  g_build_filename (temp_dir, tmp, NULL);
+	g_free (tmp);
+
+	debug (DEBUG_INFO, "mkdir %s\n", parent_dir);
+	make_directory_tree_from_path (parent_dir, 0700, NULL);
+	g_free (parent_dir);
+
+	dir = g_build_filename (temp_dir, "/", dest_dir, NULL);
+	debug (DEBUG_INFO, "symlink %s --> %s\n", dir, base_dir);
+	if (! symlink (base_dir, dir))
+		g_warning("Could not create the symbolic link '%s', pointing to '%s'", dir, base_dir);
+
+	g_free (dir);
+	g_free (dest_dir);
+
+	return temp_dir;
+}
+
+static FileData *
+find_file_in_archive (FrArchive *archive,
+		      char      *path)<--- Parameter 'path' can be declared as pointer to const
+{
+	int i;
+
+	g_return_val_if_fail (path != NULL, NULL);
+
+	i = find_path_in_file_data_array (archive->command->files, path);
+	if (i >= 0)
+		return (FileData *) g_ptr_array_index (archive->command->files, i);
+	else
+		return NULL;
+}
+
+static void delete_from_archive (FrArchive *archive, GList *file_list);
+
+static GList *
+newer_files_only (FrArchive  *archive,
+		  GList      *file_list,
+		  const char *base_dir)
+{
+	GList *newer_files = NULL;
+	GList *scan;
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char     *filename = scan->data;
+		char     *fullpath;
+		char     *uri;
+		FileData *fdata;<--- Variable 'fdata' can be declared as pointer to const
+
+		fdata = find_file_in_archive (archive, filename);
+
+		if (fdata == NULL) {
+			newer_files = g_list_prepend (newer_files, g_strdup (scan->data));
+			continue;
+		}
+
+		fullpath = g_strconcat (base_dir, "/", filename, NULL);
+		uri = g_filename_to_uri (fullpath, NULL, NULL);
+
+		if (fdata->modified >= get_file_mtime (uri)) {
+			g_free (fullpath);
+			g_free (uri);
+			continue;
+		}
+		g_free (fullpath);
+		g_free (uri);
+
+		newer_files = g_list_prepend (newer_files, g_strdup (scan->data));
+	}
+
+	return newer_files;
+}
+
+static gboolean
+save_list_to_temp_file (GList   *file_list,
+		        char   **list_dir,
+		        char   **list_filename,
+		        GError **error)
+{
+	gboolean           error_occurred = FALSE;
+	GFile             *list_file;
+	GFileOutputStream *ostream;
+
+	if (error != NULL)
+		*error = NULL;
+	*list_dir = get_temp_work_dir (NULL);
+	*list_filename = g_build_filename (*list_dir, "file-list", NULL);
+	list_file = g_file_new_for_path (*list_filename);
+	ostream = g_file_create (list_file, G_FILE_CREATE_PRIVATE, NULL, error);
+
+	if (ostream != NULL) {
+		GList *scan;
+
+		for (scan = file_list; scan != NULL; scan = scan->next) {
+			char *filename = scan->data;
+
+			filename = str_substitute (filename, "\n", "\\n");
+			if ((g_output_stream_write (G_OUTPUT_STREAM (ostream), filename, strlen (filename), NULL, error) < 0)
+			    || (g_output_stream_write (G_OUTPUT_STREAM (ostream), "\n", 1, NULL, error) < 0))
+			{
+				error_occurred = TRUE;
+			}
+
+			g_free (filename);
+
+			if (error_occurred)
+				break;
+		}
+		if (! error_occurred && ! g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, error))
+			error_occurred = TRUE;
+		g_object_unref (ostream);
+	}
+	else
+		error_occurred = TRUE;
+
+	if (error_occurred) {
+		remove_local_directory (*list_dir);
+		g_free (*list_dir);
+		g_free (*list_filename);
+		*list_dir = NULL;
+		*list_filename = NULL;
+	}
+
+	g_object_unref (list_file);
+
+	return ! error_occurred;
+}
+
+static GList *
+split_in_chunks (GList *file_list)
+{
+	GList *chunks = NULL;
+	GList *new_file_list;
+	GList *scan;
+
+	new_file_list = g_list_copy (file_list);
+	for (scan = new_file_list; scan != NULL; /* void */) {
+		GList *prev = scan->prev;
+		GList *chunk;
+		int    l;
+
+		chunk = scan;
+		l = 0;
+		while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+			if (l == 0)
+				l = strlen (scan->data);
+			prev = scan;
+			scan = scan->next;
+			if (scan != NULL)
+				l += strlen (scan->data);
+		}
+		if (prev != NULL) {
+			if (prev->next != NULL)
+				prev->next->prev = NULL;
+			prev->next = NULL;
+		}
+		chunks = g_list_append (chunks, chunk);
+	}
+
+	return chunks;
+}
+
+void
+fr_archive_add (FrArchive     *archive,
+		GList         *file_list,
+		const char    *base_dir,
+		const char    *dest_dir,
+		gboolean       update,
+		gboolean       recursive,
+		const char    *password,
+		gboolean       encrypt_header,
+		FrCompression  compression,
+		guint          volume_size)
+{
+	GList    *new_file_list = NULL;
+	gboolean  base_dir_created = FALSE;
+	GList    *scan;
+	char     *tmp_base_dir = NULL;
+	char     *tmp_archive_dir = NULL;
+	char     *archive_filename = NULL;
+	char     *tmp_archive_filename = NULL;
+	gboolean  error_occurred = FALSE;
+
+	if (file_list == NULL)
+		return;
+
+	if (archive->read_only)
+		return;
+
+	g_object_set (archive->command,
+		      "password", password,
+		      "encrypt_header", encrypt_header,
+		      "compression", compression,
+		      "volume_size", volume_size,
+		      NULL);
+
+	fr_archive_stoppable (archive, TRUE);
+
+	/* dest_dir is the destination folder inside the archive */
+
+	if ((dest_dir != NULL) && (*dest_dir != '\0') && (strcmp (dest_dir, "/") != 0)) {
+		const char *rel_dest_dir = dest_dir;
+
+		tmp_base_dir = create_tmp_base_dir (base_dir, dest_dir);
+		base_dir_created = TRUE;
+
+		if (dest_dir[0] == G_DIR_SEPARATOR)
+			rel_dest_dir = dest_dir + 1;
+
+		new_file_list = NULL;
+		for (scan = file_list; scan != NULL; scan = scan->next) {
+			char *filename = scan->data;
+			new_file_list = g_list_prepend (new_file_list, g_build_filename (rel_dest_dir, filename, NULL));
+		}
+	}
+	else {
+		tmp_base_dir = g_strdup (base_dir);
+		new_file_list = path_list_dup(file_list);
+	}
+
+	/* if the command cannot update,  get the list of files that are
+	 * newer than the ones in the archive. */
+
+	if (update && ! archive->command->propAddCanUpdate) {
+		GList *tmp_file_list;
+
+		tmp_file_list = new_file_list;
+		new_file_list = newer_files_only (archive, tmp_file_list, tmp_base_dir);
+		path_list_free (tmp_file_list);
+	}
+
+	if (new_file_list == NULL) {
+		debug (DEBUG_INFO, "nothing to update.\n");
+
+		if (base_dir_created)
+			remove_local_directory (tmp_base_dir);
+		g_free (tmp_base_dir);
+
+		archive->process->error.type = FR_PROC_ERROR_NONE;
+		g_signal_emit_by_name (G_OBJECT (archive->process),
+				       "done",
+				       &archive->process->error);
+		return;
+	}
+
+	archive->command->creating_archive = ! g_file_query_exists (archive->local_copy, archive->priv->cancellable);
+
+	/* create the new archive in a temporary sub-directory, this allows
+	 * to cancel the operation without losing the original archive and
+	 * removing possible temporary files created by the command. */
+
+	{
+		GFile *local_copy_parent;
+		char  *archive_dir;
+		GFile *tmp_file;
+
+		/* create the new archive in a sub-folder of the original
+		 * archive this way the 'mv' command is fast. */
+
+		local_copy_parent = g_file_get_parent (archive->local_copy);
+		archive_dir = g_file_get_path (local_copy_parent);
+		tmp_archive_dir = get_temp_work_dir (archive_dir);
+		archive_filename = g_file_get_path (archive->local_copy);
+		tmp_archive_filename = g_build_filename (tmp_archive_dir, file_name_from_path (archive_filename), NULL);
+		tmp_file = g_file_new_for_path (tmp_archive_filename);
+		g_object_set (archive->command, "file", tmp_file, NULL);
+
+		if (! archive->command->creating_archive) {
+			/* copy the original archive to the new position */
+
+			fr_process_begin_command (archive->process, "cp");
+			fr_process_add_arg (archive->process, "-f");
+			fr_process_add_arg (archive->process, archive_filename);
+			fr_process_add_arg (archive->process, tmp_archive_filename);
+			fr_process_end_command (archive->process);
+		}
+
+		g_object_unref (tmp_file);
+		g_free (archive_dir);
+		g_object_unref (local_copy_parent);
+	}
+
+	fr_command_uncompress (archive->command);
+
+	/* when files are already present in a tar archive and are added
+	 * again, they are not replaced, so we have to delete them first. */
+
+	/* if we are adding (== ! update) and 'add' cannot replace or
+	 * if we are updating and 'add' cannot update,
+	 * delete the files first. */
+
+	if ((! update && ! archive->command->propAddCanReplace)
+	    || (update && ! archive->command->propAddCanUpdate))
+	{
+		GList *del_list = NULL;
+
+		for (scan = new_file_list; scan != NULL; scan = scan->next) {
+			char *filename = scan->data;
+			if (find_file_in_archive (archive, filename))
+				del_list = g_list_prepend (del_list, filename);
+		}
+
+		/* delete */
+
+		if (del_list != NULL) {
+			delete_from_archive (archive, del_list);
+			fr_process_set_ignore_error (archive->process, TRUE);
+			g_list_free (del_list);
+		}
+	}
+
+	/* add now. */
+
+	fr_command_set_n_files (archive->command, g_list_length (new_file_list));
+
+	if (archive->command->propListFromFile
+	    && (archive->command->n_files > LIST_LENGTH_TO_USE_FILE))
+	{
+		char   *list_dir;
+		char   *list_filename;
+		GError *error = NULL;
+
+		if (! save_list_to_temp_file (new_file_list, &list_dir, &list_filename, &error)) {
+			archive->process->error.type = FR_PROC_ERROR_GENERIC;
+			archive->process->error.status = 0;
+			archive->process->error.gerror = g_error_copy (error);
+			g_signal_emit_by_name (G_OBJECT (archive->process),
+					       "done",
+					       &archive->process->error);
+			g_clear_error (&error);
+			error_occurred = TRUE;
+		}
+		else {
+			fr_command_add (archive->command,
+					list_filename,
+					new_file_list,
+					tmp_base_dir,
+					update,
+					recursive);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
+		}
+
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		GList *chunks = NULL;
+
+		/* specify the file list on the command line, splitting
+		 * in more commands to avoid to overflow the command line
+		 * length limit. */
+
+		chunks = split_in_chunks (new_file_list);
+		for (scan = chunks; scan != NULL; scan = scan->next) {
+			GList *chunk = scan->data;
+
+			fr_command_add (archive->command,
+					NULL,
+					chunk,
+					tmp_base_dir,
+					update,
+					recursive);
+			g_list_free (chunk);
+		}
+
+		g_list_free (chunks);
+	}
+
+	path_list_free (new_file_list);
+
+	if (! error_occurred) {
+		fr_command_recompress (archive->command);
+
+		/* move the new archive to the original position */
+
+		fr_process_begin_command (archive->process, "mv");
+		fr_process_add_arg (archive->process, "-f");
+		fr_process_add_arg (archive->process, tmp_archive_filename);
+		fr_process_add_arg (archive->process, archive_filename);
+		fr_process_end_command (archive->process);
+
+		/* remove the temp sub-directory */
+
+		fr_process_begin_command (archive->process, "rm");
+		fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+		fr_process_set_sticky (archive->process, TRUE);
+		fr_process_add_arg (archive->process, "-rf");
+		fr_process_add_arg (archive->process, tmp_archive_dir);
+		fr_process_end_command (archive->process);
+
+		/* remove the base dir */
+
+		if (base_dir_created) {
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, tmp_base_dir);
+			fr_process_end_command (archive->process);
+		}
+	}
+
+	g_free (tmp_archive_filename);
+	g_free (archive_filename);
+	g_free (tmp_archive_dir);
+	g_free (tmp_base_dir);
+}
+
+static void
+fr_archive_add_local_files (FrArchive     *archive,
+			    GList         *file_list,
+			    const char    *base_dir,
+			    const char    *dest_dir,
+			    gboolean       update,
+			    const char    *password,
+			    gboolean       encrypt_header,
+			    FrCompression  compression,
+			    guint          volume_size)
+{
+	fr_process_clear (archive->process);
+	fr_archive_add (archive,
+			file_list,
+			base_dir,
+			dest_dir,
+			update,
+			FALSE,
+			password,
+			encrypt_header,
+			compression,
+			volume_size);
+	fr_process_start (archive->process);
+}
+
+static void
+copy_remote_files_done (GError   *error,
+			gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	fr_archive_copy_done (xfer_data->archive, FR_ACTION_COPYING_FILES_FROM_REMOTE, error);
+
+	if (error == NULL)
+		fr_archive_add_local_files (xfer_data->archive,
+					    xfer_data->file_list,
+					    xfer_data->tmp_dir,
+					    xfer_data->dest_dir,
+					    FALSE,
+					    xfer_data->password,
+					    xfer_data->encrypt_header,
+					    xfer_data->compression,
+					    xfer_data->volume_size);
+	xfer_data_free (xfer_data);
+}
+
+static void
+copy_remote_files_progress (goffset   current_file,
+                            goffset   total_files,
+                            GFile    *source,
+                            GFile    *destination,
+                            goffset   current_num_bytes,
+                            goffset   total_num_bytes,
+                            gpointer  user_data)
+{
+	XferData *xfer_data = user_data;
+
+	g_signal_emit (G_OBJECT (xfer_data->archive),
+		       fr_archive_signals[PROGRESS],
+		       0,
+		       (double) current_file / (total_files + 1));
+}
+
+static void
+copy_remote_files (FrArchive     *archive,
+		   GList         *file_list,
+		   const char    *base_uri,
+		   const char    *dest_dir,
+		   gboolean       update,
+		   const char    *password,
+		   gboolean       encrypt_header,
+		   FrCompression  compression,
+		   guint          volume_size,
+		   const char    *tmp_dir)
+{
+	GList      *sources = NULL, *destinations = NULL;
+	GHashTable *created_folders;
+	GList      *scan;
+	XferData   *xfer_data;
+
+	created_folders = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
+	for (scan = file_list; scan; scan = scan->next) {
+		char  *partial_filename = scan->data;
+		char  *local_uri;
+		char  *local_folder_uri;
+		char  *remote_uri;
+
+		local_uri = g_strconcat ("file://", tmp_dir, "/", partial_filename, NULL);
+		local_folder_uri = remove_level_from_path (local_uri);
+		if (g_hash_table_lookup (created_folders, local_folder_uri) == NULL) {
+			GError *error = NULL;
+			if (! ensure_dir_exists (local_folder_uri, 0755, &error)) {
+				g_free (local_folder_uri);
+				g_free (local_uri);
+				gio_file_list_free (sources);
+				gio_file_list_free (destinations);
+				g_hash_table_destroy (created_folders);
+
+				fr_archive_action_completed (archive,
+							     FR_ACTION_COPYING_FILES_FROM_REMOTE,
+							     FR_PROC_ERROR_GENERIC,
+							     error->message);
+				g_clear_error (&error);
+				return;
+			}
+
+			g_hash_table_insert (created_folders, local_folder_uri, GINT_TO_POINTER (1));
+		}
+		else
+			g_free (local_folder_uri);
+
+		remote_uri = g_strconcat (base_uri, "/", partial_filename, NULL);
+		sources = g_list_append (sources, g_file_new_for_uri (remote_uri));
+		g_free (remote_uri);
+
+		destinations = g_list_append (destinations, g_file_new_for_uri (local_uri));
+		g_free (local_uri);
+	}
+	g_hash_table_destroy (created_folders);
+
+	xfer_data = g_new0 (XferData, 1);
+	xfer_data->archive = archive;
+	xfer_data->file_list = path_list_dup (file_list);
+	xfer_data->base_uri = g_strdup (base_uri);
+	xfer_data->dest_dir = g_strdup (dest_dir);
+	xfer_data->update = update;
+	xfer_data->password = g_strdup (password);
+	xfer_data->encrypt_header = encrypt_header;
+	xfer_data->compression = compression;
+	xfer_data->volume_size = volume_size;
+	xfer_data->tmp_dir = g_strdup (tmp_dir);
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_COPYING_FILES_FROM_REMOTE);
+
+	g_copy_files_async (sources,
+			    destinations,
+			    G_FILE_COPY_OVERWRITE,
+			    G_PRIORITY_DEFAULT,
+			    archive->priv->cancellable,
+			    copy_remote_files_progress,
+			    xfer_data,
+			    copy_remote_files_done,
+			    xfer_data);
+
+	gio_file_list_free (sources);
+	gio_file_list_free (destinations);
+}
+
+static char *
+fr_archive_get_temp_work_dir (FrArchive *archive)
+{
+	fr_archive_remove_temp_work_dir (archive);
+	archive->priv->temp_dir = get_temp_work_dir (NULL);
+	return archive->priv->temp_dir;
+}
+
+void
+fr_archive_add_files (FrArchive     *archive,
+		      GList         *file_list,
+		      const char    *base_dir,
+		      const char    *dest_dir,
+		      gboolean       update,
+		      const char    *password,
+		      gboolean       encrypt_header,
+		      FrCompression  compression,
+		      guint          volume_size)
+{
+	if (uri_is_local (base_dir)) {
+		char *local_dir = g_filename_from_uri (base_dir, NULL, NULL);
+		fr_archive_add_local_files (archive,
+					    file_list,
+					    local_dir,
+					    dest_dir,
+					    update,
+					    password,
+					    encrypt_header,
+					    compression,
+					    volume_size);
+		g_free (local_dir);
+	}
+	else
+		copy_remote_files (archive,
+				   file_list,
+				   base_dir,
+				   dest_dir,
+				   update,
+				   password,
+				   encrypt_header,
+				   compression,
+				   volume_size,
+				   fr_archive_get_temp_work_dir (archive));
+}
+
+/* -- add with wildcard -- */
+
+typedef struct {
+	FrArchive     *archive;
+	char          *source_dir;
+	char          *dest_dir;
+	gboolean       update;
+	char          *password;
+	gboolean       encrypt_header;
+	FrCompression  compression;
+	guint          volume_size;
+} AddWithWildcardData;
+
+static void
+add_with_wildcard_data_free (AddWithWildcardData *aww_data)
+{
+	g_free (aww_data->source_dir);
+	g_free (aww_data->dest_dir);
+	g_free (aww_data->password);
+	g_free (aww_data);
+}
+
+static void
+add_with_wildcard__step2 (GList    *file_list,
+			  GList    *dirs_list,
+			  GError   *error,
+			  gpointer  data)
+{
+	AddWithWildcardData *aww_data = data;
+	FrArchive           *archive = aww_data->archive;
+
+	if (error != NULL) {
+		fr_archive_action_completed (archive,
+					     FR_ACTION_GETTING_FILE_LIST,
+					     (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ? FR_PROC_ERROR_STOPPED : FR_PROC_ERROR_GENERIC),
+					     error->message);
+		return;
+	}
+
+	fr_archive_action_completed (archive,
+				     FR_ACTION_GETTING_FILE_LIST,
+				     FR_PROC_ERROR_NONE,
+				     NULL);
+
+	if (file_list != NULL)
+		fr_archive_add_files (aww_data->archive,
+				      file_list,
+				      aww_data->source_dir,
+				      aww_data->dest_dir,
+				      aww_data->update,
+				      aww_data->password,
+				      aww_data->encrypt_header,
+				      aww_data->compression,
+				      aww_data->volume_size);
+
+	path_list_free (file_list);
+	path_list_free (dirs_list);
+	add_with_wildcard_data_free (aww_data);
+}
+
+void
+fr_archive_add_with_wildcard (FrArchive     *archive,
+			      const char    *include_files,
+			      const char    *exclude_files,
+			      const char    *exclude_folders,
+			      const char    *source_dir,
+			      const char    *dest_dir,
+			      gboolean       update,
+			      gboolean       follow_links,
+			      const char    *password,
+			      gboolean       encrypt_header,
+			      FrCompression  compression,
+			      guint          volume_size)
+{
+	AddWithWildcardData *aww_data;
+
+	g_return_if_fail (! archive->read_only);
+
+	aww_data = g_new0 (AddWithWildcardData, 1);
+	aww_data->archive = archive;
+	aww_data->source_dir = g_strdup (source_dir);
+	aww_data->dest_dir = g_strdup (dest_dir);
+	aww_data->update = update;
+	aww_data->password = g_strdup (password);
+	aww_data->encrypt_header = encrypt_header;
+	aww_data->compression = compression;
+	aww_data->volume_size = volume_size;
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_GETTING_FILE_LIST);
+
+	g_directory_list_async (source_dir,
+				source_dir,
+				TRUE,
+				follow_links,
+				NO_BACKUP_FILES,
+				NO_DOT_FILES,
+				include_files,
+				exclude_files,
+				exclude_folders,
+				IGNORE_CASE,
+				archive->priv->cancellable,
+				add_with_wildcard__step2,
+				aww_data);
+}
+
+/* -- fr_archive_add_directory -- */
+
+typedef struct {
+	FrArchive     *archive;
+	char          *base_dir;
+	char          *dest_dir;
+	gboolean       update;
+	char          *password;
+	gboolean       encrypt_header;
+	FrCompression  compression;
+	guint          volume_size;
+} AddDirectoryData;
+
+static void
+add_directory_data_free (AddDirectoryData *ad_data)
+{
+	g_free (ad_data->base_dir);
+	g_free (ad_data->dest_dir);
+	g_free (ad_data->password);
+	g_free (ad_data);
+}
+
+static void
+add_directory__step2 (GList    *file_list,
+		      GList    *dir_list,
+		      GError   *error,
+		      gpointer  data)
+{
+	AddDirectoryData *ad_data = data;
+	FrArchive        *archive = ad_data->archive;
+
+	if (error != NULL) {
+		fr_archive_action_completed (archive,
+					     FR_ACTION_GETTING_FILE_LIST,
+					     (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ? FR_PROC_ERROR_STOPPED : FR_PROC_ERROR_GENERIC),
+					     error->message);
+		return;
+	}
+
+	fr_archive_action_completed (archive,
+				     FR_ACTION_GETTING_FILE_LIST,
+				     FR_PROC_ERROR_NONE,
+				     NULL);
+
+	if (archive->command->propAddCanStoreFolders)
+		file_list = g_list_concat (file_list, dir_list);
+	else
+		path_list_free (dir_list);
+
+	if (file_list != NULL) {
+		fr_archive_add_files (ad_data->archive,
+				      file_list,
+				      ad_data->base_dir,
+				      ad_data->dest_dir,
+				      ad_data->update,
+				      ad_data->password,
+				      ad_data->encrypt_header,
+				      ad_data->compression,
+				      ad_data->volume_size);
+		path_list_free (file_list);
+	}
+
+	add_directory_data_free (ad_data);
+}
+
+void
+fr_archive_add_directory (FrArchive     *archive,
+			  const char    *directory,
+			  const char    *base_dir,
+			  const char    *dest_dir,
+			  gboolean       update,
+			  const char    *password,
+			  gboolean       encrypt_header,
+			  FrCompression  compression,
+			  guint          volume_size)
+
+{
+	AddDirectoryData *ad_data;
+
+	g_return_if_fail (! archive->read_only);
+
+	ad_data = g_new0 (AddDirectoryData, 1);
+	ad_data->archive = archive;
+	ad_data->base_dir = g_strdup (base_dir);
+	ad_data->dest_dir = g_strdup (dest_dir);
+	ad_data->update = update;
+	ad_data->password = g_strdup (password);
+	ad_data->encrypt_header = encrypt_header;
+	ad_data->compression = compression;
+	ad_data->volume_size = volume_size;
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_GETTING_FILE_LIST);
+
+	g_directory_list_all_async (directory,
+				    base_dir,
+				    TRUE,
+				    archive->priv->cancellable,
+				    add_directory__step2,
+				    ad_data);
+}
+
+void
+fr_archive_add_items (FrArchive     *archive,
+		      GList         *item_list,
+		      const char    *base_dir,
+		      const char    *dest_dir,
+		      gboolean       update,
+		      const char    *password,
+		      gboolean       encrypt_header,
+		      FrCompression  compression,
+		      guint          volume_size)
+
+{
+	AddDirectoryData *ad_data;
+
+	g_return_if_fail (! archive->read_only);
+
+	ad_data = g_new0 (AddDirectoryData, 1);
+	ad_data->archive = archive;
+	ad_data->base_dir = g_strdup (base_dir);
+	ad_data->dest_dir = g_strdup (dest_dir);
+	ad_data->update = update;
+	ad_data->password = g_strdup (password);
+	ad_data->encrypt_header = encrypt_header;
+	ad_data->compression = compression;
+	ad_data->volume_size = volume_size;
+
+	g_signal_emit (G_OBJECT (archive),
+		       fr_archive_signals[START],
+		       0,
+		       FR_ACTION_GETTING_FILE_LIST);
+
+	g_list_items_async (item_list,
+			    base_dir,
+			    archive->priv->cancellable,
+			    add_directory__step2,
+			    ad_data);
+}
+
+/* -- fr_archive_add_dropped_items -- */
+
+static gboolean
+all_files_in_same_dir (GList *list)<--- Parameter 'list' can be declared as pointer to const
+{
+	gboolean  same_dir = TRUE;
+	char     *first_basedir;
+	GList    *scan;
+
+	if (list == NULL)
+		return FALSE;
+
+	first_basedir = remove_level_from_path (list->data);
+	if (first_basedir == NULL)
+		return TRUE;
+
+	for (scan = list->next; scan; scan = scan->next) {
+		char *path = scan->data;<--- Variable 'path' can be declared as pointer to const
+		char *basedir;
+
+		basedir = remove_level_from_path (path);
+		if (basedir == NULL) {
+			same_dir = FALSE;
+			break;
+		}
+
+		if (strcmp (first_basedir, basedir) != 0) {
+			same_dir = FALSE;
+			g_free (basedir);
+			break;
+		}
+		g_free (basedir);
+	}
+	g_free (first_basedir);
+
+	return same_dir;
+}
+
+static void
+add_dropped_items (DroppedItemsData *data)
+{
+	FrArchive *archive = data->archive;
+	GList     *list = data->item_list;
+	GList     *scan;
+
+	if (list == NULL) {
+		dropped_items_data_free (archive->priv->dropped_items_data);
+		archive->priv->dropped_items_data = NULL;
+		fr_archive_action_completed (archive,
+					     FR_ACTION_ADDING_FILES,
+					     FR_PROC_ERROR_NONE,
+					     NULL);
+		return;
+	}
+
+	/* if all files/dirs are in the same directory call fr_archive_add_items... */
+
+	if (all_files_in_same_dir (list)) {
+		char *first_base_dir;
+
+		first_base_dir = remove_level_from_path (list->data);
+		fr_archive_add_items (data->archive,
+				      list,
+				      first_base_dir,
+				      data->dest_dir,
+				      data->update,
+				      data->password,
+				      data->encrypt_header,
+				      data->compression,
+				      data->volume_size);
+		g_free (first_base_dir);
+
+		dropped_items_data_free (archive->priv->dropped_items_data);
+		archive->priv->dropped_items_data = NULL;
+
+		return;
+	}
+
+	/* ...else add a directory at a time. */
+
+	for (scan = list; scan; scan = scan->next) {
+		char *path = scan->data;
+		char *base_dir;
+
+		if (! uri_is_dir (path))
+			continue;
+
+		data->item_list = g_list_remove_link (list, scan);
+		if (data->item_list != NULL)
+			archive->priv->continue_adding_dropped_items = TRUE;
+		base_dir = remove_level_from_path (path);
+
+		fr_archive_add_directory (archive,
+					  file_name_from_path (path),
+					  base_dir,
+					  data->dest_dir,
+					  data->update,
+					  data->password,
+					  data->encrypt_header,
+					  data->compression,
+					  data->volume_size);
+
+		g_free (base_dir);
+		g_free (path);
+
+		return;
+	}
+
+	/* if all files are in the same directory call fr_archive_add_files. */
+
+	if (all_files_in_same_dir (list)) {
+		char  *first_basedir;
+		GList *only_names_list = NULL;
+
+		first_basedir = remove_level_from_path (list->data);
+
+		for (scan = list; scan; scan = scan->next) {
+			char *name;
+
+			name = g_uri_unescape_string (file_name_from_path (scan->data), NULL);
+			only_names_list = g_list_prepend (only_names_list, name);
+		}
+
+		fr_archive_add_files (archive,
+				      only_names_list,
+				      first_basedir,
+				      data->dest_dir,
+				      data->update,
+				      data->password,
+				      data->encrypt_header,
+				      data->compression,
+				      data->volume_size);
+
+		path_list_free (only_names_list);
+		g_free (first_basedir);
+
+		return;
+	}
+
+	/* ...else call fr_command_add for each file.  This is needed to add
+	 * files without path info. FIXME: doesn't work with remote files. */
+
+	fr_archive_stoppable (archive, FALSE);
+	archive->command->creating_archive = ! g_file_query_exists (archive->local_copy, archive->priv->cancellable);
+	g_object_set (archive->command,
+		      "file", archive->local_copy,
+		      "password", data->password,
+		      "encrypt_header", data->encrypt_header,
+		      "compression", data->compression,
+		      "volume_size", data->volume_size,
+		      NULL);
+	fr_process_clear (archive->process);
+	fr_command_uncompress (archive->command);
+	for (scan = list; scan; scan = scan->next) {
+		char  *fullpath = scan->data;<--- Variable 'fullpath' can be declared as pointer to const
+		char  *basedir;
+		GList *singleton;
+
+		basedir = remove_level_from_path (fullpath);
+		singleton = g_list_prepend (NULL, (char*)file_name_from_path (fullpath));
+		fr_command_add (archive->command,
+				NULL,
+				singleton,
+				basedir,
+				data->update,
+				FALSE);
+		g_list_free (singleton);
+		g_free (basedir);
+	}
+	fr_command_recompress (archive->command);
+	fr_process_start (archive->process);
+
+	path_list_free (data->item_list);
+	data->item_list = NULL;
+}
+
+void
+fr_archive_add_dropped_items (FrArchive     *archive,
+			      GList         *item_list,
+			      const char    *base_dir,
+			      const char    *dest_dir,
+			      gboolean       update,
+			      const char    *password,
+			      gboolean       encrypt_header,
+			      FrCompression  compression,
+			      guint          volume_size)
+{
+	GList *scan;
+	char  *archive_uri;
+
+	if (archive->read_only) {
+		fr_archive_action_completed (archive,
+					     FR_ACTION_ADDING_FILES,
+					     FR_PROC_ERROR_GENERIC,
+					     ! archive->have_permissions ? _("You don't have the right permissions.") : _("This archive type cannot be modified"));
+		return;
+	}
+
+	/* FIXME: make this check for all the add actions */
+	archive_uri = g_file_get_uri (archive->file);
+	for (scan = item_list; scan; scan = scan->next) {
+		if (uricmp (scan->data, archive_uri) == 0) {
+			g_free (archive_uri);
+			fr_archive_action_completed (archive,
+						     FR_ACTION_ADDING_FILES,
+						     FR_PROC_ERROR_GENERIC,
+						     _("You can't add an archive to itself."));
+			return;
+		}
+	}
+	g_free (archive_uri);
+
+	if (archive->priv->dropped_items_data != NULL)
+		dropped_items_data_free (archive->priv->dropped_items_data);
+	archive->priv->dropped_items_data = dropped_items_data_new (
+						archive,
+				       		item_list,
+				       		base_dir,
+				       		dest_dir,
+				       		update,
+				       		password,
+				       		encrypt_header,
+				       		compression,
+				       		volume_size);
+	add_dropped_items (archive->priv->dropped_items_data);
+}
+
+/* -- remove -- */
+
+static gboolean
+file_is_in_subfolder_of (const char *filename,
+		         GList      *folder_list)
+{
+	GList *scan;
+
+	if (filename == NULL)
+		return FALSE;
+
+	for (scan = folder_list; scan; scan = scan->next) {
+		char *folder_in_list = (char*) scan->data;<--- Variable 'folder_in_list' can be declared as pointer to const
+
+		if (path_in_path (folder_in_list, filename))
+			return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+archive_type_has_issues_deleting_non_empty_folders (FrArchive *archive)
+{
+       return ! archive->command->propCanDeleteNonEmptyFolders;
+}
+
+static void
+delete_from_archive (FrArchive *archive,
+		     GList     *file_list)
+{
+	gboolean  file_list_created = FALSE;
+	GList    *tmp_file_list = NULL;
+	gboolean  tmp_file_list_created = FALSE;
+	GList    *scan;
+
+	/* file_list == NULL means delete all the files in the archive. */
+
+	if (file_list == NULL) {
+		guint i;
+
+		for (i = 0; i < archive->command->files->len; i++) {
+			FileData *fdata = g_ptr_array_index (archive->command->files, i);
+			file_list = g_list_prepend (file_list, fdata->original_path);
+		}
+
+		file_list_created = TRUE;
+	}
+
+	if (archive_type_has_issues_deleting_non_empty_folders (archive)) {
+		GList *folders_to_remove;
+
+		/* remove from the list the files contained in folders to be
+		 * removed. */
+
+		folders_to_remove = NULL;
+		for (scan = file_list; scan != NULL; scan = scan->next) {
+			char *path = scan->data;
+
+			if (path[strlen (path) - 1] == '/')
+				folders_to_remove = g_list_prepend (folders_to_remove, path);
+		}
+
+		if (folders_to_remove != NULL) {
+			tmp_file_list = NULL;
+			for (scan = file_list; scan != NULL; scan = scan->next) {
+				char *path = scan->data;
+
+				if (! file_is_in_subfolder_of (path, folders_to_remove))
+					tmp_file_list = g_list_prepend (tmp_file_list, path);
+			}
+			tmp_file_list_created = TRUE;
+			g_list_free (folders_to_remove);
+		}
+	}
+
+	if (! tmp_file_list_created)
+		tmp_file_list = g_list_copy (file_list);
+
+	if (file_list_created)
+		g_list_free (file_list);
+
+	fr_command_set_n_files (archive->command, g_list_length (tmp_file_list));
+
+	if (archive->command->propListFromFile
+	    && (archive->command->n_files > LIST_LENGTH_TO_USE_FILE))
+	{
+		char *list_dir;
+		char *list_filename;
+
+		if (save_list_to_temp_file (tmp_file_list, &list_dir, &list_filename, NULL)) {
+			fr_command_delete (archive->command,
+					   list_filename,
+					   tmp_file_list);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
+		}
+
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		for (scan = tmp_file_list; scan != NULL; ) {
+			GList *prev = scan->prev;
+			GList *chunk_list;
+			int    l;
+
+			chunk_list = scan;
+			l = 0;
+			while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+				if (l == 0)
+					l = strlen (scan->data);
+				prev = scan;
+				scan = scan->next;
+				if (scan != NULL)
+					l += strlen (scan->data);
+			}
+
+			prev->next = NULL;
+			fr_command_delete (archive->command, NULL, chunk_list);
+			prev->next = scan;
+		}
+	}
+
+	g_list_free (tmp_file_list);
+}
+
+void
+fr_archive_remove (FrArchive     *archive,
+		   GList         *file_list,
+		   FrCompression  compression)
+{
+	char *tmp_archive_dir = NULL;
+	char *archive_filename = NULL;
+	char *tmp_archive_filename = NULL;
+
+	g_return_if_fail (archive != NULL);
+
+	if (archive->read_only)
+		return;
+
+	fr_archive_stoppable (archive, TRUE);
+	archive->command->creating_archive = FALSE;
+	g_object_set (archive->command, "compression", compression, NULL);
+
+	/* create the new archive in a temporary sub-directory, this allows
+	 * to cancel the operation without losing the original archive and
+	 * removing possible temporary files created by the command. */
+
+	{
+		GFile *local_copy_parent;
+		char  *archive_dir;
+		GFile *tmp_file;
+
+		/* create the new archive in a sub-folder of the original
+		 * archive this way the 'mv' command is fast. */
+
+		local_copy_parent = g_file_get_parent (archive->local_copy);
+		archive_dir = g_file_get_path (local_copy_parent);
+		tmp_archive_dir = get_temp_work_dir (archive_dir);
+		archive_filename = g_file_get_path (archive->local_copy);
+		tmp_archive_filename = g_build_filename (tmp_archive_dir, file_name_from_path (archive_filename), NULL);
+		tmp_file = g_file_new_for_path (tmp_archive_filename);
+		g_object_set (archive->command, "file", tmp_file, NULL);
+
+		if (! archive->command->creating_archive) {
+			/* copy the original archive to the new position */
+
+			fr_process_begin_command (archive->process, "cp");
+			fr_process_add_arg (archive->process, "-f");
+			fr_process_add_arg (archive->process, archive_filename);
+			fr_process_add_arg (archive->process, tmp_archive_filename);
+			fr_process_end_command (archive->process);
+		}
+
+		g_object_unref (tmp_file);
+		g_free (archive_dir);
+		g_object_unref (local_copy_parent);
+	}
+
+	/* uncompress, delete and recompress */
+
+	fr_command_uncompress (archive->command);
+	delete_from_archive (archive, file_list);
+	fr_command_recompress (archive->command);
+
+	/* move the new archive to the original position */
+
+	fr_process_begin_command (archive->process, "mv");
+	fr_process_add_arg (archive->process, "-f");
+	fr_process_add_arg (archive->process, tmp_archive_filename);
+	fr_process_add_arg (archive->process, archive_filename);
+	fr_process_end_command (archive->process);
+
+	/* remove the temp sub-directory */
+
+	fr_process_begin_command (archive->process, "rm");
+	fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+	fr_process_set_sticky (archive->process, TRUE);
+	fr_process_add_arg (archive->process, "-rf");
+	fr_process_add_arg (archive->process, tmp_archive_dir);
+	fr_process_end_command (archive->process);
+
+	g_free (tmp_archive_filename);
+	g_free (archive_filename);
+	g_free (tmp_archive_dir);
+}
+
+/* -- extract -- */
+
+static void
+move_files_to_dir (FrArchive  *archive,
+		   GList      *file_list,
+		   const char *source_dir,
+		   const char *dest_dir,
+		   gboolean    overwrite)
+{
+	GList *list;
+	GList *scan;
+
+	/* we prefer mv instead of cp for performance reasons,
+	 * but if the destination folder already exists mv
+	 * doesn't work correctly. (bug #590027) */
+
+	list = g_list_copy (file_list);
+	for (scan = list; scan; /* void */) {
+		GList *next = scan->next;
+		char  *filename = scan->data;
+		char  *basename;
+		char  *destname;
+
+		basename = g_path_get_basename (filename);
+		destname = g_build_filename (dest_dir, basename, NULL);
+		if (g_file_test (destname, G_FILE_TEST_IS_DIR)) {
+			fr_process_begin_command (archive->process, "cp");
+			fr_process_add_arg (archive->process, "-R");
+			if (overwrite)
+				fr_process_add_arg (archive->process, "-f");
+			else
+				fr_process_add_arg (archive->process, "-n");
+			if (filename[0] == '/')
+				fr_process_add_arg_concat (archive->process, source_dir, filename, NULL);
+			else
+				fr_process_add_arg_concat (archive->process, source_dir, "/", filename, NULL);
+			fr_process_add_arg (archive->process, dest_dir);
+			fr_process_end_command (archive->process);
+
+			list = g_list_remove_link (list, scan);
+			g_list_free (scan);
+		}
+
+		g_free (destname);
+		g_free (basename);
+
+		scan = next;
+	}
+
+	if (list == NULL)
+		return;
+
+	/* 'list' now contains the files that can be moved without problems */
+
+	fr_process_begin_command (archive->process, "mv");
+	if (overwrite)
+		fr_process_add_arg (archive->process, "-f");
+	else
+		fr_process_add_arg (archive->process, "-n");
+	for (scan = list; scan; scan = scan->next) {
+		char *filename = scan->data;
+
+		if (filename[0] == '/')
+			fr_process_add_arg_concat (archive->process, source_dir, filename, NULL);
+		else
+			fr_process_add_arg_concat (archive->process, source_dir, "/", filename, NULL);
+	}
+	fr_process_add_arg (archive->process, dest_dir);
+	fr_process_end_command (archive->process);
+
+	g_list_free (list);
+}
+
+static void
+move_files_in_chunks (FrArchive  *archive,
+		      GList      *file_list,
+		      const char *temp_dir,
+		      const char *dest_dir,
+		      gboolean    overwrite)
+{
+	GList *scan;
+	int    temp_dir_l;
+
+	temp_dir_l = strlen (temp_dir);
+
+	for (scan = file_list; scan != NULL; ) {
+		GList *prev = scan->prev;
+		GList *chunk_list;
+		int    l;
+
+		chunk_list = scan;
+		l = 0;
+		while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+			if (l == 0)
+				l = temp_dir_l + 1 + strlen (scan->data);
+			prev = scan;
+			scan = scan->next;
+			if (scan != NULL)
+				l += temp_dir_l + 1 + strlen (scan->data);
+		}
+
+		prev->next = NULL;
+		move_files_to_dir (archive, chunk_list, temp_dir, dest_dir, overwrite);
+		prev->next = scan;
+	}
+}
+
+static void
+extract_from_archive (FrArchive  *archive,
+		      GList      *file_list,
+		      const char *dest_dir,
+		      gboolean    overwrite,
+		      gboolean    skip_older,
+		      gboolean    junk_paths,
+		      const char *password)
+{
+	FrCommand *command = archive->command;
+	GList     *scan;
+
+	g_object_set (command, "password", password, NULL);
+
+	if (file_list == NULL) {
+		fr_command_extract (command,
+				    NULL,
+				    file_list,
+				    dest_dir,
+				    overwrite,
+				    skip_older,
+				    junk_paths);
+		return;
+	}
+
+	if (command->propListFromFile
+	    && (g_list_length (file_list) > LIST_LENGTH_TO_USE_FILE))
+	{
+		char *list_dir;
+		char *list_filename;
+
+		if (save_list_to_temp_file (file_list, &list_dir, &list_filename, NULL)) {
+			fr_command_extract (command,
+					    list_filename,
+					    file_list,
+					    dest_dir,
+					    overwrite,
+					    skip_older,
+					    junk_paths);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
+		}
+
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		for (scan = file_list; scan != NULL; ) {
+			GList *prev = scan->prev;
+			GList *chunk_list;
+			int    l;
+
+			chunk_list = scan;
+			l = 0;
+			while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+				if (l == 0)
+					l = strlen (scan->data);
+				prev = scan;
+				scan = scan->next;
+				if (scan != NULL)
+					l += strlen (scan->data);
+			}
+
+			prev->next = NULL;
+			fr_command_extract (command,
+					    NULL,
+					    chunk_list,
+					    dest_dir,
+					    overwrite,
+					    skip_older,
+					    junk_paths);
+			prev->next = scan;
+		}
+	}
+}
+
+static char*
+compute_base_path (const char *base_dir,
+		   const char *path,
+		   gboolean    junk_paths,
+		   gboolean    can_junk_paths)
+{
+	int         base_dir_len = strlen (base_dir);
+	int         path_len = strlen (path);
+	const char *base_path;
+	char       *name_end;<--- Variable 'name_end' can be declared as pointer to const
+	char       *new_path;
+
+	if (junk_paths) {
+		if (can_junk_paths)
+			new_path = g_strdup (file_name_from_path (path));
+		else
+			new_path = g_strdup (path);
+
+		/*debug (DEBUG_INFO, "%s, %s --> %s\n", base_dir, path, new_path);*/
+
+		return new_path;
+	}
+
+	if (path_len < base_dir_len)
+		return NULL;
+
+	base_path = path + base_dir_len;
+	if (path[0] != '/')
+		base_path -= 1;
+	name_end = strchr (base_path, '/');
+
+	if (name_end == NULL)
+		new_path = g_strdup (path);
+	else {
+		int name_len = name_end - path;
+		new_path = g_strndup (path, name_len);
+	}
+
+	/*debug (DEBUG_INFO, "%s, %s --> %s\n", base_dir, path, new_path);*/
+
+	return new_path;
+}
+
+static GList*
+compute_list_base_path (const char *base_dir,
+			GList      *filtered,
+			gboolean    junk_paths,
+			gboolean    can_junk_paths)
+{
+	GList *scan;
+	GList *list = NULL, *list_unique = NULL;
+	GList *last_inserted;
+
+	if (filtered == NULL)
+		return NULL;
+
+	for (scan = filtered; scan; scan = scan->next) {
+		const char *path = scan->data;
+		char       *new_path;
+
+		new_path = compute_base_path (base_dir, path, junk_paths, can_junk_paths);
+		if (new_path != NULL)
+			list = g_list_prepend (list, new_path);
+	}
+
+	/* The above operation can create duplicates, we remove them here. */
+	list = g_list_sort (list, (GCompareFunc)strcmp);
+
+	last_inserted = NULL;
+	for (scan = list; scan; scan = scan->next) {
+		const char *path = scan->data;
+
+		if (last_inserted != NULL) {
+			const char *last_path = (const char*)last_inserted->data;
+			if (strcmp (last_path, path) == 0) {
+				g_free (scan->data);
+				continue;
+			}
+		}
+
+		last_inserted = scan;
+		list_unique = g_list_prepend (list_unique, scan->data);
+	}
+
+	g_list_free (list);
+
+	return list_unique;
+}
+
+static gboolean
+archive_type_has_issues_extracting_non_empty_folders (FrArchive *archive)
+{
+	/*if ((archive->command->files == NULL) || (archive->command->files->len == 0))
+		return FALSE;  FIXME: test with extract_here */
+	return ! archive->command->propCanExtractNonEmptyFolders;
+}
+
+static gboolean
+file_list_contains_files_in_this_dir (GList      *file_list,
+				      const char *dirname)
+{
+	GList *scan;
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char *filename = scan->data;<--- Variable 'filename' can be declared as pointer to const
+
+		if (path_in_path (dirname, filename))
+			return TRUE;
+	}
+
+	return FALSE;
+}
+
+static GList*
+remove_files_contained_in_this_dir (GList *file_list,
+				    GList *dir_pointer)
+{
+	char  *dirname = dir_pointer->data;<--- Variable 'dirname' can be declared as pointer to const
+	int    dirname_l = strlen (dirname);
+	GList *scan;
+
+	for (scan = dir_pointer->next; scan; /* empty */) {
+		char *filename = scan->data;<--- Variable 'filename' can be declared as pointer to const
+
+		if (strncmp (dirname, filename, dirname_l) != 0)
+			break;
+
+		if (path_in_path (dirname, filename)) {
+			GList *next = scan->next;
+
+			file_list = g_list_remove_link (file_list, scan);
+			g_list_free (scan);
+
+			scan = next;
+		}
+		else
+			scan = scan->next;
+	}
+
+	return file_list;
+}
+
+void
+fr_archive_extract_to_local (FrArchive  *archive,
+			     GList      *file_list,
+			     const char *destination,
+			     const char *base_dir,
+			     gboolean    skip_older,
+			     gboolean    overwrite,
+			     gboolean    junk_paths,
+			     const char *password)
+{
+	GList    *filtered;
+	GList    *scan;
+	gboolean  extract_all;
+	gboolean  use_base_dir;
+	gboolean  all_options_supported;
+	gboolean  move_to_dest_dir;
+	gboolean  file_list_created = FALSE;
+
+	g_return_if_fail (archive != NULL);
+
+	fr_archive_stoppable (archive, TRUE);
+	g_object_set (archive->command, "file", archive->local_copy, NULL);
+
+	/* if a command supports all the requested options use
+	 * fr_command_extract directly. */
+
+	use_base_dir = ! ((base_dir == NULL)
+			  || (strcmp (base_dir, "") == 0)
+			  || (strcmp (base_dir, "/") == 0));
+
+	all_options_supported = (! use_base_dir
+				 && ! (! overwrite && ! archive->command->propExtractCanAvoidOverwrite)
+				 && ! (skip_older && ! archive->command->propExtractCanSkipOlder)
+				 && ! (junk_paths && ! archive->command->propExtractCanJunkPaths));
+
+	extract_all = (file_list == NULL);
+	if (extract_all && (! all_options_supported || ! archive->command->propCanExtractAll)) {
+		guint i;
+
+		file_list = NULL;
+		for (i = 0; i < archive->command->files->len; i++) {
+			FileData *fdata = g_ptr_array_index (archive->command->files, i);
+			file_list = g_list_prepend (file_list, g_strdup (fdata->original_path));
+		}
+		file_list_created = TRUE;
+	}
+
+	if (extract_all && (file_list == NULL))
+		fr_command_set_n_files (archive->command, archive->command->n_regular_files);
+	else
+		fr_command_set_n_files (archive->command, g_list_length (file_list));
+
+	if (all_options_supported) {
+		gboolean created_filtered_list = FALSE;
+
+		if (! extract_all && archive_type_has_issues_extracting_non_empty_folders (archive)) {
+			created_filtered_list = TRUE;
+			filtered = g_list_copy (file_list);
+			filtered = g_list_sort (filtered, (GCompareFunc) strcmp);
+			for (scan = filtered; scan; scan = scan->next)
+				filtered = remove_files_contained_in_this_dir (filtered, scan);
+		}
+		else
+			filtered = file_list;
+
+		if (! (created_filtered_list && (filtered == NULL)))
+			extract_from_archive (archive,
+					      filtered,
+					      destination,
+					      overwrite,
+					      skip_older,
+					      junk_paths,
+					      password);
+
+		if (created_filtered_list && (filtered != NULL))
+			g_list_free (filtered);
+
+		if (file_list_created)
+			path_list_free (file_list);
+
+		return;
+	}
+
+	/* .. else we have to implement the unsupported options. */
+
+	move_to_dest_dir = (use_base_dir
+			    || ((junk_paths
+				 && ! archive->command->propExtractCanJunkPaths)));
+
+	if (extract_all && ! file_list_created) {
+		guint i;
+
+		file_list = NULL;
+		for (i = 0; i < archive->command->files->len; i++) {
+			FileData *fdata = g_ptr_array_index (archive->command->files, i);
+			file_list = g_list_prepend (file_list, g_strdup (fdata->original_path));
+		}
+
+		file_list_created = TRUE;
+	}
+
+	filtered = NULL;
+	for (scan = file_list; scan; scan = scan->next) {
+		FileData   *fdata;
+		char       *archive_list_filename = scan->data;
+		char        dest_filename[4096];
+		const char *filename;
+
+		fdata = find_file_in_archive (archive, archive_list_filename);
+
+		if (fdata == NULL)
+			continue;
+
+		if (archive_type_has_issues_extracting_non_empty_folders (archive)
+		    && fdata->dir
+		    && file_list_contains_files_in_this_dir (file_list, archive_list_filename))
+			continue;
+
+		/* get the destination file path. */
+
+		if (! junk_paths)
+			filename = archive_list_filename;
+		else
+			filename = file_name_from_path (archive_list_filename);
+
+		if ((destination[strlen (destination) - 1] == '/')
+		    || (filename[0] == '/'))
+			sprintf (dest_filename, "%s%s", destination, filename);
+		else
+			sprintf (dest_filename, "%s/%s", destination, filename);
+
+		/*debug (DEBUG_INFO, "-> %s\n", dest_filename);*/
+
+		/**/
+
+		if (! archive->command->propExtractCanSkipOlder
+		    && skip_older
+		    && g_file_test (dest_filename, G_FILE_TEST_EXISTS)
+		    && (fdata->modified < get_file_mtime_for_path (dest_filename)))
+			continue;
+
+		if (! archive->command->propExtractCanAvoidOverwrite
+		    && ! overwrite
+		    && g_file_test (dest_filename, G_FILE_TEST_EXISTS))
+			continue;
+
+		filtered = g_list_prepend (filtered, fdata->original_path);
+	}
+
+	if (filtered == NULL) {
+		/* all files got filtered, do nothing. */
+		debug (DEBUG_INFO, "All files got filtered, nothing to do.\n");
+
+		if (extract_all)
+			path_list_free (file_list);
+		return;
+	}
+
+	if (move_to_dest_dir) {
+		char *temp_dir;
+
+		temp_dir = get_temp_work_dir (destination);
+		extract_from_archive (archive,
+				      filtered,
+				      temp_dir,
+				      overwrite,
+				      skip_older,
+				      junk_paths,
+				      password);
+
+		if (use_base_dir) {
+			GList *tmp_list = compute_list_base_path (base_dir, filtered, junk_paths, archive->command->propExtractCanJunkPaths);
+			g_list_free (filtered);
+			filtered = tmp_list;
+		}
+
+		move_files_in_chunks (archive,
+				      filtered,
+				      temp_dir,
+				      destination,
+				      overwrite);
+
+		/* remove the temp dir. */
+
+		fr_process_begin_command (archive->process, "rm");
+		fr_process_add_arg (archive->process, "-rf");
+		fr_process_add_arg (archive->process, temp_dir);
+		fr_process_end_command (archive->process);
+
+		g_free (temp_dir);
+	}
+	else
+		extract_from_archive (archive,
+				      filtered,
+				      destination,
+				      overwrite,
+				      skip_older,
+				      junk_paths,
+				      password);
+
+	if (filtered != NULL)
+		g_list_free (filtered);
+	if (file_list_created)
+		path_list_free (file_list);
+}
+
+void
+fr_archive_extract (FrArchive  *archive,
+		    GList      *file_list,
+		    const char *destination,
+		    const char *base_dir,
+		    gboolean    skip_older,
+		    gboolean    overwrite,
+		    gboolean    junk_paths,
+		    const char *password)
+{
+	g_free (archive->priv->extraction_destination);
+	archive->priv->extraction_destination = g_strdup (destination);
+
+	g_free (archive->priv->temp_extraction_dir);
+	archive->priv->temp_extraction_dir = NULL;
+
+	archive->priv->remote_extraction = ! uri_is_local (destination);
+	if (archive->priv->remote_extraction) {
+		archive->priv->temp_extraction_dir = get_temp_work_dir (NULL);
+		fr_archive_extract_to_local (archive,
+					     file_list,
+					     archive->priv->temp_extraction_dir,
+					     base_dir,
+					     skip_older,
+					     overwrite,
+					     junk_paths,
+					     password);
+	}
+	else {
+		char *local_destination;
+
+		local_destination = g_filename_from_uri (destination, NULL, NULL);
+		fr_archive_extract_to_local (archive,
+					     file_list,
+					     local_destination,
+					     base_dir,
+					     skip_older,
+					     overwrite,
+					     junk_paths,
+					     password);
+		g_free (local_destination);
+	}
+}
+
+static char *
+get_desired_destination_for_archive (GFile *file)
+{
+	GFile      *directory;
+	char       *directory_uri;
+	char       *name;
+	const char *ext;
+	char       *new_name;
+	char       *new_name_escaped;
+	char       *desired_destination = NULL;
+
+	directory = g_file_get_parent (file);
+	directory_uri = g_file_get_uri (directory);
+
+	name = g_file_get_basename (file);
+	ext = get_archive_filename_extension (name);
+	if (ext == NULL)
+		/* if no extension is present add a suffix to the name... */
+		new_name = g_strconcat (name, "_FILES", NULL);
+	else
+		/* ...else use the name without the extension */
+		new_name = g_strndup (name, strlen (name) - strlen (ext));
+	new_name_escaped = g_uri_escape_string (new_name, "", FALSE);
+
+	desired_destination = g_strconcat (directory_uri, "/", new_name_escaped, NULL);
+
+	g_free (new_name_escaped);
+	g_free (new_name);
+	g_free (name);
+	g_free (directory_uri);
+	g_object_unref (directory);
+
+	return desired_destination;
+}
+
+static char *
+get_extract_here_destination (GFile   *file,
+			      GError **error)
+{
+	char  *desired_destination;
+	char  *destination = NULL;
+	int    n = 1;
+
+	desired_destination = get_desired_destination_for_archive (file);
+	do {
+		GFile *directory;
+
+		*error = NULL;
+
+		g_free (destination);
+		if (n == 1)
+			destination = g_strdup (desired_destination);
+		else
+			destination = g_strdup_printf ("%s%%20(%d)", desired_destination, n);
+
+		directory = g_file_new_for_uri (destination);
+		g_file_make_directory (directory, NULL, error);
+		g_object_unref (directory);
+
+		n++;
+	} while (g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_EXISTS));
+
+	g_free (desired_destination);
+
+	if (*error != NULL) {
+		g_warning ("could not create destination folder: %s\n", (*error)->message);
+		g_free (destination);
+		destination = NULL;
+	}
+
+	return destination;
+}
+
+gboolean
+fr_archive_extract_here (FrArchive  *archive,
+			 gboolean    skip_older,
+			 gboolean    overwrite,
+			 gboolean    junk_path,
+			 const char *password)
+{
+	char   *destination;
+	GError *error = NULL;
+
+	destination = get_extract_here_destination (archive->file, &error);
+	if (error != NULL) {
+		fr_archive_action_completed (archive,
+					     FR_ACTION_EXTRACTING_FILES,
+					     FR_PROC_ERROR_GENERIC,
+					     error->message);
+		g_clear_error (&error);
+		return FALSE;
+	}
+
+	archive->priv->extract_here = TRUE;
+	fr_archive_extract (archive,
+			    NULL,
+			    destination,
+			    NULL,
+			    skip_older,
+			    overwrite,
+			    junk_path,
+			    password);
+
+	g_free (destination);
+
+	return TRUE;
+}
+
+const char *
+fr_archive_get_last_extraction_destination (FrArchive *archive)
+{
+	return archive->priv->extraction_destination;
+}
+
+void
+fr_archive_test (FrArchive  *archive,
+		 const char *password)
+{
+	fr_archive_stoppable (archive, TRUE);
+
+	g_object_set (archive->command,
+		      "file", archive->local_copy,
+		      "password", password,
+		      NULL);
+	fr_process_clear (archive->process);
+	fr_command_set_n_files (archive->command, 0);
+	fr_command_test (archive->command);
+	fr_process_start (archive->process);
+}
+
+gboolean
+uri_is_archive (const char *uri)
+{
+	GFile      *file;
+	const char *mime_type;
+	gboolean    is_archive = FALSE;
+
+	file = g_file_new_for_uri (uri);
+	mime_type = get_mime_type_from_magic_numbers (file);
+	if (mime_type == NULL)
+		mime_type = get_mime_type_from_content (file);
+	if (mime_type == NULL)
+		mime_type = get_mime_type_from_filename (file);
+
+	if (mime_type != NULL) {
+		int i;
+
+		for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
+			if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
+				is_archive = TRUE;
+				break;
+			}
+		}
+	}
+	g_object_unref (file);
+
+	return is_archive;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/49.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/49.html new file mode 100644 index 0000000..53c9949 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/49.html @@ -0,0 +1,513 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _GIO_UTILS_H
+#define _GIO_UTILS_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* callback types */
+
+typedef enum {
+	DIR_OP_CONTINUE,
+	DIR_OP_SKIP,
+	DIR_OP_STOP
+} DirOp;
+
+typedef DirOp (*StartDirCallback)    (const char  *uri,
+				      GError     **error,
+				      gpointer     user_data);
+typedef void (*ForEachChildCallback) (const char  *uri,
+				       gboolean     follow_links,
+				       GFileInfo   *info,
+				       gpointer     user_data);
+typedef void (*ForEachDoneCallback)  (GError      *error,
+				      gpointer     data);
+typedef void (*ListReadyCallback)    (GList       *files,
+				      GList       *dirs,
+				      GError      *error,
+				      gpointer     user_data);
+typedef void (*CopyProgressCallback) (goffset      current_file,
+                                      goffset      total_files,
+                                      GFile       *source,
+                                      GFile       *destination,
+                                      goffset      current_num_bytes,
+                                      goffset      total_num_bytes,
+                                      gpointer     user_data);
+typedef void (*CopyDoneCallback)     (GError      *error,
+				      gpointer     user_data);
+
+/* asynchronous recursive list functions */
+
+void   g_directory_foreach_child     (GFile                 *directory,
+				      gboolean               recursive,
+				      gboolean               follow_links,
+				      GCancellable          *cancellable,
+				      StartDirCallback       start_dir_func,
+				      ForEachChildCallback   for_each_file_func,
+				      ForEachDoneCallback    done_func,
+				      gpointer               user_data);
+void   g_directory_list_async        (const char            *directory,
+				      const char            *base_dir,
+				      gboolean               recursive,
+				      gboolean               follow_links,
+				      gboolean               no_backup_files,
+				      gboolean               no_dot_files,
+				      const char            *include_files,
+				      const char            *exclude_files,
+				      const char            *exclude_folders,
+				      gboolean               ignorecase,
+				      GCancellable          *cancellable,
+				      ListReadyCallback      done_func,
+				      gpointer               done_data);
+void   g_list_items_async            (GList                 *items,
+				      const char            *base_dir,
+				      GCancellable          *cancellable,
+				      ListReadyCallback      done_func,
+				      gpointer               done_data);
+
+/* asynchronous copy functions */
+
+void   g_copy_files_async            (GList                 *sources,
+				      GList                 *destinations,
+				      GFileCopyFlags         flags,
+				      int                    io_priority,
+				      GCancellable          *cancellable,
+				      CopyProgressCallback   progress_callback,
+				      gpointer               progress_callback_data,
+				      CopyDoneCallback       callback,
+				      gpointer               user_data);
+void   g_copy_file_async             (GFile                 *source,
+				      GFile                 *destination,
+				      GFileCopyFlags         flags,
+				      int                    io_priority,
+				      GCancellable          *cancellable,
+				      CopyProgressCallback   progress_callback,
+				      gpointer               progress_callback_data,
+				      CopyDoneCallback       callback,
+				      gpointer               user_data);
+void   g_directory_copy_async        (const char            *source,
+				      const char            *destination,
+				      GFileCopyFlags         flags,
+				      int                    io_priority,
+				      GCancellable          *cancellable,
+				      CopyProgressCallback   progress_callback,
+				      gpointer               progress_callback_data,
+				      CopyDoneCallback       callback,
+				      gpointer               user_data);
+gboolean g_load_file_in_buffer       (GFile                 *file,
+				      void                  *buffer,
+				      gsize                  size,
+				      GError               **error);
+
+/* convenience macros */
+
+/**
+ * g_directory_list_all_async:
+ * @directory:
+ * @base_dir:
+ * @recursive:
+ * @cancellable:
+ * @done_func:
+ * @done_data:
+ *
+ */
+#define g_directory_list_all_async(directory, base_dir, recursive, cancellable, done_func, done_data) \
+    g_directory_list_async ((directory), (base_dir), (recursive), TRUE, FALSE, FALSE, NULL, NULL, NULL, FALSE, (cancellable), (done_func), (done_data))
+
+#endif /* _GIO_UTILS_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/5.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/5.html new file mode 100644 index 0000000..b3411cb --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/5.html @@ -0,0 +1,3055 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * Inspired by various other pieces of code including GsmClient (C)
+ * 2001 Havoc Pennington, MateClient (C) 1998 Carsten Schaar, and twm
+ * session code (C) 1998 The Open Group.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include "eggsmclient.h"
+#include "eggsmclient-private.h"
+
+#include "eggdesktopfile.h"
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/SM/SMlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#define EGG_TYPE_SM_CLIENT_XSMP            (egg_sm_client_xsmp_get_type ())
+#define EGG_SM_CLIENT_XSMP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
+#define EGG_SM_CLIENT_XSMP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))
+#define EGG_IS_SM_CLIENT_XSMP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP))
+#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP))
+#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))
+
+typedef struct _EggSMClientXSMP        EggSMClientXSMP;
+typedef struct _EggSMClientXSMPClass   EggSMClientXSMPClass;
+
+/* These mostly correspond to the similarly-named states in section
+ * 9.1 of the XSMP spec. Some of the states there aren't represented
+ * here, because we don't need them. SHUTDOWN_CANCELLED is slightly
+ * different from the spec; we use it when the client is IDLE after a
+ * ShutdownCancelled message, but the application is still interacting
+ * and doesn't know the shutdown has been cancelled yet.
+ */
+typedef enum
+{
+    XSMP_STATE_IDLE,
+    XSMP_STATE_SAVE_YOURSELF,
+    XSMP_STATE_INTERACT_REQUEST,
+    XSMP_STATE_INTERACT,
+    XSMP_STATE_SAVE_YOURSELF_DONE,
+    XSMP_STATE_SHUTDOWN_CANCELLED,
+    XSMP_STATE_CONNECTION_CLOSED
+} EggSMClientXSMPState;
+
+static const char *state_names[] =
+{
+    "idle",
+    "save-yourself",
+    "interact-request",
+    "interact",
+    "save-yourself-done",
+    "shutdown-cancelled",
+    "connection-closed"
+};
+
+#define EGG_SM_CLIENT_XSMP_STATE(xsmp) (state_names[(xsmp)->state])
+
+struct _EggSMClientXSMP
+{
+    EggSMClient parent;
+
+    SmcConn connection;
+    char *client_id;
+
+    EggSMClientXSMPState state;
+    char **restart_command;
+    gboolean set_restart_command;
+    int restart_style;
+	char **discard_command;
+	gboolean set_discard_command;
+
+    guint idle;
+
+    /* Current SaveYourself state */
+    guint expecting_initial_save_yourself : 1;
+    guint need_save_state : 1;
+    guint need_quit_requested : 1;
+    guint interact_errors : 1;
+    guint shutting_down : 1;
+
+    /* Todo list */
+    guint waiting_to_set_initial_properties : 1;
+    guint waiting_to_emit_quit : 1;
+    guint waiting_to_emit_quit_cancelled : 1;
+    guint waiting_to_save_myself : 1;
+
+};
+
+struct _EggSMClientXSMPClass
+{
+    EggSMClientClass parent_class;
+
+};
+
+static void     sm_client_xsmp_startup (EggSMClient *client,
+                                        const char  *client_id);
+static void     sm_client_xsmp_set_restart_command (EggSMClient  *client,
+        int           argc,
+        const char  **argv);
+static void     sm_client_xsmp_set_discard_command (EggSMClient  *client,
+        int           argc,
+        const char  **argv);
+static void     sm_client_xsmp_will_quit (EggSMClient *client,
+        gboolean     will_quit);
+static gboolean sm_client_xsmp_end_session (EggSMClient         *client,
+        EggSMClientEndStyle  style,
+        gboolean  request_confirmation);
+
+static void xsmp_save_yourself      (SmcConn   smc_conn,
+                                     SmPointer client_data,
+                                     int       save_style,
+                                     Bool      shutdown,
+                                     int       interact_style,
+                                     Bool      fast);
+static void xsmp_die                (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_save_complete      (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_shutdown_cancelled (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_interact           (SmcConn   smc_conn,
+                                     SmPointer client_data);
+
+static SmProp *array_prop        (const char    *name,
+                                  ...);
+static SmProp *ptrarray_prop     (const char    *name,
+                                  GPtrArray     *values);
+static SmProp *string_prop       (const char    *name,
+                                  const char    *value);
+static SmProp *card8_prop        (const char    *name,
+                                  unsigned char  value);
+
+static void set_properties         (EggSMClientXSMP *xsmp, ...);
+static void delete_properties      (EggSMClientXSMP *xsmp, ...);
+
+static GPtrArray *generate_command (char       **restart_command,
+                                    const char  *client_id,
+                                    const char  *state_file);
+
+static void save_state            (EggSMClientXSMP *xsmp);
+static void do_save_yourself      (EggSMClientXSMP *xsmp);
+static void update_pending_events (EggSMClientXSMP *xsmp);
+
+static void     ice_init             (void);
+static gboolean process_ice_messages (IceConn       ice_conn);
+static void     smc_error_handler    (SmcConn       smc_conn,
+                                      Bool          swap,
+                                      int           offending_minor_opcode,
+                                      unsigned long offending_sequence,
+                                      int           error_class,
+                                      int           severity,
+                                      SmPointer     values);
+
+G_DEFINE_TYPE (EggSMClientXSMP, egg_sm_client_xsmp, EGG_TYPE_SM_CLIENT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static void
+egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp)
+{
+    xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+    xsmp->connection = NULL;
+    xsmp->restart_style = SmRestartIfRunning;
+}
+
+static void
+egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
+{
+    EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
+
+    sm_client_class->startup             = sm_client_xsmp_startup;
+    sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
+	sm_client_class->set_discard_command = sm_client_xsmp_set_discard_command;
+    sm_client_class->will_quit           = sm_client_xsmp_will_quit;
+    sm_client_class->end_session         = sm_client_xsmp_end_session;
+}
+
+EggSMClient *
+egg_sm_client_xsmp_new (void)
+{
+    if (!g_getenv ("SESSION_MANAGER"))
+        return NULL;
+
+    return g_object_new (EGG_TYPE_SM_CLIENT_XSMP, NULL);
+}
+
+static gboolean
+sm_client_xsmp_set_initial_properties (gpointer user_data)
+{
+    EggSMClientXSMP *xsmp = user_data;
+    EggDesktopFile *desktop_file;
+    GPtrArray *clone, *restart;
+    char pid_str[64];
+
+    if (xsmp->idle)
+    {
+        g_source_remove (xsmp->idle);
+        xsmp->idle = 0;
+    }
+    xsmp->waiting_to_set_initial_properties = FALSE;
+
+    if (egg_sm_client_get_mode () == EGG_SM_CLIENT_MODE_NO_RESTART)
+        xsmp->restart_style = SmRestartNever;
+
+    /* Parse info out of desktop file */
+    desktop_file = egg_get_desktop_file ();
+    if (desktop_file)
+    {
+        GError *err = NULL;
+        char **argv;
+        int argc;
+
+        if (xsmp->restart_style == SmRestartIfRunning)
+        {
+            if (egg_desktop_file_get_boolean (desktop_file,
+                                              "X-MATE-AutoRestart", NULL))
+                xsmp->restart_style = SmRestartImmediately;
+        }
+
+        if (!xsmp->set_restart_command)
+        {
+            char *cmdline;
+
+            cmdline = egg_desktop_file_parse_exec (desktop_file, NULL, &err);
+            if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err))
+            {
+                egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp),
+                                                   argc, (const char **)argv);
+                g_strfreev (argv);
+            }
+            else
+            {
+                g_warning ("Could not parse Exec line in desktop file: %s",
+                           err->message);
+                g_error_free (err);
+            }
+            g_free (cmdline);
+        }
+    }
+
+    if (!xsmp->set_restart_command)
+        xsmp->restart_command = g_strsplit (g_get_prgname (), " ", -1);
+
+    clone = generate_command (xsmp->restart_command, NULL, NULL);
+    restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL);
+
+    g_debug ("Setting initial properties");
+
+    /* Program, CloneCommand, RestartCommand, and UserID are required.
+     * ProcessID isn't required, but the SM may be able to do something
+     * useful with it.
+     */
+    g_snprintf (pid_str, sizeof (pid_str), "%lu", (gulong) getpid ());
+    set_properties (xsmp,
+                    string_prop   (SmProgram, g_get_prgname ()),
+                    ptrarray_prop (SmCloneCommand, clone),
+                    ptrarray_prop (SmRestartCommand, restart),
+                    string_prop   (SmUserID, g_get_user_name ()),
+                    string_prop   (SmProcessID, pid_str),
+                    card8_prop    (SmRestartStyleHint, xsmp->restart_style),
+                    NULL);
+    g_ptr_array_free (clone, TRUE);
+    g_ptr_array_free (restart, TRUE);
+
+    if (desktop_file)
+    {
+        set_properties (xsmp,
+                        string_prop ("_GSM_DesktopFile", egg_desktop_file_get_source (desktop_file)),
+                        NULL);
+    }
+
+    update_pending_events (xsmp);
+    return FALSE;
+}
+
+/* This gets called from two different places: xsmp_die() (when the
+ * server asks us to disconnect) and process_ice_messages() (when the
+ * server disconnects unexpectedly).
+ */
+static void
+sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp)
+{
+    SmcConn connection;
+
+    if (!xsmp->connection)
+        return;
+
+    g_debug ("Disconnecting");
+
+    connection = xsmp->connection;
+    xsmp->connection = NULL;
+    SmcCloseConnection (connection, 0, NULL);
+    xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+
+    xsmp->waiting_to_save_myself = FALSE;
+    update_pending_events (xsmp);
+}
+
+static void
+sm_client_xsmp_startup (EggSMClient *client,
+                        const char  *client_id)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    SmcCallbacks callbacks;
+    char *ret_client_id;
+    char error_string_ret[256];
+
+    xsmp->client_id = g_strdup (client_id);
+
+    ice_init ();
+    SmcSetErrorHandler (smc_error_handler);
+
+    callbacks.save_yourself.callback      = xsmp_save_yourself;
+    callbacks.die.callback                = xsmp_die;
+    callbacks.save_complete.callback      = xsmp_save_complete;
+    callbacks.shutdown_cancelled.callback = xsmp_shutdown_cancelled;
+
+    callbacks.save_yourself.client_data      = xsmp;
+    callbacks.die.client_data                = xsmp;
+    callbacks.save_complete.client_data      = xsmp;
+    callbacks.shutdown_cancelled.client_data = xsmp;
+
+    client_id = NULL;
+    error_string_ret[0] = '\0';
+    xsmp->connection =
+        SmcOpenConnection (NULL, xsmp, SmProtoMajor, SmProtoMinor,
+                           SmcSaveYourselfProcMask | SmcDieProcMask |
+                           SmcSaveCompleteProcMask |
+                           SmcShutdownCancelledProcMask,
+                           &callbacks,
+                           xsmp->client_id, &ret_client_id,
+                           sizeof (error_string_ret), error_string_ret);
+
+    if (!xsmp->connection)
+    {
+        g_warning ("Failed to connect to the session manager: %s\n",
+                   error_string_ret[0] ?
+                   error_string_ret : "no error message given");
+        xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+        return;
+    }
+
+    /* We expect a pointless initial SaveYourself if either (a) we
+     * didn't have an initial client ID, or (b) we DID have an initial
+     * client ID, but the server rejected it and gave us a new one.
+     */
+    if (!xsmp->client_id ||
+            (ret_client_id && strcmp (xsmp->client_id, ret_client_id) != 0))
+        xsmp->expecting_initial_save_yourself = TRUE;
+
+    if (ret_client_id)
+    {
+        g_free (xsmp->client_id);
+        xsmp->client_id = g_strdup (ret_client_id);
+        free (ret_client_id);
+
+#if defined(GDK_WINDOWING_X11) || defined(HAVE_X11)
+      if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+        gdk_x11_set_sm_client_id (xsmp->client_id);
+#endif
+
+        g_debug ("Got client ID \"%s\"", xsmp->client_id);
+    }
+
+    xsmp->state = XSMP_STATE_IDLE;
+
+    /* Do not set the initial properties until we reach the main loop,
+     * so that the application has a chance to call
+     * egg_set_desktop_file(). (This may also help the session manager
+     * have a better idea of when the application is fully up and
+     * running.)
+     */
+    xsmp->waiting_to_set_initial_properties = TRUE;
+    xsmp->idle = g_idle_add (sm_client_xsmp_set_initial_properties, client);
+}
+
+static void
+sm_client_xsmp_set_restart_command (EggSMClient  *client,
+                                    int           argc,
+                                    const char  **argv)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    int i;
+
+    g_strfreev (xsmp->restart_command);
+
+    xsmp->restart_command = g_new (char *, argc + 1);
+    for (i = 0; i < argc; i++)
+        xsmp->restart_command[i] = g_strdup (argv[i]);
+    xsmp->restart_command[i] = NULL;
+
+    xsmp->set_restart_command = TRUE;
+}
+
+static void
+sm_client_xsmp_set_discard_command (EggSMClient  *client,
+                                    int           argc,
+                                    const char  **argv)
+{
+	EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+	int i;
+
+	g_strfreev (xsmp->discard_command);
+
+	xsmp->discard_command = g_new (char *, argc + 1);
+	for (i = 0; i < argc; i++)
+		xsmp->discard_command[i] = g_strdup (argv[i]);
+	xsmp->discard_command[i] = NULL;
+
+	xsmp->set_discard_command = TRUE;
+}
+
+static void
+sm_client_xsmp_will_quit (EggSMClient *client,
+                          gboolean     will_quit)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+
+    if (xsmp->state == XSMP_STATE_CONNECTION_CLOSED)
+    {
+        /* The session manager has already exited! Schedule a quit
+         * signal.
+         */
+        xsmp->waiting_to_emit_quit = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+    else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* We received a ShutdownCancelled message while the application
+         * was interacting; Schedule a quit_cancelled signal.
+         */
+        xsmp->waiting_to_emit_quit_cancelled = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+
+    g_return_if_fail (xsmp->state == XSMP_STATE_INTERACT);
+
+    g_debug ("Sending InteractDone(%s)", will_quit ? "False" : "True");
+    SmcInteractDone (xsmp->connection, !will_quit);
+
+    if (will_quit && xsmp->need_save_state)
+        save_state (xsmp);
+
+    g_debug ("Sending SaveYourselfDone(%s)", will_quit ? "True" : "False");
+    SmcSaveYourselfDone (xsmp->connection, will_quit);
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+}
+
+static gboolean
+sm_client_xsmp_end_session (EggSMClient         *client,
+                            EggSMClientEndStyle  style,
+                            gboolean             request_confirmation)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    int save_type;
+
+    /* To end the session via XSMP, we have to send a
+     * SaveYourselfRequest. We aren't allowed to do that if anything
+     * else is going on, but we don't want to expose this fact to the
+     * application. So we do our best to patch things up here...
+     *
+     * In the worst case, this method might block for some length of
+     * time in process_ice_messages, but the only time that code path is
+     * honestly likely to get hit is if the application tries to end the
+     * session as the very first thing it does, in which case it
+     * probably won't actually block anyway. It's not worth gunking up
+     * the API to try to deal nicely with the other 0.01% of cases where
+     * this happens.
+     */
+
+    while (xsmp->state != XSMP_STATE_IDLE ||
+            xsmp->expecting_initial_save_yourself)
+    {
+        /* If we're already shutting down, we don't need to do anything. */
+        if (xsmp->shutting_down)
+            return TRUE;
+
+        switch (xsmp->state)
+        {
+        case XSMP_STATE_CONNECTION_CLOSED:
+            return FALSE;
+
+        case XSMP_STATE_SAVE_YOURSELF:
+            /* Trying to log out from the save_state callback? Whatever.
+             * Abort the save_state.
+             */
+            SmcSaveYourselfDone (xsmp->connection, FALSE);
+            xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+            break;
+
+        case XSMP_STATE_INTERACT_REQUEST:
+        case XSMP_STATE_INTERACT:
+        case XSMP_STATE_SHUTDOWN_CANCELLED:
+            /* Already in a shutdown-related state, just ignore
+             * the new shutdown request...
+             */
+            return TRUE;
+
+        case XSMP_STATE_IDLE:
+            if (xsmp->waiting_to_set_initial_properties)
+                sm_client_xsmp_set_initial_properties (xsmp);
+
+            if (!xsmp->expecting_initial_save_yourself)
+                break;
+            /* else fall through */
+
+        case XSMP_STATE_SAVE_YOURSELF_DONE:
+            /* We need to wait for some response from the server.*/
+            process_ice_messages (SmcGetIceConnection (xsmp->connection));
+            break;
+
+        default:
+            /* Hm... shouldn't happen */
+            return FALSE;
+        }
+    }
+
+    /* xfce4-session will do the wrong thing if we pass SmSaveGlobal and
+     * the user chooses to save the session. But mate-session will do
+     * the wrong thing if we pass SmSaveBoth and the user chooses NOT to
+     * save the session... Sigh.
+     */
+    if (!strcmp (SmcVendor (xsmp->connection), "xfce4-session"))
+        save_type = SmSaveBoth;
+    else
+        save_type = SmSaveGlobal;
+
+    g_debug ("Sending SaveYourselfRequest(SmSaveGlobal, Shutdown, SmInteractStyleAny, %sFast)", request_confirmation ? "!" : "");
+    SmcRequestSaveYourself (xsmp->connection,
+                            save_type,
+                            True, /* shutdown */
+                            SmInteractStyleAny,
+                            !request_confirmation, /* fast */
+                            True /* global */);
+    return TRUE;
+}
+
+static gboolean
+idle_do_pending_events (gpointer data)
+{
+    EggSMClientXSMP *xsmp = data;
+    EggSMClient *client = data;
+
+    xsmp->idle = 0;
+
+    if (xsmp->waiting_to_emit_quit)
+    {
+        xsmp->waiting_to_emit_quit = FALSE;
+        egg_sm_client_quit (client);
+        goto out;
+    }
+
+    if (xsmp->waiting_to_emit_quit_cancelled)
+    {
+        xsmp->waiting_to_emit_quit_cancelled = FALSE;
+        egg_sm_client_quit_cancelled (client);
+        xsmp->state = XSMP_STATE_IDLE;
+    }
+
+    if (xsmp->waiting_to_save_myself)
+    {
+        xsmp->waiting_to_save_myself = FALSE;
+        do_save_yourself (xsmp);
+    }
+
+out:
+    return FALSE;
+}
+
+static void
+update_pending_events (EggSMClientXSMP *xsmp)
+{
+    gboolean want_idle =
+        xsmp->waiting_to_emit_quit ||
+        xsmp->waiting_to_emit_quit_cancelled ||
+        xsmp->waiting_to_save_myself;
+
+    if (want_idle)
+    {
+        if (xsmp->idle == 0)
+            xsmp->idle = g_idle_add (idle_do_pending_events, xsmp);
+    }
+    else
+    {
+        if (xsmp->idle != 0)
+            g_source_remove (xsmp->idle);
+        xsmp->idle = 0;
+    }
+}
+
+static void
+fix_broken_state (EggSMClientXSMP *xsmp, const char *message,
+                  gboolean send_interact_done,
+                  gboolean send_save_yourself_done)
+{
+    g_warning ("Received XSMP %s message in state %s: client or server error",
+               message, EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    /* Forget any pending SaveYourself plans we had */
+    xsmp->waiting_to_save_myself = FALSE;
+    update_pending_events (xsmp);
+
+    if (send_interact_done)
+        SmcInteractDone (xsmp->connection, False);
+    if (send_save_yourself_done)
+        SmcSaveYourselfDone (xsmp->connection, True);
+
+    xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE;
+}
+
+/* SM callbacks */
+
+static void
+xsmp_save_yourself (SmcConn   smc_conn,
+                    SmPointer client_data,
+                    int       save_type,
+                    Bool      shutdown,
+                    int       interact_style,
+                    Bool      fast)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    gboolean wants_quit_requested;
+
+    g_debug ("Received SaveYourself(%s, %s, %s, %s) in state %s",
+             save_type == SmSaveLocal ? "SmSaveLocal" :
+             save_type == SmSaveGlobal ? "SmSaveGlobal" : "SmSaveBoth",
+             shutdown ? "Shutdown" : "!Shutdown",
+             interact_style == SmInteractStyleAny ? "SmInteractStyleAny" :
+             interact_style == SmInteractStyleErrors ? "SmInteractStyleErrors" :
+             "SmInteractStyleNone", fast ? "Fast" : "!Fast",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state != XSMP_STATE_IDLE &&
+            xsmp->state != XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        fix_broken_state (xsmp, "SaveYourself", FALSE, TRUE);
+        return;
+    }
+
+    if (xsmp->waiting_to_set_initial_properties)
+        sm_client_xsmp_set_initial_properties (xsmp);
+
+    /* If this is the initial SaveYourself, ignore it; we've already set
+     * properties and there's no reason to actually save state too.
+     */
+    if (xsmp->expecting_initial_save_yourself)
+    {
+        xsmp->expecting_initial_save_yourself = FALSE;
+
+        if (save_type == SmSaveLocal &&
+                interact_style == SmInteractStyleNone &&
+                !shutdown && !fast)
+        {
+            g_debug ("Sending SaveYourselfDone(True) for initial SaveYourself");
+            SmcSaveYourselfDone (xsmp->connection, True);
+            /* As explained in the comment at the end of
+             * do_save_yourself(), SAVE_YOURSELF_DONE is the correct
+             * state here, not IDLE.
+             */
+            xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+            return;
+        }
+        else
+            g_warning ("First SaveYourself was not the expected one!");
+    }
+
+    /* Even ignoring the "fast" flag completely, there are still 18
+     * different combinations of save_type, shutdown and interact_style.
+     * We interpret them as follows:
+     *
+     *   Type  Shutdown  Interact	 Interpretation
+     *     G      F       A/E/N  	 do nothing (1)
+     *     G      T         N    	 do nothing (1)*
+     *     G      T        A/E   	 quit_requested (2)
+     *    L/B     F       A/E/N  	 save_state (3)
+     *    L/B     T         N    	 save_state (3)*
+     *    L/B     T        A/E   	 quit_requested, then save_state (4)
+     *
+     *   1. Do nothing, because the SM asked us to do something
+     *      uninteresting (save open files, but then don't quit
+     *      afterward) or rude (save open files without asking the user
+     *      for confirmation).
+     *
+     *   2. Request interaction and then emit ::quit_requested. This
+     *      perhaps isn't quite correct for the SmInteractStyleErrors
+     *      case, but we don't care.
+     *
+     *   3. Emit ::save_state. The SmSaveBoth SaveYourselfs in these
+     *      rows essentially get demoted to SmSaveLocal, because their
+     *      Global halves correspond to "do nothing".
+     *
+     *   4. Request interaction, emit ::quit_requested, and then emit
+     *      ::save_state after interacting. This is the SmSaveBoth
+     *      equivalent of #2, but we also promote SmSaveLocal shutdown
+     *      SaveYourselfs to SmSaveBoth here, because we want to give
+     *      the user a chance to save open files before quitting.
+     *
+     * (* It would be nice if we could do something useful when the
+     * session manager sends a SaveYourself with shutdown True and
+     * SmInteractStyleNone. But we can't, so we just pretend it didn't
+     * even tell us it was shutting down. The docs for ::quit mention
+     * that it might not always be preceded by ::quit_requested.)
+     */
+
+    /* As an optimization, we don't actually request interaction and
+     * emit ::quit_requested if the application isn't listening to the
+     * signal.
+     */
+    wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT), 0, FALSE);
+
+    xsmp->need_save_state     = (save_type != SmSaveGlobal);
+    xsmp->need_quit_requested = (shutdown && wants_quit_requested &&
+                                 interact_style != SmInteractStyleNone);
+    xsmp->interact_errors     = (interact_style == SmInteractStyleErrors);
+
+    xsmp->shutting_down       = shutdown;
+
+    do_save_yourself (xsmp);
+}
+
+static void
+do_save_yourself (EggSMClientXSMP *xsmp)
+{
+    if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* The SM cancelled a previous SaveYourself, but we haven't yet
+         * had a chance to tell the application, so we can't start
+         * processing this SaveYourself yet.
+         */
+        xsmp->waiting_to_save_myself = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+
+    if (xsmp->need_quit_requested)
+    {
+        xsmp->state = XSMP_STATE_INTERACT_REQUEST;
+
+        g_debug ("Sending InteractRequest(%s)",
+                 xsmp->interact_errors ? "Error" : "Normal");
+        SmcInteractRequest (xsmp->connection,
+                            xsmp->interact_errors ? SmDialogError : SmDialogNormal,
+                            xsmp_interact,
+                            xsmp);
+        return;
+    }
+
+    if (xsmp->need_save_state)
+    {
+        save_state (xsmp);
+
+        /* Though unlikely, the client could have been disconnected
+         * while the application was saving its state.
+         */
+        if (!xsmp->connection)
+            return;
+    }
+
+    g_debug ("Sending SaveYourselfDone(True)");
+    SmcSaveYourselfDone (xsmp->connection, True);
+
+    /* The client state diagram in the XSMP spec says that after a
+     * non-shutdown SaveYourself, we go directly back to "idle". But
+     * everything else in both the XSMP spec and the libSM docs
+     * disagrees.
+     */
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+}
+
+static void
+save_state (EggSMClientXSMP *xsmp)
+{
+    GKeyFile *state_file;
+    char *state_file_path, *data;
+    EggDesktopFile *desktop_file;
+	GPtrArray *restart, *discard;
+    int offset, fd;
+
+    /* We set xsmp->state before emitting save_state, but our caller is
+     * responsible for setting it back afterward.
+     */
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF;
+
+    state_file = egg_sm_client_save_state ((EggSMClient *)xsmp);
+    if (!state_file)
+    {
+        restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL);
+        set_properties (xsmp,
+                        ptrarray_prop (SmRestartCommand, restart),
+                        NULL);
+        g_ptr_array_free (restart, TRUE);
+
+		if (xsmp->set_discard_command)
+		{
+			discard = generate_command (xsmp->discard_command, NULL, NULL);
+			set_properties (xsmp,
+			                ptrarray_prop (SmDiscardCommand, discard),
+			                NULL);
+			g_ptr_array_free (discard, TRUE);
+		}
+		else
+        delete_properties (xsmp, SmDiscardCommand, NULL);
+
+        return;
+    }
+
+    desktop_file = egg_get_desktop_file ();
+    if (desktop_file)
+    {
+        GKeyFile *merged_file;
+        char *desktop_file_path;
+
+        merged_file = g_key_file_new ();
+        desktop_file_path =
+            g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
+                                 NULL, NULL);
+        if (desktop_file_path &&
+                g_key_file_load_from_file (merged_file, desktop_file_path,
+                                           G_KEY_FILE_KEEP_COMMENTS |
+                                           G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
+        {
+            guint g, k, i;
+            char **groups, **keys, *value, *exec;
+
+            groups = g_key_file_get_groups (state_file, NULL);
+            for (g = 0; groups[g]; g++)
+            {
+                keys = g_key_file_get_keys (state_file, groups[g], NULL, NULL);
+                for (k = 0; keys[k]; k++)
+                {
+                    value = g_key_file_get_value (state_file, groups[g],
+                                                  keys[k], NULL);
+                    if (value)
+                    {
+                        g_key_file_set_value (merged_file, groups[g],
+                                              keys[k], value);
+                        g_free (value);
+                    }
+                }
+                g_strfreev (keys);
+            }
+            g_strfreev (groups);
+
+            g_key_file_free (state_file);
+            state_file = merged_file;
+
+            /* Update Exec key using "--sm-client-state-file %k" */
+            restart = generate_command (xsmp->restart_command,
+                                        NULL, "%k");
+            for (i = 0; i < restart->len; i++)
+                restart->pdata[i] = g_shell_quote (restart->pdata[i]);
+            g_ptr_array_add (restart, NULL);
+            exec = g_strjoinv (" ", (char **)restart->pdata);
+            g_strfreev ((char **)restart->pdata);
+            g_ptr_array_free (restart, FALSE);
+
+            g_key_file_set_string (state_file, EGG_DESKTOP_FILE_GROUP,
+                                   EGG_DESKTOP_FILE_KEY_EXEC,
+                                   exec);
+            g_free (exec);
+        }
+        else
+            desktop_file = NULL;
+
+        g_free (desktop_file_path);
+    }
+
+    /* Now write state_file to disk. (We can't use mktemp(), because
+     * that requires the filename to end with "XXXXXX", and we want
+     * it to end with ".desktop".)
+     */
+
+    data = g_key_file_to_data (state_file, NULL, NULL);
+    g_key_file_free (state_file);
+
+    offset = 0;
+    while (1)
+    {
+        state_file_path = g_strdup_printf ("%s%csession-state%c%s-%ld.%s",
+                                           g_get_user_config_dir (),
+                                           G_DIR_SEPARATOR, G_DIR_SEPARATOR,
+                                           g_get_prgname (),
+                                           (long)time (NULL) + offset,
+                                           desktop_file ? "desktop" : "state");
+
+        fd = open (state_file_path, O_WRONLY | O_CREAT | O_EXCL, 0644);
+        if (fd == -1)
+        {
+            if (errno == EEXIST)
+            {
+                offset++;
+                g_free (state_file_path);
+                continue;
+            }
+            else if (errno == ENOTDIR || errno == ENOENT)
+            {
+                char *sep = strrchr (state_file_path, G_DIR_SEPARATOR);
+
+                *sep = '\0';
+                if (g_mkdir_with_parents (state_file_path, 0755) != 0)
+                {
+                    g_warning ("Could not create directory '%s'",
+                               state_file_path);
+                    g_free (state_file_path);
+                    state_file_path = NULL;
+                    break;
+                }
+
+                continue;
+            }
+
+            g_warning ("Could not create file '%s': %s",
+                       state_file_path, g_strerror (errno));
+            g_free (state_file_path);
+            state_file_path = NULL;
+            break;
+        }
+
+        close (fd);
+        g_file_set_contents (state_file_path, data, -1, NULL);
+        break;
+    }
+    g_free (data);
+
+    restart = generate_command (xsmp->restart_command, xsmp->client_id,
+                                state_file_path);
+    set_properties (xsmp,
+                    ptrarray_prop (SmRestartCommand, restart),
+                    NULL);
+    g_ptr_array_free (restart, TRUE);
+
+    if (state_file_path)
+    {
+        set_properties (xsmp,
+                        array_prop (SmDiscardCommand,
+                                    "/bin/rm", "-rf", state_file_path,
+                                    NULL),
+                        NULL);
+        g_free (state_file_path);
+    }
+}
+
+static void
+xsmp_interact (SmcConn   smc_conn,
+               SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received Interact message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state != XSMP_STATE_INTERACT_REQUEST)
+    {
+        fix_broken_state (xsmp, "Interact", TRUE, TRUE);
+        return;
+    }
+
+    xsmp->state = XSMP_STATE_INTERACT;
+    egg_sm_client_quit_requested (client);
+}
+
+static void
+xsmp_die (SmcConn   smc_conn,
+          SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received Die message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    sm_client_xsmp_disconnect (xsmp);
+    egg_sm_client_quit (client);
+}
+
+static void
+xsmp_save_complete (SmcConn   smc_conn,
+                    SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+
+    g_debug ("Received SaveComplete message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
+        xsmp->state = XSMP_STATE_IDLE;
+    else
+        fix_broken_state (xsmp, "SaveComplete", FALSE, FALSE);
+}
+
+static void
+xsmp_shutdown_cancelled (SmcConn   smc_conn,
+                         SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received ShutdownCancelled message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    xsmp->shutting_down = FALSE;
+
+    if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
+    {
+        /* We've finished interacting and now the SM has agreed to
+         * cancel the shutdown.
+         */
+        xsmp->state = XSMP_STATE_IDLE;
+        egg_sm_client_quit_cancelled (client);
+    }
+    else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* Hm... ok, so we got a shutdown SaveYourself, which got
+         * cancelled, but the application was still interacting, so we
+         * didn't tell it yet, and then *another* SaveYourself arrived,
+         * which we must still be waiting to tell the app about, except
+         * that now that SaveYourself has been cancelled too! Dizzy yet?
+         */
+        xsmp->waiting_to_save_myself = FALSE;
+        update_pending_events (xsmp);
+    }
+    else
+    {
+        g_debug ("Sending SaveYourselfDone(False)");
+        SmcSaveYourselfDone (xsmp->connection, False);
+
+        if (xsmp->state == XSMP_STATE_INTERACT)
+        {
+            /* The application is currently interacting, so we can't
+             * tell it about the cancellation yet; we will wait until
+             * after it calls egg_sm_client_will_quit().
+             */
+            xsmp->state = XSMP_STATE_SHUTDOWN_CANCELLED;
+        }
+        else
+        {
+            /* The shutdown was cancelled before the application got a
+             * chance to interact.
+             */
+            xsmp->state = XSMP_STATE_IDLE;
+        }
+    }
+}
+
+/* Utilities */
+
+/* Create a restart/clone/Exec command based on @restart_command.
+ * If @client_id is non-%NULL, add "--sm-client-id @client_id".
+ * If @state_file is non-%NULL, add "--sm-client-state-file @state_file".
+ *
+ * None of the input strings are g_strdup()ed; the caller must keep
+ * them around until it is done with the returned GPtrArray, and must
+ * then free the array, but not its contents.
+ */
+static GPtrArray *
+generate_command (char **restart_command, const char *client_id,
+                  const char *state_file)
+{
+    GPtrArray *cmd;
+    int i;
+
+    cmd = g_ptr_array_new ();
+    g_ptr_array_add (cmd, restart_command[0]);
+
+    if (client_id)
+    {
+        g_ptr_array_add (cmd, (char *)"--sm-client-id");
+        g_ptr_array_add (cmd, (char *)client_id);
+    }
+
+    if (state_file)
+    {
+        g_ptr_array_add (cmd, (char *)"--sm-client-state-file");
+        g_ptr_array_add (cmd, (char *)state_file);
+    }
+
+    for (i = 1; restart_command[i]; i++)
+        g_ptr_array_add (cmd, restart_command[i]);
+
+    return cmd;
+}
+
+/* Takes a NULL-terminated list of SmProp * values, created by
+ * array_prop, ptrarray_prop, string_prop, card8_prop, sets them, and
+ * frees them.
+ */
+static void
+set_properties (EggSMClientXSMP *xsmp, ...)
+{
+    GPtrArray *props;
+    SmProp *prop;
+    va_list ap;
+    guint i;
+
+    props = g_ptr_array_new ();
+
+    va_start (ap, xsmp);
+    while ((prop = va_arg (ap, SmProp *)))
+        g_ptr_array_add (props, prop);
+    va_end (ap);
+
+    if (xsmp->connection)
+    {
+        SmcSetProperties (xsmp->connection, props->len,
+                          (SmProp **)props->pdata);
+    }
+
+    for (i = 0; i < props->len; i++)
+    {
+        prop = props->pdata[i];
+        g_free (prop->vals);
+        g_free (prop);
+    }
+    g_ptr_array_free (props, TRUE);
+}
+
+/* Takes a NULL-terminated list of property names and deletes them. */
+static void
+delete_properties (EggSMClientXSMP *xsmp, ...)
+{
+    GPtrArray *props;
+    char *prop;
+    va_list ap;
+
+    if (!xsmp->connection)
+        return;
+
+    props = g_ptr_array_new ();
+
+    va_start (ap, xsmp);
+    while ((prop = va_arg (ap, char *)))
+        g_ptr_array_add (props, prop);
+    va_end (ap);
+
+    SmcDeleteProperties (xsmp->connection, props->len,
+                         (char **)props->pdata);
+
+    g_ptr_array_free (props, TRUE);
+}
+
+/* Takes an array of strings and creates a LISTofARRAY8 property. The
+ * strings are neither dupped nor freed; they need to remain valid
+ * until you're done with the SmProp.
+ */
+static SmProp *
+array_prop (const char *name, ...)
+{
+    SmProp *prop;
+    SmPropValue pv;
+    GArray *vals;
+    char *value;
+    va_list ap;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmLISTofARRAY8;
+
+    vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
+
+    va_start (ap, name);
+    while ((value = va_arg (ap, char *)))
+    {
+        pv.length = strlen (value);
+        pv.value = value;
+        g_array_append_val (vals, pv);
+    }
+    va_end (ap);
+
+    prop->num_vals = vals->len;
+    prop->vals = (SmPropValue *)vals->data;
+
+    g_array_free (vals, FALSE);
+
+    return prop;
+}
+
+/* Takes a GPtrArray of strings and creates a LISTofARRAY8 property.
+ * The array contents are neither dupped nor freed; they need to
+ * remain valid until you're done with the SmProp.
+ */
+static SmProp *
+ptrarray_prop (const char *name, GPtrArray *values)
+{
+    SmProp *prop;
+    SmPropValue pv;
+    GArray *vals;
+    guint i;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmLISTofARRAY8;
+
+    vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
+
+    for (i = 0; i < values->len; i++)
+    {
+        pv.length = strlen (values->pdata[i]);
+        pv.value = values->pdata[i];
+        g_array_append_val (vals, pv);
+    }
+
+    prop->num_vals = vals->len;
+    prop->vals = (SmPropValue *)vals->data;
+
+    g_array_free (vals, FALSE);
+
+    return prop;
+}
+
+/* Takes a string and creates an ARRAY8 property. The string is
+ * neither dupped nor freed; it needs to remain valid until you're
+ * done with the SmProp.
+ */
+static SmProp *
+string_prop (const char *name, const char *value)
+{
+    SmProp *prop;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmARRAY8;
+
+    prop->num_vals = 1;
+    prop->vals = g_new (SmPropValue, 1);
+
+    prop->vals[0].length = strlen (value);
+    prop->vals[0].value = (char *)value;
+
+    return prop;
+}
+
+/* Takes a char and creates a CARD8 property. */
+static SmProp *
+card8_prop (const char *name, unsigned char value)
+{
+    SmProp *prop;
+    char *card8val;
+
+    /* To avoid having to allocate and free prop->vals[0], we cheat and
+     * make vals a 2-element-long array and then use the second element
+     * to store value.
+     */
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmCARD8;
+
+    prop->num_vals = 1;
+    prop->vals = g_new (SmPropValue, 2);
+    card8val = (char *)(&prop->vals[1]);
+    card8val[0] = value;
+
+    prop->vals[0].length = 1;
+    prop->vals[0].value = card8val;
+
+    return prop;
+}
+
+/* ICE code. This makes no effort to play nice with anyone else trying
+ * to use libICE. Fortunately, no one uses libICE for anything other
+ * than SM. (DCOP uses ICE, but it has its own private copy of
+ * libICE.)
+ *
+ * When this moves to gtk, it will need to be cleverer, to avoid
+ * tripping over old apps that use MateClient or that use libSM
+ * directly.
+ */
+
+#include <X11/ICE/ICElib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static void        ice_error_handler    (IceConn        ice_conn,
+        Bool           swap,
+        int            offending_minor_opcode,
+        unsigned long  offending_sequence,
+        int            error_class,
+        int            severity,
+        IcePointer     values);
+static void        ice_io_error_handler (IceConn        ice_conn);
+static void        ice_connection_watch (IceConn        ice_conn,
+        IcePointer     client_data,
+        Bool           opening,
+        IcePointer    *watch_data);
+
+static void
+ice_init (void)
+{
+    IceSetIOErrorHandler (ice_io_error_handler);
+    IceSetErrorHandler (ice_error_handler);
+    IceAddConnectionWatch (ice_connection_watch, NULL);
+}
+
+static gboolean
+process_ice_messages (IceConn ice_conn)
+{
+    IceProcessMessagesStatus status;
+    status = IceProcessMessages (ice_conn, NULL, NULL);
+
+    switch (status)
+    {
+    case IceProcessMessagesSuccess:
+        return TRUE;
+
+    case IceProcessMessagesIOError:
+        sm_client_xsmp_disconnect (IceGetConnectionContext (ice_conn));
+        return FALSE;
+
+    case IceProcessMessagesConnectionClosed:
+        return FALSE;
+
+    default:
+        g_assert_not_reached ();
+    }
+}
+
+static gboolean
+ice_iochannel_watch (GIOChannel   *channel,
+                     GIOCondition  condition,
+                     gpointer      client_data)
+{
+    return process_ice_messages (client_data);
+}
+
+static void
+ice_connection_watch (IceConn     ice_conn,
+                      IcePointer  client_data,
+                      Bool        opening,
+                      IcePointer *watch_data)
+{
+    guint watch_id;
+
+    if (opening)
+    {
+        GIOChannel *channel;
+        int fd = IceConnectionNumber (ice_conn);
+
+        fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC);
+        channel = g_io_channel_unix_new (fd);
+        watch_id = g_io_add_watch (channel, G_IO_IN | G_IO_ERR,
+                                   ice_iochannel_watch, ice_conn);
+        g_io_channel_unref (channel);
+
+        *watch_data = GUINT_TO_POINTER (watch_id);
+    }
+    else
+    {
+        watch_id = GPOINTER_TO_UINT (*watch_data);
+        g_source_remove (watch_id);
+    }
+}
+
+static void
+ice_error_handler (IceConn       ice_conn,
+                   Bool          swap,
+                   int           offending_minor_opcode,
+                   unsigned long offending_sequence,
+                   int           error_class,
+                   int           severity,
+                   IcePointer    values)
+{
+    /* Do nothing */
+}
+
+static void
+ice_io_error_handler (IceConn ice_conn)
+{
+    /* Do nothing */
+}
+
+static void
+smc_error_handler (SmcConn       smc_conn,
+                   Bool          swap,
+                   int           offending_minor_opcode,
+                   unsigned long offending_sequence,
+                   int           error_class,
+                   int           severity,
+                   SmPointer     values)
+{
+    /* Do nothing */
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/50.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/50.html new file mode 100644 index 0000000..76bbc36 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/50.html @@ -0,0 +1,299 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __FR_ERROR_H__
+#define __FR_ERROR_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define FR_ERROR fr_error_quark ()
+GQuark fr_error_quark (void);
+
+#endif /* __FR_ERROR_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/51.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/51.html new file mode 100644 index 0000000..4f2f014 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/51.html @@ -0,0 +1,357 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#ifndef __FR_MARSHAL_MARSHAL_H__
+#define __FR_MARSHAL_MARSHAL_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* VOID:INT (fr-marshal.list:1) */
+#define fr_marshal_VOID__INT	g_cclosure_marshal_VOID__INT
+
+/* VOID:INT,INT (fr-marshal.list:2) */
+extern
+void fr_marshal_VOID__INT_INT (GClosure     *closure,
+                               GValue       *return_value,
+                               guint         n_param_values,
+                               const GValue *param_values,
+                               gpointer      invocation_hint,
+                               gpointer      marshal_data);
+
+/* VOID:INT,BOXED (fr-marshal.list:3) */
+extern
+void fr_marshal_VOID__INT_BOXED (GClosure     *closure,
+                                 GValue       *return_value,
+                                 guint         n_param_values,
+                                 const GValue *param_values,
+                                 gpointer      invocation_hint,
+                                 gpointer      marshal_data);
+
+/* VOID:POINTER (fr-marshal.list:4) */
+#define fr_marshal_VOID__POINTER	g_cclosure_marshal_VOID__POINTER
+
+/* VOID:VOID (fr-marshal.list:5) */
+#define fr_marshal_VOID__VOID	g_cclosure_marshal_VOID__VOID
+
+/* VOID:DOUBLE (fr-marshal.list:6) */
+#define fr_marshal_VOID__DOUBLE	g_cclosure_marshal_VOID__DOUBLE
+
+/* VOID:DOUBLE,STRING (fr-marshal.list:7) */
+extern
+void fr_marshal_VOID__DOUBLE_STRING (GClosure     *closure,
+                                     GValue       *return_value,
+                                     guint         n_param_values,
+                                     const GValue *param_values,
+                                     gpointer      invocation_hint,
+                                     gpointer      marshal_data);
+
+/* VOID:STRING (fr-marshal.list:8) */
+#define fr_marshal_VOID__STRING	g_cclosure_marshal_VOID__STRING
+
+/* VOID:BOOLEAN (fr-marshal.list:9) */
+#define fr_marshal_VOID__BOOLEAN	g_cclosure_marshal_VOID__BOOLEAN
+
+/* VOID:BOXED (fr-marshal.list:10) */
+#define fr_marshal_VOID__BOXED	g_cclosure_marshal_VOID__BOXED
+
+
+G_END_DECLS
+
+#endif /* __FR_MARSHAL_MARSHAL_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/52.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/52.html new file mode 100644 index 0000000..bfe0e0c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/52.html @@ -0,0 +1,1773 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-7z.h"
+#include "rar-utils.h"
+
+static void fr_command_7z_class_init  (FrCommand7zClass *class);
+static void fr_command_7z_init        (FrCommand        *afile);
+static void fr_command_7z_finalize    (GObject          *object);
+
+static gboolean spd_support = FALSE;
+static gboolean unexpected_end_of_archive = FALSE;
+static gboolean password_required = FALSE;
+static gboolean password_handled = FALSE;
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *date_s,
+		    char *time_s)
+{
+	struct tm   tm = {0, };
+	char      **fields;
+
+	tm.tm_isdst = -1;
+
+	/* date */
+
+	fields = g_strsplit (date_s, "-", 3);
+	if (fields[0] != NULL) {
+		tm.tm_year = atoi (fields[0]) - 1900;
+		tm.tm_mon = atoi (fields[1]) - 1;
+		tm.tm_mday = atoi (fields[2]);
+	}
+	g_strfreev (fields);
+
+	/* time */
+
+	fields = g_strsplit (time_s, ":", 3);
+	if (fields[0] != NULL) {
+		tm.tm_hour = atoi (fields[0]);
+		if (fields[1] != NULL) {
+			tm.tm_min = atoi (fields[1]);
+			if (fields[2] != NULL)
+				tm.tm_sec = atoi (fields[2]);
+		}
+	}
+	g_strfreev (fields);
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,
+		    gpointer  data)
+{
+	FrCommand    *comm = FR_COMMAND (data);
+	FrCommand7z  *p7z_comm = FR_COMMAND_7Z (comm);
+	char        **fields;
+	FileData     *fdata;
+
+	g_return_if_fail (line != NULL);
+
+	if (! p7z_comm->list_started) {
+		if (strncmp (line, "p7zip Version ", 14) == 0) {
+			const char *ver_start;
+			int         ver_len;
+			char        version[256];
+
+			ver_start = eat_spaces (line + 14);
+			ver_len = strchr (ver_start, ' ') - ver_start;
+			strncpy (version, ver_start, ver_len);
+			version[ver_len] = 0;
+
+			if ((strcmp (version, "4.55") < 0) && (ver_len > 1) && (version[1] == '.'))
+				p7z_comm->old_style = TRUE;
+			else
+				p7z_comm->old_style = FALSE;
+			if ((strcmp (version, "9.38") < 0) && (ver_len > 1) && (version[1] == '.'))
+				spd_support = FALSE;
+			else
+				spd_support = TRUE;
+		}
+		else if (p7z_comm->old_style && (strncmp (line, "Listing archive: ", 17) == 0))
+			p7z_comm->list_started = TRUE;
+		else if (! p7z_comm->old_style && (strcmp (line, "----------") == 0))
+			p7z_comm->list_started = TRUE;
+		else if (strncmp (line, "Multivolume = ", 14) == 0) {
+			fields = g_strsplit (line, " = ", 2);
+			comm->multi_volume = (strcmp (fields[1], "+") == 0);
+			g_strfreev (fields);
+		}
+		else if (strncmp (line, "Unexpected end of archive", 25) == 0)  {
+			unexpected_end_of_archive = TRUE;
+		}
+		return;
+	}
+
+	if (strcmp (line, "") == 0) {
+		if (p7z_comm->fdata != NULL) {
+			if (p7z_comm->fdata->original_path == NULL) {
+				file_data_free (p7z_comm->fdata);
+				p7z_comm->fdata = NULL;
+			}
+			else {
+				fdata = p7z_comm->fdata;
+				if (fdata->dir)
+					fdata->name = dir_name_from_path (fdata->full_path);
+				else
+					fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+				fdata->path = remove_level_from_path (fdata->full_path);
+				fr_command_add_file (comm, fdata);
+				p7z_comm->fdata = NULL;
+			}
+		}
+		return;
+	}
+
+	if (p7z_comm->fdata == NULL)
+		p7z_comm->fdata = file_data_new ();
+
+	fields = g_strsplit (line, " = ", 2);
+
+	if (g_strv_length (fields) < 2) {
+		g_strfreev (fields);
+		return;
+	}
+
+	fdata = p7z_comm->fdata;
+
+	if (strcmp (fields[0], "Path") == 0) {
+		fdata->free_original_path = TRUE;
+		fdata->original_path = g_strdup (fields[1]);
+		fdata->full_path = g_strconcat ((fdata->original_path[0] != '/') ? "/" : "",
+						fdata->original_path,
+						(fdata->dir && (fdata->original_path[strlen (fdata->original_path) - 1] != '/')) ? "/" : "",
+						NULL);
+	}
+	else if (strcmp (fields[0], "Folder") == 0) {
+		fdata->dir = (strcmp (fields[1], "+") == 0);
+	}
+	else if (strcmp (fields[0], "Size") == 0) {
+		fdata->size = g_ascii_strtoull (fields[1], NULL, 10);
+	}
+	else if (strcmp (fields[0], "Modified") == 0) {
+		char **modified_fields;
+
+		modified_fields = g_strsplit (fields[1], " ", 2);
+		if (modified_fields[0] != NULL)
+			fdata->modified = mktime_from_string (modified_fields[0], modified_fields[1]);
+		g_strfreev (modified_fields);
+	}
+	else if (strcmp (fields[0], "Encrypted") == 0) {
+		if (strcmp (fields[1], "+") == 0)
+			fdata->encrypted = TRUE;
+	}
+	else if (strcmp (fields[0], "Method") == 0) {
+		if (strstr (fields[1], "AES") != NULL)
+			fdata->encrypted = TRUE;
+	}
+	else if (strcmp (fields[0], "Attributes") == 0) {
+		if (fields[1][0] == 'D')
+			fdata->dir = TRUE;
+	}
+	g_strfreev (fields);
+}
+
+static void
+fr_command_7z_begin_command (FrCommand *comm)
+{
+	// Modern 7-Zip by the original author.
+	// Statically linked from a binary distribution, almost guaranteed to work.
+	if (is_program_in_path ("7zzs"))
+		fr_process_begin_command (comm->process, "7zzs");
+	// Dynamically linked from either binary or source distribution.
+	else if (is_program_in_path ("7zz"))
+		fr_process_begin_command (comm->process, "7zz");
+	// Legacy p7zip project.
+	else if (is_program_in_path ("7z"))
+		fr_process_begin_command (comm->process, "7z");
+	else if (is_program_in_path ("7za"))
+		fr_process_begin_command (comm->process, "7za");
+	else if (is_program_in_path ("7zr"))
+		fr_process_begin_command (comm->process, "7zr");
+}
+
+static void
+add_password_arg (FrCommand     *comm,
+		  const char    *password,
+		  gboolean       always_specify)
+{
+	if (always_specify || ((password != NULL) && (*password != 0))) {
+		char *arg;
+
+		arg = g_strconcat ("-p", password, NULL);
+		fr_process_add_arg (comm->process, arg);
+		g_free (arg);
+		password_handled = TRUE;
+	}
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommand7z *p7z_comm = data;
+
+	if (p7z_comm->fdata != NULL) {
+		file_data_free (p7z_comm->fdata);
+		p7z_comm->fdata = NULL;
+	}
+	p7z_comm->list_started = FALSE;
+}
+
+static void
+fr_command_7z_list (FrCommand  *comm)
+{
+	rar_check_multi_volume (comm);
+
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);
+
+	fr_command_7z_begin_command (comm);
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "l");
+	fr_process_add_arg (comm->process, "-slt");
+	fr_process_add_arg (comm->process, "-bd");
+	fr_process_add_arg (comm->process, "-y");
+	add_password_arg (comm, comm->password, FALSE);
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+
+	fr_process_start (comm->process);
+}
+
+static void
+parse_progress_line (FrCommand  *comm,
+		     const char *prefix,
+		     const char *message_prefix,
+		     const char *line)
+{
+	int prefix_len;
+
+	prefix_len = strlen (prefix);
+	if (strncmp (line, prefix, prefix_len) == 0)
+		fr_command_progress (comm, (double) ++comm->n_file / (comm->n_files + 1));
+}
+
+static void
+process_line__add (char     *line,
+		   gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (strstr (line, "Enter password") != NULL)
+		password_required = TRUE;
+
+	if ((comm->volume_size > 0) && (strncmp (line, "Creating archive", 16) == 0)) {
+		char  *volume_filename;
+		GFile *volume_file;
+
+		volume_filename = g_strconcat (comm->filename, ".001", NULL);
+		volume_file = g_file_new_for_path (volume_filename);
+		fr_command_set_multi_volume (comm, volume_file);
+
+		g_object_unref (volume_file);
+		g_free (volume_filename);
+	}
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Compressing  ", _("Adding file: "), line);
+}
+
+static void
+fr_command_7z_add (FrCommand     *comm,
+		   const char    *from_file,
+		   GList         *file_list,
+		   const char    *base_dir,
+		   gboolean       update,
+		   gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__add,
+				      comm);
+
+	fr_command_7z_begin_command (comm);
+
+	if (update)
+		fr_process_add_arg (comm->process, "u");
+	else
+		fr_process_add_arg (comm->process, "a");
+
+	if (base_dir != NULL) {
+		fr_process_set_working_dir (comm->process, base_dir);
+	}
+
+	if (is_mime_type (comm->mime_type, "application/zip")
+	    || is_mime_type (comm->mime_type, "application/x-cbz"))
+	{
+		fr_process_add_arg (comm->process, "-tzip");
+		fr_process_add_arg (comm->process, "-mem=AES128");
+	}
+
+	if (spd_support) fr_process_add_arg (comm->process, "-spd");
+	fr_process_add_arg (comm->process, "-bd");
+	fr_process_add_arg (comm->process, "-bb1");
+	fr_process_add_arg (comm->process, "-y");
+	if (recursive)
+		fr_process_add_arg (comm->process, "-l");
+	add_password_arg (comm, comm->password, FALSE);
+	if ((comm->password != NULL)
+	    && (*comm->password != 0)
+	    && comm->encrypt_header
+	    && fr_command_is_capable_of (comm, FR_COMMAND_CAN_ENCRYPT_HEADER))
+	{
+		fr_process_add_arg (comm->process, "-mhe=on");
+	}
+
+	/* fr_process_add_arg (comm->process, "-ms=off"); FIXME: solid mode off? */
+
+	switch (comm->compression) {
+	case FR_COMPRESSION_VERY_FAST:
+		fr_process_add_arg (comm->process, "-mx=1");
+		break;
+	case FR_COMPRESSION_FAST:
+		fr_process_add_arg (comm->process, "-mx=5");
+		break;
+	case FR_COMPRESSION_NORMAL:
+		fr_process_add_arg (comm->process, "-mx=7");
+		break;
+	case FR_COMPRESSION_MAXIMUM:
+		fr_process_add_arg (comm->process, "-mx=9");
+		if (! is_mime_type (comm->mime_type, "application/zip")
+		    && ! is_mime_type (comm->mime_type, "application/x-cbz"))
+		{
+			fr_process_add_arg (comm->process, "-m0=lzma2");;
+		}
+		break;
+	}
+
+	if (is_mime_type (comm->mime_type, "application/x-ms-dos-executable"))
+		fr_process_add_arg (comm->process, "-sfx");
+
+	if (comm->volume_size > 0)
+		fr_process_add_arg_printf (comm->process, "-v%ub", comm->volume_size);
+
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Files prefixed with '@' need to be handled specially */
+			if (g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL);
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Skip files prefixed with '@', already added */
+			if (!g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__delete (char     *line,
+		      gpointer  data)
+{
+	if ((strstr (line, "Wrong password?") != NULL)
+	    || (strstr (line, "Enter password") != NULL))
+	{
+		password_required = TRUE;
+	}
+}
+
+static void
+fr_command_7z_delete (FrCommand  *comm,
+		      const char *from_file,
+		      GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_set_out_line_func (comm->process,
+			      process_line__delete,
+			      comm);
+
+	fr_command_7z_begin_command (comm);
+	fr_process_add_arg (comm->process, "d");
+	if (spd_support) fr_process_add_arg (comm->process, "-spd");
+	fr_process_add_arg (comm->process, "-bd");
+	fr_process_add_arg (comm->process, "-y");
+	if (is_mime_type (comm->mime_type, "application/x-ms-dos-executable"))
+		fr_process_add_arg (comm->process, "-sfx");
+
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Files prefixed with '@' need to be handled specially */
+			if (g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL);
+
+	add_password_arg (comm, FR_COMMAND (comm)->password, FALSE);
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Skip files prefixed with '@', already added */
+			if (!g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__extract (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		       gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Extracting  ", _("Extracting file: "), line);
+}
+
+static void
+fr_command_7z_extract (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list,
+		       const char *dest_dir,
+		       gboolean    overwrite,
+		       gboolean    skip_older,
+		       gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__extract,<--- You might need to cast the function pointer here
+				      comm);
+	fr_command_7z_begin_command (comm);
+
+	if (junk_paths)
+		fr_process_add_arg (comm->process, "e");
+	else
+		fr_process_add_arg (comm->process, "x");
+
+	if (spd_support) fr_process_add_arg (comm->process, "-spd");
+	fr_process_add_arg (comm->process, "-bd");
+	fr_process_add_arg (comm->process, "-bb1");
+	fr_process_add_arg (comm->process, "-y");
+	add_password_arg (comm, comm->password, FALSE);
+
+	if (dest_dir != NULL)
+		fr_process_add_arg_concat (comm->process, "-o", dest_dir, NULL);
+
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Files prefixed with '@' need to be handled specially */
+			if (g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL);
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			/* Skip files prefixed with '@', already added */
+			if (!g_str_has_prefix (scan->data, "@"))
+				fr_process_add_arg (comm->process, scan->data);
+
+	if (unexpected_end_of_archive) fr_process_set_ignore_error (comm->process, TRUE);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_7z_test (FrCommand   *comm)
+{
+	fr_command_7z_begin_command (comm);
+	fr_process_add_arg (comm->process, "t");
+	fr_process_add_arg (comm->process, "-bd");
+	fr_process_add_arg (comm->process, "-y");
+	add_password_arg (comm, comm->password, FALSE);
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_7z_handle_error (FrCommand   *comm,
+			    FrProcError *error)
+{
+	if (error->type == FR_PROC_ERROR_NONE) {
+		FileData *first;
+		char     *basename;
+		char     *testname;
+
+		/* This is a way to fix bug #582712. */
+
+		if (comm->files->len != 1)
+			return;
+
+		if (! g_str_has_suffix (comm->filename, ".001"))
+			return;
+
+		first = g_ptr_array_index (comm->files, 0);
+		basename = g_path_get_basename (comm->filename);
+		testname = g_strconcat (first->original_path, ".001", NULL);
+
+		if (strcmp (basename, testname) == 0)
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+
+		g_free (testname);
+		g_free (basename);
+
+		return;
+	}
+
+	if ((error->status <= 1) || (unexpected_end_of_archive)) {
+		error->type = FR_PROC_ERROR_NONE;
+	}
+	else {
+		if (password_required && (!password_handled))
+		{
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+			return;
+		}
+
+		GList *scan;
+
+		for (scan = g_list_last (comm->process->out.raw); scan; scan = scan->prev) {
+			char *line = scan->data;
+
+			if ((strstr (line, "Wrong password?") != NULL)
+			    || (strstr (line, "Enter password") != NULL))
+			{
+				error->type = FR_PROC_ERROR_ASK_PASSWORD;
+				break;
+			}
+		}
+	}
+}
+
+const char *sevenz_mime_types[] = { "application/epub+zip",
+				    "application/x-7z-compressed",
+				    "application/x-arj",
+				    "application/vnd.ms-cab-compressed",
+				    "application/x-cd-image",
+				    /*"application/x-cbr",*/
+				    "application/x-cbz",
+				    "application/x-ms-dos-executable",
+				    "application/x-ms-wim",
+				    "application/x-rar",
+				    "application/zip", /* zip always at the end and the number of */
+				    NULL };            /* place in fr_command_7z_get_mime_types   */
+
+static const char **
+fr_command_7z_get_mime_types (FrCommand *comm)
+{
+	GSettings *settings;
+	settings = g_settings_new ("org.mate.engrampa.general");
+
+	if (g_settings_get_boolean (settings, "unar-open-zip") &&
+	    is_program_in_path ("unar") && is_program_in_path ("lsar"))
+		sevenz_mime_types [9] = NULL;
+	else
+		g_settings_set_boolean (settings, "unar-open-zip", FALSE);
+
+	g_object_unref (settings);
+
+	return sevenz_mime_types;
+}
+
+static FrCommandCaps
+fr_command_7z_get_capabilities (FrCommand  *comm,<--- Parameter 'comm' can be declared as pointer to const
+				const char *mime_type,
+				gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	gboolean available_7zip = is_program_available ("7zz", check_command) || is_program_available ("7zzs", check_command);
+	if (! available_7zip\
+		&& ! is_program_available ("7za", check_command) \
+		&& ! is_program_available ("7zr", check_command) \
+		&& ! is_program_available ("7z", check_command))
+		return capabilities;
+
+	if (is_mime_type (mime_type, "application/x-7z-compressed")) {
+		capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES;
+		if (is_program_available ("7z", check_command) || available_7zip)
+			capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
+	}
+	else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) {
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+		if (is_program_available ("7z", check_command) || available_7zip)
+			capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
+	}
+	else if (is_program_available ("7z", check_command) || available_7zip) {
+		if (is_mime_type (mime_type, "application/x-rar")
+		    || is_mime_type (mime_type, "application/x-cbr"))
+		{
+			if (! check_command || available_7zip || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS)
+			    || g_file_test ("/usr/libexec/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/libexec/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS))
+				capabilities |= FR_COMMAND_CAN_READ;
+		}
+		else
+			capabilities |= FR_COMMAND_CAN_READ;
+
+		if (is_mime_type (mime_type, "application/epub+zip")
+		    || is_mime_type (mime_type, "application/x-cbz")
+		    || is_mime_type (mime_type, "application/x-ms-dos-executable")
+		    || is_mime_type (mime_type, "application/zip"))
+		{
+			capabilities |= FR_COMMAND_CAN_WRITE | FR_COMMAND_CAN_ENCRYPT;
+		}
+	}
+	else if (is_program_available ("7za", check_command)) {
+		if (is_mime_type (mime_type, "application/vnd.ms-cab-compressed")
+		    || is_mime_type (mime_type, "application/zip"))
+		{
+			capabilities |= FR_COMMAND_CAN_READ;
+		}
+
+		if (is_mime_type (mime_type, "application/zip"))
+			capabilities |= FR_COMMAND_CAN_WRITE;
+	}
+
+	/* multi-volumes are read-only */
+	if ((comm->files->len > 0) && comm->multi_volume && (capabilities & FR_COMMAND_CAN_WRITE))
+		capabilities ^= FR_COMMAND_CAN_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_7z_get_packages (FrCommand  *comm,
+			    const char *mime_type)
+{
+	if (is_mime_type (mime_type, "application/x-rar"))
+		return PACKAGES ("7zip,7zip-rar");
+	else if (is_mime_type (mime_type, "application/zip") || is_mime_type (mime_type, "application/vnd.ms-cab-compressed"))
+		return PACKAGES ("7zip,7zip-full");
+	else
+		return PACKAGES ("7zip");
+}
+
+static void
+fr_command_7z_class_init (FrCommand7zClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_7z_finalize;
+
+	afc->list             = fr_command_7z_list;
+	afc->add              = fr_command_7z_add;
+	afc->delete           = fr_command_7z_delete;
+	afc->extract          = fr_command_7z_extract;
+	afc->test             = fr_command_7z_test;
+	afc->handle_error     = fr_command_7z_handle_error;
+	afc->get_mime_types   = fr_command_7z_get_mime_types;
+	afc->get_capabilities = fr_command_7z_get_capabilities;<--- You might need to cast the function pointer here
+	afc->get_packages     = fr_command_7z_get_packages;
+}
+
+static void
+fr_command_7z_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = TRUE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = TRUE;
+	comm->propListFromFile             = TRUE;
+}
+
+static void
+fr_command_7z_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_7Z (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_7z_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommand7zClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_7z_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommand7z),
+			0,
+			(GInstanceInitFunc) fr_command_7z_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommand7z",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/53.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/53.html new file mode 100644 index 0000000..5c69b62 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/53.html @@ -0,0 +1,347 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_7Z_H
+#define FR_COMMAND_7Z_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_7Z            (fr_command_7z_get_type ())
+#define FR_COMMAND_7Z(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_7Z, FrCommand7z))
+#define FR_COMMAND_7Z_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_7Z, FrCommand7zClass))
+#define FR_IS_COMMAND_7Z(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_7Z))
+#define FR_IS_COMMAND_7Z_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_7Z))
+#define FR_COMMAND_7Z_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_7Z, FrCommand7zClass))
+
+typedef struct _FrCommand7z       FrCommand7z;
+typedef struct _FrCommand7zClass  FrCommand7zClass;
+
+struct _FrCommand7z
+{
+	FrCommand __parent;
+	gboolean   list_started;
+	gboolean   old_style;
+	FileData  *fdata;
+};
+
+struct _FrCommand7zClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_7z_get_type (void);
+
+#endif /* FR_COMMAND_7Z_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/54.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/54.html new file mode 100644 index 0000000..e6a6ef2 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/54.html @@ -0,0 +1,899 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-ace.h"
+
+static void fr_command_ace_class_init  (FrCommandAceClass *class);
+static void fr_command_ace_init        (FrCommand        *afile);
+static void fr_command_ace_finalize    (GObject          *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *date,
+		    char *time)
+{
+	struct tm    tm = {0, };
+	char       **fields;
+
+	tm.tm_isdst = -1;
+
+	/* date */
+
+	fields = g_strsplit (date, ".", 3);
+	if (fields[0] != NULL) {
+		tm.tm_mday = atoi (fields[0]);
+		if (fields[1] != NULL) {
+			tm.tm_mon = atoi (fields[1]) - 1;
+			if (fields[2] != NULL) {
+				int y = atoi (fields[2]);
+				if (y > 75)
+					tm.tm_year = y;
+				else
+					tm.tm_year = 100 + y;
+			}
+		}
+	}
+	g_strfreev (fields);
+
+	/* time */
+
+	fields = g_strsplit (time, ":", 2);
+	if (fields[0] != NULL) {
+		tm.tm_hour = atoi (fields[0]);
+		if (fields[1] != NULL)
+			tm.tm_min = atoi (fields[1]);
+	}
+	tm.tm_sec = 0;
+	g_strfreev (fields);
+
+	return mktime (&tm);
+}
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FileData      *fdata;
+	FrCommandAce  *ace_comm = FR_COMMAND_ACE (data);
+	FrCommand     *comm = FR_COMMAND (data);
+	char         **fields = NULL;
+	const char    *field_name = NULL;
+
+	g_return_if_fail (line != NULL);
+
+	if (ace_comm->command_type == FR_ACE_COMMAND_UNKNOWN) {
+		if (g_str_has_prefix (line, "UNACE")) {
+			if (strstr (line, "public version") != NULL)
+				ace_comm->command_type = FR_ACE_COMMAND_PUBLIC;
+			else
+				ace_comm->command_type = FR_ACE_COMMAND_NONFREE;
+		}
+		return;
+	}
+
+	if (! ace_comm->list_started) {
+		if (ace_comm->command_type == FR_ACE_COMMAND_PUBLIC) {
+			if (g_str_has_prefix (line, "Date"))
+				ace_comm->list_started = TRUE;
+		}
+		else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE) {
+			if (g_str_has_prefix (line, "  Date"))
+				ace_comm->list_started = TRUE;
+		}
+		return;
+	}
+
+	if (g_str_has_prefix (line, "listed"))
+		return;
+
+	fdata = file_data_new ();
+
+	if (ace_comm->command_type == FR_ACE_COMMAND_PUBLIC)
+		fields = g_strsplit (line, "|", 6);
+	else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE)
+		fields = split_line (line, 5);
+
+	if ((fields == NULL) || (g_strv_length (fields) < 5))
+		return;
+
+	fdata->size = g_ascii_strtoull (fields[3], NULL, 10);
+	fdata->modified = mktime_from_string (fields[0], fields[1]);
+
+	if (ace_comm->command_type == FR_ACE_COMMAND_PUBLIC) {
+		field_name = fields[5];
+		field_name = field_name + 1;
+	}
+	else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE)
+		field_name = get_last_field (line, 6);
+
+        g_assert (field_name != NULL);
+	if (field_name[0] != '/') {
+		fdata->full_path = g_strconcat ("/", field_name, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+	else {
+		fdata->full_path = g_strdup (field_name);
+		fdata->original_path = fdata->full_path;
+	}
+
+	g_strfreev (fields);
+
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandAce *comm = data;
+
+	comm->list_started = FALSE;
+	comm->command_type = FR_ACE_COMMAND_UNKNOWN;
+}
+
+static void
+fr_command_ace_list (FrCommand  *comm)
+{
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	fr_process_begin_command (comm->process, "unace");
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "v");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_ace_extract (FrCommand   *comm,
+			const char  *from_file,
+			GList       *file_list,
+			const char  *dest_dir,
+			gboolean     overwrite,
+			gboolean     skip_older,
+			gboolean     junk_paths)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "unace");
+
+	if (dest_dir != NULL)
+		fr_process_set_working_dir (comm->process, dest_dir);
+
+	if (junk_paths)
+		fr_process_add_arg (comm->process, "e");
+	else
+		fr_process_add_arg (comm->process, "x");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_ace_test (FrCommand   *comm)
+{
+        fr_process_begin_command (comm->process, "unace");
+        fr_process_add_arg (comm->process, "t");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, comm->filename);
+        fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_ace_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	/* FIXME */
+}
+
+const char *ace_mime_type[] = { "application/x-ace", NULL };
+
+static const char **
+fr_command_ace_get_mime_types (FrCommand *comm)
+{
+	return ace_mime_type;
+}
+
+static FrCommandCaps
+fr_command_ace_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("unace", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_ace_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("unace");
+}
+
+static void
+fr_command_ace_class_init (FrCommandAceClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_ace_finalize;
+
+        afc->list             = fr_command_ace_list;
+	afc->extract          = fr_command_ace_extract;
+	afc->test             = fr_command_ace_test;
+	afc->handle_error     = fr_command_ace_handle_error;
+	afc->get_mime_types   = fr_command_ace_get_mime_types;
+	afc->get_capabilities = fr_command_ace_get_capabilities;
+	afc->get_packages     = fr_command_ace_get_packages;
+}
+
+static void
+fr_command_ace_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = TRUE;
+}
+
+static void
+fr_command_ace_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_ACE (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_ace_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandAceClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_ace_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandAce),
+			0,
+			(GInstanceInitFunc) fr_command_ace_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandAce",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/55.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/55.html new file mode 100644 index 0000000..9dc48bf --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/55.html @@ -0,0 +1,361 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ACE_H
+#define FR_COMMAND_ACE_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_ACE            (fr_command_ace_get_type ())
+#define FR_COMMAND_ACE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ACE, FrCommandAce))
+#define FR_COMMAND_ACE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ACE, FrCommandAceClass))
+#define FR_IS_COMMAND_ACE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ACE))
+#define FR_IS_COMMAND_ACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ACE))
+#define FR_COMMAND_ACE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ACE, FrCommandAceClass))
+
+typedef enum {
+	FR_ACE_COMMAND_UNKNOWN = 0,
+	FR_ACE_COMMAND_PUBLIC,
+	FR_ACE_COMMAND_NONFREE
+} FrAceCommand;
+
+typedef struct _FrCommandAce       FrCommandAce;
+typedef struct _FrCommandAceClass  FrCommandAceClass;
+
+struct _FrCommandAce
+{
+	FrCommand  __parent;
+
+	gboolean     list_started;
+	FrAceCommand command_type;
+};
+
+struct _FrCommandAceClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_ace_get_type (void);
+
+#endif /* FR_COMMAND_ACE_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/56.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/56.html new file mode 100644 index 0000000..25fc371 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/56.html @@ -0,0 +1,1013 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "fr-command.h"
+#include "fr-command-alz.h"
+#include "glib-utils.h"
+
+static void fr_command_alz_class_init  (FrCommandAlzClass *class);
+static void fr_command_alz_init        (FrCommand         *afile);
+static void fr_command_alz_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *date_s,
+		    char *time_s)
+{
+	struct tm   tm = {0, };
+	char      **fields;
+
+	/* date */
+
+	fields = g_strsplit (date_s, "/", 3);
+	if (fields[0] != NULL) {
+		tm.tm_mon = atoi (fields[0]) - 1;
+		if (fields[1] != NULL) {
+			tm.tm_mday = atoi (fields[1]);
+			if (fields[2] != NULL)
+				tm.tm_year = 100 + atoi (fields[2]);
+		}
+	}
+	g_strfreev (fields);
+
+	/* time */
+
+	fields = g_strsplit (time_s, ":", 3);
+	if (fields[0] != NULL) {
+		tm.tm_hour = atoi (fields[0]);
+		if (fields[1] != NULL)
+			tm.tm_min = atoi (fields[1]);
+	}
+	g_strfreev (fields);
+
+	return mktime (&tm);
+}
+
+static void
+process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+	      gpointer  data)
+{
+	FrCommand     *comm = FR_COMMAND (data);
+	FrCommandAlz  *alz_comm = FR_COMMAND_ALZ (comm);
+	FileData      *fdata;
+	char         **fields;
+	char          *name_field;
+	char           name_last;
+	gsize	       name_len;
+
+	g_return_if_fail (line != NULL);
+
+	if (! alz_comm->list_started) {
+		if (strncmp (line, "-----", 5 ) == 0 )
+			alz_comm->list_started = TRUE;
+		return;
+	}
+
+	if (strncmp (line, "-----", 5 ) == 0) {
+		alz_comm->list_started = FALSE;
+		return;
+
+	}
+
+	if (! alz_comm->list_started)<--- Condition '!alz_comm->list_started' is always false
+		return;
+
+	fdata = file_data_new ();
+	fields = split_line (line, 5);
+	fdata->modified = mktime_from_string (fields[0], fields[1]);
+	fdata->size = g_ascii_strtoull (fields[3], NULL, 10);
+
+	name_field = g_strdup (get_last_field (line, 6));
+	name_len = strlen (name_field);
+
+	name_last = name_field[name_len - 1];
+	fdata->dir = name_last == '\\';
+	fdata->encrypted = name_last == '*';
+
+	if (fdata->dir || fdata->encrypted)
+		name_field[--name_len] = '\0';
+
+	if (*name_field == '/') {
+		fdata->full_path = g_strdup (name_field);
+		fdata->original_path = fdata->full_path;
+	}
+	else {
+		fdata->full_path = g_strconcat ("/", name_field, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	if (fdata->dir) {
+		char *s;
+		for (s = fdata->full_path; *s != '\0'; ++s)
+			if (*s == '\\') *s = '/';
+		for (s = fdata->original_path; *s != '\0'; ++s)
+			if (*s == '\\') *s = '/';
+		fdata->name = dir_name_from_path (fdata->full_path);
+	}
+	else {
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	}
+
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+
+	g_free (name_field);
+	g_strfreev (fields);
+}
+
+static void
+add_codepage_arg (FrCommand *comm)
+{
+	const char  *env_list[] = { "LC_CTYPE", "LC_ALL", "LANG", NULL };
+	const char **scan;
+	const char  *arg = "-cp949";
+
+	for (scan = env_list; *scan != NULL; ++scan) {
+		char *env = getenv (*scan);
+
+		if (! env)
+			continue;
+
+		if (strstr (env, "UTF-8") ||  strstr (env, "utf-8"))
+			arg = "-utf8";
+		else if (strstr (env, "euc") || strstr (env, "EUC"))
+			arg = "-euc-kr";
+		else
+			continue;
+		break;
+	}
+
+	fr_process_add_arg (comm->process, arg);
+}
+
+static void
+add_password_arg (FrCommand  *comm,
+		  const char *password,
+		  gboolean    disable_query)
+{
+	if (password != NULL) {
+		fr_process_add_arg (comm->process, "-pwd");
+		fr_process_add_arg (comm->process, password);
+	}
+	else if (disable_query) {
+		fr_process_add_arg (comm->process, "-pwd");
+		fr_process_add_arg (comm->process, "");
+	}
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandAlz *comm = data;
+
+	comm->list_started = FALSE;
+	comm->invalid_password = FALSE;
+}
+
+static void
+fr_command_alz_list (FrCommand  *comm)
+{
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process, process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "unalz");
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "-l");
+	add_codepage_arg(comm);
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_start (comm->process);
+}
+
+/* -- extract -- */
+
+static void
+process_extract_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		      gpointer  data)
+{
+	FrCommand     *comm = FR_COMMAND (data);
+	FrCommandAlz  *alz_comm = FR_COMMAND_ALZ (comm);
+
+	g_return_if_fail (line != NULL);
+
+	/* - error check - */
+
+	if (strncmp (line, "err code(28) (invalid password)", 31) == 0) {
+		alz_comm->invalid_password = TRUE;
+		fr_process_stop (comm->process);
+		return;
+	}
+
+	if (alz_comm->extract_none && (strncmp (line, "unalziiiing :", 13) == 0)) {
+		alz_comm->extract_none = FALSE;
+	}
+	else if ((strncmp (line, "done..", 6) == 0) && alz_comm->extract_none) {
+		fr_process_stop (comm->process);
+		return;
+	}
+}
+
+static void
+fr_command_alz_extract (FrCommand  *comm,
+		        const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	FR_COMMAND_ALZ (comm)->extract_none = TRUE;
+
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+				      process_extract_line,<--- You might need to cast the function pointer here
+				      comm);
+
+	fr_process_begin_command (comm->process, "unalz");
+	if (dest_dir != NULL) {
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, dest_dir);
+	}
+	add_codepage_arg (comm);
+	add_password_arg (comm, comm->password, TRUE);
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_alz_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	if (error->type == FR_PROC_ERROR_STOPPED) {
+		if  (FR_COMMAND_ALZ (comm)->extract_none ||
+		     FR_COMMAND_ALZ (comm)->invalid_password ) {
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+		}
+	}
+}
+
+const char *alz_mime_type[] = { "application/x-alz", NULL };
+
+static const char **
+fr_command_alz_get_mime_types (FrCommand *comm)
+{
+	return alz_mime_type;
+}
+
+static FrCommandCaps
+fr_command_alz_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("unalz", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_alz_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("unalz");
+}
+
+static void
+fr_command_alz_class_init (FrCommandAlzClass *class)
+{
+        GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_alz_finalize;
+
+        afc->list             = fr_command_alz_list;
+	afc->add              = NULL;
+	afc->delete           = NULL;
+	afc->extract          = fr_command_alz_extract;
+	afc->handle_error     = fr_command_alz_handle_error;
+	afc->get_mime_types   = fr_command_alz_get_mime_types;
+	afc->get_capabilities = fr_command_alz_get_capabilities;
+	afc->get_packages     = fr_command_alz_get_packages;
+}
+
+static void
+fr_command_alz_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_alz_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_ALZ (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_alz_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandAlzClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_alz_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandAlz),
+			0,
+			(GInstanceInitFunc) fr_command_alz_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FrCommandAlz",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/57.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/57.html new file mode 100644 index 0000000..a93f866 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/57.html @@ -0,0 +1,351 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ALZ_H
+#define FR_COMMAND_ALZ_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_ALZ            (fr_command_alz_get_type ())
+#define FR_COMMAND_ALZ(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ALZ, FrCommandAlz))
+#define FR_COMMAND_ALZ_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ALZ, FrCommandAlzClass))
+#define FR_IS_COMMAND_ALZ(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ALZ))
+#define FR_IS_COMMAND_ALZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ALZ))
+#define FR_COMMAND_ALZ_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ALZ, FrCommandAlzClass))
+
+typedef struct _FrCommandAlz       FrCommandAlz;
+typedef struct _FrCommandAlzClass  FrCommandAlzClass;
+
+struct _FrCommandAlz
+{
+	FrCommand  __parent;
+
+	gboolean extract_none;
+	gboolean invalid_password;
+	gboolean list_started;
+};
+
+struct _FrCommandAlzClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_alz_get_type (void);
+
+#endif /* FR_COMMAND_ALZ_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/58.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/58.html new file mode 100644 index 0000000..5972b26 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/58.html @@ -0,0 +1,863 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE /* strptime */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "fr-command.h"
+#include "fr-command-ar.h"
+
+#define LS_AR_DATE_FORMAT "%b %e %H:%M %Y"
+
+static void fr_command_ar_class_init  (FrCommandArClass *class);
+static void fr_command_ar_init        (FrCommand        *afile);
+static void fr_command_ar_finalize    (GObject          *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (const char  *time_s,
+                    int          index,
+                    char       **end)
+{
+        struct tm tm = {0, };
+        char *p;
+
+        tm.tm_isdst = -1;
+        p = strptime (time_s + index, LS_AR_DATE_FORMAT, &tm);
+        if (p != NULL)
+                *end = p + 1;
+        return mktime (&tm);
+}
+
+static void
+process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+	      gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	int          date_idx;
+	char        *field_size;
+	char        *field_name = NULL;
+
+	g_return_if_fail (line != NULL);
+
+	fdata = file_data_new ();
+
+	date_idx = file_list__get_index_from_pattern (line, "%c%c%c %a%n %n%n:%n%n %n%n%n%n");
+
+	field_size = file_list__get_prev_field (line, date_idx, 1);
+	fdata->size = g_ascii_strtoull (field_size, NULL, 10);
+	g_free (field_size);
+
+	fdata->modified = mktime_from_string (line, date_idx, &field_name);
+
+	/* Full path */
+
+	fields = g_strsplit (field_name, " -> ", 2);
+
+	if (fields[0] == NULL) {
+		g_strfreev (fields);
+		file_data_free (fdata);
+		return;
+	}
+
+	if (fields[1] == NULL) {
+		g_strfreev (fields);
+		fields = g_strsplit (field_name, " link to ", 2);
+	}
+
+	if (*(fields[0]) == '/') {
+		fdata->full_path = g_strdup (fields[0]);
+		fdata->original_path = fdata->full_path;
+	} else {
+		fdata->full_path = g_strconcat ("/", fields[0], NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	if (fields[1] != NULL)
+		fdata->link = g_strdup (fields[1]);
+	g_strfreev (fields);
+
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_ar_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "ar");
+	fr_process_add_arg (comm->process, "tv");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_ar_add (FrCommand     *comm,
+		   const char    *from_file,
+		   GList         *file_list,
+		   const char    *base_dir,
+		   gboolean       update,
+		   gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "ar");
+
+	if (update)
+		fr_process_add_arg (comm->process, "ru");
+	else
+		fr_process_add_arg (comm->process, "r");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_ar_delete (FrCommand  *comm,
+		      const char *from_file,
+		      GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "ar");
+	fr_process_add_arg (comm->process, "d");
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_ar_extract (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list,
+		       const char *dest_dir,
+		       gboolean    overwrite,
+		       gboolean    skip_older,
+		       gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "ar");
+
+	if (dest_dir != NULL)
+		fr_process_set_working_dir (comm->process, dest_dir);
+
+	fr_process_add_arg (comm->process, "x");
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_ar_handle_error (FrCommand   *comm,
+			    FrProcError *error)
+{
+	/* FIXME */
+}
+
+const char *ar_mime_type[] = { "application/x-archive",
+                               "application/vnd.debian.binary-package",
+                               NULL };
+
+static const char **
+fr_command_ar_get_mime_types (FrCommand *comm)
+{
+	return ar_mime_type;
+}
+
+static FrCommandCaps
+fr_command_ar_get_capabilities (FrCommand  *comm,
+			        const char *mime_type,
+				gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("ar", check_command)) {
+		if (is_mime_type (mime_type, "application/vnd.debian.binary-package"))
+			capabilities |= FR_COMMAND_CAN_READ;
+		else if (is_mime_type (mime_type, "application/x-archive"))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+
+	return capabilities;
+}
+
+static const char *
+fr_command_ar_get_packages (FrCommand  *comm,
+			    const char *mime_type)
+{
+	return PACKAGES ("binutils");
+}
+
+static void
+fr_command_ar_class_init (FrCommandArClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_ar_finalize;
+
+        afc->list             = fr_command_ar_list;
+	afc->add              = fr_command_ar_add;
+	afc->delete           = fr_command_ar_delete;
+	afc->extract          = fr_command_ar_extract;
+	afc->handle_error     = fr_command_ar_handle_error;
+	afc->get_mime_types   = fr_command_ar_get_mime_types;
+	afc->get_capabilities = fr_command_ar_get_capabilities;
+	afc->get_packages     = fr_command_ar_get_packages;
+}
+
+static void
+fr_command_ar_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_ar_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_AR (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_ar_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandArClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_ar_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandAr),
+			0,
+			(GInstanceInitFunc) fr_command_ar_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandAr",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/59.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/59.html new file mode 100644 index 0000000..54f18cf --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/59.html @@ -0,0 +1,341 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_AR_H
+#define FR_COMMAND_AR_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_AR            (fr_command_ar_get_type ())
+#define FR_COMMAND_AR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_AR, FrCommandAr))
+#define FR_COMMAND_AR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_AR, FrCommandArClass))
+#define FR_IS_COMMAND_AR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_AR))
+#define FR_IS_COMMAND_AR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_AR))
+#define FR_COMMAND_AR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_AR, FrCommandArClass))
+
+typedef struct _FrCommandAr       FrCommandAr;
+typedef struct _FrCommandArClass  FrCommandArClass;
+
+struct _FrCommandAr
+{
+	FrCommand  __parent;
+};
+
+struct _FrCommandArClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_ar_get_type (void);
+
+#endif /* FR_COMMAND_AR_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/6.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/6.html new file mode 100644 index 0000000..29b2cb0 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/6.html @@ -0,0 +1,453 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
/* eggsmclient.h
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_SM_CLIENT_H__
+#define __EGG_SM_CLIENT_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_SM_CLIENT            (egg_sm_client_get_type ())
+G_DECLARE_DERIVABLE_TYPE (EggSMClient, egg_sm_client, EGG, SM_CLIENT, GObject)
+
+typedef enum
+{
+    EGG_SM_CLIENT_END_SESSION_DEFAULT,
+    EGG_SM_CLIENT_LOGOUT,
+    EGG_SM_CLIENT_REBOOT,
+    EGG_SM_CLIENT_SHUTDOWN
+} EggSMClientEndStyle;
+
+typedef enum
+{
+    EGG_SM_CLIENT_MODE_DISABLED,
+    EGG_SM_CLIENT_MODE_NO_RESTART,
+    EGG_SM_CLIENT_MODE_NORMAL
+} EggSMClientMode;
+
+struct _EggSMClientClass
+{
+    GObjectClass parent_class;
+
+    /* signals */
+    void (*save_state)       (EggSMClient *client,
+                              GKeyFile    *state_file);
+
+    void (*quit_requested)   (EggSMClient *client);
+    void (*quit_cancelled)   (EggSMClient *client);
+    void (*quit)             (EggSMClient *client);
+
+    /* virtual methods */
+    void (*startup)             (EggSMClient          *client,
+                                 const char           *client_id);
+    void (*set_restart_command) (EggSMClient          *client,
+                                 int                   argc,
+                                 const char          **argv);
+	void (*set_discard_command) (EggSMClient          *client,
+                                 int                   argc,
+                                 const char          **argv);
+    void (*will_quit)           (EggSMClient          *client,
+                                 gboolean              will_quit);
+    gboolean (*end_session)     (EggSMClient          *client,
+                                 EggSMClientEndStyle   style,
+                                 gboolean              request_confirmation);
+
+    /* Padding for future expansion */
+    void (*_egg_reserved1) (void);
+    void (*_egg_reserved2) (void);
+    void (*_egg_reserved3) (void);
+    void (*_egg_reserved4) (void);
+};
+
+GOptionGroup    *egg_sm_client_get_option_group    (void);
+
+/* Initialization */
+void             egg_sm_client_set_mode            (EggSMClientMode mode);
+EggSMClientMode  egg_sm_client_get_mode            (void);
+EggSMClient     *egg_sm_client_get                 (void);
+
+/* Resuming a saved session */
+gboolean         egg_sm_client_is_resumed          (EggSMClient *client);
+GKeyFile        *egg_sm_client_get_state_file      (EggSMClient *client);
+
+/* Alternate means of saving state */
+void             egg_sm_client_set_restart_command (EggSMClient  *client,
+                                                    int           argc,
+                                                    const char  **argv);
+void             egg_sm_client_set_discard_command (EggSMClient  *client,
+                                                    int           argc,
+                                                    const char  **argv);
+
+/* Handling "quit_requested" signal */
+void             egg_sm_client_will_quit           (EggSMClient *client,
+                                                    gboolean     will_quit);
+
+/* Initiate a logout/reboot/shutdown */
+gboolean         egg_sm_client_end_session         (EggSMClientEndStyle  style,
+                                                    gboolean             request_confirmation);
+
+G_END_DECLS
+
+#endif /* __EGG_SM_CLIENT_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/60.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/60.html new file mode 100644 index 0000000..b47c7a4 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/60.html @@ -0,0 +1,1083 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-arj.h"
+
+static void fr_command_arj_class_init  (FrCommandArjClass *class);
+static void fr_command_arj_init        (FrCommand         *afile);
+static void fr_command_arj_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *date_s,
+		    char *time_s)
+{
+	struct tm   tm = {0, };
+	char      **fields;
+
+	tm.tm_isdst = -1;
+
+	/* date */
+
+	fields = g_strsplit (date_s, "-", 3);
+	if (fields[0] != NULL) {
+		/* warning : this will work until 2075 ;) */
+		int y = atoi (fields[0]);
+		if (y >= 75)
+			tm.tm_year = y;
+		else
+			tm.tm_year = 100 + y;
+
+		tm.tm_mon = atoi (fields[1]) - 1;
+		tm.tm_mday = atoi (fields[2]);
+	}
+	g_strfreev (fields);
+
+	/* time */
+
+	fields = g_strsplit (time_s, ":", 3);
+	if (fields[0] != NULL) {
+		tm.tm_hour = atoi (fields[0]);
+		if (fields[1] != NULL) {
+			tm.tm_min = atoi (fields[1]);
+			if (fields[2] != NULL)
+				tm.tm_sec = atoi (fields[2]);
+		}
+	}
+	g_strfreev (fields);
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,
+		    gpointer  data)
+{
+	FrCommand     *comm = FR_COMMAND (data);
+	FrCommandArj  *arj_comm = FR_COMMAND_ARJ (comm);
+
+	g_return_if_fail (line != NULL);
+
+	if (! arj_comm->list_started) {
+		if (strncmp (line, "--------", 8) == 0) {
+			arj_comm->list_started = TRUE;
+			arj_comm->line_no = 1;
+		}
+		return;
+	}
+
+	if (strncmp (line, "--------", 8) == 0) {
+		arj_comm->list_started = FALSE;
+		return;
+	}
+
+	if (g_regex_match (arj_comm->filename_line_regex, line, 0, NULL)) { /* Read the filename. */
+		FileData   *fdata;
+		const char *name_field;
+
+		arj_comm->line_no = 1;
+
+		arj_comm->fdata = fdata = file_data_new ();
+
+		name_field = get_last_field (line, 2);
+
+		if (*name_field == '/') {
+			fdata->full_path = g_strdup (name_field);
+			fdata->original_path = fdata->full_path;
+		}
+		else {
+			fdata->full_path = g_strconcat ("/", name_field, NULL);
+			fdata->original_path = fdata->full_path + 1;
+		}
+
+		fdata->link = NULL;
+
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+		fdata->path = remove_level_from_path (fdata->full_path);
+	}
+	else if (arj_comm->line_no == 2) { /* Read file size and date. */
+		FileData  *fdata;
+		char     **fields;
+
+		fdata = arj_comm->fdata;
+
+		/* read file info. */
+
+		fields = split_line (line, 10);
+		fdata->size = g_ascii_strtoull (fields[2], NULL, 10);
+		fdata->modified = mktime_from_string (fields[5], fields[6]);
+		if ((strcmp (fields[1], "MS-DOS") == 0) || (strcmp (fields[1], "WIN32") == 0))
+			fdata->encrypted = (g_ascii_strcasecmp (fields[7], "11") == 0);
+		else
+			fdata->encrypted = (g_ascii_strcasecmp (fields[9], "11") == 0);
+		g_strfreev (fields);
+
+		if (*fdata->name == 0)
+			file_data_free (fdata);
+		else
+			fr_command_add_file (comm, fdata);
+		arj_comm->fdata = NULL;
+	}
+
+	arj_comm->line_no++;
+}
+
+static void
+fr_command_arj_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);
+
+	fr_process_begin_command (comm->process, "arj");
+	fr_process_add_arg (comm->process, "v");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, "-");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_arj_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "arj");
+
+	fr_process_add_arg (comm->process, "a");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	if (update)
+		fr_process_add_arg (comm->process, "-u");
+
+	if (comm->password != NULL)
+		fr_process_add_arg_concat (comm->process, "-g/", comm->password, NULL);
+
+	switch (comm->compression) {
+	case FR_COMPRESSION_VERY_FAST:
+		fr_process_add_arg (comm->process, "-m3"); break;
+	case FR_COMPRESSION_FAST:
+		fr_process_add_arg (comm->process, "-m2"); break;
+	case FR_COMPRESSION_NORMAL:
+		fr_process_add_arg (comm->process, "-m1"); break;
+	case FR_COMPRESSION_MAXIMUM:
+		fr_process_add_arg (comm->process, "-m1"); break;
+	}
+
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, "-");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, (gchar*) scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_arj_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "arj");
+	fr_process_add_arg (comm->process, "d");
+
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, "-");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_arj_extract (FrCommand  *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "arj");
+
+	if (junk_paths)
+		fr_process_add_arg (comm->process, "e");
+	else
+		fr_process_add_arg (comm->process, "x");
+
+	if (dest_dir != NULL)
+		fr_process_add_arg_concat (comm->process, "-ht/", dest_dir, NULL);
+
+	if (! overwrite)
+		fr_process_add_arg (comm->process, "-n");
+
+	if (skip_older)
+		fr_process_add_arg (comm->process, "-u");
+
+	if (comm->password != NULL)
+		fr_process_add_arg_concat (comm->process, "-g/", comm->password, NULL);
+	else
+ 		fr_process_add_arg (comm->process, "-g/");
+
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, "-");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_arj_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "arj");
+	fr_process_add_arg (comm->process, "t");
+	if (comm->password != NULL)
+		fr_process_add_arg_concat (comm->process, "-g/", comm->password, NULL);
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, "-y");
+	fr_process_add_arg (comm->process, "-");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_arj_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	if (error->type != FR_PROC_ERROR_NONE) {
+ 		if (error->status <= 1)
+ 			error->type = FR_PROC_ERROR_NONE;
+		else if (error->status == 3)
+ 			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+ 	}
+}
+
+const char *arj_mime_type[] = { "application/x-arj", NULL };
+
+static const char **
+fr_command_arj_get_mime_types (FrCommand *comm)
+{
+	return arj_mime_type;
+}
+
+static FrCommandCaps
+fr_command_arj_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT;
+	if (is_program_available ("arj", check_command))
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_arj_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("arj");
+}
+
+static void
+fr_command_arj_class_init (FrCommandArjClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_arj_finalize;
+
+	afc->list             = fr_command_arj_list;
+	afc->add              = fr_command_arj_add;
+	afc->delete           = fr_command_arj_delete;
+	afc->extract          = fr_command_arj_extract;
+	afc->test             = fr_command_arj_test;
+	afc->handle_error     = fr_command_arj_handle_error;
+	afc->get_mime_types   = fr_command_arj_get_mime_types;
+	afc->get_capabilities = fr_command_arj_get_capabilities;
+	afc->get_packages     = fr_command_arj_get_packages;
+}
+
+static void
+fr_command_arj_init (FrCommand *comm)
+{
+	FrCommandArj *arj_comm;
+
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = FALSE;
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = TRUE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = TRUE;
+
+	arj_comm = FR_COMMAND_ARJ (comm);
+	arj_comm->list_started = FALSE;
+	arj_comm->fdata = FALSE;
+	arj_comm->filename_line_regex = g_regex_new ("[0-9]+\\) ", G_REGEX_OPTIMIZE, 0, NULL);
+}
+
+static void
+fr_command_arj_finalize (GObject *object)
+{
+	FrCommandArj *arj_comm;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_ARJ (object));
+
+	arj_comm = FR_COMMAND_ARJ (object);
+	g_regex_unref (arj_comm->filename_line_regex);
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_arj_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandArjClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_arj_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandArj),
+			0,
+			(GInstanceInitFunc) fr_command_arj_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandArj",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/61.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/61.html new file mode 100644 index 0000000..c402193 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/61.html @@ -0,0 +1,351 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ARJ_H
+#define FR_COMMAND_ARJ_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_ARJ            (fr_command_arj_get_type ())
+#define FR_COMMAND_ARJ(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ARJ, FrCommandArj))
+#define FR_COMMAND_ARJ_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ARJ, FrCommandArjClass))
+#define FR_IS_COMMAND_ARJ(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ARJ))
+#define FR_IS_COMMAND_ARJ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ARJ))
+#define FR_COMMAND_ARJ_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ARJ, FrCommandArjClass))
+
+typedef struct _FrCommandArj       FrCommandArj;
+typedef struct _FrCommandArjClass  FrCommandArjClass;
+
+struct _FrCommandArj
+{
+	FrCommand  __parent;
+
+	gboolean  list_started;
+	int       line_no;
+	FileData *fdata;
+	GRegex   *filename_line_regex;
+};
+
+struct _FrCommandArjClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_arj_get_type (void);
+
+#endif /* FR_COMMAND_ARJ_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/62.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/62.html new file mode 100644 index 0000000..ac9d986 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/62.html @@ -0,0 +1,1647 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-cfile.h"
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+static char *
+get_uncompressed_name_from_archive (FrCommand  *comm,<--- Parameter 'comm' can be declared as pointer to const
+				    const char *archive)
+{
+	GFile        *file;
+	GInputStream *stream;
+	char         *filename = NULL;
+
+	if (! is_mime_type (comm->mime_type, "application/x-gzip"))
+		return NULL;
+
+	file = g_file_new_for_path (archive);
+
+	stream = (GInputStream *) g_file_read (file, NULL, NULL);
+	if (stream != NULL) {
+		gboolean filename_present = TRUE;
+		char     buffer[10];
+
+		if (g_input_stream_read (stream, buffer, 10, NULL, NULL) >= 0) {
+			/* Check whether the FLG.FNAME is set */
+			if (((unsigned char)(buffer[3]) & 0x08) != 0x08)
+				filename_present = FALSE;
+
+			/* Check whether the FLG.FEXTRA is set */
+			if (((unsigned char)(buffer[3]) & 0x04) == 0x04)
+				filename_present = FALSE;
+		}
+
+		if (filename_present) {
+			GString *str = NULL;
+
+			str = g_string_new ("");
+			while (g_input_stream_read (stream, buffer, 1, NULL, NULL) > 0) {
+				if (buffer[0] == '\0') {
+					filename = g_strdup (file_name_from_path (str->str));
+#ifdef MATE_ENABLE_DEBUG
+					g_message ("filename is: %s", filename);
+#endif
+					break;
+				}
+				g_string_append_c (str, buffer[0]);
+			}
+			g_string_free (str, TRUE);
+		}
+		g_object_unref (stream);
+	}
+	g_object_unref (file);
+
+	return filename;
+}
+
+static void
+list__process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		    gpointer  data)
+{
+	FrCommand  *comm = FR_COMMAND (data);
+	FileData   *fdata;
+	char      **fields;
+	char       *filename;
+
+	fdata = file_data_new ();
+
+	fields = split_line (line, 2);
+	if (strcmp (fields[1], "-1") != 0)
+		fdata->size = g_ascii_strtoull (fields[1], NULL, 10);
+	g_strfreev (fields);
+
+	if (fdata->size == 0)
+		fdata->size = get_file_size (comm->filename);
+
+	filename = get_uncompressed_name_from_archive (comm, comm->filename);
+	if (filename == NULL)
+		filename = remove_extension_from_path (comm->filename);
+
+	fdata->full_path = g_strconcat ("/",
+					file_name_from_path (filename),
+					NULL);
+	g_free (filename);
+
+	fdata->original_path = fdata->full_path + 1;
+	fdata->link = NULL;
+	fdata->modified = get_file_mtime_for_path (comm->filename);
+
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_cfile_list (FrCommand  *comm)
+{
+	FrCommandCFile *comm_cfile = FR_COMMAND_CFILE (comm);
+
+	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
+		/* gzip let us known the uncompressed size */
+
+		fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+					      list__process_line,<--- You might need to cast the function pointer here
+					      comm);
+
+		fr_process_begin_command (comm->process, "gzip");
+		fr_process_add_arg (comm->process, "-l");
+		fr_process_add_arg (comm->process, "-q");
+		fr_process_add_arg (comm->process, comm->filename);
+		fr_process_end_command (comm->process);
+		fr_process_start (comm->process);
+	}
+	else {
+		/* ... other compressors do not support this feature so
+		 * simply use the archive size, suboptimal but there is no
+		 * alternative. */
+
+		FileData *fdata;
+		char     *filename;
+
+		fdata = file_data_new ();
+
+		filename = remove_extension_from_path (comm->filename);
+		fdata->full_path = g_strconcat ("/",
+						file_name_from_path (filename),
+						NULL);
+		g_free (filename);
+
+		fdata->original_path = fdata->full_path + 1;
+		fdata->link = NULL;
+		fdata->size = get_file_size_for_path (comm->filename);
+		fdata->modified = get_file_mtime_for_path (comm->filename);
+
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+		fdata->path = remove_level_from_path (fdata->full_path);
+
+		if (*fdata->name == 0)
+			file_data_free (fdata);
+		else
+			fr_command_add_file (comm, fdata);
+
+		comm_cfile->error.type = FR_PROC_ERROR_NONE;
+		comm_cfile->error.status = 0;
+		g_signal_emit_by_name (G_OBJECT (comm),
+				       "done",
+				       comm->action,
+				       &comm_cfile->error);
+	}
+}
+
+static void
+fr_command_cfile_add (FrCommand     *comm,
+		      const char    *from_file,
+		      GList         *file_list,
+		      const char    *base_dir,
+		      gboolean       update,
+		      gboolean       recursive)
+{
+	const char *filename = NULL;
+	char       *temp_dir = NULL;
+	char       *temp_file = NULL;
+	char       *compressed_filename = NULL;
+
+	if ((file_list == NULL) || (file_list->data == NULL))
+		return;
+
+	/* copy file to the temp dir */
+
+	temp_dir = get_temp_work_dir (NULL);
+	filename = file_list->data;
+	temp_file = g_strconcat (temp_dir, "/", filename, NULL);
+
+	fr_process_begin_command (comm->process, "cp");
+	fr_process_set_working_dir (comm->process, base_dir);
+	fr_process_add_arg (comm->process, "-f");
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, filename);
+	fr_process_add_arg (comm->process, temp_file);
+	fr_process_end_command (comm->process);
+
+	/**/
+
+	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
+		fr_process_begin_command (comm->process, "gzip");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".gz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
+		fr_process_begin_command (comm->process, "brotli");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".br", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
+		fr_process_begin_command (comm->process, "bzip2");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".bz2", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-compress")) {
+		fr_process_begin_command (comm->process, "compress");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".Z", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
+		fr_process_begin_command (comm->process, "lzip");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".lz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
+		fr_process_begin_command (comm->process, "lzma");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".lzma", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-xz")) {
+		fr_process_begin_command (comm->process, "xz");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".xz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
+		fr_process_begin_command (comm->process, "lzop");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "-fU");
+		fr_process_add_arg (comm->process, "--no-stdin");
+		fr_process_add_arg (comm->process, "--");
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".lzo", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-rzip")) {
+		fr_process_begin_command (comm->process, "rzip");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".rz", NULL);
+	}
+
+	else if (is_mime_type (comm->mime_type, "application/zstd")
+		 || is_mime_type (comm->mime_type, "application/x-zstd")) {
+		fr_process_begin_command (comm->process, "zstd");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+		compressed_filename = g_strconcat (filename, ".zst", NULL);
+	}
+
+	/* copy compressed file to the dest dir */
+
+	fr_process_begin_command (comm->process, "cp");
+	fr_process_set_working_dir (comm->process, temp_dir);
+	fr_process_add_arg (comm->process, "-f");
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, compressed_filename);
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+
+	/* remove the temp dir */
+
+	fr_process_begin_command (comm->process, "rm");
+	fr_process_set_sticky (comm->process, TRUE);
+	fr_process_add_arg (comm->process, "-rf");
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, temp_dir);
+	fr_process_end_command (comm->process);
+
+	g_free (compressed_filename);
+	g_free (temp_file);
+	g_free (temp_dir);
+}
+
+static void
+fr_command_cfile_delete (FrCommand  *comm,
+			 const char *from_file,
+			 GList      *file_list)
+{
+	/* never called */
+}
+
+static void
+fr_command_cfile_extract (FrCommand  *comm,
+			  const char *from_file,
+			  GList      *file_list,
+			  const char *dest_dir,
+			  gboolean    overwrite,
+			  gboolean    skip_older,
+			  gboolean    junk_paths)
+{
+	char *temp_dir;
+	char *dest_file;
+	char *temp_file;
+	char *uncompr_file;
+	char *compr_file;
+
+	/* copy file to the temp dir, remove the already existing file first */
+
+	temp_dir = get_temp_work_dir (NULL);
+	temp_file = g_strconcat (temp_dir,
+				 "/",
+				 file_name_from_path (comm->filename),
+				 NULL);
+
+	fr_process_begin_command (comm->process, "cp");
+	fr_process_add_arg (comm->process, "-f");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_add_arg (comm->process, temp_file);
+	fr_process_end_command (comm->process);
+
+	/* uncompress the file */
+
+	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
+		fr_process_begin_command (comm->process, "gzip");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, "-n");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
+		fr_process_begin_command (comm->process, "brotli");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
+		fr_process_begin_command (comm->process, "bzip2");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-compress")) {
+		if (is_program_in_path ("gzip")) {
+			fr_process_begin_command (comm->process, "gzip");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, "-n");
+		}
+		else
+			fr_process_begin_command (comm->process, "uncompress");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
+		fr_process_begin_command (comm->process, "lzip");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
+		fr_process_begin_command (comm->process, "lzma");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-xz")) {
+		fr_process_begin_command (comm->process, "xz");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
+		fr_process_begin_command (comm->process, "lzop");
+		fr_process_set_working_dir (comm->process, temp_dir);
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, "-fU");
+		fr_process_add_arg (comm->process, "--no-stdin");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-rzip")) {
+		fr_process_begin_command (comm->process, "rzip");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+
+	else if (is_mime_type (comm->mime_type, "application/zstd")
+		 || is_mime_type (comm->mime_type, "application/x-zstd")) {
+		fr_process_begin_command (comm->process, "zstd");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, temp_file);
+		fr_process_end_command (comm->process);
+	}
+
+	/* copy uncompress file to the dest dir */
+
+	uncompr_file = remove_extension_from_path (temp_file);
+
+	compr_file = get_uncompressed_name_from_archive (comm, comm->filename);
+	if (compr_file == NULL)
+		compr_file = remove_extension_from_path (file_name_from_path (comm->filename));
+	dest_file = g_strconcat (dest_dir,
+				 "/",
+				 compr_file,
+				 NULL);
+
+	fr_process_begin_command (comm->process, "cp");
+	fr_process_add_arg (comm->process, "-f");
+	fr_process_add_arg (comm->process, uncompr_file);
+	fr_process_add_arg (comm->process, dest_file);
+	fr_process_end_command (comm->process);
+
+	/* remove the temp dir */
+
+	fr_process_begin_command (comm->process, "rm");
+	fr_process_set_sticky (comm->process, TRUE);
+	fr_process_add_arg (comm->process, "-rf");
+	fr_process_add_arg (comm->process, temp_dir);
+	fr_process_end_command (comm->process);
+
+	g_free (dest_file);
+	g_free (compr_file);
+	g_free (uncompr_file);
+	g_free (temp_file);
+	g_free (temp_dir);
+}
+
+static void
+fr_command_cfile_test (FrCommand   *comm)
+{
+	const char *compress_cmd;
+	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
+		compress_cmd = "gzip";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
+		compress_cmd = "brotli";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
+		compress_cmd = "bzip2";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-compress")) {
+		compress_cmd = is_program_in_path ("gzip") ? "gzip" : "uncompress";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
+		compress_cmd = "lzip";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
+		compress_cmd = "lzma";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-xz")) {
+		compress_cmd = "xz";
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
+		compress_cmd = "lzop";
+	}
+	else if (is_mime_type (comm->mime_type, "application/zstd")
+		 || is_mime_type (comm->mime_type, "application/x-zstd")) {
+		compress_cmd = "zstd";
+		fr_process_begin_command (comm->process, compress_cmd);
+		fr_process_add_arg (comm->process, "-v");
+		fr_process_add_arg (comm->process, "--test");
+		fr_process_add_arg (comm->process, comm->filename);
+		fr_process_end_command (comm->process);
+		return;
+	} else { // i.e. if (is_mime_type (comm->mime_type, "application/x-rzip"))
+		g_warning ("Test integrity is unsupported for %s\n", comm->mime_type);
+		return;
+	}
+	fr_process_begin_command (comm->process, compress_cmd);
+	fr_process_add_arg (comm->process, "-vt"); // verbose and test
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+const char *cfile_mime_type[] = { "application/x-gzip",
+				  "application/x-brotli",
+				  "application/x-bzip",
+				  "application/x-compress",
+				  "application/x-lzip",
+				  "application/x-lzma",
+				  "application/x-lzop",
+				  "application/x-rzip",
+				  "application/x-xz",
+				  "application/zstd",
+				  "application/x-zstd",
+				  NULL };
+
+static const char **
+fr_command_cfile_get_mime_types (FrCommand *comm)
+{
+	return cfile_mime_type;
+}
+
+static FrCommandCaps
+fr_command_cfile_get_capabilities (FrCommand  *comm,
+				   const char *mime_type,
+				   gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_DO_NOTHING;
+	if (is_mime_type (mime_type, "application/x-gzip")) {
+		if (is_program_available ("gzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-brotli")) {
+		if (is_program_available ("brotli", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-bzip")) {
+		if (is_program_available ("bzip2", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-compress")) {
+		if (is_program_available ("compress", check_command))
+			capabilities |= FR_COMMAND_CAN_WRITE;
+		if (is_program_available ("uncompress", check_command) || is_program_available ("gzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzip")) {
+		if (is_program_available ("lzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzma")) {
+		if (is_program_available ("lzma", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-xz")) {
+		if (is_program_available ("xz", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzop")) {
+		if (is_program_available ("lzop", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-rzip")) {
+		if (is_program_available ("rzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/zstd")
+		 || is_mime_type (mime_type, "application/x-zstd")) {
+		if (is_program_available ("zstd", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+
+	return capabilities;
+}
+
+static void
+fr_command_cfile_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_CFILE (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static const char *
+fr_command_cfile_get_packages (FrCommand  *comm,
+			       const char *mime_type)
+{
+	if (is_mime_type (mime_type, "application/x-gzip"))
+		return PACKAGES ("gzip");
+	else if (is_mime_type (mime_type, "application/x-brotli"))
+		return PACKAGES ("brotli");
+	else if (is_mime_type (mime_type, "application/x-bzip"))
+		return PACKAGES ("bzip2");
+	else if (is_mime_type (mime_type, "application/x-compress"))
+		return PACKAGES ("ncompress");
+	else if (is_mime_type (mime_type, "application/x-lzip"))
+		return PACKAGES ("lzip");
+	else if (is_mime_type (mime_type, "application/x-lzma"))
+		return PACKAGES ("lzma");
+	else if (is_mime_type (mime_type, "application/x-xz"))
+		return PACKAGES ("xz");
+	else if (is_mime_type (mime_type, "application/x-lzop"))
+		return PACKAGES ("lzop");
+	else if (is_mime_type (mime_type, "application/x-rzip"))
+		return PACKAGES ("rzip");
+	else if (is_mime_type (mime_type, "application/zstd")
+		 || is_mime_type (mime_type, "application/x-zstd"))
+		return PACKAGES ("zstd");
+
+	return NULL;
+}
+
+static void
+fr_command_cfile_class_init (FrCommandCFileClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_cfile_finalize;
+
+	afc->list             = fr_command_cfile_list;
+	afc->add              = fr_command_cfile_add;
+	afc->delete           = fr_command_cfile_delete;
+	afc->extract          = fr_command_cfile_extract;
+	afc->test             = fr_command_cfile_test;
+	afc->get_mime_types   = fr_command_cfile_get_mime_types;
+	afc->get_capabilities = fr_command_cfile_get_capabilities;
+	afc->get_packages     = fr_command_cfile_get_packages;
+}
+
+static void
+fr_command_cfile_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = TRUE;
+}
+
+GType
+fr_command_cfile_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandCFileClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_cfile_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandCFile),
+			0,
+			(GInstanceInitFunc) fr_command_cfile_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandCFile",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/63.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/63.html new file mode 100644 index 0000000..e9c4236 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/63.html @@ -0,0 +1,349 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_CFILE_H
+#define FR_COMMAND_CFILE_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "typedefs.h"
+
+#define FR_TYPE_COMMAND_CFILE            (fr_command_cfile_get_type ())
+#define FR_COMMAND_CFILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFile))
+#define FR_COMMAND_CFILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass))
+#define FR_IS_COMMAND_CFILE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_CFILE))
+#define FR_IS_COMMAND_CFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_CFILE))
+#define FR_COMMAND_CFILE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass))
+
+typedef struct _FrCommandCFile       FrCommandCFile;
+typedef struct _FrCommandCFileClass  FrCommandCFileClass;
+
+struct _FrCommandCFile
+{
+	FrCommand  __parent;
+
+	/*<private>*/
+
+	FrProcError error;
+};
+
+struct _FrCommandCFileClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_cfile_get_type (void);
+
+#endif /* FR_COMMAND_CFILE_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/64.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/64.html new file mode 100644 index 0000000..9f29cf7 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/64.html @@ -0,0 +1,875 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-cpio.h"
+
+static void fr_command_cpio_class_init  (FrCommandCpioClass *class);
+static void fr_command_cpio_init        (FrCommand         *afile);
+static void fr_command_cpio_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *month,<--- Parameter 'month' can be declared as pointer to const
+		    char *mday,<--- Parameter 'mday' can be declared as pointer to const
+		    char *year)
+{
+	struct tm tm = {0, };
+
+	tm.tm_isdst = -1;
+
+	if (month != NULL) {
+		static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+		                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+		int i;
+
+		for (i = 0; i < 12; i++) {
+			if (strcmp (months[i], month) == 0) {
+				tm.tm_mon = i;
+				break;
+			}
+		}
+	}
+	tm.tm_mday = atoi (mday);
+	if (strchr (year, ':') != NULL) {
+		char **fields = g_strsplit (year, ":", 2);
+		if ((fields != NULL) && (g_strv_length (fields) == 2)) {
+	        	time_t      now;
+        		struct tm  *now_tm;<--- Variable 'now_tm' can be declared as pointer to const
+
+	  		tm.tm_hour = atoi (fields[0]);
+	  		tm.tm_min = atoi (fields[1]);
+
+	  		now = time(NULL);
+	  		now_tm = localtime (&now);
+	  		tm.tm_year = now_tm->tm_year;
+        	}
+	} else
+		tm.tm_year = atoi (year) - 1900;
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		    gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	const char  *name_field;
+	char        *name;
+	int          ofs = 0;<--- Variable 'ofs' is assigned a value that is never used.
+
+	g_return_if_fail (line != NULL);
+
+	fdata = file_data_new ();
+
+#ifdef __sun
+	fields = split_line (line, 9);
+	fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+	fdata->modified = mktime_from_string (fields[5], fields[6], fields[8]);
+	g_strfreev (fields);
+
+	name_field = get_last_field (line, 10);
+#else /* !__sun */
+	/* Handle char and block device files */
+	if ((line[0] == 'c') || (line[0] == 'b')) {
+		fields = split_line (line, 9);
+		ofs = 1;
+		fdata->size = 0;
+		/* FIXME: We should also specify the content type */
+	}
+	else {
+		fields = split_line (line, 8);
+		fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+	}
+	fdata->modified = mktime_from_string (fields[5+ofs], fields[6+ofs], fields[7+ofs]);
+	g_strfreev (fields);
+
+	name_field = get_last_field (line, 9+ofs);
+#endif /* !__sun */
+
+	fields = g_strsplit (name_field, " -> ", 2);
+
+	if (fields[1] == NULL) {
+		g_strfreev (fields);
+		fields = g_strsplit (name_field, " link to ", 2);
+	}
+
+	fdata->dir = line[0] == 'd';
+
+	name = g_strcompress (fields[0]);
+	if (*(fields[0]) == '/') {
+		fdata->full_path = g_strdup (name);
+		fdata->original_path = fdata->full_path;
+	}
+	else {
+		fdata->full_path = g_strconcat ("/", name, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	if (fdata->dir && (name[strlen (name) - 1] != '/')) {
+		char *old_full_path = fdata->full_path;
+		fdata->full_path = g_strconcat (old_full_path, "/", NULL);
+		g_free (old_full_path);
+		fdata->original_path = g_strdup (name);
+		fdata->free_original_path = TRUE;
+	}
+	g_free (name);
+
+	if (fields[1] != NULL)
+		fdata->link = g_strcompress (fields[1]);
+	g_strfreev (fields);
+
+	if (fdata->dir)
+		fdata->name = dir_name_from_path (fdata->full_path);
+	else
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_cpio_list (FrCommand  *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "sh");
+	fr_process_add_arg (comm->process, "-c");
+	fr_process_add_arg_concat (comm->process, CPIO_PATH " -itv < ", comm->e_filename, NULL);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_cpio_extract (FrCommand *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList   *scan;
+	GString *cmd;
+
+	fr_process_begin_command (comm->process, "sh");
+	if (dest_dir != NULL)
+                fr_process_set_working_dir (comm->process, dest_dir);
+	fr_process_add_arg (comm->process, "-c");
+
+	cmd = g_string_new ("cpio -idu --no-absolute-filenames ");
+	for (scan = file_list; scan; scan = scan->next) {
+		char *filepath = scan->data;
+		char *filename;
+
+		if (filepath[0] == '/')
+			filename = g_shell_quote (filepath + 1);
+		else
+			filename = g_shell_quote (filepath);
+		g_string_append (cmd, filename);
+		g_string_append (cmd, " ");
+
+		g_free (filename);
+	}
+        g_string_append (cmd, " < ");
+	g_string_append (cmd, comm->e_filename);
+	fr_process_add_arg (comm->process, cmd->str);
+	g_string_free (cmd, TRUE);
+
+	fr_process_end_command (comm->process);
+}
+
+const char *cpio_mime_type[] = { /*"application/x-cpio",*/ NULL };
+
+static const char **
+fr_command_cpio_get_mime_types (FrCommand *comm)
+{
+	return cpio_mime_type;
+}
+
+static FrCommandCaps
+fr_command_cpio_get_capabilities (FrCommand  *comm,
+			          const char *mime_type,
+				  gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+/*	if (is_program_available (CPIO_PATH, check_command))
+		capabilities |= FR_COMMAND_CAN_READ;*/
+
+	return capabilities;
+}
+
+static const char *
+fr_command_cpio_get_packages (FrCommand  *comm,
+			      const char *mime_type)
+{
+	return PACKAGES ("cpio");
+}
+
+static void
+fr_command_cpio_class_init (FrCommandCpioClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_cpio_finalize;
+
+        afc->list             = fr_command_cpio_list;
+	afc->extract          = fr_command_cpio_extract;
+	afc->get_mime_types   = fr_command_cpio_get_mime_types;
+	afc->get_capabilities = fr_command_cpio_get_capabilities;
+	afc->get_packages     = fr_command_cpio_get_packages;
+}
+
+static void
+fr_command_cpio_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = FALSE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propAddCanStoreFolders       = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_cpio_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_CPIO (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_cpio_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandCpioClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_cpio_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandCpio),
+			0,
+			(GInstanceInitFunc) fr_command_cpio_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandCpio",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/65.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/65.html new file mode 100644 index 0000000..5412107 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/65.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_CPIO_H
+#define FR_COMMAND_CPIO_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_CPIO            (fr_command_cpio_get_type ())
+#define FR_COMMAND_CPIO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_CPIO, FrCommandCpio))
+#define FR_COMMAND_CPIO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_CPIO, FrCommandCpioClass))
+#define FR_IS_COMMAND_CPIO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_CPIO))
+#define FR_IS_COMMAND_CPIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_CPIO))
+#define FR_COMMAND_CPIO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_CPIO, FrCommandCpioClass))
+
+typedef struct _FrCommandCpio       FrCommandCpio;
+typedef struct _FrCommandCpioClass  FrCommandCpioClass;
+
+struct _FrCommandCpio
+{
+	FrCommand  __parent;
+	gboolean   is_empty;
+};
+
+struct _FrCommandCpioClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_cpio_get_type (void);
+
+#endif /* FR_COMMAND_CPIO_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/66.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/66.html new file mode 100644 index 0000000..3f0c510 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/66.html @@ -0,0 +1,851 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE /* strptime */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-dpkg.h"
+
+#define LSDPKG_DATE_FORMAT "%Y-%m-%d %H:%M"
+
+static void fr_command_dpkg_class_init  (FrCommandDpkgClass *class);
+static void fr_command_dpkg_init        (FrCommand         *afile);
+static void fr_command_dpkg_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+static time_t
+mktime_from_string (const char *time_s)
+{
+        struct tm tm = {0, };
+        tm.tm_isdst = -1;
+        strptime (time_s, LSDPKG_DATE_FORMAT, &tm);
+        return mktime (&tm);
+}
+
+static void
+process_metadata_line (char      *line,<--- Parameter 'line' can be declared as pointer to const
+                       FrCommand *comm)
+{
+        FileData    *fdata;
+        char       **fields;
+        char        *name;
+
+        g_return_if_fail (line != NULL);
+
+        fields = split_line (line, 5);
+        if (!fields[1] || !g_str_equal (fields[1], "bytes,")) {
+                g_strfreev (fields);
+                return;
+        }
+
+        fdata = file_data_new ();
+        fdata->size = g_ascii_strtoull (fields[0], NULL, 10);
+
+        if (g_str_equal (fields[4],"*")) {
+                g_strfreev (fields);
+                fields = split_line (line, 6);
+                name = g_strdup (fields[5]);
+        } else {
+                name = g_strdup (get_last_field (line, 5));
+        }
+        g_strstrip (name);
+
+        fdata->full_path = g_strconcat ("/DEBIAN/", name, NULL);
+        fdata->original_path = fdata->full_path + 1;
+
+        g_strfreev (fields);
+
+        fdata->name = g_strdup (name);
+        g_free (name);
+        fdata->path = g_strdup ("DEBIAN");
+        fr_command_add_file (comm, fdata);
+}
+
+static void
+process_data_line (char     *line,
+                   gpointer  data)
+{
+        FileData    *fdata;
+        FrCommand   *comm = FR_COMMAND (data);
+        char       **fields;
+	char        *time_s;
+        const char  *name;
+
+        g_return_if_fail (line != NULL);
+
+        if (line[0] == ' ') {
+                /* This is the output of dpkg-deb -I */
+                process_metadata_line (line, comm);
+                return;
+        }
+
+        fdata = file_data_new ();
+
+        fields = split_line (line, 5);
+
+        fdata->size = g_ascii_strtoull (fields[2], NULL, 10);
+
+	time_s = g_strjoin (" ", fields[3], fields[4], NULL);
+	fdata->modified = mktime_from_string (time_s);
+	g_free (time_s);
+
+        name = get_last_field (line, 6);
+        fields = g_strsplit (name, " -> ", 2);
+
+        fdata->dir = line[0] == 'd';
+        name = fields[0];
+        if (g_str_has_prefix (name, "./")) { /* Should generally be the case */
+                fdata->full_path = g_strdup (name + 1);
+                fdata->original_path = fdata->full_path + 1;
+        } else if (name[0] == '/') {
+                fdata->full_path = g_strdup (name);
+                fdata->original_path = fdata->full_path;
+        } else {
+                fdata->full_path = g_strconcat ("/", name, NULL);
+                fdata->original_path = fdata->full_path + 1;
+        }
+        if (fdata->dir && (name[strlen (name) - 1] != '/')) {
+                char *old_full_path = fdata->full_path;
+                fdata->full_path = g_strconcat (old_full_path, "/", NULL);
+                g_free (old_full_path);
+                fdata->original_path = g_strdup (name);
+                fdata->free_original_path = TRUE;
+        }
+
+        if (fields[1] != NULL)
+                fdata->link = g_strdup (fields[1]);
+        g_strfreev (fields);
+
+        if (fdata->dir)
+                fdata->name = dir_name_from_path (fdata->full_path);
+        else
+                fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+        fdata->path = remove_level_from_path (fdata->full_path);
+
+        if (*fdata->name == 0)
+                file_data_free (fdata);
+        else
+                fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_dpkg_list (FrCommand *comm)
+{
+        fr_process_set_out_line_func (comm->process, process_data_line, comm);
+
+        fr_process_begin_command (comm->process, "dpkg-deb");
+        fr_process_add_arg (comm->process, "-I");
+        fr_process_add_arg (comm->process, comm->filename);
+        fr_process_end_command (comm->process);
+        fr_process_start (comm->process);
+
+        fr_process_begin_command (comm->process, "dpkg-deb");
+        fr_process_add_arg (comm->process, "-c");
+        fr_process_add_arg (comm->process, comm->filename);
+        fr_process_end_command (comm->process);
+        fr_process_start (comm->process);
+}
+
+static void
+fr_command_dpkg_extract (FrCommand  *comm,
+                         const char *from_file,
+                         GList      *file_list,
+                         const char *dest_dir,
+                         gboolean    overwrite,
+                         gboolean    skip_older,
+                         gboolean    junk_paths)
+{
+        fr_process_begin_command (comm->process, "dpkg-deb");
+        fr_process_add_arg (comm->process, "-x");
+        fr_process_add_arg (comm->process, comm->filename);
+        if (dest_dir != NULL) {
+                fr_process_add_arg (comm->process, dest_dir);
+        } else {
+                fr_process_add_arg (comm->process, ".");
+        }
+        /* FIXME it is not possible to unpack only some files */
+        fr_process_end_command (comm->process);
+
+        /* Also extract metadata in DEBIAN/ */
+        fr_process_begin_command (comm->process, "dpkg-deb");
+        if (dest_dir != NULL) {
+                fr_process_set_working_dir (comm->process, dest_dir);
+        }
+        fr_process_add_arg (comm->process, "-e");
+        fr_process_add_arg (comm->process, comm->filename);
+        fr_process_end_command (comm->process);
+}
+
+const char *dpkg_mime_type[] = { "application/vnd.debian.binary-package", NULL };
+
+static const char **
+fr_command_dpkg_get_mime_types (FrCommand *comm)
+{
+        return dpkg_mime_type;
+}
+
+static FrCommandCaps
+fr_command_dpkg_get_capabilities (FrCommand  *comm,
+                                  const char *mime_type,
+                                  gboolean    check_command)
+{
+        FrCommandCaps capabilities;
+
+        capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+        if (is_program_available ("dpkg-deb", check_command))
+                capabilities |= FR_COMMAND_CAN_READ;
+
+        return capabilities;
+}
+
+static const char *
+fr_command_dpkg_get_packages (FrCommand  *comm,
+                              const char *mime_type)
+{
+        return PACKAGES ("dpkg");
+}
+
+static void
+fr_command_dpkg_class_init (FrCommandDpkgClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+        afc = (FrCommandClass*) class;
+
+        gobject_class->finalize = fr_command_dpkg_finalize;
+
+        afc->list             = fr_command_dpkg_list;
+        afc->extract          = fr_command_dpkg_extract;
+        afc->get_mime_types   = fr_command_dpkg_get_mime_types;
+        afc->get_capabilities = fr_command_dpkg_get_capabilities;
+        afc->get_packages     = fr_command_dpkg_get_packages;
+}
+
+static void
+fr_command_dpkg_init (FrCommand *comm)
+{
+        comm->propAddCanUpdate             = FALSE;
+        comm->propAddCanReplace            = FALSE;
+        comm->propExtractCanAvoidOverwrite = FALSE;
+        comm->propExtractCanSkipOlder      = FALSE;
+        comm->propExtractCanJunkPaths      = FALSE;
+        comm->propPassword                 = FALSE;
+        comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_dpkg_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_DPKG (object));
+
+        /* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+                G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_dpkg_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+                        sizeof (FrCommandDpkgClass),
+                        NULL,
+                        NULL,
+                        (GClassInitFunc) fr_command_dpkg_class_init,
+                        NULL,
+                        NULL,
+                        sizeof (FrCommandDpkg),
+                        0,
+                        (GInstanceInitFunc) fr_command_dpkg_init,
+			NULL
+                };
+
+                type = g_type_register_static (FR_TYPE_COMMAND,
+                                               "FRCommandDpkg",
+                                               &type_info,
+                                               0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/67.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/67.html new file mode 100644 index 0000000..c685e46 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/67.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_DPKG_H
+#define FR_COMMAND_DPKG_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_DPKG            (fr_command_dpkg_get_type ())
+#define FR_COMMAND_DPKG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_DPKG, FrCommandDpkg))
+#define FR_COMMAND_DPKG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_DPKG, FrCommandDpkgClass))
+#define FR_IS_COMMAND_DPKG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_DPKG))
+#define FR_IS_COMMAND_DPKG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_DPKG))
+#define FR_COMMAND_DPKG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_DPKG, FrCommandDpkgClass))
+
+typedef struct _FrCommandDpkg       FrCommandDpkg;
+typedef struct _FrCommandDpkgClass  FrCommandDpkgClass;
+
+struct _FrCommandDpkg
+{
+	FrCommand  __parent;
+	gboolean   is_empty;
+};
+
+struct _FrCommandDpkgClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_dpkg_get_type (void);
+
+#endif /* FR_COMMAND_DPKG_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/68.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/68.html new file mode 100644 index 0000000..c4598bb --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/68.html @@ -0,0 +1,851 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2004 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-iso.h"
+
+static void fr_command_iso_class_init  (FrCommandIsoClass *class);
+static void fr_command_iso_init        (FrCommand         *afile);
+static void fr_command_iso_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+static time_t
+mktime_from_string (char *month,<--- Parameter 'month' can be declared as pointer to const
+		    char *mday,<--- Parameter 'mday' can be declared as pointer to const
+		    char *year)<--- Parameter 'year' can be declared as pointer to const
+{
+	struct tm tm = {0, };
+
+	tm.tm_isdst = -1;
+
+	if (month != NULL) {
+		static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+		                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+		int i;
+
+		for (i = 0; i < 12; i++) {
+			if (strcmp (months[i], month) == 0) {
+				tm.tm_mon = i;
+				break;
+			}
+		}
+	}
+	tm.tm_mday = atoi (mday);
+	tm.tm_year = atoi (year) - 1900;
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		    gpointer  data)
+{
+	FileData      *fdata;
+	FrCommand     *comm = FR_COMMAND (data);
+	FrCommandIso  *comm_iso = FR_COMMAND_ISO (comm);
+	char         **fields;
+	const char    *name_field;
+
+	g_return_if_fail (line != NULL);
+
+	if (line[0] == 'd') /* Ignore directories. */
+		return;
+
+	if (line[0] == 'D') {
+		g_free (comm_iso->cur_path);
+		comm_iso->cur_path = g_strdup (get_last_field (line, 4));
+
+	} else if (line[0] == '-') { /* Is file */
+		const char *last_field, *first_bracket;
+
+		fdata = file_data_new ();
+
+		fields = split_line (line, 8);
+		fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+		fdata->modified = mktime_from_string (fields[5], fields[6], fields[7]);
+		g_strfreev (fields);
+
+		/* Full path */
+
+		last_field = get_last_field (line, 9);
+		first_bracket = strchr (last_field, ']');
+		if (first_bracket == NULL) {
+			file_data_free (fdata);
+			return;
+		}
+
+		name_field = eat_spaces (first_bracket + 1);
+		if ((name_field == NULL)
+		    || (strcmp (name_field, ".") == 0)
+		    || (strcmp (name_field, "..") == 0)) {
+			file_data_free (fdata);
+			return;
+		}
+
+		if (comm_iso->cur_path[0] != '/')
+			fdata->full_path = g_strstrip (g_strconcat ("/", comm_iso->cur_path, name_field, NULL));
+		else
+			fdata->full_path = g_strstrip (g_strconcat (comm_iso->cur_path, name_field, NULL));
+		fdata->original_path = fdata->full_path;
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+		fdata->path = remove_level_from_path (fdata->full_path);
+
+		fr_command_add_file (comm, fdata);
+	}
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandIso *comm = data;
+
+	g_free (comm->cur_path);
+	comm->cur_path = NULL;
+}
+
+static void
+fr_command_iso_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "sh");
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, SHDIR "isoinfo.sh");
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_add_arg (comm->process, "-l");
+	fr_process_end_command (comm->process);
+
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_iso_extract (FrCommand  *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char       *path = scan->data;<--- Variable 'path' can be declared as pointer to const
+		const char *filename;
+		char       *file_dir;
+		char       *temp_dest_dir = NULL;
+
+		filename = file_name_from_path (path);
+		file_dir = remove_level_from_path (path);
+		if ((file_dir != NULL) && (strcmp (file_dir, "/") != 0))
+			temp_dest_dir = g_build_filename (dest_dir, file_dir, NULL);
+		 else
+			temp_dest_dir = g_strdup (dest_dir);
+		g_free (file_dir);
+
+		if (temp_dest_dir == NULL)
+			continue;
+
+		make_directory_tree_from_path (temp_dest_dir, 0700, NULL);
+
+		fr_process_begin_command (comm->process, "sh");
+		fr_process_set_working_dir (comm->process, temp_dest_dir);
+		fr_process_add_arg (comm->process, SHDIR "isoinfo.sh");
+		fr_process_add_arg (comm->process, "-i");
+		fr_process_add_arg (comm->process, comm->filename);
+		fr_process_add_arg (comm->process, "-x");
+		fr_process_add_arg (comm->process, path);
+		fr_process_add_arg (comm->process, filename);
+		fr_process_end_command (comm->process);
+
+		g_free (temp_dest_dir);
+	}
+}
+
+const char *iso_mime_type[] = { "application/x-cd-image", NULL };
+
+static const char **
+fr_command_iso_get_mime_types (FrCommand *comm)
+{
+	return iso_mime_type;
+}
+
+static FrCommandCaps
+fr_command_iso_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("isoinfo", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_iso_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("genisoimage");
+}
+
+static void
+fr_command_iso_class_init (FrCommandIsoClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_iso_finalize;
+
+	afc->list             = fr_command_iso_list;
+	afc->extract          = fr_command_iso_extract;
+	afc->get_mime_types   = fr_command_iso_get_mime_types;
+	afc->get_capabilities = fr_command_iso_get_capabilities;
+	afc->get_packages     = fr_command_iso_get_packages;
+}
+
+static void
+fr_command_iso_init (FrCommand *comm)
+{
+	FrCommandIso *comm_iso = FR_COMMAND_ISO (comm);
+
+	comm_iso->cur_path = NULL;
+	comm_iso->joliet = TRUE;
+
+	comm->propAddCanUpdate             = FALSE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = FALSE;
+	comm->propCanExtractAll            = FALSE;
+}
+
+static void
+fr_command_iso_finalize (GObject *object)
+{
+	FrCommandIso *comm_iso;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_ISO (object));
+
+	comm_iso = FR_COMMAND_ISO (object);
+
+	g_free (comm_iso->cur_path);
+	comm_iso->cur_path = NULL;
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_iso_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandIsoClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_iso_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandIso),
+			0,
+			(GInstanceInitFunc) fr_command_iso_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandIso",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/69.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/69.html new file mode 100644 index 0000000..36e310b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/69.html @@ -0,0 +1,345 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ISO_H
+#define FR_COMMAND_ISO_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_ISO            (fr_command_iso_get_type ())
+#define FR_COMMAND_ISO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ISO, FrCommandIso))
+#define FR_COMMAND_ISO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ISO, FrCommandIsoClass))
+#define FR_IS_COMMAND_ISO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ISO))
+#define FR_IS_COMMAND_ISO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ISO))
+#define FR_COMMAND_ISO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ISO, FrCommandIsoClass))
+
+typedef struct _FrCommandIso       FrCommandIso;
+typedef struct _FrCommandIsoClass  FrCommandIsoClass;
+
+struct _FrCommandIso
+{
+	FrCommand  __parent;
+	char      *cur_path;
+	gboolean   joliet;
+};
+
+struct _FrCommandIsoClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_iso_get_type (void);
+
+#endif /* FR_COMMAND_ISO_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/7.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/7.html new file mode 100644 index 0000000..6455e1c --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/7.html @@ -0,0 +1,327 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
/* eggsmclient-private.h
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_SM_CLIENT_PRIVATE_H__
+#define __EGG_SM_CLIENT_PRIVATE_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggsmclient.h"
+
+G_BEGIN_DECLS
+
+GKeyFile *egg_sm_client_save_state     (EggSMClient *client);
+void      egg_sm_client_quit_requested (EggSMClient *client);
+void      egg_sm_client_quit_cancelled (EggSMClient *client);
+void      egg_sm_client_quit           (EggSMClient *client);
+
+#ifdef EGG_SM_CLIENT_BACKEND_XSMP
+    GType        egg_sm_client_xsmp_get_type (void);
+    EggSMClient *egg_sm_client_xsmp_new      (void);
+#endif
+#ifdef EGG_SM_CLIENT_BACKEND_DBUS
+    GType        egg_sm_client_dbus_get_type (void);
+    EggSMClient *egg_sm_client_dbus_new      (void);
+#endif
+
+G_END_DECLS
+
+#endif /* __EGG_SM_CLIENT_PRIVATE_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/70.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/70.html new file mode 100644 index 0000000..7a05145 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/70.html @@ -0,0 +1,815 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-utils.h"
+#include "fr-command.h"
+#include "fr-command-zip.h"
+#include "fr-command-jar.h"
+#include "java-utils.h"
+
+typedef struct {
+	char *filename;
+	char *rel_path;
+	char *package_minus_one_level;
+	char *link_name;		/* package dir = package_minus_one_level + '/' + link_name */
+} JarData;
+
+static void fr_command_jar_class_init  (FrCommandJarClass *class);
+static void fr_command_jar_init        (FrCommand         *afile);
+static void fr_command_jar_finalize    (GObject           *object);
+
+static FrCommandClass *parent_class = NULL;
+
+static void
+fr_command_jar_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	FrProcess *proc = comm->process;
+	GList     *zip_list = NULL, *jardata_list = NULL, *jar_list = NULL;
+	GList     *scan;
+	char      *tmp_dir;
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char *filename = scan->data;
+		char *path = build_uri (base_dir, filename, NULL);
+		char *package = NULL;
+
+		if (file_extension_is (filename, ".java"))
+			package = get_package_name_from_java_file (path);
+		else if (file_extension_is (filename, ".class"))
+			package = get_package_name_from_class_file (path);
+
+		if ((package == NULL) || (strlen (package) == 0))
+			zip_list = g_list_append (zip_list, g_strdup (filename));
+		else {
+			JarData *newdata = g_new0 (JarData, 1);
+
+			newdata->package_minus_one_level = remove_level_from_path (package);
+			newdata->link_name = g_strdup (file_name_from_path (package));
+			newdata->rel_path = remove_level_from_path (filename);
+			newdata->filename = g_strdup (file_name_from_path (filename));
+			jardata_list = g_list_append (jardata_list, newdata);
+		}
+
+		g_free (package);
+		g_free (path);
+	}
+
+	tmp_dir = get_temp_work_dir (NULL);
+	for (scan = jardata_list; scan ; scan = scan->next) {
+		JarData *jdata = scan->data;
+		char    *pack_path;
+		char    *old_link;
+		char    *link_name;
+		int      retval;
+
+		pack_path = build_uri (tmp_dir, jdata->package_minus_one_level, NULL);
+		if (! make_directory_tree_from_path (pack_path, 0755, NULL)) {
+			g_free (pack_path);
+			continue;
+		}
+
+		old_link = build_uri (base_dir, jdata->rel_path, NULL);
+		link_name = g_build_filename (pack_path, jdata->link_name, NULL);
+
+		retval = symlink (old_link, link_name);
+		if ((retval != -1) || (errno == EEXIST))
+			jar_list = g_list_append (jar_list,
+						  g_build_filename (jdata->package_minus_one_level,
+							            jdata->link_name,
+						      	            jdata->filename,
+						      	            NULL));
+
+		g_free (link_name);
+		g_free (old_link);
+		g_free (pack_path);
+	}
+
+	if (zip_list != NULL)
+		parent_class->add (comm, NULL, zip_list, base_dir, update, FALSE);
+
+	if (jar_list != NULL)
+		parent_class->add (comm, NULL, jar_list, tmp_dir, update, FALSE);
+
+	fr_process_begin_command (proc, "rm");
+	fr_process_set_working_dir (proc, "/");
+	fr_process_add_arg (proc, "-r");
+	fr_process_add_arg (proc, "-f");
+	fr_process_add_arg (proc, tmp_dir);
+	fr_process_end_command (proc);
+	fr_process_set_sticky (proc, TRUE);
+
+	for (scan = jardata_list; scan ; scan = scan->next) {
+		JarData *jdata = scan->data;
+		g_free (jdata->filename);
+		g_free (jdata->package_minus_one_level);
+		g_free (jdata->link_name);
+		g_free (jdata->rel_path);
+	}
+
+	path_list_free (jardata_list);
+	path_list_free (jar_list);
+	path_list_free (zip_list);
+	g_free (tmp_dir);
+}
+
+const char *jar_mime_type[] = { "application/x-java-archive",
+				NULL };
+
+static const char **
+fr_command_jar_get_mime_types (FrCommand *comm)
+{
+	return jar_mime_type;
+}
+
+static FrCommandCaps
+fr_command_jar_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("zip", check_command))
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_jar_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("zip,unzip");
+}
+
+static void
+fr_command_jar_class_init (FrCommandJarClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS(class);
+	FrCommandClass *afc = FR_COMMAND_CLASS (class);
+
+	parent_class = g_type_class_peek_parent (class);
+
+	gobject_class->finalize = fr_command_jar_finalize;
+
+	afc->add = fr_command_jar_add;
+	afc->get_mime_types = fr_command_jar_get_mime_types;
+	afc->get_capabilities = fr_command_jar_get_capabilities;
+	afc->get_packages     = fr_command_jar_get_packages;
+}
+
+static void
+fr_command_jar_init (FrCommand *comm)
+{
+}
+
+static void
+fr_command_jar_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_JAR (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_jar_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandJarClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_jar_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandJar),
+			0,
+			(GInstanceInitFunc) fr_command_jar_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND_ZIP,
+					       "FRCommandJar",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/71.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/71.html new file mode 100644 index 0000000..915c699 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/71.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ZIP_H
+#define FR_COMMAND_ZIP_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_ZIP            (fr_command_zip_get_type ())
+#define FR_COMMAND_ZIP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ZIP, FrCommandZip))
+#define FR_COMMAND_ZIP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ZIP, FrCommandZipClass))
+#define FR_IS_COMMAND_ZIP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ZIP))
+#define FR_IS_COMMAND_ZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ZIP))
+#define FR_COMMAND_ZIP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ZIP, FrCommandZipClass))
+
+typedef struct _FrCommandZip       FrCommandZip;
+typedef struct _FrCommandZipClass  FrCommandZipClass;
+
+struct _FrCommandZip
+{
+	FrCommand  __parent;
+	gboolean   is_empty;
+};
+
+struct _FrCommandZipClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_zip_get_type (void);
+
+#endif /* FR_COMMAND_ZIP_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/72.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/72.html new file mode 100644 index 0000000..8bb988a --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/72.html @@ -0,0 +1,339 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_JAR_H
+#define FR_COMMAND_JAR_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command-zip.h"
+
+#define FR_TYPE_COMMAND_JAR            (fr_command_jar_get_type ())
+#define FR_COMMAND_JAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_JAR, FrCommandJar))
+#define FR_COMMAND_JAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_JAR, FrCommandJarClass))
+#define FR_IS_COMMAND_JAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_JAR))
+#define FR_IS_COMMAND_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_JAR))
+#define FR_COMMAND_JAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_JAR, FrCommandJarClass))
+
+typedef struct _FrCommandJar       FrCommandJar;
+typedef struct _FrCommandJarClass  FrCommandJarClass;
+
+struct _FrCommandJar
+{
+	FrCommandZip  __parent;
+};
+
+struct _FrCommandJarClass
+{
+	FrCommandZipClass __parent_class;
+};
+
+GType fr_command_jar_get_type (void);
+
+#endif /* FR_COMMAND_JAR_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/73.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/73.html new file mode 100644 index 0000000..86ed2f4 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/73.html @@ -0,0 +1,1067 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-lha.h"
+
+static void fr_command_lha_class_init  (FrCommandLhaClass *class);
+static void fr_command_lha_init        (FrCommand         *afile);
+static void fr_command_lha_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *month,<--- Parameter 'month' can be declared as pointer to const
+		    char *mday,<--- Parameter 'mday' can be declared as pointer to const
+		    char *time_or_year)
+{
+	struct tm tm = {0, };
+
+	tm.tm_isdst = -1;
+
+	/* date */
+
+	if (month != NULL) {
+		static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+		                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+		int i;
+
+		for (i = 0; i < 12; i++) {
+			if (strcmp (months[i], month) == 0) {
+				tm.tm_mon = i;
+				break;
+			}
+		}
+	}
+	tm.tm_mday = atoi (mday);
+	if (strchr (time_or_year, ':') == NULL)
+		tm.tm_year = atoi (time_or_year) - 1900;
+	else {
+		char     **fields;
+		time_t     now;
+		struct tm *tm_now;<--- Variable 'tm_now' can be declared as pointer to const
+
+		now = time (NULL);
+		tm_now = localtime (&now);
+		if (tm_now != NULL)
+			tm.tm_year = tm_now->tm_year;
+
+		/* time */
+
+		fields = g_strsplit (time_or_year, ":", 2);
+		if (fields[0] != NULL) {
+			tm.tm_hour = atoi (fields[0]);
+			if (fields[1] != NULL)
+				tm.tm_min = atoi (fields[1]);
+		}
+		g_strfreev (fields);
+	}
+
+	return mktime (&tm);
+}
+
+static char **
+split_line_lha (char *line)
+{
+	char       **fields;
+	int          n_fields = 7;
+	const char  *scan;
+	int          i;
+
+	fields = g_new0 (char *, n_fields + 1);
+	fields[n_fields] = NULL;
+
+	i = 0;
+
+	if (strncmp (line, "[MS-DOS]", 8) == 0) {
+		fields[i++] = g_strdup ("");
+		fields[i++] = g_strdup ("");
+		line += strlen ("[MS-DOS]");
+	}
+	else if (strncmp (line, "[generic]", 9) == 0) {
+		fields[i++] = g_strdup ("");
+		fields[i++] = g_strdup ("");
+		line += strlen ("[generic]");
+	}
+	else if (strncmp (line, "[unknown]", 9) == 0) {
+		fields[i++] = g_strdup ("");
+		fields[i++] = g_strdup ("");
+		line += strlen ("[unknown]");
+	}
+	else if (strncmp (line, "[Amiga]", 7) == 0) {
+		fields[i++] = g_strdup ("");
+		fields[i++] = g_strdup ("");
+		line += strlen ("[Amiga]");
+	}
+
+	scan = eat_spaces (line);
+	for (; i < n_fields; i++) {
+		const char *field_end;
+
+		if (NULL != (field_end = strchr (scan, ' '))) {
+			fields[i] = g_strndup (scan, field_end - scan);
+			scan = eat_spaces (field_end);
+		}
+	}
+
+	return fields;
+}
+
+static const char *
+get_last_field_lha (char *line)<--- Parameter 'line' can be declared as pointer to const
+{
+	int         i;
+	const char *field;
+	int         n = 7;
+
+	if (strncmp (line, "[MS-DOS]", 8) == 0)
+		n--;
+
+	if (strncmp (line, "[generic]", 9) == 0)
+		n--;
+
+	if (strncmp (line, "[unknown]", 9) == 0)
+		n--;
+
+	if (strncmp (line, "[Amiga]", 7) == 0)
+		n--;
+
+	field = eat_spaces (line);
+	for (i = 0; i < n; i++) {
+		field = strchr (field, ' ');
+		field = eat_spaces (field);
+	}
+
+	return field;
+}
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	const char  *name_field;
+
+	g_return_if_fail (line != NULL);
+
+	fdata = file_data_new ();
+
+	fields = split_line_lha (line);
+	fdata->size = g_ascii_strtoull (fields[2], NULL, 10);
+	fdata->modified = mktime_from_string (fields[4],
+					      fields[5],
+					      fields[6]);
+	g_strfreev (fields);
+
+	/* Full path */
+
+	name_field = get_last_field_lha (line);
+
+	if (name_field && *name_field == '/') {
+		fdata->full_path = g_strdup (name_field);
+		fdata->original_path = fdata->full_path;
+	} else {
+		fdata->full_path = g_strconcat ("/", name_field, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	fdata->link = NULL;
+
+	fdata->dir = line[0] == 'd';
+	if (fdata->dir)
+		fdata->name = dir_name_from_path (fdata->full_path);
+	else
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_lha_list (FrCommand  *comm)
+{
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	fr_process_begin_command (comm->process, "lha");
+	fr_process_add_arg (comm->process, "lq");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_lha_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "lha");
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+	if (update)
+		fr_process_add_arg (comm->process, "u");
+	else
+		fr_process_add_arg (comm->process, "a");
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_lha_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "lha");
+	fr_process_add_arg (comm->process, "d");
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_lha_extract (FrCommand  *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+	char   options[5];
+	int    i = 0;
+
+	fr_process_begin_command (comm->process, "lha");
+
+	if (dest_dir != NULL)
+		fr_process_set_working_dir (comm->process, dest_dir);
+
+	options[i++] = 'x';
+	options[i++] = 'f'; /* Always overwrite.
+			     * The overwrite option is handled in
+			     * fr_archive_extract,
+			     * this is because lha asks the user whether he
+			     * wants to overwrite a file. */
+
+	if (junk_paths)
+		options[i++] = 'i';
+
+	options[i++] = 0;
+	fr_process_add_arg (comm->process, options);
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_lha_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "lha");
+	fr_process_add_arg (comm->process, "t");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+const char *lha_mime_type[] = { "application/x-lzh-compressed", "application/x-lha",  NULL };
+
+static const char **
+fr_command_lha_get_mime_types (FrCommand *comm)
+{
+	return lha_mime_type;
+}
+
+static FrCommandCaps
+fr_command_lha_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("lha", check_command))
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_lha_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("lha");
+}
+
+static void
+fr_command_lha_class_init (FrCommandLhaClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_lha_finalize;
+
+        afc->list             = fr_command_lha_list;
+	afc->add              = fr_command_lha_add;
+	afc->delete           = fr_command_lha_delete;
+	afc->extract          = fr_command_lha_extract;
+	afc->test             = fr_command_lha_test;
+	afc->get_mime_types   = fr_command_lha_get_mime_types;
+	afc->get_capabilities = fr_command_lha_get_capabilities;
+	afc->get_packages     = fr_command_lha_get_packages;
+}
+
+static void
+fr_command_lha_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = TRUE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = TRUE;
+}
+
+static void
+fr_command_lha_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_LHA (object));
+
+	 /* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_lha_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandLhaClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_lha_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandLha),
+			0,
+			(GInstanceInitFunc) fr_command_lha_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandLha",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/74.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/74.html new file mode 100644 index 0000000..9dd4803 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/74.html @@ -0,0 +1,341 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_LHA_H
+#define FR_COMMAND_LHA_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_LHA            (fr_command_lha_get_type ())
+#define FR_COMMAND_LHA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_LHA, FrCommandLha))
+#define FR_COMMAND_LHA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_LHA, FrCommandLhaClass))
+#define FR_IS_COMMAND_LHA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_LHA))
+#define FR_IS_COMMAND_LHA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_LHA))
+#define FR_COMMAND_LHA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_LHA, FrCommandLhaClass))
+
+typedef struct _FrCommandLha       FrCommandLha;
+typedef struct _FrCommandLhaClass  FrCommandLhaClass;
+
+struct _FrCommandLha
+{
+	FrCommand  __parent;
+};
+
+struct _FrCommandLhaClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_lha_get_type (void);
+
+#endif /* FR_COMMAND_LHA_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/75.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/75.html new file mode 100644 index 0000000..d6efa21 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/75.html @@ -0,0 +1,755 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
/*
+ * fr-command-lrzip.c
+ *
+ *  Created on: 10.04.2010
+ *      Author: Alexander Saprykin
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-lrzip.h"
+
+static void fr_command_lrzip_class_init  (FrCommandLrzipClass *class);
+static void fr_command_lrzip_init        (FrCommand         *afile);
+static void fr_command_lrzip_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static void
+list__process_line (char     *line,
+		    gpointer  data)
+{
+	FileData  *fdata;
+	FrCommand *comm = FR_COMMAND (data);
+
+	g_return_if_fail (line != NULL);
+
+	if (strlen (line) == 0)
+		return;
+
+	if (! g_str_has_prefix (line, "Decompressed file size:"))
+		return;
+
+	fdata = file_data_new ();
+	fdata->size = g_ascii_strtoull (get_last_field (line, 4), NULL, 10);
+
+	struct stat st;
+
+	if (stat (comm->filename, &st) == 0)
+		fdata->modified = st.st_mtim.tv_sec;
+	else
+		time(&(fdata->modified));
+
+	fdata->encrypted = FALSE;
+
+	char *new_fname = g_strdup (file_name_from_path (comm->filename));
+	if (g_str_has_suffix (new_fname, ".lrz"))
+		new_fname[strlen (new_fname) - 4] = '\0';
+
+	if (*new_fname == '/') {
+		fdata->full_path = g_strdup (new_fname);
+		fdata->original_path = fdata->full_path;
+	}
+	else {
+		fdata->full_path = g_strconcat ("/", new_fname, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+	fdata->path = remove_level_from_path (fdata->full_path);
+	fdata->name = new_fname;
+	fdata->dir = FALSE;
+	fdata->link = NULL;
+
+	if (*fdata->name == '\0')
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_lrzip_list (FrCommand  *comm)
+{
+	fr_process_set_err_line_func (comm->process, list__process_line, comm);
+
+	fr_process_begin_command (comm->process, "lrzip");
+	fr_process_add_arg (comm->process, "-i");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_lrzip_add (FrCommand  *comm,
+		      const char *from_file,
+		      GList      *file_list,<--- Parameter 'file_list' can be declared as pointer to const
+		      const char *base_dir,
+		      gboolean    update,
+		      gboolean    recursive)
+{
+	fr_process_begin_command (comm->process, "lrzip");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	/* preserve links. */
+
+	switch (comm->compression) {
+	case FR_COMPRESSION_VERY_FAST:
+		fr_process_add_arg (comm->process, "-l"); break;
+	case FR_COMPRESSION_FAST:
+		fr_process_add_arg (comm->process, "-g"); break;
+	case FR_COMPRESSION_NORMAL:
+		fr_process_add_arg (comm->process, "-b"); break;
+	case FR_COMPRESSION_MAXIMUM:
+		fr_process_add_arg (comm->process, "-z"); break;
+	}
+
+	fr_process_add_arg (comm->process, "-o");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_add_arg (comm->process, (char *) file_list->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_lrzip_extract (FrCommand  *comm,
+			  const char *from_file,
+			  GList      *file_list,
+			  const char *dest_dir,
+			  gboolean    overwrite,
+			  gboolean    skip_older,
+			  gboolean    junk_paths)
+{
+	fr_process_begin_command (comm->process, "lrzip");
+	fr_process_add_arg (comm->process, "-d");
+
+	if (dest_dir != NULL) {
+		fr_process_add_arg (comm->process, "-O");
+		fr_process_add_arg (comm->process, dest_dir);
+	}
+	if (overwrite)
+		fr_process_add_arg (comm->process, "-f");
+
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+/*
+static void
+fr_command_lrzip_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "lrzip");
+	fr_process_add_arg (comm->process, "-t");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+*/
+
+const char *lrzip_mime_type[] = { "application/x-lrzip", NULL };
+
+static const char **
+fr_command_lrzip_get_mime_types (FrCommand *comm)
+{
+	return lrzip_mime_type;
+}
+
+static FrCommandCaps
+fr_command_lrzip_get_capabilities (FrCommand  *comm,
+				   const char *mime_type,
+				   gboolean    check_command)
+{
+	FrCommandCaps capabilities = FR_COMMAND_CAN_DO_NOTHING;
+
+	if (is_program_available ("lrzip", check_command))
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_lrzip_get_packages (FrCommand  *comm,
+			       const char *mime_type)
+{
+	return PACKAGES ("lrzip");
+}
+
+static void
+fr_command_lrzip_class_init (FrCommandLrzipClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_lrzip_finalize;
+
+	afc->list             = fr_command_lrzip_list;
+	afc->add              = fr_command_lrzip_add;<--- You might need to cast the function pointer here
+	afc->extract          = fr_command_lrzip_extract;
+	afc->get_mime_types   = fr_command_lrzip_get_mime_types;
+	afc->get_capabilities = fr_command_lrzip_get_capabilities;
+	afc->get_packages     = fr_command_lrzip_get_packages;
+}
+
+static void
+fr_command_lrzip_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = FALSE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propAddCanStoreFolders       = FALSE;
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_lrzip_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_LRZIP (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_lrzip_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandLrzipClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_lrzip_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandLrzip),
+			0,
+			(GInstanceInitFunc) fr_command_lrzip_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandLrzip",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/76.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/76.html new file mode 100644 index 0000000..51868b6 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/76.html @@ -0,0 +1,311 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
/*
+ * fr-command-lrzip.h
+ *
+ *  Created on: 10.04.2010
+ *      Author: Alexander Saprykin
+ */
+
+#ifndef FRCOMMANDLRZIP_H_
+#define FRCOMMANDLRZIP_H_
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_LRZIP            (fr_command_lrzip_get_type ())
+#define FR_COMMAND_LRZIP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_LRZIP, FrCommandLrzip))
+#define FR_COMMAND_LRZIP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_LRZIP, FrCommandLrzipClass))
+#define FR_IS_COMMAND_LRZIP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_LRZIP))
+#define FR_IS_COMMAND_LRZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_LRZIP))
+#define FR_COMMAND_LRZIP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_LRZIP, FrCommandLrzipClass))
+
+typedef struct _FrCommandLrzip       FrCommandLrzip;
+typedef struct _FrCommandLrzipClass  FrCommandLrzipClass;
+
+struct _FrCommandLrzip
+{
+	FrCommand  __parent;
+};
+
+struct _FrCommandLrzipClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_lrzip_get_type (void);
+
+#endif /* FRCOMMANDLRZIP_H_ */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/77.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/77.html new file mode 100644 index 0000000..49fc798 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/77.html @@ -0,0 +1,851 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE /* strptime */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-nomarch.h"
+
+#define LSNOMARCH_DATE_FORMAT "%Y-%m-%d %H:%M"
+
+static void fr_command_nomarch_class_init  (FrCommandNomarchClass *class);
+static void fr_command_nomarch_init        (FrCommand             *afile);
+static void fr_command_nomarch_finalize    (GObject               *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (const char *time_s)
+{
+	struct tm tm = {0, };
+	tm.tm_isdst = -1;
+	strptime (time_s, LSNOMARCH_DATE_FORMAT, &tm);
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,
+		    gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	int          date_idx;
+	char        *field_date, *field_name;
+
+	g_return_if_fail (line != NULL);
+
+	date_idx = file_list__get_index_from_pattern (line, "%n%n%n%n-%n%n-%n%n %n%n:%n%n");
+	if (date_idx < 0)
+		return;
+
+	fdata = file_data_new ();
+	fields = split_line (line, 8);
+
+	field_name = fields[0];
+	fdata->full_path = g_strconcat ("/", field_name, NULL);
+	fdata->original_path = fdata->full_path + 1;
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+
+	field_date = g_strndup (line + date_idx, 16);
+	fdata->modified = mktime_from_string (field_date);
+	g_free (field_date);
+
+	g_strfreev (fields);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_nomarch_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);
+
+	fr_process_begin_command (comm->process, "nomarch");
+	fr_process_add_arg (comm->process, "-lvU");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_nomarch_add (FrCommand     *comm,
+                        const char    *from_file,
+                        GList         *file_list,
+                        const char    *base_dir,
+                        gboolean       update,
+                        gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "arc");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	if (update)
+		fr_process_add_arg (comm->process, "u");
+	else
+		fr_process_add_arg (comm->process, "a");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, (gchar*) scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_nomarch_delete (FrCommand  *comm,
+                           const char *from_file,
+                           GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "arc");
+	fr_process_add_arg (comm->process, "d");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_nomarch_extract (FrCommand  *comm,
+                            const char *from_file,
+                            GList      *file_list,
+                            const char *dest_dir,
+                            gboolean    overwrite,
+                            gboolean    skip_older,
+                            gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "nomarch");
+
+	if (dest_dir != NULL)
+		fr_process_set_working_dir (comm->process, dest_dir);
+
+	fr_process_add_arg (comm->process, "-U");
+	fr_process_add_arg (comm->process, comm->filename);
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_nomarch_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "nomarch");
+	fr_process_add_arg (comm->process, "-tU");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_nomarch_handle_error (FrCommand   *comm,
+                                 FrProcError *error)
+{
+	if (error->type != FR_PROC_ERROR_NONE) {
+ 		if (error->status <= 1)
+ 			error->type = FR_PROC_ERROR_NONE;
+		else if (error->status == 3)
+ 			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+ 	}
+}
+
+const char *nomarch_mime_type[] = { "application/x-arc", NULL };
+
+static const char **
+fr_command_nomarch_get_mime_types (FrCommand *comm)
+{
+	return nomarch_mime_type;
+}
+
+static FrCommandCaps
+fr_command_nomarch_get_capabilities (FrCommand  *comm,
+                                     const char *mime_type,
+                                     gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("nomarch", check_command)) {
+		capabilities |= FR_COMMAND_CAN_READ;
+		if (is_program_available ("arc", check_command))
+			capabilities |= FR_COMMAND_CAN_WRITE;
+	}
+	return capabilities;
+}
+
+static const char *
+fr_command_nomarch_get_packages (FrCommand  *comm,
+                                 const char *mime_type)
+{
+	return PACKAGES ("nomarch,arc");
+}
+
+static void
+fr_command_nomarch_class_init (FrCommandNomarchClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_nomarch_finalize;
+
+	afc->list             = fr_command_nomarch_list;
+	afc->add              = fr_command_nomarch_add;
+	afc->delete           = fr_command_nomarch_delete;
+	afc->extract          = fr_command_nomarch_extract;
+	afc->test             = fr_command_nomarch_test;
+	afc->handle_error     = fr_command_nomarch_handle_error;
+	afc->get_mime_types   = fr_command_nomarch_get_mime_types;
+	afc->get_capabilities = fr_command_nomarch_get_capabilities;
+	afc->get_packages     = fr_command_nomarch_get_packages;
+}
+
+static void
+fr_command_nomarch_init (FrCommand *comm)
+{
+	FrCommandNomarch *nomarch_comm;
+
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = FALSE;
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = TRUE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = TRUE;
+
+	nomarch_comm = FR_COMMAND_NOMARCH (comm);
+	nomarch_comm->fdata = FALSE;
+}
+
+static void
+fr_command_nomarch_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_NOMARCH (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_nomarch_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandNomarchClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_nomarch_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandNomarch),
+			0,
+			(GInstanceInitFunc) fr_command_nomarch_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandNomarch",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/78.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/78.html new file mode 100644 index 0000000..1a9b377 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/78.html @@ -0,0 +1,345 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_NOMARCH_H
+#define FR_COMMAND_NOMARCH_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_NOMARCH            (fr_command_nomarch_get_type ())
+#define FR_COMMAND_NOMARCH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_NOMARCH, FrCommandNomarch))
+#define FR_COMMAND_NOMARCH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_NOMARCH, FrCommandNomarchClass))
+#define FR_IS_COMMAND_NOMARCH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_NOMARCH))
+#define FR_IS_COMMAND_NOMARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_NOMARCH))
+#define FR_COMMAND_NOMARCH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_NOMARCH, FrCommandNomarchClass))
+
+typedef struct _FrCommandNomarch       FrCommandNomarch;
+typedef struct _FrCommandNomarchClass  FrCommandNomarchClass;
+
+struct _FrCommandNomarch
+{
+	FrCommand  __parent;
+
+	FileData *fdata;
+};
+
+struct _FrCommandNomarchClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_nomarch_get_type (void);
+
+#endif /* FR_COMMAND_NOMARCH_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/79.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/79.html new file mode 100644 index 0000000..fc235bd --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/79.html @@ -0,0 +1,1891 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE 700
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "gio-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-rar.h"
+#include "fr-error.h"
+#include "rar-utils.h"
+
+static void fr_command_rar_class_init  (FrCommandRarClass *class);
+static void fr_command_rar_init        (FrCommand         *afile);
+static void fr_command_rar_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* rar 5.30 and later uses YYYY-MM-DD instead DD-MM-YY in the listing output */
+
+static gboolean date_newstyle = FALSE;
+
+static const struct {
+	const gchar *command;
+	FrCommandCaps capabilities;
+} candidate_commands[] = {
+	{ "rar", FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES },
+	{ "unrar", FR_COMMAND_CAN_READ },
+	{ "unrar-free", FR_COMMAND_CAN_READ }
+};
+
+static const gchar *
+get_rar_command (void)
+{
+	for (guint i = 0; i < G_N_ELEMENTS(candidate_commands); i++) {
+		if (is_program_in_path (candidate_commands[i].command))
+			return candidate_commands[i].command;
+	}
+
+	/* this should never happen as we shouldn't get called if none of the
+	 * candidate exist, but better safe than sorry */
+	return "unrar";
+}
+
+/* -- list -- */
+
+/*
+
+// SAMPLE RAR VERSION 5.30 AND NEWER LISTING OUTPUT:
+
+RAR 5.30   Copyright (c) 1993-2015 Alexander Roshal   18 Nov 2015
+Trial version             Type RAR -? for help
+
+Archive: /test.rar
+Details: RAR 4
+
+ Attributes      Size    Packed Ratio    Date    Time   Checksum  Name
+----------- ---------  -------- ----- ---------- -----  --------  ----
+ -rw-rw-r--      3165      1310  41%  2017-03-07 21:34  888D50B3  loremipsum.txt
+ -rw-rw-r--         0         8   0%  2017-03-07 21:36  00000000  file2.empty
+----------- ---------  -------- ----- ---------- -----  --------  ----
+                 3165      1318  41%                              2
+
+// SAMPLE RAR VERSION 5.00 TO 5.21 LISTING OUTPUT:
+
+RAR 5.21   Copyright (c) 1993-2015 Alexander Roshal   15 Feb 2015
+Trial version             Type RAR -? for help
+
+Archive: /test.rar
+Details: RAR 4
+
+ Attributes      Size    Packed Ratio   Date   Time   Checksum  Name
+----------- ---------  -------- ----- -------- -----  --------  ----
+ -rw-rw-r--      3165      1310  41%  07-03-17 21:34  888D50B3  loremipsum.txt
+ -rw-rw-r--         0         8   0%  07-03-17 21:36  00000000  file2.empty
+----------- ---------  -------- ----- -------- -----  --------  ----
+                 3165      1318  41%                            2
+
+// SAMPLE RAR VERSION 4.20 AND OLDER LISTING OUTPUT:
+
+RAR 4.20   Copyright (c) 1993-2012 Alexander Roshal   9 Jun 2012
+Trial version             Type RAR -? for help
+
+Archive /test.rar
+
+Pathname/Comment
+                  Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
+-------------------------------------------------------------------------------
+ loremipsum.txt
+                  3165     1310  41% 07-03-17 21:34 -rw-rw-r-- 888D50B3 m3b 2.9
+ file2.empty
+                     0        8   0% 07-03-17 21:36 -rw-rw-r-- 00000000 m3b 2.9
+-------------------------------------------------------------------------------
+    2             3165     1318  41%
+
+*/
+
+static time_t
+mktime_from_string (const char *date_s,
+		    const char *time_s)
+{
+	struct tm tm = {0, };
+	char *date_time_s;
+
+	tm.tm_isdst = -1;
+	date_time_s = g_strjoin (" ", date_s, time_s, NULL);
+	strptime (date_time_s, date_newstyle ? "%Y-%m-%d %H:%M" : "%d-%m-%y %H:%M", &tm);
+	g_free (date_time_s);
+
+	return mktime (&tm);
+}
+
+static gboolean
+attribute_field_with_space (const char *line)
+{
+	/* sometimes when the archive is encrypted the attributes field is
+	* like this: "* ..A...."
+	* */
+	return ((line[0] != ' ') && (line[1] == ' '));
+}
+
+static void
+parse_name_field (char         *line,
+		  FrCommandRar *rar_comm)
+{
+	char     *name_field;
+	FileData *fdata;
+
+	rar_comm->fdata = fdata = file_data_new ();
+
+	/* read file name. */
+
+	fdata->encrypted = (line[0] == '*') ? TRUE : FALSE;
+
+	if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5)
+		/* rar-5 output adds trailing spaces to short file names :( */
+		name_field = g_strchomp (g_strdup (get_last_field (line, attribute_field_with_space (line) ? 9 : 8)));
+	else
+		name_field = g_strdup (line + 1);
+
+	if (name_field == NULL)
+		return;
+
+	if (*name_field == '/') {
+		fdata->full_path = g_strdup (name_field);
+		fdata->original_path = fdata->full_path;
+	}
+	else {
+		fdata->full_path = g_strconcat ("/", name_field, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	fdata->link = NULL;
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	g_free (name_field);
+}
+
+static gboolean
+attr_field_is_dir (const char   *attr_field,
+                   FrCommandRar *rar_comm)<--- Parameter 'rar_comm' can be declared as pointer to const
+{
+        if ((attr_field[0] == 'd') ||
+            (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5 && attr_field[3] == 'D') ||
+            (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5 && attr_field[1] == 'D'))
+                return TRUE;
+
+        return FALSE;
+}
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FrCommand     *comm = FR_COMMAND (data);
+	FrCommandRar  *rar_comm = FR_COMMAND_RAR (comm);
+	char         **fields;
+
+	g_return_if_fail (line != NULL);
+
+	if (! rar_comm->list_started) {
+		int version = 0;
+
+		if (sscanf (line, "RAR %d.", &version) == 1 || sscanf (line, "UNRAR %d.", &version) == 1) {
+			rar_comm->output_type = (version >= 5) ? FR_COMMAND_RAR_TYPE_RAR5 : FR_COMMAND_RAR_TYPE_RAR4;
+
+			if (version > 5)
+				date_newstyle = TRUE;
+			else if (version == 5 && (sscanf (line, "RAR 5.%d ", &version) == 1 ||
+			                          sscanf (line, "UNRAR 5.%d ", &version) == 1))
+			{
+				if (version >= 30)
+					date_newstyle = TRUE;
+			}
+		}
+		else if (g_str_has_prefix (line, "unrar-free ")) {
+			rar_comm->output_type = FR_COMMAND_RAR_TYPE_UNRAR_FREE;
+			date_newstyle = FALSE;
+		}
+		else if (strncmp (line, "--------", 8) == 0) {
+			rar_comm->list_started = TRUE;
+			if (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5)
+			    rar_comm->rar4_odd_line = TRUE;
+		}
+		else if (strncmp (line, "Volume ", 7) == 0)
+			comm->multi_volume = TRUE;
+		return;
+	}
+
+	if (strncmp (line, "--------", 8) == 0) {
+		rar_comm->list_started = FALSE;
+		return;
+	}
+
+	if (rar_comm->rar4_odd_line || rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5)
+		parse_name_field (line, rar_comm);
+
+	if (! rar_comm->rar4_odd_line) {
+		FileData   *fdata;
+		const char *size_field, *ratio_field, *date_field, *time_field, *attr_field;
+		int n_fields;
+
+		if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5)
+			n_fields = 6 + (attribute_field_with_space (line) != 0);
+		else if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_UNRAR_FREE)
+			n_fields = 4;
+		else
+			n_fields = 6;
+
+		fdata = rar_comm->fdata;
+
+		/* read file info. */
+
+		fields = split_line (line, n_fields);
+		if (g_strv_length (fields) < (guint) n_fields) {
+			/* wrong line format, treat this line as a filename line */
+			g_strfreev (fields);
+			file_data_free (rar_comm->fdata);
+			rar_comm->fdata = NULL;
+			rar_comm->rar4_odd_line = TRUE;
+			parse_name_field (line, rar_comm);
+		}
+		else {
+			if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5) {
+				int offset = attribute_field_with_space (line) ? 1 : 0;
+
+				size_field = fields[1+offset];
+				ratio_field = fields[3+offset];
+				date_field = fields[4+offset];
+				time_field = fields[5+offset];
+				attr_field = fields[0+offset];
+			}
+			else if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_UNRAR_FREE) {
+				size_field = fields[0];
+				date_field = fields[1];
+				time_field = fields[2];
+				attr_field = fields[3];
+				ratio_field = "";
+			}
+			else {
+				size_field = fields[0];
+				ratio_field = fields[2];
+				date_field = fields[3];
+				time_field = fields[4];
+				attr_field = fields[5];
+			}
+
+			if ((strcmp (ratio_field, "<->") == 0)
+			    || (strcmp (ratio_field, "<--") == 0))
+			{
+				/* ignore files that span more volumes */
+
+				file_data_free (rar_comm->fdata);
+				rar_comm->fdata = NULL;
+			}
+			else {
+				fdata->size = g_ascii_strtoull (size_field, NULL, 10);
+				fdata->modified = mktime_from_string (date_field, time_field);
+
+				if (attr_field_is_dir (attr_field, rar_comm)) {
+					char *tmp;
+
+					tmp = fdata->full_path;
+					fdata->full_path = g_strconcat (fdata->full_path, "/", NULL);
+
+					fdata->original_path = g_strdup (fdata->original_path);
+					fdata->free_original_path = TRUE;
+
+					g_free (tmp);
+
+					fdata->name = dir_name_from_path (fdata->full_path);
+					fdata->dir = TRUE;
+				}
+				else {
+					fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+					if (attr_field[0] == 'l')
+						fdata->link = g_strdup (file_name_from_path (fdata->full_path));
+				}
+
+				fr_command_add_file (comm, fdata);
+				rar_comm->fdata = NULL;
+			}
+
+			g_strfreev (fields);
+		}
+	}
+
+	if (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5)
+		rar_comm->rar4_odd_line = ! rar_comm->rar4_odd_line;
+}
+
+static void
+add_password_arg (FrCommand  *comm,
+		  const char *password,
+		  gboolean    disable_query)
+{
+	if ((password != NULL) && (password[0] != '\0')) {
+		if (comm->encrypt_header)
+			fr_process_add_arg_concat (comm->process, "-hp", password, NULL);
+		else
+			fr_process_add_arg_concat (comm->process, "-p", password, NULL);
+	}
+	else if (disable_query)
+		fr_process_add_arg (comm->process, "-p-");
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandRar *comm = data;
+
+	comm->list_started = FALSE;
+}
+
+static void
+fr_command_rar_list (FrCommand  *comm)
+{
+	rar_check_multi_volume (comm);
+
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	fr_process_begin_command (comm->process, get_rar_command ());
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "v");
+	fr_process_add_arg (comm->process, "-c-");
+	fr_process_add_arg (comm->process, "-v");
+
+	add_password_arg (comm, comm->password, TRUE);
+
+	/* stop switches scanning */
+	fr_process_add_arg (comm->process, "--");
+
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+
+	fr_process_start (comm->process);
+}
+
+static void
+parse_progress_line (FrCommand  *comm,
+		     const char *prefix,
+		     const char *message_prefix,
+		     const char *line)
+{
+	if (strncmp (line, prefix, strlen (prefix)) == 0)
+		fr_command_progress (comm, (double) ++comm->n_file / (comm->n_files + 1));
+}
+
+static void
+process_line__add (char     *line,
+		   gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (strncmp (line, "Creating archive ", 17) == 0) {
+		const char *archive_filename = line + 17;
+		char *uri;
+
+		uri = g_filename_to_uri (archive_filename, NULL, NULL);
+		if ((comm->volume_size > 0)
+		    && g_regex_match_simple ("^.*\\.part(0)*2\\.rar$", uri, G_REGEX_CASELESS, 0))
+		{
+			char  *volume_filename;
+			GFile *volume_file;
+
+			volume_filename = g_strdup (archive_filename);
+			volume_filename[strlen (volume_filename) - 5] = '1';
+			volume_file = g_file_new_for_path (volume_filename);
+			fr_command_set_multi_volume (comm, volume_file);
+
+			g_object_unref (volume_file);
+			g_free (volume_filename);
+		}
+		fr_command_working_archive (comm, uri);
+
+		g_free (uri);
+		return;
+	}
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Adding    ", _("Adding file: "), line);
+}
+
+static void
+fr_command_rar_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__add,
+				      comm);
+
+	fr_process_begin_command (comm->process, "rar");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	if (update)
+		fr_process_add_arg (comm->process, "u");
+	else
+		fr_process_add_arg (comm->process, "a");
+
+	switch (comm->compression) {
+	case FR_COMPRESSION_VERY_FAST:
+		fr_process_add_arg (comm->process, "-m1"); break;
+	case FR_COMPRESSION_FAST:
+		fr_process_add_arg (comm->process, "-m2"); break;
+	case FR_COMPRESSION_NORMAL:
+		fr_process_add_arg (comm->process, "-m3"); break;
+	case FR_COMPRESSION_MAXIMUM:
+		fr_process_add_arg (comm->process, "-m5"); break;
+	}
+
+	add_password_arg (comm, comm->password, FALSE);
+
+	if (comm->volume_size > 0)
+		fr_process_add_arg_printf (comm->process, "-v%ub", comm->volume_size);
+
+	/* disable percentage indicator */
+	fr_process_add_arg (comm->process, "-Idp");
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+	else
+		fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__delete (char     *line,
+		      gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (strncmp (line, "Deleting from ", 14) == 0) {
+		char *uri;
+
+		uri = g_filename_to_uri (line + 14, NULL, NULL);
+		fr_command_working_archive (comm, uri);
+		g_free (uri);
+
+		return;
+	}
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Deleting ", _("Removing file: "), line);
+}
+
+static void
+fr_command_rar_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__delete,
+				      comm);
+
+	fr_process_begin_command (comm->process, "rar");
+	fr_process_add_arg (comm->process, "d");
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+	else
+		fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__extract (char     *line,
+		       gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (strncmp (line, "Extracting from ", 16) == 0) {
+		char *uri;
+
+		uri = g_filename_to_uri (line + 16, NULL, NULL);
+		fr_command_working_archive (comm, uri);
+		g_free (uri);
+
+		return;
+	}
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Extracting  ", _("Extracting file: "), line);
+}
+
+static void
+fr_command_rar_extract (FrCommand  *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__extract,
+				      comm);
+
+	fr_process_begin_command (comm->process, get_rar_command ());
+
+	fr_process_add_arg (comm->process, "x");
+
+	/* keep broken extracted files */
+	fr_process_add_arg (comm->process, "-kb");
+
+	if (overwrite)
+		fr_process_add_arg (comm->process, "-o+");
+	else
+		fr_process_add_arg (comm->process, "-o-");
+
+	if (skip_older)
+		fr_process_add_arg (comm->process, "-u");
+
+	if (junk_paths)
+		fr_process_add_arg (comm->process, "-ep");
+
+	add_password_arg (comm, comm->password, TRUE);
+
+	/* disable percentage indicator */
+	fr_process_add_arg (comm->process, "-Idp");
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+	else
+		fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
+
+	if (dest_dir != NULL)
+		fr_process_add_arg (comm->process, dest_dir);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_rar_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, get_rar_command ());
+
+	fr_process_add_arg (comm->process, "t");
+
+	add_password_arg (comm, comm->password, TRUE);
+
+	/* disable percentage indicator */
+	fr_process_add_arg (comm->process, "-Idp");
+
+	/* stop switches scanning */
+	fr_process_add_arg (comm->process, "--");
+
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_rar_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	GList *scan;
+
+#if 0
+	{
+		GList *scan;
+
+		for (scan = g_list_last (comm->process->err.raw); scan; scan = scan->prev)
+			g_print ("%s\n", (char*)scan->data);
+	}
+#endif
+
+	if (error->type == FR_PROC_ERROR_NONE)
+		return;
+
+	/*if (error->status == 3)
+		error->type = FR_PROC_ERROR_ASK_PASSWORD;
+	else */
+	if (error->status <= 1)
+		error->type = FR_PROC_ERROR_NONE;
+
+	for (scan = g_list_last (comm->process->err.raw); scan; scan = scan->prev) {
+		char *line = scan->data;
+
+		if ((strstr (line, "Incorrect password") != NULL) ||
+		    (strstr (line, "password incorrect") != NULL) ||
+		    (strstr (line, "password is incorrect") != NULL) ||
+		    (strstr (line, "wrong password") != NULL)) {
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+			break;
+		}
+
+		if (strncmp (line, "Unexpected end of archive", 25) == 0) {
+			/* FIXME: handle this type of errors at a higher level when the freeze is over. */
+		}
+
+		if (strncmp (line, "Cannot find volume", 18) == 0) {
+			char *volume_filename;
+
+			g_clear_error (&error->gerror);
+
+			error->type = FR_PROC_ERROR_MISSING_VOLUME;
+			volume_filename = g_path_get_basename (line + strlen ("Cannot find volume "));
+			error->gerror = g_error_new (FR_ERROR, error->status, _("Could not find the volume: %s"), volume_filename);
+			g_free (volume_filename);
+			break;
+		}
+	}
+}
+
+const char *rar_mime_type[] = { "application/x-cbr",
+				"application/x-rar",
+				NULL };
+
+static const char **
+fr_command_rar_get_mime_types (FrCommand *comm)
+{
+	return rar_mime_type;
+}
+
+static FrCommandCaps
+fr_command_rar_get_capabilities (FrCommand  *comm,<--- Parameter 'comm' can be declared as pointer to const
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
+	/* add command-specific capabilities depending on availability */
+	for (guint i = 0; i < G_N_ELEMENTS (candidate_commands); i++) {
+		if (is_program_available (candidate_commands[i].command, check_command)) {
+			capabilities |= candidate_commands[i].capabilities;
+			break;
+		}
+	}
+
+	/* multi-volumes are read-only */
+	if ((comm->files->len > 0) && comm->multi_volume && (capabilities & FR_COMMAND_CAN_WRITE))
+		capabilities ^= FR_COMMAND_CAN_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_rar_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("rar,unrar,unrar-free");
+}
+
+static void
+fr_command_rar_class_init (FrCommandRarClass *class)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_rar_finalize;
+
+	afc->list             = fr_command_rar_list;
+	afc->add              = fr_command_rar_add;
+	afc->delete           = fr_command_rar_delete;
+	afc->extract          = fr_command_rar_extract;
+	afc->test             = fr_command_rar_test;
+	afc->handle_error     = fr_command_rar_handle_error;
+	afc->get_mime_types   = fr_command_rar_get_mime_types;
+	afc->get_capabilities = fr_command_rar_get_capabilities;<--- You might need to cast the function pointer here
+	afc->get_packages     = fr_command_rar_get_packages;
+}
+
+static void
+fr_command_rar_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = TRUE;
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = TRUE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = TRUE;
+	comm->propListFromFile             = TRUE;
+}
+
+static void
+fr_command_rar_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_RAR (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_rar_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandRarClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_rar_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandRar),
+			0,
+			(GInstanceInitFunc) fr_command_rar_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandRar",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/8.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/8.html new file mode 100644 index 0000000..4471a10 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/8.html @@ -0,0 +1,1523 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggsmclient.h"
+#include "eggsmclient-private.h"
+
+static void egg_sm_client_debug_handler (const char *log_domain,
+        GLogLevelFlags log_level,
+        const char *message,
+        gpointer user_data);
+
+enum
+{
+    SAVE_STATE,
+    QUIT_REQUESTED,
+    QUIT_CANCELLED,
+    QUIT,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+    GKeyFile *state_file;
+}EggSMClientPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EggSMClient, egg_sm_client, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static EggSMClient *global_client;
+static EggSMClientMode global_client_mode = EGG_SM_CLIENT_MODE_NORMAL;
+
+static gboolean
+running_in_mate (void)
+{
+    return (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0)
+        || (g_strcmp0 (g_getenv ("XDG_SESSION_DESKTOP"), "mate") == 0)
+        || (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "mate") == 0);
+}
+
+static void
+egg_sm_client_init (EggSMClient *client)
+{
+    ;
+}
+
+static void
+egg_sm_client_class_init (EggSMClientClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    /**
+     * EggSMClient::save_state:
+     * @client: the client
+     * @state_file: a #GKeyFile to save state information into
+     *
+     * Emitted when the session manager has requested that the
+     * application save information about its current state. The
+     * application should save its state into @state_file, and then the
+     * session manager may then restart the application in a future
+     * session and tell it to initialize itself from that state.
+     *
+     * You should not save any data into @state_file's "start group"
+     * (ie, the %NULL group). Instead, applications should save their
+     * data into groups with names that start with the application name,
+     * and libraries that connect to this signal should save their data
+     * into groups with names that start with the library name.
+     *
+     * Alternatively, rather than (or in addition to) using @state_file,
+     * the application can save its state by calling
+     * egg_sm_client_set_restart_command() during the processing of this
+     * signal (eg, to include a list of files to open).
+     **/
+    signals[SAVE_STATE] =
+        g_signal_new ("save_state",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, save_state),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__POINTER,
+                      G_TYPE_NONE,
+                      1, G_TYPE_POINTER);
+
+    /**
+     * EggSMClient::quit_requested:
+     * @client: the client
+     *
+     * Emitted when the session manager requests that the application
+     * exit (generally because the user is logging out). The application
+     * should decide whether or not it is willing to quit (perhaps after
+     * asking the user what to do with documents that have unsaved
+     * changes) and then call egg_sm_client_will_quit(), passing %TRUE
+     * or %FALSE to give its answer to the session manager. (It does not
+     * need to give an answer before returning from the signal handler;
+     * it can interact with the user asynchronously and then give its
+     * answer later on.) If the application does not connect to this
+     * signal, then #EggSMClient will automatically return %TRUE on its
+     * behalf.
+     *
+     * The application should not save its session state as part of
+     * handling this signal; if the user has requested that the session
+     * be saved when logging out, then ::save_state will be emitted
+     * separately.
+     *
+     * If the application agrees to quit, it should then wait for either
+     * the ::quit_cancelled or ::quit signals to be emitted.
+     **/
+    signals[QUIT_REQUESTED] =
+        g_signal_new ("quit_requested",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit_requested),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+
+    /**
+     * EggSMClient::quit_cancelled:
+     * @client: the client
+     *
+     * Emitted when the session manager decides to cancel a logout after
+     * the application has already agreed to quit. After receiving this
+     * signal, the application can go back to what it was doing before
+     * receiving the ::quit_requested signal.
+     **/
+    signals[QUIT_CANCELLED] =
+        g_signal_new ("quit_cancelled",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit_cancelled),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+
+    /**
+     * EggSMClient::quit:
+     * @client: the client
+     *
+     * Emitted when the session manager wants the application to quit
+     * (generally because the user is logging out). The application
+     * should exit as soon as possible after receiving this signal; if
+     * it does not, the session manager may choose to forcibly kill it.
+     *
+     * Normally a GUI application would only be sent a ::quit if it
+     * agreed to quit in response to a ::quit_requested signal. However,
+     * this is not guaranteed; in some situations the session manager
+     * may decide to end the session without giving applications a
+     * chance to object.
+     **/
+    signals[QUIT] =
+        g_signal_new ("quit",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+}
+
+static gboolean sm_client_disable = FALSE;
+static char *sm_client_state_file = NULL;
+static char *sm_client_id = NULL;
+static char *sm_config_prefix = NULL;
+
+static gboolean
+sm_client_post_parse_func (GOptionContext  *context,
+                           GOptionGroup    *group,
+                           gpointer         data,
+                           GError         **error)
+{
+    EggSMClient *client = egg_sm_client_get ();
+
+    if (sm_client_id == NULL)
+    {
+        const gchar *desktop_autostart_id;
+
+        desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+
+        if (desktop_autostart_id != NULL)
+            sm_client_id = g_strdup (desktop_autostart_id);
+    }
+
+    /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to
+     * use the same client id. */
+    g_unsetenv ("DESKTOP_AUTOSTART_ID");
+
+    if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
+        EGG_SM_CLIENT_GET_CLASS (client)->startup)
+        EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
+    return TRUE;
+}
+
+/**
+ * egg_sm_client_get_option_group:
+ *
+ * Creates a %GOptionGroup containing the session-management-related
+ * options. You should add this group to the application's
+ * %GOptionContext if you want to use #EggSMClient.
+ *
+ * Return value: the %GOptionGroup
+ **/
+GOptionGroup *
+egg_sm_client_get_option_group (void)
+{
+    const GOptionEntry entries[] =
+    {
+        {
+            "sm-client-disable", 0, 0,
+            G_OPTION_ARG_NONE, &sm_client_disable,
+            N_("Disable connection to session manager"), NULL
+        },
+        {
+            "sm-client-state-file", 0, 0,
+            G_OPTION_ARG_FILENAME, &sm_client_state_file,
+            N_("Specify file containing saved configuration"), N_("FILE")
+        },
+        {
+            "sm-client-id", 0, 0,
+            G_OPTION_ARG_STRING, &sm_client_id,
+            N_("Specify session management ID"), N_("ID")
+        },
+        /* MateClient compatibility option */
+        {
+            "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
+            G_OPTION_ARG_NONE, &sm_client_disable,
+            NULL, NULL
+        },
+        /* MateClient compatibility option. This is a dummy option that only
+         * exists so that sessions saved by apps with MateClient can be restored
+         * later when they've switched to EggSMClient. See bug #575308.
+         */
+        {
+            "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
+            G_OPTION_ARG_STRING, &sm_config_prefix,
+            NULL, NULL
+        },
+        { NULL }
+    };
+    GOptionGroup *group;
+
+    /* Use our own debug handler for the "EggSMClient" domain. */
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
+                       egg_sm_client_debug_handler, NULL);
+
+    group = g_option_group_new ("sm-client",
+                                _("Session management options:"),
+                                _("Show session management options"),
+                                NULL, NULL);
+    g_option_group_add_entries (group, entries);
+    g_option_group_set_parse_hooks (group, NULL, sm_client_post_parse_func);
+
+    return group;
+}
+
+/**
+ * egg_sm_client_set_mode:
+ * @mode: an #EggSMClient mode
+ *
+ * Sets the "mode" of #EggSMClient as follows:
+ *
+ *    %EGG_SM_CLIENT_MODE_DISABLED: Session management is completely
+ *    disabled, until the mode is changed again. The application will
+ *    not even connect to the session manager. (egg_sm_client_get()
+ *    will still return an #EggSMClient object.)
+ *
+ *    %EGG_SM_CLIENT_MODE_NO_RESTART: The application will connect to
+ *    the session manager (and thus will receive notification when the
+ *    user is logging out, etc), but will request to not be
+ *    automatically restarted with saved state in future sessions.
+ *
+ *    %EGG_SM_CLIENT_MODE_NORMAL: The default. #EggSMCLient will
+ *    function normally.
+ *
+ * This must be called before the application's main loop begins and
+ * before any call to egg_sm_client_get(), unless the mode was set
+ * earlier to %EGG_SM_CLIENT_MODE_DISABLED and this call enables
+ * session management. Note that option parsing will call
+ * egg_sm_client_get().
+ **/
+void
+egg_sm_client_set_mode (EggSMClientMode mode)
+{
+    EggSMClientMode old_mode = global_client_mode;
+
+    g_return_if_fail (global_client == NULL || global_client_mode == EGG_SM_CLIENT_MODE_DISABLED);
+    g_return_if_fail (!(global_client != NULL && mode == EGG_SM_CLIENT_MODE_DISABLED));
+
+    global_client_mode = mode;
+
+    if (global_client != NULL && old_mode == EGG_SM_CLIENT_MODE_DISABLED)
+    {
+        if (EGG_SM_CLIENT_GET_CLASS (global_client)->startup)
+            EGG_SM_CLIENT_GET_CLASS (global_client)->startup (global_client, sm_client_id);
+    }
+}
+
+/**
+ * egg_sm_client_get_mode:
+ *
+ * Gets the global #EggSMClientMode. See egg_sm_client_set_mode()
+ * for details.
+ *
+ * Return value: the global #EggSMClientMode
+ **/
+EggSMClientMode
+egg_sm_client_get_mode (void)
+{
+    return global_client_mode;
+}
+
+/**
+ * egg_sm_client_get:
+ *
+ * Returns the master #EggSMClient for the application.
+ *
+ * On platforms that support saved sessions (ie, POSIX/X11), the
+ * application will only request to be restarted by the session
+ * manager if you call egg_set_desktop_file() to set an application
+ * desktop file. In particular, if the desktop file contains the key
+ * "X
+ *
+ * Return value: the master #EggSMClient.
+ **/
+EggSMClient *
+egg_sm_client_get (void)
+{
+    if (!global_client)
+    {
+        if (!sm_client_disable)
+        {
+            /* If both D-Bus and XSMP are compiled in, try XSMP first
+             * (since it supports state saving) and fall back to D-Bus
+             * if XSMP isn't available.
+             */
+#ifdef EGG_SM_CLIENT_BACKEND_XSMP
+            global_client = egg_sm_client_xsmp_new ();
+#endif
+#ifdef EGG_SM_CLIENT_BACKEND_DBUS
+            if (!global_client)
+                global_client = egg_sm_client_dbus_new ();
+#endif
+        }
+
+        /* Fallback: create a dummy client, so that callers don't have
+         * to worry about a %NULL return value.
+         */
+        if (!global_client)
+            global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
+        /*FIXME
+          Disabling when root/not in MATE in GtkApplication builds
+          as egg_sm_client_set_mode must be called prior to start of main loop
+          to stop caja restart but this is diffcult in GtkApplication */
+
+		if (geteuid () == 0 || !running_in_mate ()){
+            global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
+        }
+    }
+
+    return global_client;
+}
+
+/**
+ * egg_sm_client_is_resumed:
+ * @client: the client
+ *
+ * Checks whether or not the current session has been resumed from
+ * a previous saved session. If so, the application should call
+ * egg_sm_client_get_state_file() and restore its state from the
+ * returned #GKeyFile.
+ *
+ * Return value: %TRUE if the session has been resumed
+ **/
+gboolean
+egg_sm_client_is_resumed (EggSMClient *client)
+{
+    g_return_val_if_fail (client == global_client, FALSE);
+
+    return sm_client_state_file != NULL;
+}
+
+/**
+ * egg_sm_client_get_state_file:
+ * @client: the client
+ *
+ * If the application was resumed by the session manager, this will
+ * return the #GKeyFile containing its state from the previous
+ * session.
+ *
+ * Note that other libraries and #EggSMClient itself may also store
+ * state in the key file, so if you call egg_sm_client_get_groups(),
+ * on it, the return value will likely include groups that you did not
+ * put there yourself. (It is also not guaranteed that the first
+ * group created by the application will still be the "start group"
+ * when it is resumed.)
+ *
+ * Return value: the #GKeyFile containing the application's earlier
+ * state, or %NULL on error. You should not free this key file; it
+ * is owned by @client.
+ **/
+GKeyFile *
+egg_sm_client_get_state_file (EggSMClient *client)
+{
+    EggSMClientPrivate *priv = egg_sm_client_get_instance_private (client);
+    char *state_file_path;
+    GError *err = NULL;
+
+    g_return_val_if_fail (client == global_client, NULL);
+
+    if (!sm_client_state_file)
+        return NULL;
+    if (priv->state_file)
+        return priv->state_file;
+
+    if (!strncmp (sm_client_state_file, "file://", 7))
+        state_file_path = g_filename_from_uri (sm_client_state_file, NULL, NULL);
+    else
+        state_file_path = g_strdup (sm_client_state_file);
+
+    priv->state_file = g_key_file_new ();
+    if (!g_key_file_load_from_file (priv->state_file, state_file_path, 0, &err))
+    {
+        g_warning ("Could not load SM state file '%s': %s",
+                   sm_client_state_file, err->message);
+        g_clear_error (&err);
+        g_key_file_free (priv->state_file);
+        priv->state_file = NULL;
+    }
+
+    g_free (state_file_path);
+    return priv->state_file;
+}
+
+/**
+ * egg_sm_client_set_restart_command:
+ * @client: the client
+ * @argc: the length of @argv
+ * @argv: argument vector
+ *
+ * Sets the command used to restart @client if it does not have a
+ * .desktop file that can be used to find its restart command.
+ *
+ * This can also be used when handling the ::save_state signal, to
+ * save the current state via an updated command line. (Eg, providing
+ * a list of filenames to open when the application is resumed.)
+ **/
+void
+egg_sm_client_set_restart_command (EggSMClient  *client,
+                                   int           argc,
+                                   const char  **argv)
+{
+    g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command)
+        EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command (client, argc, argv);
+}
+
+/**
+ * egg_sm_client_set_discard_command:
+ * @client: the client
+ * @argc: the length of @argv
+ * @argv: argument vector
+ *
+ * Sets the command used to discard a custom state file if using
+ * egg_sm_client_set_restart_command(), which must be called before
+ * using this function.
+ **/
+void
+egg_sm_client_set_discard_command (EggSMClient  *client,
+                                   int           argc,
+                                   const char  **argv)
+{
+	g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+	if (EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command)
+		EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command (client, argc, argv);
+}
+
+/**
+ * egg_sm_client_will_quit:
+ * @client: the client
+ * @will_quit: whether or not the application is willing to quit
+ *
+ * This MUST be called in response to the ::quit_requested signal, to
+ * indicate whether or not the application is willing to quit. The
+ * application may call it either directly from the signal handler, or
+ * at some later point (eg, after asynchronously interacting with the
+ * user).
+ *
+ * If the application does not connect to ::quit_requested,
+ * #EggSMClient will call this method on its behalf (passing %TRUE
+ * for @will_quit).
+ *
+ * After calling this method, the application should wait to receive
+ * either ::quit_cancelled or ::quit.
+ **/
+void
+egg_sm_client_will_quit (EggSMClient *client,
+                         gboolean     will_quit)
+{
+    g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->will_quit)
+        EGG_SM_CLIENT_GET_CLASS (client)->will_quit (client, will_quit);
+}
+
+/**
+ * egg_sm_client_end_session:
+ * @style: a hint at how to end the session
+ * @request_confirmation: whether or not the user should get a chance
+ * to confirm the action
+ *
+ * Requests that the session manager end the current session. @style
+ * indicates how the session should be ended, and
+ * @request_confirmation indicates whether or not the user should be
+ * given a chance to confirm the logout/reboot/shutdown. Both of these
+ * flags are merely hints though; the session manager may choose to
+ * ignore them.
+ *
+ * Return value: %TRUE if the request was sent; %FALSE if it could not
+ * be (eg, because it could not connect to the session manager).
+ **/
+gboolean
+egg_sm_client_end_session (EggSMClientEndStyle  style,
+                           gboolean             request_confirmation)
+{
+    EggSMClient *client = egg_sm_client_get ();
+
+    g_return_val_if_fail (EGG_IS_SM_CLIENT (client), FALSE);
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->end_session)
+    {
+        return EGG_SM_CLIENT_GET_CLASS (client)->end_session (client, style,
+                request_confirmation);
+    }
+    else
+        return FALSE;
+}
+
+/* Signal-emitting callbacks from platform-specific code */
+
+GKeyFile *
+egg_sm_client_save_state (EggSMClient *client)
+{
+    GKeyFile *state_file;
+    char *group;
+
+    g_return_val_if_fail (client == global_client, NULL);
+
+    state_file = g_key_file_new ();
+
+    g_debug ("Emitting save_state");
+    g_signal_emit (client, signals[SAVE_STATE], 0, state_file);
+    g_debug ("Done emitting save_state");
+
+    group = g_key_file_get_start_group (state_file);
+    if (group)
+    {
+        g_free (group);
+        return state_file;
+    }
+    else
+    {
+        g_key_file_free (state_file);
+        return NULL;
+    }
+}
+
+void
+egg_sm_client_quit_requested (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    if (!g_signal_has_handler_pending (client, signals[QUIT_REQUESTED], 0, FALSE))
+    {
+        g_debug ("Not emitting quit_requested because no one is listening");
+        egg_sm_client_will_quit (client, TRUE);
+        return;
+    }
+
+    g_debug ("Emitting quit_requested");
+    g_signal_emit (client, signals[QUIT_REQUESTED], 0);
+    g_debug ("Done emitting quit_requested");
+}
+
+void
+egg_sm_client_quit_cancelled (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    g_debug ("Emitting quit_cancelled");
+    g_signal_emit (client, signals[QUIT_CANCELLED], 0);
+    g_debug ("Done emitting quit_cancelled");
+}
+
+void
+egg_sm_client_quit (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    g_debug ("Emitting quit");
+    g_signal_emit (client, signals[QUIT], 0);
+    g_debug ("Done emitting quit");
+
+    /* FIXME: should we just call gtk_main_quit() here? */
+}
+
+static void
+egg_sm_client_debug_handler (const char *log_domain,
+                             GLogLevelFlags log_level,
+                             const char *message,
+                             gpointer user_data)
+{
+    static int debug = -1;
+
+    if (debug < 0)
+        debug = (g_getenv ("EGG_SM_CLIENT_DEBUG") != NULL);
+
+    if (debug)
+        g_log_default_handler (log_domain, log_level, message, NULL);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/80.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/80.html new file mode 100644 index 0000000..92c561b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/80.html @@ -0,0 +1,367 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_RAR_H
+#define FR_COMMAND_RAR_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_RAR            (fr_command_rar_get_type ())
+#define FR_COMMAND_RAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_RAR, FrCommandRar))
+#define FR_COMMAND_RAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_RAR, FrCommandRarClass))
+#define FR_IS_COMMAND_RAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_RAR))
+#define FR_IS_COMMAND_RAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_RAR))
+#define FR_COMMAND_RAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_RAR, FrCommandRarClass))
+
+typedef struct _FrCommandRar       FrCommandRar;
+typedef struct _FrCommandRarClass  FrCommandRarClass;
+
+typedef enum
+{
+	FR_COMMAND_RAR_TYPE_RAR4 = 0,
+	FR_COMMAND_RAR_TYPE_RAR5,
+	FR_COMMAND_RAR_TYPE_UNRAR_FREE,
+} FrCommandRarType;
+
+struct _FrCommandRar
+{
+	FrCommand  __parent;
+
+	gboolean  list_started;
+	gboolean  rar4_odd_line;
+	FrCommandRarType output_type;
+	FileData *fdata;
+};
+
+struct _FrCommandRarClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_rar_get_type (void);
+
+#endif /* FR_COMMAND_RAR_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/81.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/81.html new file mode 100644 index 0000000..bdd57f3 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/81.html @@ -0,0 +1,879 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-rpm.h"
+
+static void fr_command_rpm_class_init  (FrCommandRpmClass *class);
+static void fr_command_rpm_init        (FrCommand         *afile);
+static void fr_command_rpm_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *month,<--- Parameter 'month' can be declared as pointer to const
+		    char *mday,<--- Parameter 'mday' can be declared as pointer to const
+		    char *year)
+{
+	struct tm tm = {0, };
+
+	tm.tm_isdst = -1;
+
+	if (month != NULL) {
+		static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+		                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+		int i;
+
+		for (i = 0; i < 12; i++) {
+			if (strcmp (months[i], month) == 0) {
+				tm.tm_mon = i;
+				break;
+			}
+		}
+	} else
+		tm.tm_mon = 0;
+
+	if (mday != NULL)
+		tm.tm_mday = atoi (mday);
+	else
+		tm.tm_mday = 1;
+
+	if (year != NULL) {
+		if (strchr (year, ':') != NULL) {
+			char **fields = g_strsplit (year, ":", 2);
+			if ((fields != NULL) && (g_strv_length (fields) == 2)) {
+				time_t      now;
+				struct tm  *now_tm;<--- Variable 'now_tm' can be declared as pointer to const
+
+				tm.tm_hour = atoi (fields[0]);
+				tm.tm_min = atoi (fields[1]);
+
+				now = time(NULL);
+				now_tm = localtime (&now);
+				tm.tm_year = now_tm->tm_year;
+			}
+		} else
+			tm.tm_year = atoi (year) - 1900;
+	} else
+		tm.tm_year = 70;
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		    gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	const char  *name_field;
+	char        *name;
+	int          ofs = 0;<--- Variable 'ofs' is assigned a value that is never used.
+
+	g_return_if_fail (line != NULL);
+
+	fdata = file_data_new ();
+
+#ifdef __sun
+	fields = split_line (line, 9);
+	fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+	fdata->modified = mktime_from_string (fields[5], fields[6], fields[8]);
+	g_strfreev (fields);
+
+	name_field = get_last_field (line, 10);
+#else /* !__sun */
+	/* Handle char and block device files */
+	if ((line[0] == 'c') || (line[0] == 'b')) {
+		fields = split_line (line, 9);
+		ofs = 1;
+		fdata->size = 0;
+		/* TODO We should also specify the content type */
+	}
+	else {
+		fields = split_line (line, 8);
+		fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+	}
+	fdata->modified = mktime_from_string (fields[5+ofs], fields[6+ofs], fields[7+ofs]);
+	g_strfreev (fields);
+
+	name_field = get_last_field (line, 9+ofs);
+#endif /* !__sun */
+
+	fields = g_strsplit (name_field, " -> ", 2);
+
+	if (fields[1] == NULL) {
+		g_strfreev (fields);
+		fields = g_strsplit (name_field, " link to ", 2);
+	}
+
+	fdata->dir = line[0] == 'd';
+
+	name = g_strcompress (fields[0]);
+	if (*(fields[0]) == '/') {
+		fdata->full_path = g_strdup (name);
+		fdata->original_path = fdata->full_path;
+	}
+	else {
+		fdata->full_path = g_strconcat ("/", name, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+	if (fdata->dir && (name[strlen (name) - 1] != '/')) {
+		char *old_full_path = fdata->full_path;
+		fdata->full_path = g_strconcat (old_full_path, "/", NULL);
+		g_free (old_full_path);
+		fdata->original_path = g_strdup (name);
+		fdata->free_original_path = TRUE;
+	}
+	g_free (name);
+
+	if (fields[1] != NULL)
+		fdata->link = g_strcompress (fields[1]);
+	g_strfreev (fields);
+
+	if (fdata->dir)
+		fdata->name = dir_name_from_path (fdata->full_path);
+	else
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+fr_command_rpm_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "sh");
+	fr_process_add_arg (comm->process, "-c");
+	fr_process_add_arg_concat (comm->process, "rpm2cpio < ", comm->e_filename, " | cpio -itv", NULL);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_rpm_extract (FrCommand  *comm,
+		        const char  *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList   *scan;
+	GString *cmd;
+
+	fr_process_begin_command (comm->process, "sh");
+	if (dest_dir != NULL)
+                fr_process_set_working_dir (comm->process, dest_dir);
+	fr_process_add_arg (comm->process, "-c");
+
+	cmd = g_string_new ("rpm2cpio < ");
+	g_string_append (cmd, comm->e_filename);
+	g_string_append (cmd, " | cpio -idu");
+	for (scan = file_list; scan; scan = scan->next) {
+		g_string_append (cmd, " ");
+		char *filename = g_shell_quote (scan->data);
+		g_string_append (cmd, filename);
+		g_free (filename);
+	}
+	fr_process_add_arg (comm->process, cmd->str);
+	g_string_free (cmd, TRUE);
+
+	fr_process_end_command (comm->process);
+}
+
+const char *rpm_mime_type[] = { "application/x-rpm", NULL };
+
+static const char **
+fr_command_rpm_get_mime_types (FrCommand *comm)
+{
+	return rpm_mime_type;
+}
+
+static FrCommandCaps
+fr_command_rpm_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("rpm2cpio", check_command) &&
+            is_program_available (CPIO_PATH, check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_rpm_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("cpio,rpm");
+}
+
+static void
+fr_command_rpm_class_init (FrCommandRpmClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_rpm_finalize;
+
+        afc->list             = fr_command_rpm_list;
+	afc->extract          = fr_command_rpm_extract;
+	afc->get_mime_types   = fr_command_rpm_get_mime_types;
+	afc->get_capabilities = fr_command_rpm_get_capabilities;
+	afc->get_packages     = fr_command_rpm_get_packages;
+}
+
+static void
+fr_command_rpm_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = FALSE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_rpm_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_RPM (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_rpm_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandRpmClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_rpm_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandRpm),
+			0,
+			(GInstanceInitFunc) fr_command_rpm_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandRpm",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/82.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/82.html new file mode 100644 index 0000000..fd048be --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/82.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_RPM_H
+#define FR_COMMAND_RPM_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_RPM            (fr_command_rpm_get_type ())
+#define FR_COMMAND_RPM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_RPM, FrCommandRpm))
+#define FR_COMMAND_RPM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_RPM, FrCommandRpmClass))
+#define FR_IS_COMMAND_RPM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_RPM))
+#define FR_IS_COMMAND_RPM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_RPM))
+#define FR_COMMAND_RPM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_RPM, FrCommandRpmClass))
+
+typedef struct _FrCommandRpm       FrCommandRpm;
+typedef struct _FrCommandRpmClass  FrCommandRpmClass;
+
+struct _FrCommandRpm
+{
+	FrCommand  __parent;
+	gboolean   is_empty;
+};
+
+struct _FrCommandRpmClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_rpm_get_type (void);
+
+#endif /* FR_COMMAND_RPM_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/83.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/83.html new file mode 100644 index 0000000..444e2a5 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/83.html @@ -0,0 +1,2711 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _XOPEN_SOURCE 700
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-tar.h"
+
+#define LSTAR_DATE_FORMAT "%Y-%m-%d %H:%M"
+
+static void fr_command_tar_class_init  (FrCommandTarClass *class);
+static void fr_command_tar_init        (FrCommand         *afile);
+static void fr_command_tar_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (const char *time_s)
+{
+	struct tm tm = {0, };
+	tm.tm_isdst = -1;
+	strptime (time_s, LSTAR_DATE_FORMAT, &tm);
+	return mktime (&tm);
+}
+
+static char*
+tar_get_last_field (const char *line,
+		    int         start_from,
+		    int         field_n)
+{
+	const char *f_start, *f_end;
+
+	line = line + start_from;
+
+	f_start = line;
+	while ((*f_start == ' ') && (*f_start != *line))
+		f_start++;
+	f_end = f_start;
+
+	while ((field_n > 0) && (*f_end != 0)) {
+		if (*f_end == ' ') {
+			field_n--;
+			if (field_n == 1)
+				f_start = f_end;
+		}
+		f_end++;
+	}
+
+	if (*f_start == ' ')
+		f_start++;
+
+	return g_strdup (f_start);
+}
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	int          date_idx;
+	char        *field_date, *field_size, *field_name;
+	char        *name;
+
+	g_return_if_fail (line != NULL);
+
+	date_idx = file_list__get_index_from_pattern (line, "%n%n%n%n-%n%n-%n%n %n%n:%n%n");
+	if (date_idx < 0)
+		return;
+
+	fdata = file_data_new ();
+
+	field_size = file_list__get_prev_field (line, date_idx, 1);
+	fdata->size = g_ascii_strtoull (field_size, NULL, 10);
+	g_free (field_size);
+
+	field_date = g_strndup (line + date_idx, 16);
+	fdata->modified = mktime_from_string (field_date);
+	g_free (field_date);
+
+	/* Full path */
+
+	field_name = tar_get_last_field (line, date_idx, 3);
+	fields = g_strsplit (field_name, " -> ", 2);
+
+	if (fields[1] == NULL) {
+		g_strfreev (fields);
+		fields = g_strsplit (field_name, " link to ", 2);
+	}
+
+	name = g_strcompress (fields[0]);
+	if (*name == '/') {
+		fdata->full_path = g_strdup (name);
+		fdata->original_path = fdata->full_path;
+	} else {
+		fdata->full_path = g_strconcat ("/", name, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+	g_free (name);
+	name = g_filename_from_utf8 (fdata->original_path, -1, NULL, NULL, NULL);
+	if (name) {
+		fdata->original_path = g_strdup (name);
+		fdata->free_original_path = TRUE;
+	}
+	g_free (name);
+
+	if (fields[1] != NULL)
+		fdata->link = g_strdup (fields[1]);
+	g_strfreev (fields);
+	g_free (field_name);
+
+	fdata->dir = line[0] == 'd';
+	if (fdata->dir)
+		fdata->name = dir_name_from_path (fdata->full_path);
+	else
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+add_compress_arg (FrCommand *comm)
+{
+	if (is_mime_type (comm->mime_type, "application/x-compressed-tar"))
+		fr_process_add_arg (comm->process, "-z");
+
+	else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar"))
+		fr_process_add_arg (comm->process, "--use-compress-program=brotli");
+
+	else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar"))
+		if (is_program_in_path ("lbzip2"))
+			fr_process_add_arg (comm->process, "--use-compress-program=lbzip2");
+		else
+			fr_process_add_arg (comm->process, "--use-compress-program=bzip2");
+
+	else if (is_mime_type (comm->mime_type, "application/x-tarz")) {
+		if (is_program_in_path ("gzip"))
+			fr_process_add_arg (comm->process, "-z");
+		else
+			fr_process_add_arg (comm->process, "-Z");
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar"))
+		fr_process_add_arg (comm->process, "--use-compress-program=lrzip");
+
+	else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar"))
+		fr_process_add_arg (comm->process, "--use-compress-program=lzip");
+
+	else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar"))
+		fr_process_add_arg (comm->process, "--use-compress-program=lzma");
+
+	else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar"))
+		if (is_program_in_path ("pixz"))
+			fr_process_add_arg (comm->process, "--use-compress-program=pixz");
+		else
+			fr_process_add_arg (comm->process, "--use-compress-program=xz");
+
+	else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar"))
+		fr_process_add_arg (comm->process, "--use-compress-program=lzop");
+
+	else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
+		FrCommandTar *comm_tar = (FrCommandTar*) comm;
+		char         *option;
+
+		option = g_strdup_printf ("--use-compress-program=%s", comm_tar->compress_command);
+		fr_process_add_arg (comm->process, option);
+		g_free (option);
+	}
+}
+
+static void
+begin_tar_command (FrCommand *comm)
+{
+	char *command = NULL;
+
+	/* In solaris gtar is present under /usr/sfw/bin */
+
+	command = g_find_program_in_path ("gtar");
+#if defined (__SVR4) && defined (__sun)
+	if (g_file_test ("/usr/sfw/bin/gtar", G_FILE_TEST_IS_EXECUTABLE)) {
+		g_free (command);
+		command = g_strdup ("/usr/sfw/bin/gtar");
+	}
+#endif
+	if (command != NULL)
+		fr_process_begin_command (comm->process, command);
+	else
+		fr_process_begin_command (comm->process, "tar");
+	g_free (command);
+}
+
+static void
+fr_command_tar_list (FrCommand *comm)
+{
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	begin_tar_command (comm);
+	fr_process_add_arg (comm->process, "--force-local");
+	fr_process_add_arg (comm->process, "--no-wildcards");
+	fr_process_add_arg (comm->process, "-tvf");
+	fr_process_add_arg (comm->process, comm->filename);
+	add_compress_arg (comm);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static gboolean
+can_create_a_compressed_archive (FrCommand *comm)<--- Parameter 'comm' can be declared as pointer to const
+{
+	return comm->creating_archive && ! is_mime_type (comm->mime_type, "application/x-7z-compressed-tar");
+}
+
+static void
+process_line__generic (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		       gpointer  data,
+		       char     *action_msg)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (line == NULL)
+		return;
+
+	if (line[strlen (line) - 1] == '/') /* ignore directories */
+		return;
+
+	if (comm->n_files != 0) {
+		double fraction = (double) ++comm->n_file / (comm->n_files + 1);
+		fr_command_progress (comm, fraction);
+	}
+	else {
+		char *msg = g_strconcat (action_msg, file_name_from_path (line), NULL);
+		fr_command_message (comm, msg);
+		g_free (msg);
+	}
+}
+
+static void
+process_line__add (char     *line,
+		   gpointer  data)
+{
+	/* Translators: after the colon there is a filename. */
+	process_line__generic (line, data, _("Adding file: "));
+}
+
+static void
+fr_command_tar_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	FrCommandTar *c_tar = FR_COMMAND_TAR (comm);<--- Variable 'c_tar' can be declared as pointer to const
+	GList        *scan;
+
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+				      process_line__add,
+				      comm);
+
+	begin_tar_command (comm);
+	fr_process_add_arg (comm->process, "--force-local");
+	if (! recursive)
+		fr_process_add_arg (comm->process, "--no-recursion");
+	fr_process_add_arg (comm->process, "--no-wildcards");
+	fr_process_add_arg (comm->process, "--no-unquote");
+	fr_process_add_arg (comm->process, "-v");
+	fr_process_add_arg (comm->process, "-p");
+
+	if (base_dir != NULL) {
+		fr_process_add_arg (comm->process, "-C");
+		fr_process_add_arg (comm->process, base_dir);
+	}
+
+	if (can_create_a_compressed_archive (comm)) {
+		fr_process_add_arg (comm->process, "-cf");
+		fr_process_add_arg (comm->process, comm->filename);
+		add_compress_arg (comm);
+	}
+	else {
+		if (comm->creating_archive)
+			fr_process_add_arg (comm->process, "-cf");
+		else
+			fr_process_add_arg (comm->process, "-rf");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+	}
+
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
+
+	fr_process_add_arg (comm->process, "--");
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__delete (char     *line,
+		      gpointer  data)
+{
+	/* Translators: after the colon there is a filename. */
+	process_line__generic (line, data, _("Removing file: "));
+}
+
+static void
+begin_func__delete (gpointer data)
+{
+	FrCommand *comm = data;
+	fr_command_progress (comm, -1.0);
+	fr_command_message (comm, _("Deleting files from archive"));
+}
+
+static void
+fr_command_tar_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
+{
+	FrCommandTar *c_tar = FR_COMMAND_TAR (comm);<--- Variable 'c_tar' can be declared as pointer to const
+	GList        *scan;
+
+	fr_process_set_out_line_func (comm->process,
+				      process_line__delete,
+				      comm);
+
+	begin_tar_command (comm);
+	fr_process_set_begin_func (comm->process, begin_func__delete, comm);
+	fr_process_add_arg (comm->process, "--force-local");
+	fr_process_add_arg (comm->process, "--no-wildcards");
+	fr_process_add_arg (comm->process, "--no-unquote");
+	fr_process_add_arg (comm->process, "-v");
+	fr_process_add_arg (comm->process, "--delete");
+	fr_process_add_arg (comm->process, "-f");
+	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
+
+	fr_process_add_arg (comm->process, "--");
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+process_line__extract (char     *line,
+		       gpointer  data)
+{
+	/* Translators: after the colon there is a filename. */
+	process_line__generic (line, data, _("Extracting file: "));
+}
+
+static void
+fr_command_tar_extract (FrCommand  *comm,
+		        const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_set_out_line_func (comm->process,
+				      process_line__extract,
+				      comm);
+
+	begin_tar_command (comm);
+	fr_process_add_arg (comm->process, "--force-local");
+	fr_process_add_arg (comm->process, "--no-wildcards");
+	fr_process_add_arg (comm->process, "--no-unquote");
+	fr_process_add_arg (comm->process, "-v");
+	fr_process_add_arg (comm->process, "-p");
+
+	if (! overwrite)
+		fr_process_add_arg (comm->process, "-k");
+	if (skip_older)
+		fr_process_add_arg (comm->process, "--keep-newer-files");
+
+	fr_process_add_arg (comm->process, "-xf");
+	fr_process_add_arg (comm->process, comm->filename);
+	add_compress_arg (comm);
+
+	if (dest_dir != NULL) {
+		fr_process_add_arg (comm->process, "-C");
+		fr_process_add_arg (comm->process, dest_dir);
+	}
+
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
+
+	fr_process_add_arg (comm->process, "--");
+
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+begin_func__recompress (gpointer data)
+{
+	FrCommand *comm = data;
+	fr_command_progress (comm, -1.0);
+	fr_command_message (comm, _("Recompressing archive"));
+}
+
+static gboolean
+gzip_continue_func (gpointer user_data)
+{
+	FrCommand *comm = user_data;
+
+	/* ignore gzip warnings */
+
+	if (comm->process->error.status == 2) {
+		comm->process->error.type = FR_PROC_ERROR_NONE;
+		comm->process->error.status = 0;
+		g_clear_error (&comm->process->error.gerror);
+	}
+
+	return comm->process->error.status == 0;
+}
+
+static void
+fr_command_tar_recompress (FrCommand *comm)
+{
+	FrCommandTar *c_tar = FR_COMMAND_TAR (comm);
+	char         *new_name = NULL;
+
+	if (can_create_a_compressed_archive (comm))
+		return;
+
+	if (is_mime_type (comm->mime_type, "application/x-compressed-tar")) {
+		fr_process_begin_command (comm->process, "gzip");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		fr_process_set_continue_func (comm->process, gzip_continue_func, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".gz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+		fr_process_begin_command (comm->process, "brotli");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "--best"); break; // i.e. -q 11
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".br", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
+		fr_process_begin_command (comm->process, "bzip2");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".bz2", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-tarz")) {
+		fr_process_begin_command (comm->process, "compress");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".Z", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar")) {
+		fr_process_begin_command (comm->process, "lrzip");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-l"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-g"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-b"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-z"); break;
+		}
+		fr_process_add_arg (comm->process, "-o");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".lrz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar")) {
+		fr_process_begin_command (comm->process, "lzip");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".lz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar")) {
+		fr_process_begin_command (comm->process, "lzma");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".lzma", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+		fr_process_begin_command (comm->process, "xz");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".xz", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
+		fr_process_begin_command (comm->process, "lzop");
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-3"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-6"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-9"); break;
+		}
+		fr_process_add_arg (comm->process, "-fU");
+		fr_process_add_arg (comm->process, "--no-stdin");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".lzo", NULL);
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
+		FrCommandTar *comm_tar = (FrCommandTar*) comm;
+
+		fr_process_begin_command (comm->process, comm_tar->compress_command);
+		fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+		switch (comm->compression) {
+		case FR_COMPRESSION_VERY_FAST:
+			fr_process_add_arg (comm->process, "-mx=1"); break;
+		case FR_COMPRESSION_FAST:
+			fr_process_add_arg (comm->process, "-mx=5"); break;
+		case FR_COMPRESSION_NORMAL:
+			fr_process_add_arg (comm->process, "-mx=5"); break;
+		case FR_COMPRESSION_MAXIMUM:
+			fr_process_add_arg (comm->process, "-mx=7"); break;
+		}
+		fr_process_add_arg (comm->process, "a");
+		fr_process_add_arg (comm->process, "-bd");
+		fr_process_add_arg (comm->process, "-y");
+		if (g_strcmp0 (comm_tar->compress_command, "7zzs") != 0 && g_strcmp0 (comm_tar->compress_command, "7zz") != 0)
+			fr_process_add_arg (comm->process, "-l");
+
+		new_name = g_strconcat (c_tar->uncomp_filename, ".7z", NULL);
+		fr_process_add_arg_concat (comm->process, new_name, NULL);
+
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+
+		/* remove the uncompressed tar */
+
+		fr_process_begin_command (comm->process, "rm");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+		fr_process_end_command (comm->process);
+	}
+
+	if (c_tar->name_modified) {
+		char *tmp_dir;
+
+		/* Restore original name. */
+
+		fr_process_begin_command (comm->process, "mv");
+		fr_process_add_arg (comm->process, "-f");
+		fr_process_add_arg (comm->process, new_name);
+		fr_process_add_arg (comm->process, comm->filename);
+		fr_process_end_command (comm->process);
+
+		tmp_dir = remove_level_from_path (new_name);
+
+		fr_process_begin_command (comm->process, "rm");
+		fr_process_set_sticky (comm->process, TRUE);
+		fr_process_add_arg (comm->process, "-fr");
+		fr_process_add_arg (comm->process, tmp_dir);
+		fr_process_end_command (comm->process);
+
+		g_free (tmp_dir);
+	}
+
+	g_free (new_name);
+	g_free (c_tar->uncomp_filename);
+	c_tar->uncomp_filename = NULL;
+}
+
+static void
+begin_func__uncompress (gpointer data)
+{
+	FrCommand *comm = data;
+	fr_command_progress (comm, -1.0);
+	fr_command_message (comm, _("Decompressing archive"));
+}
+
+static char *
+get_uncompressed_name (FrCommandTar *c_tar,
+		       const char   *e_filename)
+{
+	FrCommand *comm = FR_COMMAND (c_tar);<--- Variable 'comm' can be declared as pointer to const
+	char      *new_name = g_strdup (e_filename);
+	int        l = strlen (new_name);
+
+	if (is_mime_type (comm->mime_type, "application/x-compressed-tar")) {
+		/* X.tgz     -->  X.tar
+		 * X.tar.gz  -->  X.tar */
+		if (file_extension_is (e_filename, ".tgz")) {
+			new_name[l - 2] = 'a';
+			new_name[l - 1] = 'r';
+		}
+		else if (file_extension_is (e_filename, ".tar.gz"))
+			new_name[l - 3] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+		/* X.tar.br -->  X.tar */
+		if (file_extension_is (e_filename, ".tar.br"))
+			new_name[l - 3] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
+		/* X.tbz2    -->  X.tar
+		 * X.tar.bz2 -->  X.tar */
+		if (file_extension_is (e_filename, ".tbz2")) {
+			new_name[l - 3] = 'a';
+			new_name[l - 2] = 'r';
+			new_name[l - 1] = 0;
+		}
+		else if (file_extension_is (e_filename, ".tar.bz2"))
+			new_name[l - 4] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-tarz")) {
+		/* X.taz   -->  X.tar
+		 * X.tar.Z -->  X.tar */
+		if (file_extension_is (e_filename, ".taz"))
+			new_name[l - 1] = 'r';
+		else if (file_extension_is (e_filename, ".tar.Z"))
+			new_name[l - 2] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar")) {
+		/* X.tlrz     -->  X.tar
+		 * X.tar.lrz  -->  X.tar */
+		if (file_extension_is (e_filename, ".tlrz")) {
+			new_name[l - 3] = 'a';
+			new_name[l - 2] = 'r';
+			new_name[l - 1] = 0;
+		}
+		else if (file_extension_is (e_filename, ".tar.lrz"))
+			new_name[l - 4] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar")) {
+		/* X.tlz     -->  X.tar
+		 * X.tar.lz  -->  X.tar */
+		if (file_extension_is (e_filename, ".tlz")) {
+			new_name[l - 2] = 'a';
+			new_name[l - 1] = 'r';
+		}
+		else if (file_extension_is (e_filename, ".tar.lz"))
+			new_name[l - 3] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar")) {
+		/* X.tar.lzma --> X.tar
+		 * (There doesn't seem to be a shorthand suffix) */
+		if (file_extension_is (e_filename, ".tar.lzma"))
+			new_name[l - 5] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+		/* X.txz     -->  X.tar
+		 * X.tar.xz  -->  X.tar */
+		if (file_extension_is (e_filename, ".txz")) {
+			new_name[l - 2] = 'a';
+			new_name[l - 1] = 'r';
+		}
+		else if (file_extension_is (e_filename, ".tar.xz"))
+			new_name[l - 3] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
+		/* X.tzo     -->  X.tar
+		 * X.tar.lzo -->  X.tar */
+		if (file_extension_is (e_filename, ".tzo")) {
+			new_name[l - 2] = 'a';
+			new_name[l - 1] = 'r';
+		}
+		else if (file_extension_is (e_filename, ".tar.lzo"))
+			new_name[l - 4] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
+		/* X.tar.7z -->  X.tar */
+		if (file_extension_is (e_filename, ".tar.7z"))
+			new_name[l - 3] = 0;
+	}
+	else if (is_mime_type (comm->mime_type, "application/x-zstd-compressed-tar")) {
+		/* X.tar.zst -->  X.tar */
+		if (file_extension_is (e_filename, ".tar.zst"))
+			new_name[l - 4] = 0;
+	}
+
+	return new_name;
+}
+
+static char *
+get_temp_name (FrCommandTar *c_tar,
+	       const char   *filepath)
+{
+	char *dirname = remove_level_from_path (filepath);
+	char *template;
+	char *result = NULL;
+	char *temp_name = NULL;
+
+	template = g_strconcat (dirname, "/.fr-XXXXXX", NULL);
+	result = mkdtemp (template);
+	temp_name = g_build_filename (result, file_name_from_path (filepath), NULL);
+	g_free (template);
+
+	return temp_name;
+}
+
+static void
+fr_command_tar_uncompress (FrCommand *comm)
+{
+	FrCommandTar *c_tar = FR_COMMAND_TAR (comm);
+	char         *tmp_name;
+	gboolean      archive_exists;
+
+	if (can_create_a_compressed_archive (comm))
+		return;
+
+	if (c_tar->uncomp_filename != NULL) {
+		g_free (c_tar->uncomp_filename);
+		c_tar->uncomp_filename = NULL;
+	}
+
+	archive_exists = ! comm->creating_archive;
+
+	c_tar->name_modified = ! is_mime_type (comm->mime_type, "application/x-tar");
+	if (c_tar->name_modified) {
+		tmp_name = get_temp_name (c_tar, comm->filename);
+		if (archive_exists) {
+			fr_process_begin_command (comm->process, "mv");
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, comm->filename);
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+	}
+	else
+		tmp_name = g_strdup (comm->filename);
+
+	if (archive_exists) {
+		if (is_mime_type (comm->mime_type, "application/x-compressed-tar")) {
+			fr_process_begin_command (comm->process, "gzip");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_set_continue_func (comm->process, gzip_continue_func, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+			fr_process_begin_command (comm->process, "brotli");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
+			fr_process_begin_command (comm->process, "bzip2");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-tarz")) {
+			if (is_program_in_path ("gzip")) {
+				fr_process_begin_command (comm->process, "gzip");
+				fr_process_set_continue_func (comm->process, gzip_continue_func, comm);
+			}
+			else
+				fr_process_begin_command (comm->process, "uncompress");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar")) {
+			fr_process_begin_command (comm->process, "lrzip");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar")) {
+			fr_process_begin_command (comm->process, "lzip");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar")) {
+			fr_process_begin_command (comm->process, "lzma");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+			fr_process_begin_command (comm->process, "xz");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
+			fr_process_begin_command (comm->process, "lzop");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-dfU");
+			fr_process_add_arg (comm->process, "--no-stdin");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
+			FrCommandTar *comm_tar = (FrCommandTar*) comm;<--- Variable 'comm_tar' can be declared as pointer to const
+
+			fr_process_begin_command (comm->process, comm_tar->compress_command);
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "e");
+			fr_process_add_arg (comm->process, "-bd");
+			fr_process_add_arg (comm->process, "-y");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+
+			/* remove the compressed tar */
+
+			fr_process_begin_command (comm->process, "rm");
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+		else if (is_mime_type (comm->mime_type, "application/x-zstd-compressed-tar")) {
+			fr_process_begin_command (comm->process, "zstd");
+			fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+			fr_process_add_arg (comm->process, "-f");
+			fr_process_add_arg (comm->process, "-d");
+			fr_process_add_arg (comm->process, tmp_name);
+			fr_process_end_command (comm->process);
+		}
+	}
+
+	c_tar->uncomp_filename = get_uncompressed_name (c_tar, tmp_name);
+	g_free (tmp_name);
+}
+
+static void
+fr_command_tar_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	if (error->type != FR_PROC_ERROR_NONE) {
+		if (error->status <= 1)
+			error->type = FR_PROC_ERROR_NONE;
+	}
+}
+
+const char *tar_mime_types[] = { "application/x-compressed-tar",
+				 "application/x-brotli-compressed-tar",
+				 "application/x-bzip-compressed-tar",
+				 "application/x-tar",
+				 "application/x-7z-compressed-tar",
+				 "application/x-lrzip-compressed-tar",
+				 "application/x-lzip-compressed-tar",
+			         "application/x-lzma-compressed-tar",
+			         "application/x-lzop-compressed-tar",
+			         "application/x-tarz",
+				 "application/x-xz-compressed-tar",
+				 "application/x-zstd-compressed-tar",
+			         NULL };
+
+static const char **
+fr_command_tar_get_mime_types (FrCommand *comm)
+{
+	return tar_mime_types;
+}
+
+static FrCommandCaps
+fr_command_tar_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+
+	/* In solaris gtar is present under /usr/sfw/bin */
+	if (! is_program_available ("tar", check_command) && ! is_program_available ("/usr/sfw/bin/gtar", check_command))
+		return capabilities;
+
+	if (is_mime_type (mime_type, "application/x-tar")) {
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-compressed-tar")) {
+		if (is_program_available ("gzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar")) {
+		if (is_program_available ("brotli", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar")) {
+		if (is_program_available ("bzip2", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-tarz")) {
+		if (is_program_available ("compress", check_command) && is_program_available ("uncompress", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+		else if (is_program_available ("gzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ;
+	}
+	else if (is_mime_type (mime_type, "application/x-lrzip-compressed-tar")) {
+		if (is_program_available ("lrzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar")) {
+		if (is_program_available ("lzip", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzma-compressed-tar")) {
+		if (is_program_available ("lzma", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-xz-compressed-tar")) {
+		if (is_program_available ("xz", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-lzop-compressed-tar")) {
+		if (is_program_available ("lzop", check_command))
+			capabilities |= FR_COMMAND_CAN_READ_WRITE;
+	}
+	else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) {
+		const char *try_command[5] = { "7zzs", "7zz", "7za", "7zr", "7z" };
+		size_t i;
+
+		for (i = 0; i < G_N_ELEMENTS (try_command); i++) {
+			if (is_program_available (try_command[i], check_command)) {
+				capabilities |= FR_COMMAND_CAN_WRITE;
+				break;
+			}
+		}
+	}
+	else if (is_mime_type (mime_type, "application/x-zstd-compressed-tar")) {
+		if (is_program_available ("zstd", check_command))
+			capabilities |= FR_COMMAND_CAN_READ;
+	}
+
+	return capabilities;
+}
+
+static void
+fr_command_tar_set_mime_type (FrCommand  *comm,
+		 	      const char *mime_type)
+{
+	FrCommandTar *comm_tar = FR_COMMAND_TAR (comm);
+
+	FR_COMMAND_CLASS (parent_class)->set_mime_type (comm, mime_type);
+
+	if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) {
+		const char *try_command[5] = { "7zzs", "7zz", "7za", "7zr", "7z" };
+		size_t i;
+
+		for (i = 0; i < G_N_ELEMENTS (try_command); i++) {
+			if (is_program_in_path (try_command[i])) {
+				comm_tar->compress_command = g_strdup (try_command[i]);
+				break;
+			}
+		}
+	}
+}
+
+static const char *
+fr_command_tar_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	if (is_mime_type (mime_type, "application/x-tar"))
+		return PACKAGES ("tar");
+	else if (is_mime_type (mime_type, "application/x-compressed-tar"))
+		return PACKAGES ("tar,gzip");
+	else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar"))
+		return PACKAGES ("tar,bzip2");
+	else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar"))
+		return PACKAGES ("tar,brotli");
+	else if (is_mime_type (mime_type, "application/x-tarz"))
+		return PACKAGES ("tar,gzip,ncompress");
+	else if (is_mime_type (mime_type, "application/x-lrzip-compressed-tar"))
+		return PACKAGES ("tar,lrzip");
+	else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar"))
+		return PACKAGES ("tar,lzip");
+	else if (is_mime_type (mime_type, "application/x-lzma-compressed-tar"))
+		return PACKAGES ("tar,lzma");
+	else if (is_mime_type (mime_type, "application/x-xz-compressed-tar"))
+		return PACKAGES ("tar,xz");
+	else if (is_mime_type (mime_type, "application/x-lzop-compressed-tar"))
+		return PACKAGES ("tar,lzop");
+	else if (is_mime_type (mime_type, "application/x-7z-compressed-tar"))
+		return PACKAGES ("tar,7zip");
+	else if (is_mime_type (mime_type, "application/x-zstd-compressed-tar"))
+		return PACKAGES ("tar,zstd");
+
+	return NULL;
+}
+
+static void
+fr_command_tar_class_init (FrCommandTarClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_tar_finalize;
+
+        afc->list             = fr_command_tar_list;
+	afc->add              = fr_command_tar_add;
+	afc->delete           = fr_command_tar_delete;
+	afc->extract          = fr_command_tar_extract;
+	afc->handle_error     = fr_command_tar_handle_error;
+	afc->get_mime_types   = fr_command_tar_get_mime_types;
+	afc->get_capabilities = fr_command_tar_get_capabilities;
+	afc->set_mime_type    = fr_command_tar_set_mime_type;
+	afc->recompress       = fr_command_tar_recompress;
+	afc->uncompress       = fr_command_tar_uncompress;
+	afc->get_packages     = fr_command_tar_get_packages;
+}
+
+static void
+fr_command_tar_init (FrCommand *comm)
+{
+	FrCommandTar *comm_tar = (FrCommandTar*) comm;
+
+	comm->propAddCanUpdate              = FALSE;
+	comm->propAddCanReplace             = FALSE;
+	comm->propAddCanStoreFolders        = TRUE;
+	comm->propExtractCanAvoidOverwrite  = FALSE;
+	comm->propExtractCanSkipOlder       = TRUE;
+	comm->propExtractCanJunkPaths       = FALSE;
+	comm->propPassword                  = FALSE;
+	comm->propTest                      = FALSE;
+	comm->propCanDeleteNonEmptyFolders  = FALSE;
+	comm->propCanExtractNonEmptyFolders = FALSE;
+	comm->propListFromFile              = TRUE;
+
+	comm_tar->msg = NULL;
+	comm_tar->uncomp_filename = NULL;
+}
+
+static void
+fr_command_tar_finalize (GObject *object)
+{
+	FrCommandTar *comm_tar;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_TAR (object));
+
+	comm_tar = FR_COMMAND_TAR (object);
+
+	if (comm_tar->uncomp_filename != NULL) {
+		g_free (comm_tar->uncomp_filename);
+		comm_tar->uncomp_filename = NULL;
+	}
+
+	if (comm_tar->msg != NULL) {
+		g_free (comm_tar->msg);
+		comm_tar->msg = NULL;
+	}
+
+	if (comm_tar->compress_command != NULL) {
+		g_free (comm_tar->compress_command);
+		comm_tar->compress_command = NULL;
+	}
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_tar_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandTarClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_tar_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandTar),
+			0,
+			(GInstanceInitFunc) fr_command_tar_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandTar",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/84.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/84.html new file mode 100644 index 0000000..e80cb14 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/84.html @@ -0,0 +1,359 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_TAR_H
+#define FR_COMMAND_TAR_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+#include "typedefs.h"
+
+#define FR_TYPE_COMMAND_TAR            (fr_command_tar_get_type ())
+#define FR_COMMAND_TAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_TAR, FrCommandTar))
+#define FR_COMMAND_TAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_TAR, FrCommandTarClass))
+#define FR_IS_COMMAND_TAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_TAR))
+#define FR_IS_COMMAND_TAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_TAR))
+#define FR_COMMAND_TAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_TAR, FrCommandTarClass))
+
+typedef struct _FrCommandTar       FrCommandTar;
+typedef struct _FrCommandTarClass  FrCommandTarClass;
+
+struct _FrCommandTar
+{
+	FrCommand  __parent;
+
+	/*<private>*/
+
+	char      *uncomp_filename;
+	gboolean   name_modified;
+	char      *compress_command;
+
+	char      *msg;
+};
+
+struct _FrCommandTarClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_tar_get_type (void);
+
+#endif /* FR_COMMAND_TAR_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/85.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/85.html new file mode 100644 index 0000000..6b8ff3d --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/85.html @@ -0,0 +1,951 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2012 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define _XOPEN_SOURCE       /* See feature_test_macros(7) */
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <json-glib/json-glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "file-utils.h"
+#include "gio-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-unarchiver.h"
+#include "fr-error.h"
+
+#define LSAR_SUPPORTED_FORMAT 2
+#define LSAR_DATE_FORMAT "%Y-%m-%d %H:%M:%S %z"
+
+static void fr_command_unarchiver_class_init  (FrCommandUnarchiverClass *class);
+static void fr_command_unarchiver_init        (FrCommand         *afile);
+static void fr_command_unarchiver_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FrCommandUnarchiver *unar_comm = FR_COMMAND_UNARCHIVER (data);
+	g_memory_input_stream_add_data (G_MEMORY_INPUT_STREAM (unar_comm->stream), line, -1, NULL);
+}
+
+static time_t
+mktime_from_string (const char *time_s)
+{
+	struct tm tm = {0, };
+	tm.tm_isdst = -1;
+	strptime (time_s, LSAR_DATE_FORMAT, &tm);
+	return mktime (&tm);
+}
+
+static void
+list_command_completed (gpointer data)
+{
+	FrCommandUnarchiver *unar_comm = FR_COMMAND_UNARCHIVER (data);
+	JsonParser          *parser;
+	GError              *error = NULL;
+
+	parser = json_parser_new ();
+	if (json_parser_load_from_stream (parser, unar_comm->stream, NULL, &error)) {
+		JsonObject *root;
+
+		root = json_node_get_object (json_parser_get_root (parser));
+
+		if (json_object_get_int_member (root, "lsarFormatVersion") == LSAR_SUPPORTED_FORMAT) {
+			JsonArray *content;
+			guint      i;
+
+			content = json_object_get_array_member (root, "lsarContents");
+			for (i = 0; i < json_array_get_length (content); i++) {
+				JsonObject *entry;
+				FileData   *fdata;
+				const char *filename;
+
+				entry = json_array_get_object_element (content, i);
+				fdata = file_data_new ();
+				fdata->size = json_object_get_int_member (entry, "XADFileSize");
+				fdata->modified = mktime_from_string (json_object_get_string_member (entry, "XADLastModificationDate"));
+				if (json_object_has_member (entry, "XADIsEncrypted"))
+					fdata->encrypted = json_object_get_int_member (entry, "XADIsEncrypted") == 1;
+
+				filename = json_object_get_string_member (entry, "XADFileName");
+				if (*filename == '/') {
+					fdata->full_path = g_strdup (filename);
+					fdata->original_path = fdata->full_path;
+				}
+				else {
+					fdata->full_path = g_strconcat ("/", filename, NULL);
+					fdata->original_path = fdata->full_path + 1;
+				}
+
+				fdata->link = NULL;
+				if (json_object_has_member (entry, "XADIsDirectory"))
+					fdata->dir = json_object_get_int_member (entry, "XADIsDirectory") == 1;
+				if (fdata->dir)
+					fdata->name = dir_name_from_path (fdata->full_path);
+				else
+					fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+				fdata->path = remove_level_from_path (fdata->full_path);
+
+				fr_command_add_file (FR_COMMAND (unar_comm), fdata);
+			}
+		}
+	}
+
+	g_object_unref (parser);
+}
+
+static void
+fr_command_unarchiver_list (FrCommand  *comm)
+{
+	FrCommandUnarchiver *unar_comm = FR_COMMAND_UNARCHIVER (comm);
+
+	_g_object_unref (unar_comm->stream);
+	unar_comm->stream = g_memory_input_stream_new ();
+
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	fr_process_begin_command (comm->process, "lsar");
+	fr_process_set_end_func (comm->process, list_command_completed, comm);
+	fr_process_add_arg (comm->process, "-j");
+	if ((comm->password != NULL) && (comm->password[0] != '\0'))
+		fr_process_add_arg_concat (comm->process, "-password=", comm->password, NULL);
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+
+	fr_process_start (comm->process);
+}
+
+static void
+process_line__extract (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		       gpointer  data)
+{
+	FrCommand           *comm = FR_COMMAND (data);
+	FrCommandUnarchiver *unar_comm = FR_COMMAND_UNARCHIVER (comm);
+
+	if (line == NULL)
+		return;
+
+	unar_comm->n_line++;
+
+	/* the first line is the name of the archive */
+	if (unar_comm->n_line == 1)
+		return;
+
+	if (comm->n_files > 1) {
+		double fraction = (double) ++comm->n_file / (comm->n_files + 1);
+		fr_command_progress (comm, CLAMP (fraction, 0.0, 1.0));
+	}
+	else
+		fr_command_message (comm, line);
+}
+
+static void
+fr_command_unarchiver_extract (FrCommand  *comm,
+			       const char *from_file,
+			       GList      *file_list,
+			       const char *dest_dir,
+			       gboolean    overwrite,
+			       gboolean    skip_older,
+			       gboolean    junk_paths)
+{
+	FrCommandUnarchiver *unar_comm = FR_COMMAND_UNARCHIVER (comm);
+	GList               *scan;
+
+	unar_comm->n_line = 0;
+
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__extract,<--- You might need to cast the function pointer here
+				      comm);
+
+	fr_process_begin_command (comm->process, "unar");
+
+	if (overwrite)
+		fr_process_add_arg (comm->process, "-f");
+	else
+		fr_process_add_arg (comm->process, "-s");
+
+	fr_process_add_arg (comm->process, "-D");
+
+	if ((comm->password != NULL) && (comm->password[0] != '\0'))
+		fr_process_add_arg_concat (comm->process, "-password=", comm->password, NULL);
+
+	if (dest_dir != NULL)
+		fr_process_add_arg_concat (comm->process, "-output-directory=", dest_dir, NULL);
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char *escaped;
+
+		escaped = escape_str (scan->data, "[?");
+		fr_process_add_arg (comm->process, escaped);
+		g_free (escaped);
+	}
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_unarchiver_handle_error (FrCommand   *comm,
+				    FrProcError *error)
+{
+	GList *scan;
+
+#if 0
+	{
+		for (scan = g_list_last (comm->process->err.raw); scan; scan = scan->prev)
+			g_print ("%s\n", (char*)scan->data);
+	}
+#endif
+
+	if (error->type == FR_PROC_ERROR_NONE)
+		return;
+
+	if (error->type == FR_PROC_ERROR_COMMAND_ERROR) {
+		for (scan = g_list_last (comm->process->out.raw); scan; scan = scan->prev) {
+			char *line = scan->data;
+
+			if ((strstr (line, "This archive requires a password to unpack.") != NULL)  ||
+			    (strstr (line, "Failed! (Missing or wrong password)") != NULL)) {
+
+				error->type = FR_PROC_ERROR_ASK_PASSWORD;
+				break;
+			}
+		}
+	}
+}
+
+const char *unarchiver_mime_type[] = { "application/zip",
+				       "application/x-cbr",
+				       "application/x-rar",
+				       "application/x-cpio",
+				       NULL };
+
+static const char **
+fr_command_unarchiver_get_mime_types (FrCommand *comm)
+{
+	return unarchiver_mime_type;
+}
+
+static FrCommandCaps
+fr_command_unarchiver_get_capabilities (FrCommand  *comm,
+					const char *mime_type,
+					gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_DO_NOTHING;
+	if (is_program_available ("lsar", check_command) && is_program_available ("unar", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_unarchiver_get_packages (FrCommand  *comm,
+				    const char *mime_type)
+{
+	return PACKAGES ("unarchiver");
+}
+
+static void
+fr_command_unarchiver_class_init (FrCommandUnarchiverClass *class)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_unarchiver_finalize;
+
+	afc->list             = fr_command_unarchiver_list;
+	afc->extract          = fr_command_unarchiver_extract;
+	afc->handle_error     = fr_command_unarchiver_handle_error;
+	afc->get_mime_types   = fr_command_unarchiver_get_mime_types;
+	afc->get_capabilities = fr_command_unarchiver_get_capabilities;
+	afc->get_packages     = fr_command_unarchiver_get_packages;
+}
+
+static void
+fr_command_unarchiver_init (FrCommand *comm)
+{
+	FrCommandUnarchiver *unar_comm;
+
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = FALSE;
+	comm->propListFromFile             = FALSE;
+
+	unar_comm = FR_COMMAND_UNARCHIVER (comm);
+	unar_comm->stream = NULL;
+}
+
+static void
+fr_command_unarchiver_finalize (GObject *object)
+{
+	FrCommandUnarchiver *unar_comm;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_UNARCHIVER (object));
+
+	unar_comm = FR_COMMAND_UNARCHIVER (object);
+	_g_object_unref (unar_comm->stream);
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_unarchiver_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandUnarchiverClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_unarchiver_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandUnarchiver),
+			0,
+			(GInstanceInitFunc) fr_command_unarchiver_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FrCommandUnarchiver",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/86.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/86.html new file mode 100644 index 0000000..cfb03c7 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/86.html @@ -0,0 +1,347 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2012 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FR_COMMAND_UNARCHIVER_H
+#define FR_COMMAND_UNARCHIVER_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_UNARCHIVER            (fr_command_unarchiver_get_type ())
+#define FR_COMMAND_UNARCHIVER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiver))
+#define FR_COMMAND_UNARCHIVER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiverClass))
+#define FR_IS_COMMAND_UNARCHIVER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_UNARCHIVER))
+#define FR_IS_COMMAND_UNARCHIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_UNARCHIVER))
+#define FR_COMMAND_UNARCHIVER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiverClass))
+
+typedef struct _FrCommandUnarchiver       FrCommandUnarchiver;
+typedef struct _FrCommandUnarchiverClass  FrCommandUnarchiverClass;
+
+struct _FrCommandUnarchiver
+{
+	FrCommand  __parent;
+
+	GInputStream *stream;
+	int           n_line;
+};
+
+struct _FrCommandUnarchiverClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_unarchiver_get_type (void);
+
+#endif /* FR_COMMAND_UNARCHIVER_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/87.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/87.html new file mode 100644 index 0000000..651a55d --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/87.html @@ -0,0 +1,991 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "fr-command.h"
+#include "fr-command-unstuff.h"
+
+static void fr_command_unstuff_class_init  (FrCommandUnstuffClass *class);
+static void fr_command_unstuff_init        (FrCommand         *afile);
+static void fr_command_unstuff_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* recursive rmdir to remove the left-overs from unstuff */
+static void
+recursive_rmdir (const char *path)
+{
+	GDir *dir;
+	const char *dirname;
+
+	dir = g_dir_open (path, 0, NULL);
+	if (dir == NULL)
+		return;
+
+	dirname = g_dir_read_name (dir);
+	while (dirname != NULL)
+	{
+		char *full_path;
+
+		if (strcmp (dirname, ".") == 0 || strcmp (dirname, "..") == 0)
+			continue;
+
+		full_path = g_build_filename (path, dirname, NULL);
+		recursive_rmdir (full_path);
+		g_free (full_path);
+
+		dirname = g_dir_read_name (dir);
+	}
+
+	rmdir (path);
+
+	g_dir_close (dir);
+}
+
+/* unstuff doesn't like file paths starting with /, that's so shite */
+static char *
+unstuff_is_shit_with_filenames (const char *orig)
+{
+	int i, num_slashes;
+	char *current_dir, *filename;
+
+	g_return_val_if_fail (orig != NULL, NULL);
+
+	current_dir = g_get_current_dir ();
+	i = num_slashes = 0;
+	while (current_dir[i] != '\0') {
+		if (current_dir[i]  == '/')
+			num_slashes++;
+		i++;
+	}
+	g_free (current_dir);
+
+	/* 3 characters for each ../ plus filename length plus \0 */
+	filename = g_malloc (3 * i + strlen (orig) + 1);
+	i = 0;
+	for ( ; num_slashes > 0 ; num_slashes--) {
+		memcpy (filename + i, "../", 3);
+		i+=3;
+	}
+	memcpy (filename + i, orig, strlen (orig) + 1);
+
+	return filename;
+}
+
+static void
+process_line (char     *line,
+	      gpointer  data)
+{
+	FrCommand        *comm = FR_COMMAND (data);
+	FrCommandUnstuff *unstuff_comm = FR_COMMAND_UNSTUFF (comm);
+	const char       *str_start;
+	char             *filename, *real_filename;
+	int               i;
+	FileData         *fdata;
+
+	g_return_if_fail (line != NULL);
+
+	if (strstr (line, "progressEvent - ")) {
+		const char *ssize;
+		guint size;
+
+		ssize = strstr (line, "progressEvent - ")
+			+ strlen ("progressEvent - ");
+		if (ssize[0] == '\0')
+			size = 0;
+		else
+			size = g_ascii_strtoull (ssize, NULL, 10);
+
+		if (unstuff_comm->fdata != NULL)
+			unstuff_comm->fdata->size = size;
+
+		return;
+	}
+
+	if (strstr (line, "fileEvent") == NULL)
+		return;
+	if (strstr (line, unstuff_comm->target_dir + 1) == NULL)
+		return;
+
+	/* Look for the filename, ends with a comma */
+	str_start = strstr (line, unstuff_comm->target_dir + 1);
+	str_start = str_start + strlen (unstuff_comm->target_dir) - 1;
+	if (str_start[0] != '/')
+		str_start--;
+	if (str_start[0] == '.')
+		str_start--;
+	i = 0;
+	while (str_start[i] != '\0' && str_start[i] != ',') {
+		i++;
+	}
+	/* This is not supposed to happen */
+	g_return_if_fail (str_start[i] != '\0');
+	filename = g_strndup (str_start, i);
+
+	/* Same thing with the real filename */
+	str_start = strstr (line, unstuff_comm->target_dir);
+	i = 0;
+	while (str_start[i] != '\0' && str_start[i] != ',') {
+		i++;
+	}
+	real_filename = g_strndup (str_start, i);
+
+	fdata = file_data_new ();
+	fdata->full_path = filename;
+	fdata->original_path = filename;
+	fdata->link = NULL;
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	fdata->size = 0;
+	fdata->modified = time (NULL);
+
+	unstuff_comm->fdata = fdata;
+	fr_command_add_file (comm, fdata);
+
+	unlink (real_filename);
+	g_free (real_filename);
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandUnstuff *comm = data;
+
+	comm->fdata = NULL;
+}
+
+static void
+fr_command_unstuff_list (FrCommand *comm)
+{
+	char *arg, *path;
+	char *filename;
+	char *path_dots;
+
+	fr_process_set_out_line_func (comm->process, process_line, comm);
+
+	fr_process_begin_command (comm->process, "unstuff");
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "--trace");
+
+	/* Actually unpack everything in a temporary directory */
+	path = get_temp_work_dir (NULL);
+	path_dots = unstuff_is_shit_with_filenames (path);
+	g_free (path);
+
+	arg = g_strdup_printf ("-d=%s", path_dots);
+	FR_COMMAND_UNSTUFF (comm)->target_dir = path_dots;
+	fr_process_add_arg (comm->process, arg);
+	g_free (arg);
+
+	filename = unstuff_is_shit_with_filenames (comm->filename);
+	fr_process_add_arg (comm->process, filename);
+	g_free (filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+fr_command_unstuff_extract (FrCommand  *comm,
+			    const char  *from_file,
+			    GList      *file_list,
+			    const char *dest_dir,
+			    gboolean    overwrite,
+			    gboolean    skip_older,
+			    gboolean    junk_paths)
+{
+#if 0
+	GList *scan;
+#endif
+	char  *filename;
+
+	fr_process_begin_command (comm->process, "unstuff");
+
+	if (dest_dir != NULL) {
+		char *dest_dir_dots;
+		char *arg;
+
+		dest_dir_dots = unstuff_is_shit_with_filenames (dest_dir);
+		arg = g_strdup_printf ("-d=%s", dest_dir_dots);
+		fr_process_add_arg (comm->process, arg);
+		FR_COMMAND_UNSTUFF (comm)->target_dir = NULL;
+		g_free (arg);
+		g_free (dest_dir_dots);
+	}
+
+	fr_process_add_arg (comm->process, "--trace");
+
+	/* unstuff doesn't like file paths starting with /, that's so shite */
+	filename = unstuff_is_shit_with_filenames (comm->filename);
+	fr_process_add_arg (comm->process, filename);
+	g_free (filename);
+
+	/* FIXME it is not possible to unpack only some files */
+#if 0
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+#endif
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_unstuff_handle_error (FrCommand   *comm,
+				 FrProcError *error)
+{
+	if ((error->type != FR_PROC_ERROR_NONE)
+	    && (error->status <= 1))
+	{
+		error->type = FR_PROC_ERROR_NONE;
+	}
+}
+
+const char *unstuff_mime_type[] = { "application/x-stuffit", NULL };
+
+static const char **
+fr_command_unstuff_get_mime_types (FrCommand *comm)
+{
+	return unstuff_mime_type;
+}
+
+static FrCommandCaps
+fr_command_unstuff_get_capabilities (FrCommand  *comm,
+			             const char *mime_type,
+				     gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("unstuff", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_unstaff_get_packages (FrCommand  *comm,
+			         const char *mime_type)
+{
+	return PACKAGES ("unstaff");
+}
+
+static void
+fr_command_unstuff_class_init (FrCommandUnstuffClass *class)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_unstuff_finalize;
+
+	afc->list             = fr_command_unstuff_list;
+	afc->add              = NULL;
+	afc->delete           = NULL;
+	afc->extract          = fr_command_unstuff_extract;
+	afc->handle_error     = fr_command_unstuff_handle_error;
+	afc->get_mime_types   = fr_command_unstuff_get_mime_types;
+	afc->get_capabilities = fr_command_unstuff_get_capabilities;
+	afc->get_packages     = fr_command_unstaff_get_packages;
+}
+
+static void
+fr_command_unstuff_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = FALSE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = FALSE;
+}
+
+static void
+fr_command_unstuff_finalize (GObject *object)
+{
+	FrCommandUnstuff *unstuff_comm = FR_COMMAND_UNSTUFF (object);
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_UNSTUFF (object));
+
+	if (unstuff_comm->target_dir != NULL) {
+		recursive_rmdir (unstuff_comm->target_dir);
+		g_free (unstuff_comm->target_dir);
+	}
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_unstuff_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandUnstuffClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_unstuff_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandUnstuff),
+			0,
+			(GInstanceInitFunc) fr_command_unstuff_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandUnstuff",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/88.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/88.html new file mode 100644 index 0000000..fb7c706 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/88.html @@ -0,0 +1,349 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_UNSTUFF_H
+#define FR_COMMAND_UNSTUFF_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "fr-command.h"
+#include "fr-process.h"
+
+#define FR_TYPE_COMMAND_UNSTUFF            (fr_command_unstuff_get_type ())
+#define FR_COMMAND_UNSTUFF(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuff))
+#define FR_COMMAND_UNSTUFF_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuffClass))
+#define FR_IS_COMMAND_UNSTUFF(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_UNSTUFF))
+#define FR_IS_COMMAND_UNSTUFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_UNSTUFF))
+#define FR_COMMAND_UNSTUFF_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuffClass))
+
+typedef struct _FrCommandUnstuff       FrCommandUnstuff;
+typedef struct _FrCommandUnstuffClass  FrCommandUnstuffClass;
+
+struct _FrCommandUnstuff
+{
+	FrCommand  __parent;
+
+	char      *target_dir;
+	FileData  *fdata;
+};
+
+struct _FrCommandUnstuffClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_unstuff_get_type (void);
+
+#endif /* FR_COMMAND_UNSTUFF_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/89.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/89.html new file mode 100644 index 0000000..6a8b376 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/89.html @@ -0,0 +1,1269 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-zip.h"
+
+#define EMPTY_ARCHIVE_WARNING        "Empty zipfile."
+#define ZIP_SPECIAL_CHARACTERS       "[]*?!^-\\"
+
+static void fr_command_zip_class_init  (FrCommandZipClass *class);
+static void fr_command_zip_init        (FrCommand         *afile);
+static void fr_command_zip_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string (char *datetime_s)
+{
+	struct tm  tm = {0, };
+	char      *date;
+	char      *time;
+	char      *year;
+	char      *month;
+	char      *day;
+	char      *hour;
+	char      *min;
+	char      *sec;
+
+	/* expected YYYYMMDD.HHMMSS */
+	if (strlen (datetime_s) < 15)
+		return mktime (&tm);
+
+	tm.tm_isdst = -1;
+
+	/* date */
+
+	date = datetime_s;
+	year = g_strndup (date, 4);
+	month = g_strndup (date + 4, 2);
+	day = g_strndup (date + 6, 2);
+	tm.tm_year = atoi (year) - 1900;
+	tm.tm_mon = atoi (month) - 1;
+	tm.tm_mday = atoi (day);
+	g_free (year);
+	g_free (month);
+	g_free (day);
+
+	/* time */
+
+	time = datetime_s + 9;
+	hour = g_strndup (time, 2);
+	min = g_strndup (time + 2, 2);
+	sec = g_strndup (time + 4, 2);
+	tm.tm_hour = atoi (hour);
+	tm.tm_min = atoi (min);
+	tm.tm_sec = atoi (sec);
+	g_free(hour);
+	g_free(min);
+	g_free(sec);
+
+	return mktime (&tm);
+}
+
+static void
+list__process_line (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		    gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *comm = FR_COMMAND (data);
+	char       **fields;
+	const char  *name_field;
+	gint         line_l;
+
+	g_return_if_fail (line != NULL);
+
+	/* check whether unzip gave the empty archive warning. */
+
+	if (FR_COMMAND_ZIP (comm)->is_empty)
+		return;
+
+	line_l = strlen (line);
+
+	if (line_l == 0)
+		return;
+
+	if (strcmp (line, EMPTY_ARCHIVE_WARNING) == 0) {
+		FR_COMMAND_ZIP (comm)->is_empty = TRUE;
+		return;
+	}
+
+	/* ignore lines that do not describe a file or a
+	 * directory. */
+	if ((line[0] != '?') && (line[0] != 'd') && (line[0] != '-'))
+		return;
+
+	/**/
+
+	fields = split_line (line, 7);
+	if (g_strv_length (fields) < 7) {
+		g_strfreev (fields);
+		return;
+	}
+
+	fdata = file_data_new ();
+
+	fdata->size = g_ascii_strtoull (fields[3], NULL, 10);
+	fdata->modified = mktime_from_string (fields[6]);
+	fdata->encrypted = (*fields[4] == 'B') || (*fields[4] == 'T');
+	g_strfreev (fields);
+
+	/* Full path */
+
+	name_field = get_last_field (line, 8);
+	if (name_field == NULL)
+		name_field = "";
+
+	if (*name_field == '/') {
+		fdata->full_path = g_strdup (name_field);
+		fdata->original_path = fdata->full_path;
+	} else {
+		fdata->full_path = g_strconcat ("/", name_field, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	fdata->link = NULL;
+
+	fdata->dir = line[0] == 'd';
+	if (fdata->dir)
+		fdata->name = dir_name_from_path (fdata->full_path);
+	else
+		fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (comm, fdata);
+}
+
+static void
+add_password_arg (FrCommand  *comm,
+		  const char *password)
+{
+	if ((password != NULL) && (password[0] != '\0')) {
+		fr_process_add_arg (comm->process, "-P");
+		fr_process_add_arg (comm->process, password);
+	}
+}
+
+static void
+list__begin (gpointer data)
+{
+	FrCommandZip *comm = data;
+
+	comm->is_empty = FALSE;
+}
+
+static void
+fr_command_zip_list (FrCommand  *comm)
+{
+	fr_process_set_out_line_func (comm->process, list__process_line, comm);<--- You might need to cast the function pointer here
+
+	fr_process_begin_command (comm->process, "unzip");
+	fr_process_set_begin_func (comm->process, list__begin, comm);
+	fr_process_add_arg (comm->process, "-ZTs");
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+	fr_process_start (comm->process);
+}
+
+static void
+process_line__common (char     *line,<--- Parameter 'line' can be declared as pointer to const
+		      gpointer  data)
+{
+	FrCommand  *comm = FR_COMMAND (data);
+
+	if (line == NULL)
+		return;
+
+	if (comm->n_files != 0) {
+		double fraction = (double) ++comm->n_file / (comm->n_files + 1);
+		fr_command_progress (comm, fraction);
+	}
+	else
+		fr_command_message (comm, line);
+}
+
+static void
+fr_command_zip_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	GList *scan;
+
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+				      process_line__common,
+				      comm);
+
+	fr_process_begin_command (comm->process, "zip");
+
+	if (base_dir != NULL)
+		fr_process_set_working_dir (comm->process, base_dir);
+
+	/* preserve links. */
+	fr_process_add_arg (comm->process, "-y");
+
+	if (update)
+		fr_process_add_arg (comm->process, "-u");
+
+	add_password_arg (comm, comm->password);
+
+	switch (comm->compression) {
+	case FR_COMPRESSION_VERY_FAST:
+		fr_process_add_arg (comm->process, "-1"); break;
+	case FR_COMPRESSION_FAST:
+		fr_process_add_arg (comm->process, "-3"); break;
+	case FR_COMPRESSION_NORMAL:
+		fr_process_add_arg (comm->process, "-6"); break;
+	case FR_COMPRESSION_MAXIMUM:
+		fr_process_add_arg (comm->process, "-9"); break;
+	}
+
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_add_arg (comm->process, "--");
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zip_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
+{
+	GList *scan;
+
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+				      process_line__common,
+				      comm);
+
+	fr_process_begin_command (comm->process, "zip");
+	fr_process_add_arg (comm->process, "-d");
+
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_add_arg (comm->process, "--");
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char *escaped;
+
+ 		escaped = escape_str (scan->data, ZIP_SPECIAL_CHARACTERS);
+ 		fr_process_add_arg (comm->process, escaped);
+ 		g_free (escaped);
+	}
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zip_extract (FrCommand  *comm,
+			const char *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
+				      process_line__common,<--- You might need to cast the function pointer here
+				      comm);
+
+	fr_process_begin_command (comm->process, "unzip");
+
+	if (dest_dir != NULL) {
+		fr_process_add_arg (comm->process, "-d");
+		fr_process_add_arg (comm->process, dest_dir);
+	}
+	if (overwrite)
+		fr_process_add_arg (comm->process, "-o");
+	else
+		fr_process_add_arg (comm->process, "-n");
+	if (skip_older)
+		fr_process_add_arg (comm->process, "-u");
+	if (junk_paths)
+		fr_process_add_arg (comm->process, "-j");
+	add_password_arg (comm, comm->password);
+
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next) {
+		char *escaped;
+
+ 		escaped = escape_str (scan->data, ZIP_SPECIAL_CHARACTERS);
+ 		fr_process_add_arg (comm->process, escaped);
+ 		g_free (escaped);
+	}
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zip_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "unzip");
+	fr_process_add_arg (comm->process, "-t");
+	add_password_arg (comm, comm->password);
+	fr_process_add_arg (comm->process, "--");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zip_handle_error (FrCommand   *comm,
+			     FrProcError *error)
+{
+	if (error->type != FR_PROC_ERROR_NONE) {
+		if (error->status <= 1)
+			error->type = FR_PROC_ERROR_NONE;
+		else if ((error->status == 82) || (error->status == 5))
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+		else {
+			GList *output;
+			GList *scan;
+
+			if (comm->action == FR_ACTION_TESTING_ARCHIVE)
+				output = comm->process->out.raw;
+			else
+				output = comm->process->err.raw;
+
+			for (scan = g_list_last (output); scan; scan = scan->prev) {
+				char *line = scan->data;
+
+				if (strstr (line, "incorrect password") != NULL) {
+					error->type = FR_PROC_ERROR_ASK_PASSWORD;
+					break;
+				}
+			}
+		}
+	}
+}
+
+const char *zip_mime_type[] = {
+				"application/epub+zip",
+				"application/vnd.oasis.opendocument.presentation",
+				"application/vnd.oasis.opendocument.spreadsheet",
+				"application/vnd.oasis.opendocument.text",
+				"application/vnd.oasis.opendocument.presentation-template",
+				"application/vnd.oasis.opendocument.spreadsheet-template",
+				"application/vnd.oasis.opendocument.text-template",
+				"application/x-cbz",
+				"application/x-ear",
+				"application/x-ms-dos-executable",
+				"application/x-war",
+				"application/zip", /* zip always at the end and the number of */
+				NULL };            /* place in fr_command_zip_get_mime_types  */
+
+static const char **
+fr_command_zip_get_mime_types (FrCommand *comm)
+{
+	GSettings *settings;
+	settings = g_settings_new ("org.mate.engrampa.general");
+
+	if (g_settings_get_boolean (settings, "unar-open-zip") &&
+	    is_program_in_path ("unar") && is_program_in_path ("lsar"))
+		zip_mime_type [10] = NULL;
+	else
+		g_settings_set_boolean (settings, "unar-open-zip", FALSE);
+
+	g_object_unref (settings);
+
+	return zip_mime_type;
+}
+
+static FrCommandCaps
+fr_command_zip_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT;
+	if (is_program_available ("zip", check_command)) {
+		if (strcmp (mime_type, "application/x-ms-dos-executable") == 0)
+			capabilities |= FR_COMMAND_CAN_READ;
+		else
+			capabilities |= FR_COMMAND_CAN_WRITE;
+	}
+	if (is_program_available ("unzip", check_command))
+		capabilities |= FR_COMMAND_CAN_READ;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_zip_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("zip,unzip");
+}
+
+static void
+fr_command_zip_class_init (FrCommandZipClass *class)
+{
+	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+	FrCommandClass *afc;
+
+	parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_zip_finalize;
+
+	afc->list             = fr_command_zip_list;
+	afc->add              = fr_command_zip_add;
+	afc->delete           = fr_command_zip_delete;
+	afc->extract          = fr_command_zip_extract;
+	afc->test             = fr_command_zip_test;
+	afc->handle_error     = fr_command_zip_handle_error;
+	afc->get_mime_types   = fr_command_zip_get_mime_types;
+	afc->get_capabilities = fr_command_zip_get_capabilities;
+	afc->get_packages     = fr_command_zip_get_packages;
+}
+
+static void
+fr_command_zip_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = TRUE;
+	comm->propAddCanStoreFolders       = TRUE;
+	comm->propExtractCanAvoidOverwrite = TRUE;
+	comm->propExtractCanSkipOlder      = TRUE;
+	comm->propExtractCanJunkPaths      = TRUE;
+	comm->propPassword                 = TRUE;
+	comm->propTest                     = TRUE;
+
+	FR_COMMAND_ZIP (comm)->is_empty = FALSE;
+}
+
+static void
+fr_command_zip_finalize (GObject *object)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND_ZIP (object));
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_zip_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandZipClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_zip_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandZip),
+			0,
+			(GInstanceInitFunc) fr_command_zip_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandZip",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/9.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/9.html new file mode 100644 index 0000000..5361b40 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/9.html @@ -0,0 +1,1071 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
/* eggtreemultidnd.c
+ * Copyright (C) 2001  Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "eggtreemultidnd.h"
+
+#define EGG_TREE_MULTI_DND_STRING "EggTreeMultiDndString"
+
+typedef struct
+{
+    guint pressed_button;
+    gint x;
+    gint y;
+    guint motion_notify_handler;
+    guint button_release_handler;
+    guint drag_data_get_handler;
+    GSList *event_list;
+} EggTreeMultiDndData;
+
+/* CUT-N-PASTE from gtktreeview.c */
+typedef struct _TreeViewDragInfo TreeViewDragInfo;
+struct _TreeViewDragInfo
+{
+    GdkModifierType start_button_mask;
+    GtkTargetList *source_target_list;<--- struct member '_TreeViewDragInfo::source_target_list' is never used.
+    GdkDragAction source_actions;
+
+    GtkTargetList *dest_target_list;<--- struct member '_TreeViewDragInfo::dest_target_list' is never used.
+
+    guint source_set : 1;
+    guint dest_set : 1;
+};
+
+
+GType
+egg_tree_multi_drag_source_get_type (void)
+{
+    static GType our_type = 0;
+
+    if (!our_type)
+    {
+        const GTypeInfo our_info =
+        {
+            sizeof (EggTreeMultiDragSourceIface), /* class_size */
+            NULL,		/* base_init */
+            NULL,		/* base_finalize */
+            NULL,
+            NULL,		/* class_finalize */
+            NULL,		/* class_data */
+            0,
+            0,              /* n_preallocs */
+            NULL
+        };
+
+        our_type = g_type_register_static (G_TYPE_INTERFACE, "EggTreeMultiDragSource", &our_info, 0);
+    }
+
+    return our_type;
+}
+
+
+/**
+ * egg_tree_multi_drag_source_row_draggable:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row on which user is initiating a drag
+ *
+ * Asks the #EggTreeMultiDragSource whether a particular row can be used as
+ * the source of a DND operation. If the source doesn't implement
+ * this interface, the row is assumed draggable.
+ *
+ * Return value: %TRUE if the row can be dragged
+ **/
+gboolean
+egg_tree_multi_drag_source_row_draggable (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->row_draggable != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+
+    if (iface->row_draggable)
+        return (* iface->row_draggable) (drag_source, path_list);
+    else
+        return TRUE;
+}
+
+
+/**
+ * egg_tree_multi_drag_source_drag_data_delete:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was being dragged
+ *
+ * Asks the #EggTreeMultiDragSource to delete the row at @path, because
+ * it was moved somewhere else via drag-and-drop. Returns %FALSE
+ * if the deletion fails because @path no longer exists, or for
+ * some model-specific reason. Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if the row was successfully deleted
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->drag_data_delete != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+
+    return (* iface->drag_data_delete) (drag_source, path_list);
+}
+
+/**
+ * egg_tree_multi_drag_source_drag_data_get:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was dragged
+ * @selection_data: a #EggSelectionData to fill with data from the dragged row
+ *
+ * Asks the #EggTreeMultiDragSource to fill in @selection_data with a
+ * representation of the row at @path. @selection_data->target gives
+ * the required type of the data.  Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if data of the required type was provided
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_get    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list,
+        GtkSelectionData  *selection_data)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->drag_data_get != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+    g_return_val_if_fail (selection_data != NULL, FALSE);
+
+    return (* iface->drag_data_get) (drag_source, path_list, selection_data);
+}
+
+static void
+stop_drag_check (GtkWidget *widget)
+{
+    EggTreeMultiDndData *priv_data;
+    GSList *l;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    for (l = priv_data->event_list; l != NULL; l = l->next)
+        gdk_event_free (l->data);
+
+    g_slist_free (priv_data->event_list);
+    priv_data->event_list = NULL;
+    g_signal_handler_disconnect (widget, priv_data->motion_notify_handler);
+    g_signal_handler_disconnect (widget, priv_data->button_release_handler);
+}
+
+static gboolean
+egg_tree_multi_drag_button_release_event (GtkWidget      *widget,
+        GdkEventButton *event,
+        gpointer        data)
+{
+    EggTreeMultiDndData *priv_data;<--- Variable 'priv_data' can be declared as pointer to const
+    GSList *l;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    for (l = priv_data->event_list; l != NULL; l = l->next)
+        gtk_propagate_event (widget, l->data);
+
+    stop_drag_check (widget);
+
+    return FALSE;
+}
+
+static void
+selection_foreach (GtkTreeModel *model,
+                   GtkTreePath  *path,
+                   GtkTreeIter  *iter,
+                   gpointer      data)
+{
+    GList **list_ptr;
+
+    list_ptr = (GList **) data;
+
+    *list_ptr = g_list_prepend (*list_ptr, gtk_tree_row_reference_new (model, path));
+}
+
+static void
+path_list_free (GList *path_list)
+{
+    g_list_foreach (path_list, (GFunc) gtk_tree_row_reference_free, NULL);
+    g_list_free (path_list);
+}
+
+static void
+set_context_data (GdkDragContext *context,
+                  GList          *path_list)
+{
+    g_object_set_data_full (G_OBJECT (context),
+                            "egg-tree-view-multi-source-row",
+                            path_list,
+                            (GDestroyNotify) path_list_free);
+}
+
+static GList *
+get_context_data (GdkDragContext *context)
+{
+    return g_object_get_data (G_OBJECT (context),
+                              "egg-tree-view-multi-source-row");
+}
+
+/* CUT-N-PASTE from gtktreeview.c */
+static TreeViewDragInfo*
+get_info (GtkTreeView *tree_view)
+{
+    return g_object_get_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info");
+}
+
+
+static void
+egg_tree_multi_drag_drag_data_get (GtkWidget        *widget,
+                                   GdkDragContext   *context,
+                                   GtkSelectionData *selection_data,
+                                   guint             info,
+                                   guint             time)
+{
+    GtkTreeView *tree_view;
+    GtkTreeModel *model;
+    TreeViewDragInfo *di;<--- Variable 'di' can be declared as pointer to const
+    GList *path_list;
+
+    tree_view = GTK_TREE_VIEW (widget);
+
+    model = gtk_tree_view_get_model (tree_view);
+
+    if (model == NULL)
+        return;
+
+    di = get_info (GTK_TREE_VIEW (widget));
+
+    if (di == NULL)
+        return;
+
+    path_list = get_context_data (context);
+
+    if (path_list == NULL)
+        return;
+
+    /* We can implement the GTK_TREE_MODEL_ROW target generically for
+     * any model; for DragSource models there are some other targets
+     * we also support.
+     */
+
+    if (EGG_IS_TREE_MULTI_DRAG_SOURCE (model))
+    {
+        egg_tree_multi_drag_source_drag_data_get (EGG_TREE_MULTI_DRAG_SOURCE (model),
+                path_list,
+                selection_data);
+    }
+}
+
+static gboolean
+egg_tree_multi_drag_motion_event (GtkWidget      *widget,
+                                  GdkEventMotion *event,
+                                  gpointer        data)
+{
+    EggTreeMultiDndData *priv_data;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    if (gtk_drag_check_threshold (widget,
+                                  priv_data->x,
+                                  priv_data->y,
+                                  event->x,
+                                  event->y))
+    {
+        GList *path_list = NULL;
+        GtkTreeSelection *selection;
+        GtkTreeModel *model;
+        TreeViewDragInfo *di;
+
+        di = get_info (GTK_TREE_VIEW (widget));
+
+        if (di == NULL)
+            return FALSE;
+
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+        stop_drag_check (widget);
+        gtk_tree_selection_selected_foreach (selection, selection_foreach, &path_list);
+        path_list = g_list_reverse (path_list);
+        model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+        if (egg_tree_multi_drag_source_row_draggable (EGG_TREE_MULTI_DRAG_SOURCE (model), path_list))
+        {
+            GdkDragContext *context;
+
+            context = gtk_drag_begin_with_coordinates (widget,
+                                                       gtk_drag_source_get_target_list (widget),
+                                                       di->source_actions,
+                                                       priv_data->pressed_button,
+                                                       (GdkEvent*)event,
+                                                       event->x,
+                                                       event->y);
+            set_context_data (context, path_list);
+            gtk_drag_set_icon_default (context);
+
+        }
+        else
+        {
+            path_list_free (path_list);
+        }
+    }
+
+    return TRUE;
+}
+
+static gboolean
+egg_tree_multi_drag_button_press_event (GtkWidget      *widget,
+                                        GdkEventButton *event,
+                                        gpointer        data)
+{
+    GtkTreeView *tree_view;
+    GtkTreePath *path = NULL;
+    GtkTreeViewColumn *column = NULL;
+    gint cell_x, cell_y;
+    GtkTreeSelection *selection;
+    EggTreeMultiDndData *priv_data;
+
+    tree_view = GTK_TREE_VIEW (widget);
+    priv_data = g_object_get_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING);
+    if (priv_data == NULL)
+    {
+        priv_data = g_new0 (EggTreeMultiDndData, 1);
+        g_object_set_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING, priv_data);
+    }
+
+    if (g_slist_find (priv_data->event_list, event))
+        return FALSE;
+
+    if (priv_data->event_list)
+    {
+        /* save the event to be propagated in order */
+        priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+        return TRUE;
+    }
+
+    if (event->type == GDK_2BUTTON_PRESS)
+        return FALSE;
+
+    gtk_tree_view_get_path_at_pos (tree_view,
+                                   event->x, event->y,
+                                   &path, &column,
+                                   &cell_x, &cell_y);
+
+    selection = gtk_tree_view_get_selection (tree_view);
+
+    if (path && gtk_tree_selection_path_is_selected (selection, path))
+    {
+        priv_data->pressed_button = event->button;
+        priv_data->x = event->x;
+        priv_data->y = event->y;
+        priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+        priv_data->motion_notify_handler =
+            g_signal_connect (G_OBJECT (tree_view), "motion_notify_event", G_CALLBACK (egg_tree_multi_drag_motion_event), NULL);
+        priv_data->button_release_handler =
+            g_signal_connect (G_OBJECT (tree_view), "button_release_event", G_CALLBACK (egg_tree_multi_drag_button_release_event), NULL);
+
+        if (priv_data->drag_data_get_handler == 0)
+        {
+            priv_data->drag_data_get_handler =
+                g_signal_connect (G_OBJECT (tree_view), "drag_data_get", G_CALLBACK (egg_tree_multi_drag_drag_data_get), NULL);
+        }
+
+        gtk_tree_path_free (path);
+
+        return TRUE;
+    }
+
+    if (path)
+    {
+        gtk_tree_path_free (path);
+    }
+
+    return FALSE;
+}
+
+void
+egg_tree_multi_drag_add_drag_support (GtkTreeView *tree_view)
+{
+    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+    g_signal_connect (G_OBJECT (tree_view), "button_press_event", G_CALLBACK (egg_tree_multi_drag_button_press_event), NULL);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/90.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/90.html new file mode 100644 index 0000000..9d0c42e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/90.html @@ -0,0 +1,1061 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2003 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-zoo.h"
+
+static void fr_command_zoo_class_init  (FrCommandZooClass *class);
+static void fr_command_zoo_init        (FrCommand         *afile);
+static void fr_command_zoo_finalize    (GObject           *object);
+
+/* Parent Class */
+
+static FrCommandClass *parent_class = NULL;
+
+/* -- list -- */
+
+static time_t
+mktime_from_string_zoo (char *mday_s,<--- Parameter 'mday_s' can be declared as pointer to const
+			char *month_s,
+			char *year_s,<--- Parameter 'year_s' can be declared as pointer to const
+			char *time_s)
+{
+	struct tm  tm = {0, };
+	char **fields;
+	int year;
+
+	tm.tm_isdst = -1;
+
+	/* This will break in 2075 */
+	year = atoi (year_s);
+	if (year >= 75) {
+		tm.tm_year = year;
+	} else {
+		tm.tm_year = 100 + year;
+	}
+
+	if (g_ascii_strncasecmp(month_s, "Jan", 3) == 0) {
+		tm.tm_mon = 0;
+	} else if (g_ascii_strncasecmp(month_s, "Feb", 3) == 0) {
+		tm.tm_mon = 1;
+	} else if (g_ascii_strncasecmp(month_s, "Mar", 3) == 0) {
+		tm.tm_mon = 2;
+	} else if (g_ascii_strncasecmp(month_s, "Apr", 3) == 0) {
+		tm.tm_mon = 3;
+	} else if (g_ascii_strncasecmp(month_s, "May", 3) == 0) {
+		tm.tm_mon = 4;
+	} else if (g_ascii_strncasecmp(month_s, "Jun", 3) == 0) {
+		tm.tm_mon = 5;
+	} else if (g_ascii_strncasecmp(month_s, "Jul", 3) == 0) {
+		tm.tm_mon = 6;
+	} else if (g_ascii_strncasecmp(month_s, "Aug", 3) == 0) {
+		tm.tm_mon = 7;
+	} else if (g_ascii_strncasecmp(month_s, "Sep", 3) == 0) {
+		tm.tm_mon = 8;
+	} else if (g_ascii_strncasecmp(month_s, "Oct", 3) == 0) {
+		tm.tm_mon = 9;
+	} else if (g_ascii_strncasecmp(month_s, "Nov", 3) == 0) {
+		tm.tm_mon = 10;
+	} else if (g_ascii_strncasecmp(month_s, "Dec", 3) == 0) {
+		tm.tm_mon = 11;
+	}
+
+	tm.tm_mday = atoi (mday_s);
+
+	fields = g_strsplit (time_s, ":", 3);
+	if (fields[0] != NULL) {
+		tm.tm_hour = atoi (fields[0]);
+		if (fields[1] != NULL) {
+			tm.tm_min  = atoi (fields[1]);
+			if (fields[2] != NULL)
+				tm.tm_sec  = atoi (fields[2]);
+		}
+	}
+
+	g_strfreev (fields);
+
+	return mktime (&tm);
+}
+
+static char **
+split_line_zoo (char *line)<--- Parameter 'line' can be declared as pointer to const
+{
+	char       **fields;
+	const char  *scan, *field_end;
+	int          i;
+
+	if (line[0] == '-') {
+		return NULL;
+	}
+
+	fields = g_new0 (char *, 6);
+	fields[5] = NULL;
+
+	/* Get Length */
+	scan = eat_spaces (line);
+	field_end = strchr (scan, ' ');
+	fields[0] = g_strndup (scan, field_end - scan);
+	scan = eat_spaces (field_end);
+
+	/* Toss CF, Size Now */
+	for (i = 0; i < 2; i++) {
+		field_end = strchr (scan, ' ');
+		scan = eat_spaces (field_end);
+	}
+
+	/* Get Day, Month, Year, Time */
+	for (i = 1; i < 5; i++) {
+		if (i == 2 && g_ascii_strncasecmp (scan, "file", 4) == 0) {
+			g_strfreev(fields);
+			return NULL;
+		}
+		field_end = strchr (scan, ' ');
+		fields[i] = g_strndup (scan, field_end - scan);
+		scan = eat_spaces (field_end);
+	}
+
+	return fields;
+}
+
+static const char *
+get_last_field_zoo (char *line)<--- Parameter 'line' can be declared as pointer to const
+{
+	const char *field;
+	int         i;
+	int         n = 6;
+
+	field = eat_spaces (line);
+	for (i = 0; i < n; i++) {
+		field = strchr (field, ' ');
+		field = eat_spaces (field);
+	}
+	field = strchr (field, ' ');
+	if (g_ascii_strncasecmp (field, " C ", 3) == 0) {
+		field = eat_spaces (field);
+		field = strchr (field, ' ');
+		field = eat_spaces (field);
+	} else
+		field = eat_spaces (field);
+
+	return field;
+}
+
+static void
+process_zoo_line (char     *line,
+		  gpointer  data)
+{
+	FileData    *fdata;
+	FrCommand   *zoo_comm = FR_COMMAND (data);
+	char       **fields;
+	const char  *name_field;
+
+	g_return_if_fail (line != NULL);
+	if (line[0] == '-')
+		return;
+
+	fields = split_line_zoo (line);
+	if (fields == NULL)
+		return;
+
+	fdata = file_data_new ();
+
+	fdata->size = g_ascii_strtoull (fields[0], NULL, 10);
+	fdata->modified = mktime_from_string_zoo (fields[1],
+						  fields[2],
+						  fields[3],
+						  fields[4]);
+	g_strfreev (fields);
+
+	/* Full path */
+
+	name_field = get_last_field_zoo (line);
+	if (*(name_field) == '/') {
+		fdata->full_path = g_strdup (name_field);
+		fdata->original_path = fdata->full_path;
+	} else {
+		fdata->full_path = g_strconcat ("/", name_field, NULL);
+		fdata->original_path = fdata->full_path + 1;
+	}
+
+	fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+	fdata->path = remove_level_from_path (fdata->full_path);
+
+	if (*fdata->name == 0)
+		file_data_free (fdata);
+	else
+		fr_command_add_file (zoo_comm, fdata);
+}
+
+static void
+fr_command_zoo_list (FrCommand  *zoo_comm)
+{
+	fr_process_set_out_line_func (zoo_comm->process, process_zoo_line, zoo_comm);
+
+	fr_process_begin_command (zoo_comm->process, "zoo");
+	fr_process_add_arg (zoo_comm->process, "lq");
+	fr_process_add_arg (zoo_comm->process, zoo_comm->filename);
+	fr_process_end_command (zoo_comm->process);
+	fr_process_start (zoo_comm->process);
+}
+
+static void
+fr_command_zoo_add (FrCommand     *comm,
+		    const char    *from_file,
+		    GList         *file_list,
+		    const char    *base_dir,
+		    gboolean       update,
+		    gboolean       recursive)
+{
+	GList        *scan;
+
+	/* Add files. */
+
+	fr_process_begin_command (comm->process, "zoo");
+
+	fr_process_set_working_dir (comm->process, base_dir);
+
+	if (update)
+		fr_process_add_arg (comm->process, "auP");
+	else
+		fr_process_add_arg (comm->process, "aP");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zoo_delete (FrCommand *comm,
+		       const char  *from_file,
+		       GList     *file_list)
+{
+	GList        *scan;
+
+	/* Delete files. */
+
+	fr_process_begin_command (comm->process, "zoo");
+	fr_process_add_arg (comm->process, "DP");
+	fr_process_add_arg (comm->process, comm->filename);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zoo_extract (FrCommand  *comm,
+			const char  *from_file,
+			GList      *file_list,
+			const char *dest_dir,
+			gboolean    overwrite,
+			gboolean    skip_older,
+			gboolean    junk_paths)
+{
+	GList *scan;
+
+	fr_process_begin_command (comm->process, "zoo");
+
+	if (overwrite)
+		fr_process_add_arg (comm->process, "xO");
+	else
+		fr_process_add_arg (comm->process, "x");
+
+	fr_process_add_arg (comm->process, comm->filename);
+
+	if (dest_dir != NULL)
+		fr_process_set_working_dir (comm->process, dest_dir);
+
+	for (scan = file_list; scan; scan = scan->next)
+		fr_process_add_arg (comm->process, scan->data);
+
+	fr_process_end_command (comm->process);
+}
+
+static void
+fr_command_zoo_test (FrCommand   *comm)
+{
+	fr_process_begin_command (comm->process, "zoo");
+	fr_process_add_arg (comm->process, "-test");
+	fr_process_add_arg (comm->process, comm->filename);
+	fr_process_end_command (comm->process);
+}
+
+const char *zoo_mime_type[] = { "application/x-zoo", NULL };
+
+static const char **
+fr_command_zoo_get_mime_types (FrCommand *comm)
+{
+	return zoo_mime_type;
+}
+
+static FrCommandCaps
+fr_command_zoo_get_capabilities (FrCommand  *comm,
+			         const char *mime_type,
+				 gboolean    check_command)
+{
+	FrCommandCaps capabilities;
+
+	capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
+	if (is_program_available ("zoo", check_command))
+		capabilities |= FR_COMMAND_CAN_READ_WRITE;
+
+	return capabilities;
+}
+
+static const char *
+fr_command_zoo_get_packages (FrCommand  *comm,
+			     const char *mime_type)
+{
+	return PACKAGES ("zoo");
+}
+
+static void
+fr_command_zoo_class_init (FrCommandZooClass *class)
+{
+        GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+        FrCommandClass *afc;
+
+        parent_class = g_type_class_peek_parent (class);
+	afc = (FrCommandClass*) class;
+
+	gobject_class->finalize = fr_command_zoo_finalize;
+
+        afc->list             = fr_command_zoo_list;
+	afc->add              = fr_command_zoo_add;
+	afc->delete           = fr_command_zoo_delete;
+	afc->extract          = fr_command_zoo_extract;
+	afc->test             = fr_command_zoo_test;
+	afc->get_mime_types   = fr_command_zoo_get_mime_types;
+	afc->get_capabilities = fr_command_zoo_get_capabilities;
+	afc->get_packages     = fr_command_zoo_get_packages;
+}
+
+static void
+fr_command_zoo_init (FrCommand *comm)
+{
+	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanReplace            = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder      = FALSE;
+	comm->propExtractCanJunkPaths      = FALSE;
+	comm->propPassword                 = FALSE;
+	comm->propTest                     = TRUE;
+}
+
+static void
+fr_command_zoo_finalize (GObject *object)
+{
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (FR_IS_COMMAND_ZOO (object));
+
+	/* Chain up */
+        if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+GType
+fr_command_zoo_get_type ()
+{
+        static GType type = 0;
+
+        if (! type) {
+                GTypeInfo type_info = {
+			sizeof (FrCommandZooClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_zoo_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommandZoo),
+			0,
+			(GInstanceInitFunc) fr_command_zoo_init,
+			NULL
+		};
+
+		type = g_type_register_static (FR_TYPE_COMMAND,
+					       "FRCommandZoo",
+					       &type_info,
+					       0);
+        }
+
+        return type;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/91.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/91.html new file mode 100644 index 0000000..557e4a2 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/91.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2003 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_COMMAND_ZOO_H
+#define FR_COMMAND_ZOO_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-command.h"
+#include "fr-process.h"
+#include "typedefs.h"
+
+#define FR_TYPE_COMMAND_ZOO            (fr_command_zoo_get_type ())
+#define FR_COMMAND_ZOO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ZOO, FrCommandZoo))
+#define FR_COMMAND_ZOO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ZOO, FrCommandZooClass))
+#define FR_IS_COMMAND_ZOO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ZOO))
+#define FR_IS_COMMAND_ZOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ZOO))
+#define FR_COMMAND_ZOO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ZOO, FrCommandZooClass))
+
+typedef struct _FrCommandZoo       FrCommandZoo;
+typedef struct _FrCommandZooClass  FrCommandZooClass;
+
+struct _FrCommandZoo
+{
+	FrCommand  __parent;
+};
+
+struct _FrCommandZooClass
+{
+	FrCommandClass __parent_class;
+};
+
+GType fr_command_zoo_get_type (void);
+
+#endif /* FR_COMMAND_ZOO_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/92.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/92.html new file mode 100644 index 0000000..dadea96 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/92.html @@ -0,0 +1,1861 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "file-utils.h"
+#include "fr-command.h"
+#include "fr-enum-types.h"
+#include "fr-marshal.h"
+#include "fr-proc-error.h"
+#include "fr-process.h"
+#include "glib-utils.h"
+
+#define INITIAL_SIZE 256
+
+/* Signals */
+enum {
+	START,
+	DONE,
+	PROGRESS,
+	MESSAGE,
+	WORKING_ARCHIVE,
+	LAST_SIGNAL
+};
+
+/* Properties */
+enum {
+        PROP_0,
+        PROP_FILE,
+        PROP_MIME_TYPE,
+        PROP_PROCESS,
+        PROP_PASSWORD,
+        PROP_ENCRYPT_HEADER,
+        PROP_COMPRESSION,
+        PROP_VOLUME_SIZE
+};
+
+static GObjectClass *parent_class = NULL;
+static guint fr_command_signals[LAST_SIGNAL] = { 0 };
+
+static void fr_command_class_init  (FrCommandClass *class);
+static void fr_command_init        (FrCommand *afile);
+static void fr_command_finalize    (GObject *object);
+
+const char *action_names[] = { "NONE",
+                               "CREATING_NEW_ARCHIVE",
+                               "LOADING_ARCHIVE",
+                               "LISTING_CONTENT",
+                               "DELETING_FILES",
+                               "TESTING_ARCHIVE",
+                               "GETTING_FILE_LIST",
+                               "COPYING_FILES_FROM_REMOTE",
+                               "ADDING_FILES",
+                               "EXTRACTING_FILES",
+                               "COPYING_FILES_TO_REMOTE",
+                               "CREATING_ARCHIVE",
+                               "SAVING_REMOTE_ARCHIVE" };
+
+#ifdef MATE_ENABLE_DEBUG
+const char * get_action_name (FrAction action)
+{
+	return action_names[action];
+}
+#endif
+
+GType
+fr_command_get_type ()
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrCommandClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_command_class_init,
+			NULL,
+			NULL,
+			sizeof (FrCommand),
+			0,
+			(GInstanceInitFunc) fr_command_init,
+			NULL
+		};
+
+		type = g_type_register_static (G_TYPE_OBJECT,
+					       "FRCommand",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+static void
+base_fr_command_list (FrCommand  *comm)
+{
+}
+
+static void
+base_fr_command_add (FrCommand     *comm,
+		     const char    *from_file,
+		     GList         *file_list,
+		     const char    *base_dir,
+		     gboolean       update,
+		     gboolean       recursive)
+{
+}
+
+static void
+base_fr_command_delete (FrCommand  *comm,
+		        const char *from_file,
+			GList       *file_list)
+{
+}
+
+static void
+base_fr_command_extract (FrCommand  *comm,
+		         const char *from_file,
+			 GList      *file_list,
+			 const char *dest_dir,
+			 gboolean    overwrite,
+			 gboolean    skip_older,
+			 gboolean    junk_paths)
+{
+}
+
+static void
+base_fr_command_test (FrCommand *comm)
+{
+}
+
+static void
+base_fr_command_uncompress (FrCommand *comm)
+{
+}
+
+static void
+base_fr_command_recompress (FrCommand *comm)
+{
+}
+
+static void
+base_fr_command_handle_error (FrCommand   *comm,
+			      FrProcError *error)
+{
+}
+
+const char **void_mime_types = { NULL };
+
+static const char **
+base_fr_command_get_mime_types (FrCommand *comm)
+{
+	return void_mime_types;
+}
+
+static FrCommandCaps
+base_fr_command_get_capabilities (FrCommand  *comm,
+			          const char *mime_type,
+			          gboolean    check_command)
+{
+	return FR_COMMAND_CAN_DO_NOTHING;
+}
+
+static void
+base_fr_command_set_mime_type (FrCommand  *comm,
+			       const char *mime_type)
+{
+	comm->mime_type = get_static_string (mime_type);
+	fr_command_update_capabilities (comm);
+}
+
+static const char *
+base_fr_command_get_packages (FrCommand  *comm,
+			      const char *mime_type)
+{
+	return NULL;
+}
+
+static void
+fr_command_start (FrProcess *process,
+		  gpointer   data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	g_signal_emit (G_OBJECT (comm),
+		       fr_command_signals[START],
+		       0,
+		       comm->action);
+}
+
+static void
+fr_command_done (FrProcess   *process,
+		 FrProcError *error,
+		 gpointer     data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	comm->process->restart = FALSE;
+	if (error->type != FR_PROC_ERROR_STOPPED)
+		fr_command_handle_error (comm, error);
+
+	if (comm->process->restart) {
+		fr_process_start (comm->process);
+		return;
+	}
+
+	if (comm->action == FR_ACTION_LISTING_CONTENT) {
+		/* order the list by name to speed up search */
+		g_ptr_array_sort (comm->files, file_data_compare_by_path);
+	}
+
+	g_signal_emit (G_OBJECT (comm),
+		       fr_command_signals[DONE],
+		       0,
+		       comm->action,
+		       error);
+}
+
+static void
+fr_command_set_process (FrCommand *comm,
+		        FrProcess *process)
+{
+	if (comm->process != NULL) {
+		g_signal_handlers_disconnect_matched (G_OBJECT (comm->process),
+					      G_SIGNAL_MATCH_DATA,
+					      0,
+					      0, NULL,
+					      0,
+					      comm);
+		g_object_unref (G_OBJECT (comm->process));
+		comm->process = NULL;
+	}
+
+	if (process == NULL)
+		return;
+
+	g_object_ref (G_OBJECT (process));
+	comm->process = process;
+	g_signal_connect (G_OBJECT (comm->process),
+			  "start",
+			  G_CALLBACK (fr_command_start),
+			  comm);
+	g_signal_connect (G_OBJECT (comm->process),
+			  "done",
+			  G_CALLBACK (fr_command_done),
+			  comm);
+}
+
+static void
+fr_command_set_property (GObject      *object,
+			 guint         prop_id,
+			 const GValue *value,
+			 GParamSpec   *pspec)
+{
+	FrCommand *comm;
+
+	comm = FR_COMMAND (object);
+
+	switch (prop_id) {
+	case PROP_PROCESS:
+		fr_command_set_process (comm, g_value_get_object (value));
+		break;
+	case PROP_FILE:
+		fr_command_set_file (comm, g_value_get_object (value));
+		break;
+	case PROP_MIME_TYPE:
+		fr_command_set_mime_type (comm, g_value_get_string (value));
+		break;
+	case PROP_PASSWORD:
+		g_free (comm->password);
+		comm->password = g_strdup (g_value_get_string (value));
+		break;
+	case PROP_ENCRYPT_HEADER:
+		comm->encrypt_header = g_value_get_boolean (value);
+		break;
+	case PROP_COMPRESSION:
+		comm->compression = g_value_get_enum (value);
+		break;
+	case PROP_VOLUME_SIZE:
+		comm->volume_size = g_value_get_uint (value);
+		break;
+	default:
+		break;
+	}
+}
+
+static void
+fr_command_get_property (GObject    *object,
+			 guint       prop_id,
+			 GValue     *value,
+			 GParamSpec *pspec)
+{
+	FrCommand *comm;
+
+	comm = FR_COMMAND (object);
+
+	switch (prop_id) {
+	case PROP_PROCESS:
+		g_value_set_object (value, comm->process);
+		break;
+	case PROP_FILE:
+		g_value_take_object (value, g_file_new_for_path (comm->filename));
+		break;
+	case PROP_MIME_TYPE:
+		g_value_set_static_string (value, comm->mime_type);
+		break;
+	case PROP_PASSWORD:
+		g_value_set_string (value, comm->password);
+		break;
+	case PROP_ENCRYPT_HEADER:
+		g_value_set_boolean (value, comm->encrypt_header);
+		break;
+	case PROP_COMPRESSION:
+		g_value_set_enum (value, comm->compression);
+		break;
+	case PROP_VOLUME_SIZE:
+		g_value_set_uint (value, comm->volume_size);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+fr_command_class_init (FrCommandClass *class)
+{
+	GObjectClass *gobject_class;
+
+	parent_class = g_type_class_peek_parent (class);
+
+	gobject_class = G_OBJECT_CLASS (class);
+
+	/* virtual functions */
+
+	gobject_class->finalize = fr_command_finalize;
+	gobject_class->set_property = fr_command_set_property;
+	gobject_class->get_property = fr_command_get_property;
+
+	class->list             = base_fr_command_list;
+	class->add              = base_fr_command_add;
+	class->delete           = base_fr_command_delete;
+	class->extract          = base_fr_command_extract;
+	class->test             = base_fr_command_test;
+	class->uncompress       = base_fr_command_uncompress;
+	class->recompress       = base_fr_command_recompress;
+	class->handle_error     = base_fr_command_handle_error;
+	class->get_mime_types   = base_fr_command_get_mime_types;
+	class->get_capabilities = base_fr_command_get_capabilities;
+	class->set_mime_type    = base_fr_command_set_mime_type;
+	class->get_packages     = base_fr_command_get_packages;
+	class->start            = NULL;
+	class->done             = NULL;
+	class->progress         = NULL;
+	class->message          = NULL;
+
+	/* signals */
+
+	fr_command_signals[START] =
+		g_signal_new ("start",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrCommandClass, start),
+			      NULL, NULL,
+			      fr_marshal_VOID__INT,
+			      G_TYPE_NONE,
+			      1, G_TYPE_INT);
+	fr_command_signals[DONE] =
+		g_signal_new ("done",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrCommandClass, done),
+			      NULL, NULL,
+			      fr_marshal_VOID__INT_BOXED,
+			      G_TYPE_NONE, 2,
+			      G_TYPE_INT,
+			      FR_TYPE_PROC_ERROR);
+	fr_command_signals[PROGRESS] =
+		g_signal_new ("progress",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrCommandClass, progress),
+			      NULL, NULL,
+			      fr_marshal_VOID__DOUBLE,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_DOUBLE);
+	fr_command_signals[MESSAGE] =
+		g_signal_new ("message",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrCommandClass, message),
+			      NULL, NULL,
+			      fr_marshal_VOID__STRING,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_STRING);
+	fr_command_signals[WORKING_ARCHIVE] =
+			g_signal_new ("working_archive",
+				      G_TYPE_FROM_CLASS (class),
+				      G_SIGNAL_RUN_LAST,
+				      G_STRUCT_OFFSET (FrCommandClass, working_archive),
+				      NULL, NULL,
+				      fr_marshal_VOID__STRING,
+				      G_TYPE_NONE, 1,
+				      G_TYPE_STRING);
+
+	/* properties */
+
+	g_object_class_install_property (gobject_class,
+					 PROP_PROCESS,
+					 g_param_spec_object ("process",
+							      "Process",
+							      "The process object used by the command",
+							      FR_TYPE_PROCESS,
+							      G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_FILE,
+					 g_param_spec_object ("file",
+							      "File",
+							      "The archive local file",
+							      G_TYPE_FILE,
+							      G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_MIME_TYPE,
+					 g_param_spec_string ("mime-type",
+							      "Mime type",
+							      "The file mime-type",
+							      NULL,
+							      G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_PASSWORD,
+					 g_param_spec_string ("password",
+							      "Password",
+							      "The archive password",
+							      NULL,
+							      G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_ENCRYPT_HEADER,
+					 g_param_spec_boolean ("encrypt-header",
+							       "Encrypt header",
+							       "Whether to encrypt the archive header when creating the archive",
+							       FALSE,
+							       G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_COMPRESSION,
+					 g_param_spec_enum ("compression",
+							    "Compression type",
+							    "The compression type to use when creating the archive",
+							    FR_TYPE_COMPRESSION,
+							    FR_COMPRESSION_NORMAL,
+							    G_PARAM_READWRITE));
+	g_object_class_install_property (gobject_class,
+					 PROP_VOLUME_SIZE,
+					 g_param_spec_uint ("volume-size",
+							    "Volume size",
+							    "The size of each volume or 0 to not use volumes",
+							    0L,
+							    G_MAXUINT,
+							    0,
+							    G_PARAM_READWRITE));
+}
+
+static void
+fr_command_init (FrCommand *comm)
+{
+	comm->files = g_ptr_array_new_full (INITIAL_SIZE, (GDestroyNotify) file_data_free);
+
+	comm->password = NULL;
+	comm->encrypt_header = FALSE;
+	comm->compression = FR_COMPRESSION_NORMAL;
+	comm->volume_size = 0;
+	comm->filename = NULL;
+	comm->e_filename = NULL;
+	comm->fake_load = FALSE;
+
+	comm->propAddCanUpdate = FALSE;
+	comm->propAddCanReplace = FALSE;
+	comm->propAddCanStoreFolders = FALSE;
+	comm->propExtractCanAvoidOverwrite = FALSE;
+	comm->propExtractCanSkipOlder = FALSE;
+	comm->propExtractCanJunkPaths = FALSE;
+	comm->propPassword = FALSE;
+	comm->propTest = FALSE;
+	comm->propCanExtractAll = TRUE;
+	comm->propCanDeleteNonEmptyFolders = TRUE;
+	comm->propCanExtractNonEmptyFolders = TRUE;
+	comm->propListFromFile = FALSE;
+}
+
+static void
+fr_command_finalize (GObject *object)
+{
+	FrCommand* comm;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_COMMAND (object));
+
+	comm = FR_COMMAND (object);
+
+	g_free (comm->filename);
+	g_free (comm->e_filename);
+	g_free (comm->password);
+	if (comm->files != NULL)
+		g_ptr_array_free (comm->files, TRUE);
+	fr_command_set_process (comm, NULL);
+
+	/* Chain up */
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+fr_command_set_filename (FrCommand  *comm,
+			 const char *filename)
+{
+	g_return_if_fail (FR_IS_COMMAND (comm));
+
+	if (comm->filename != NULL) {
+		g_free (comm->filename);
+		comm->filename = NULL;
+	}
+
+	if (comm->e_filename != NULL) {
+		g_free (comm->e_filename);
+		comm->e_filename = NULL;
+	}
+
+	if (filename != NULL) {
+		if (! g_path_is_absolute (filename)) {
+			char *current_dir;
+
+			current_dir = g_get_current_dir ();
+			comm->filename = g_strconcat (current_dir,
+						      "/",
+						      filename,
+						      NULL);
+			g_free (current_dir);
+		}
+		else
+			comm->filename = g_strdup (filename);
+
+		comm->e_filename = g_shell_quote (comm->filename);
+
+		debug (DEBUG_INFO, "filename : %s\n", comm->filename);
+		debug (DEBUG_INFO, "e_filename : %s\n", comm->e_filename);
+	}
+
+	fr_command_working_archive (comm, comm->filename);
+}
+
+void
+fr_command_set_file (FrCommand *comm,
+		     GFile     *file)
+{
+	char *filename;
+
+	filename = g_file_get_path (file);
+	fr_command_set_filename (comm, filename);
+
+	g_free (filename);
+}
+
+void
+fr_command_set_multi_volume (FrCommand *comm,
+			     GFile     *file)
+{
+	comm->multi_volume = TRUE;
+	fr_command_set_file (comm, file);
+}
+
+void
+fr_command_list (FrCommand *comm)
+{
+	g_return_if_fail (FR_IS_COMMAND (comm));
+
+	fr_command_progress (comm, -1.0);
+
+	if (comm->files != NULL) {
+		g_ptr_array_free (comm->files, TRUE);
+		comm->files = g_ptr_array_new_full (INITIAL_SIZE, (GDestroyNotify) file_data_free);
+	}
+
+	comm->action = FR_ACTION_LISTING_CONTENT;
+	fr_process_set_out_line_func (comm->process, NULL, NULL);
+	fr_process_set_err_line_func (comm->process, NULL, NULL);
+	fr_process_use_standard_locale (comm->process, TRUE);
+	comm->multi_volume = FALSE;
+
+	if (! comm->fake_load) {
+		FR_COMMAND_GET_CLASS (G_OBJECT (comm))->list (comm);
+	} else {
+		comm->process->error.type = FR_PROC_ERROR_NONE;
+		comm->process->error.status = 0;
+		g_clear_error (&comm->process->error.gerror);
+
+		g_signal_emit (G_OBJECT (comm),
+			       fr_command_signals[DONE],
+			       0,
+			       comm->action,
+			       &comm->process->error);
+	}
+}
+
+void
+fr_command_add (FrCommand     *comm,
+		const char    *from_file,
+		GList         *file_list,
+		const char    *base_dir,
+		gboolean       update,
+		gboolean       recursive)
+{
+	fr_command_progress (comm, -1.0);
+
+	comm->action = FR_ACTION_ADDING_FILES;
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->add (comm,
+						     from_file,
+						     file_list,
+						     base_dir,
+						     update,
+						     recursive);
+}
+
+void
+fr_command_delete (FrCommand   *comm,
+		   const char  *from_file,
+		   GList       *file_list)
+{
+	fr_command_progress (comm, -1.0);
+
+	comm->action = FR_ACTION_DELETING_FILES;
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->delete (comm, from_file, file_list);
+}
+
+void
+fr_command_extract (FrCommand  *comm,
+		    const char *from_file,
+		    GList      *file_list,
+		    const char *dest_dir,
+		    gboolean    overwrite,
+		    gboolean    skip_older,
+		    gboolean    junk_paths)
+{
+	fr_command_progress (comm, -1.0);
+
+	comm->action = FR_ACTION_EXTRACTING_FILES;
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->extract (comm,
+							 from_file,
+							 file_list,
+							 dest_dir,
+							 overwrite,
+							 skip_older,
+							 junk_paths);
+}
+
+void
+fr_command_test (FrCommand *comm)
+{
+	fr_command_progress (comm, -1.0);
+
+	comm->action = FR_ACTION_TESTING_ARCHIVE;
+	fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
+
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->test (comm);
+}
+
+void
+fr_command_uncompress (FrCommand *comm)
+{
+	fr_command_progress (comm, -1.0);
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->uncompress (comm);
+}
+
+void
+fr_command_recompress (FrCommand *comm)
+{
+	fr_command_progress (comm, -1.0);
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->recompress (comm);
+}
+
+const char **
+fr_command_get_mime_types (FrCommand *comm)
+{
+	return FR_COMMAND_GET_CLASS (G_OBJECT (comm))->get_mime_types (comm);
+}
+
+void
+fr_command_update_capabilities (FrCommand *comm)
+{
+	comm->capabilities = fr_command_get_capabilities (comm, comm->mime_type, TRUE);
+}
+
+FrCommandCaps
+fr_command_get_capabilities (FrCommand  *comm,
+			     const char *mime_type,
+			     gboolean    check_command)
+{
+	return FR_COMMAND_GET_CLASS (G_OBJECT (comm))->get_capabilities (comm, mime_type, check_command);
+}
+
+gboolean
+fr_command_is_capable_of (FrCommand     *comm,<--- Parameter 'comm' can be declared as pointer to const
+			  FrCommandCaps  requested_capabilities)
+{
+	return (((comm->capabilities ^ requested_capabilities) & requested_capabilities) == 0);
+}
+
+const char *
+fr_command_get_packages (FrCommand  *comm,
+			 const char *mime_type)
+{
+	return FR_COMMAND_GET_CLASS (G_OBJECT (comm))->get_packages (comm, mime_type);
+}
+
+/* fraction == -1 means : I don't known how much time the current operation
+ *                        will take, the dialog will display this info pulsing
+ *                        the progress bar.
+ * fraction in [0.0, 1.0] means the amount of work, in percentage,
+ *                        accomplished.
+ */
+void
+fr_command_progress (FrCommand *comm,
+		     double     fraction)
+{
+	g_signal_emit (G_OBJECT (comm),
+		       fr_command_signals[PROGRESS],
+		       0,
+		       fraction);
+}
+
+void
+fr_command_message (FrCommand  *comm,
+		    const char *msg)
+{
+	g_signal_emit (G_OBJECT (comm),
+		       fr_command_signals[MESSAGE],
+		       0,
+		       msg);
+}
+
+void
+fr_command_working_archive (FrCommand  *comm,
+		            const char *archive_name)
+{
+	g_signal_emit (G_OBJECT (comm),
+		       fr_command_signals[WORKING_ARCHIVE],
+		       0,
+		       archive_name);
+}
+
+void
+fr_command_set_n_files (FrCommand *comm,
+			int        n_files)
+{
+	comm->n_files = n_files;
+	comm->n_file = 0;
+}
+
+void
+fr_command_add_file (FrCommand *comm,
+		     FileData  *fdata)
+{
+	file_data_update_content_type (fdata);
+	g_ptr_array_add (comm->files, fdata);
+	if (! fdata->dir)
+		comm->n_regular_files++;
+}
+
+void
+fr_command_set_mime_type (FrCommand  *comm,
+			  const char *mime_type)
+{
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->set_mime_type (comm, mime_type);
+}
+
+void
+fr_command_handle_error (FrCommand   *comm,
+			 FrProcError *error)
+{
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->handle_error (comm, error);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/93.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/93.html new file mode 100644 index 0000000..256c81e --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/93.html @@ -0,0 +1,277 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20

+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#ifndef FR_ENUM_TYPES_H
+#define FR_ENUM_TYPES_H
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+/* enumerations from "typedefs.h" */
+GType fr_compression_get_type (void);
+#define FR_TYPE_COMPRESSION (fr_compression_get_type())
+GType fr_overwrite_get_type (void);
+#define FR_TYPE_OVERWRITE (fr_overwrite_get_type())
+G_END_DECLS
+
+#endif /* FR_ENUM_TYPES_H */
+
+/* Generated data ends here */
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/94.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/94.html new file mode 100644 index 0000000..5460205 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/94.html @@ -0,0 +1,1593 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "file-data.h"
+#include "file-utils.h"
+#include "glib-utils.h"
+#include "fr-command.h"
+#include "fr-command-ace.h"
+#include "fr-command-alz.h"
+#include "fr-command-ar.h"
+#include "fr-command-arj.h"
+#include "fr-command-cfile.h"
+#include "fr-command-cpio.h"
+#include "fr-command-dpkg.h"
+#include "fr-command-iso.h"
+#include "fr-command-jar.h"
+#include "fr-command-lha.h"
+#include "fr-command-nomarch.h"
+#include "fr-command-rar.h"
+#include "fr-command-rpm.h"
+#include "fr-command-tar.h"
+#if HAVE_JSON_GLIB
+  #include "fr-command-unarchiver.h"
+#endif
+#include "fr-command-unstuff.h"
+#include "fr-command-zip.h"
+#include "fr-command-zoo.h"
+#include "fr-command-7z.h"
+#include "fr-command-lrzip.h"
+#include "fr-init.h"
+#include "fr-process.h"
+#include "fr-window.h"
+#include "typedefs.h"
+#include "preferences.h"
+
+/* The capabilities are computed automatically in
+ * compute_supported_archive_types() so it's correct to initialize to 0 here. */
+FrMimeTypeDescription mime_type_desc[] = {
+	{ "application/vnd.debian.binary-package",                    ".deb",      N_("Debian package"), 0 },
+	{ "application/vnd.ms-cab-compressed",                        ".cab",      N_("Cabinet"), 0 },
+	{ "application/vnd.oasis.opendocument.presentation",          ".odp",      N_("OpenDocument Presentation"), 0 },
+	{ "application/vnd.oasis.opendocument.spreadsheet",           ".ods",      N_("OpenDocument Spreadsheet"), 0 },
+	{ "application/vnd.oasis.opendocument.text",                  ".odt",      N_("OpenDocument Text"), 0 },
+	{ "application/vnd.oasis.opendocument.presentation-template", ".otp",      N_("OpenDocument Presentation Template"), 0 },
+	{ "application/vnd.oasis.opendocument.spreadsheet-template",  ".ots",      N_("OpenDocument Spreadsheet Template"), 0 },
+	{ "application/vnd.oasis.opendocument.text-template",         ".ott",      N_("OpenDocument Text Template"), 0 },
+	{ "application/epub+zip",                                     ".epub",     N_("Electronic Publication"), 0 },
+	{ "application/x-7z-compressed",                              ".7z",       N_("7-Zip"), 0 },
+	{ "application/x-7z-compressed-tar",                          ".tar.7z",   N_("Tar compressed with 7z"), 0 },
+	{ "application/x-ace",                                        ".ace",      N_("Ace"), 0 },
+	{ "application/x-alz",                                        ".alz",      N_("ALZip archive"), 0 },
+	{ "application/x-arc",                                        ".arc",	   N_("ARC archive"), 0 },
+	{ "application/x-archive",                                    ".ar",       N_("Ar"), 0 },
+	{ "application/x-arj",                                        ".arj",      N_("Arj"), 0 },
+	{ "application/x-brotli",                                     ".br",       N_("Brotli compressed file"), 0 },
+	{ "application/x-brotli-compressed-tar",                      ".tar.br",   N_("Tar compressed with brotli"), 0 },
+	{ "application/x-bzip",                                       ".bz2",      N_("Bzip2 compressed file"), 0 },
+	{ "application/x-bzip-compressed-tar",                        ".tar.bz2",  N_("Tar compressed with bzip2"), 0 },
+	{ "application/x-bzip1",                                      ".bz",       N_("Bzip compressed file"), 0 },
+	{ "application/x-bzip1-compressed-tar",                       ".tar.bz",   N_("Tar compressed with bzip"), 0 },
+	{ "application/x-cbr",                                        ".cbr",      N_("Rar Archived Comic Book"), 0 },
+	{ "application/x-cbz",                                        ".cbz",      N_("Zip Archived Comic Book"), 0 },
+	{ "application/x-cd-image",                                   ".iso",      N_("Disc Image File"), 0 },
+	{ "application/x-compress",                                   ".Z",        N_("Unix Compressed Archive file"), 0 },
+	{ "application/x-compressed-tar",                             ".tar.gz",   N_("Tar compressed with gzip"), 0 },
+	{ "application/x-cpio",                                       ".cpio",     N_("Unix CPIO Archive"), 0 },
+	{ "application/x-ear",                                        ".ear",      N_("Ear"), 0 },
+	{ "application/x-gzip",                                       ".gz",       N_("GZip compressed file"), 0 },
+	{ "application/x-java-archive",                               ".jar",      N_("Jar"), 0 },
+	{ "application/x-lzh-compressed",                             ".lzh",      N_("Lha"), 0 },
+	{ "application/x-lrzip",                                      ".lrz",      N_("Lrzip "), 0},
+	{ "application/x-lrzip-compressed-tar",                       ".tar.lrz",  N_("Tar compressed with lrzip"), 0 },
+	{ "application/x-lzip",                                       ".lz",       N_("LZip compressed file"), 0 },
+	{ "application/x-lzip-compressed-tar",                        ".tar.lz",   N_("Tar compressed with lzip"), 0 },
+	{ "application/x-lzma",                                       ".lzma",     N_("LZMA compressed file"), 0 },
+	{ "application/x-lzma-compressed-tar",                        ".tar.lzma", N_("Tar compressed with lzma"), 0 },
+	{ "application/x-lzop",                                       ".lzo",      N_("LZO compressed file"), 0 },
+	{ "application/x-lzop-compressed-tar",                        ".tar.lzo",  N_("Tar compressed with lzop"), 0 },
+	{ "application/x-ms-dos-executable",                          ".exe",      N_("Self-extracting zip"), 0 },
+	{ "application/x-ms-wim",                                     ".wim",      N_("Windows Imaging Format"), 0 },
+	{ "application/x-rar",                                        ".rar",      N_("Rar"), 0 },
+	{ "application/x-rpm",                                        ".rpm",      N_("Red Hat Package Manager file"), 0 },
+	{ "application/x-rzip",                                       ".rz",       N_("RZip compressed file"), 0 },
+	{ "application/x-stuffit",                                    ".sit",      N_("StuffIt Archive"), 0 },
+	{ "application/x-tar",                                        ".tar",      N_("Tar uncompressed"), 0 },
+	{ "application/x-tarz",                                       ".tar.Z",    N_("Tar compressed with compress"), 0 },
+	{ "application/x-war",                                        ".war",      N_("War"), 0 },
+	{ "application/x-xz",                                         ".xz",       N_("Xz compressed file"), 0 },
+	{ "application/x-xz-compressed-tar",                          ".tar.xz",   N_("Tar compressed with xz"), 0 },
+	{ "application/x-zoo",                                        ".zoo",      N_("Zoo"), 0 },
+	{ "application/zstd",                                         ".zst",      N_("Zstandard compressed file"), 0 },
+	{ "application/x-zstd",                                       ".zst",      N_("Zstandard compressed file"), 0 },
+	{ "application/x-zstd-compressed-tar",                        ".tar.zst",  N_("Tar compressed with zstd"), 0 },
+	{ "application/zip",                                          ".zip",      N_("Zip"), 0 },
+	{ NULL, NULL, NULL, 0 }
+};
+
+FrExtensionType file_ext_type[] = {
+	{ ".7z", "application/x-7z-compressed" },
+	{ ".a", "application/x-archive" },
+	{ ".ace", "application/x-ace" },
+	{ ".alz", "application/x-alz" },
+	{ ".ar", "application/x-archive" },
+	{ ".arc", "application/x-arc" },
+	{ ".arj", "application/x-arj" },
+	{ ".bin", "application/x-stuffit" },
+	{ ".br", "application/x-brotli" },
+	{ ".bz", "application/x-bzip" },
+	{ ".bz2", "application/x-bzip" },
+	{ ".cab", "application/vnd.ms-cab-compressed" },
+	{ ".cbr", "application/x-cbr" },
+	{ ".cbz", "application/x-cbz" },
+	{ ".cpio", "application/x-cpio" },
+	{ ".deb", "application/vnd.debian.binary-package" },
+	{ ".ear", "application/x-ear" },
+	{ ".epub", "application/epub+zip" },
+	{ ".exe", "application/x-ms-dos-executable" },
+	{ ".gz", "application/x-gzip" },
+	{ ".iso", "application/x-cd-image" },
+	{ ".jar", "application/x-java-archive" },
+	{ ".lha", "application/x-lzh-compressed" },
+	{ ".lrz", "application/x-lrzip" },
+	{ ".lzh", "application/x-lzh-compressed" },
+	{ ".lz", "application/x-lzip" },
+	{ ".lzma", "application/x-lzma" },
+	{ ".lzo", "application/x-lzop" },
+	{ ".odp", "application/vnd.oasis.opendocument.presentation" },
+	{ ".ods", "application/vnd.oasis.opendocument.spreadsheet" },
+	{ ".odt", "application/vnd.oasis.opendocument.text" },
+	{ ".otp", "application/vnd.oasis.opendocument.presentation-template" },
+	{ ".ots", "application/vnd.oasis.opendocument.spreadsheet-template" },
+	{ ".ott", "application/vnd.oasis.opendocument.text-template" },
+	{ ".rar", "application/x-rar" },
+	{ ".rpm", "application/x-rpm" },
+	{ ".rz", "application/x-rzip" },
+	{ ".sit", "application/x-stuffit" },
+	{ ".swm", "application/x-ms-wim" },
+	{ ".tar", "application/x-tar" },
+	{ ".tar.7z", "application/x-7z-compressed-tar" },
+	{ ".tar.br", "application/x-brotli-compressed-tar" },
+	{ ".tar.bz", "application/x-bzip-compressed-tar" },
+	{ ".tar.bz2", "application/x-bzip-compressed-tar" },
+	{ ".tar.gz", "application/x-compressed-tar" },
+	{ ".tar.lrz", "application/x-lrzip-compressed-tar" },
+	{ ".tar.lz", "application/x-lzip-compressed-tar" },
+	{ ".tar.lzma", "application/x-lzma-compressed-tar" },
+	{ ".tar.lzo", "application/x-lzop-compressed-tar" },
+	{ ".tar.xz", "application/x-xz-compressed-tar" },
+	{ ".tar.Z", "application/x-tarz" },
+	{ ".tar.zst", "application/x-zstd-compressed-tar" },
+	{ ".taz", "application/x-tarz" },
+	{ ".tbz", "application/x-bzip-compressed-tar" },
+	{ ".tbz2", "application/x-bzip-compressed-tar" },
+	{ ".tgz", "application/x-compressed-tar" },
+	{ ".tlz", "application/x-lzip-compressed-tar" },
+	{ ".txz", "application/x-xz-compressed-tar" },
+	{ ".tzma", "application/x-lzma-compressed-tar" },
+	{ ".tzo", "application/x-lzop-compressed-tar" },
+	{ ".udeb", "application/vnd.debian.binary-package" },
+	{ ".war", "application/x-war" },
+	{ ".wim", "application/x-ms-wim" },
+	{ ".xz", "application/x-xz" },
+	{ ".z", "application/x-gzip" },
+	{ ".Z", "application/x-compress" },
+	{ ".zip", "application/zip" },
+	{ ".zoo", "application/x-zoo" },
+	{ ".zst", "application/zstd" },
+	{ NULL, NULL }
+};
+
+GList        *CommandList;
+gint          ForceDirectoryCreation;
+GHashTable   *ProgramsCache;
+GPtrArray    *Registered_Commands;
+int           single_file_save_type[G_N_ELEMENTS (mime_type_desc)];
+int           save_type[G_N_ELEMENTS (mime_type_desc)];
+int           open_type[G_N_ELEMENTS (mime_type_desc)];
+int           create_type[G_N_ELEMENTS (mime_type_desc)];
+
+static void
+migrate_options_directory (void)
+{
+	char *old_directory_path;
+	GFile *old_directory;
+	GFile *new_directory;
+
+	old_directory_path = get_home_relative_path (".config/mate/engrampa/options");
+	old_directory = g_file_new_for_path (old_directory_path);
+	new_directory = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, FALSE);
+	if (g_file_query_exists (old_directory, NULL) && ! g_file_query_exists (new_directory, NULL)) {
+		GFile *parent;
+
+		parent = g_file_get_parent (new_directory);
+		if (make_directory_tree (parent, 0700, NULL))
+			g_file_move (old_directory, new_directory, 0, NULL, NULL, NULL, NULL);
+
+		g_object_unref (parent);
+	}
+
+	g_object_unref (new_directory);
+	g_object_unref (old_directory);
+	g_free (old_directory_path);
+}
+
+/* -- FrRegisteredCommand -- */
+
+static FrRegisteredCommand *
+fr_registered_command_new (GType command_type)
+{
+	FrRegisteredCommand  *reg_com;
+	FrCommand            *command;
+	const char          **mime_types;
+	int                   i;
+
+	reg_com = g_new0 (FrRegisteredCommand, 1);
+	reg_com->ref = 1;
+	reg_com->type = command_type;
+	reg_com->caps = g_ptr_array_new ();
+	reg_com->packages = g_ptr_array_new ();
+
+	command = (FrCommand*) g_object_new (reg_com->type, NULL);
+	mime_types = fr_command_get_mime_types (command);
+	for (i = 0; mime_types[i] != NULL; i++) {
+		const char         *mime_type;
+		FrMimeTypeCap      *cap;
+		FrMimeTypePackages *packages;
+
+		mime_type = get_static_string (mime_types[i]);
+
+		cap = g_new0 (FrMimeTypeCap, 1);
+		cap->mime_type = mime_type;
+		cap->current_capabilities = fr_command_get_capabilities (command, mime_type, TRUE);
+		cap->potential_capabilities = fr_command_get_capabilities (command, mime_type, FALSE);
+		g_ptr_array_add (reg_com->caps, cap);
+
+		packages = g_new0 (FrMimeTypePackages, 1);
+		packages->mime_type = mime_type;
+		packages->packages = fr_command_get_packages (command, mime_type);
+		g_ptr_array_add (reg_com->packages, packages);
+	}
+
+	g_object_unref (command);
+
+	return reg_com;
+}
+
+G_GNUC_UNUSED static void
+fr_registered_command_ref (FrRegisteredCommand *reg_com)
+{
+	reg_com->ref++;
+}
+
+static void
+fr_registered_command_unref (FrRegisteredCommand *reg_com)
+{
+	if (--(reg_com->ref) != 0)
+		return;
+
+	g_ptr_array_foreach (reg_com->caps, (GFunc) g_free, NULL);
+	g_ptr_array_free (reg_com->caps, TRUE);
+	g_free (reg_com);
+}
+
+static FrCommandCaps
+fr_registered_command_get_capabilities (FrRegisteredCommand *reg_com,
+				        const char          *mime_type)
+{
+	guint i;
+
+	for (i = 0; i < reg_com->caps->len; i++) {
+		FrMimeTypeCap *cap;
+
+		cap = g_ptr_array_index (reg_com->caps, i);
+		if (is_mime_type (mime_type, cap->mime_type))
+			return cap->current_capabilities;
+	}
+
+	return FR_COMMAND_CAN_DO_NOTHING;
+}
+
+static FrCommandCaps
+fr_registered_command_get_potential_capabilities (FrRegisteredCommand *reg_com,
+						  const char          *mime_type)
+{
+	guint i;
+
+	if (mime_type == NULL)
+		return FR_COMMAND_CAN_DO_NOTHING;
+
+	for (i = 0; i < reg_com->caps->len; i++) {
+		FrMimeTypeCap *cap;
+
+		cap = g_ptr_array_index (reg_com->caps, i);
+		if ((cap->mime_type != NULL) && (is_mime_type (mime_type, cap->mime_type)))
+			return cap->potential_capabilities;
+	}
+
+	return FR_COMMAND_CAN_DO_NOTHING;
+}
+
+static void
+register_command (GType command_type)
+{
+	if (Registered_Commands == NULL)
+		Registered_Commands = g_ptr_array_sized_new (5);
+	g_ptr_array_add (Registered_Commands, fr_registered_command_new (command_type));
+}
+
+G_GNUC_UNUSED static gboolean
+unregister_command (GType command_type)
+{
+	guint i;
+
+	for (i = 0; i < Registered_Commands->len; i++) {
+		FrRegisteredCommand *command;
+
+		command = g_ptr_array_index (Registered_Commands, i);
+		if (command->type == command_type) {
+			g_ptr_array_remove_index (Registered_Commands, i);
+			fr_registered_command_unref (command);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+register_commands (void)
+{
+	/* The order here is important. Commands registered earlier have higher
+	 * priority.  However commands that can read and write a file format
+	 * have higher priority over commands that can only read the same
+	 * format, regardless of the registration order. */
+
+	register_command (FR_TYPE_COMMAND_TAR);
+	register_command (FR_TYPE_COMMAND_CFILE);
+	register_command (FR_TYPE_COMMAND_RAR);
+	register_command (FR_TYPE_COMMAND_7Z);
+	register_command (FR_TYPE_COMMAND_DPKG);
+
+	register_command (FR_TYPE_COMMAND_ACE);
+	register_command (FR_TYPE_COMMAND_ALZ);
+	register_command (FR_TYPE_COMMAND_AR);
+	register_command (FR_TYPE_COMMAND_NOMARCH);
+	register_command (FR_TYPE_COMMAND_ARJ);
+	register_command (FR_TYPE_COMMAND_CPIO);
+	register_command (FR_TYPE_COMMAND_ISO);
+	register_command (FR_TYPE_COMMAND_JAR);
+	register_command (FR_TYPE_COMMAND_LHA);
+	register_command (FR_TYPE_COMMAND_RPM);
+	register_command (FR_TYPE_COMMAND_UNSTUFF);
+	register_command (FR_TYPE_COMMAND_ZIP);
+	register_command (FR_TYPE_COMMAND_LRZIP);
+	register_command (FR_TYPE_COMMAND_ZOO);
+#if HAVE_JSON_GLIB
+	register_command (FR_TYPE_COMMAND_UNARCHIVER);
+#endif
+}
+
+GType
+get_command_type_from_mime_type (const char    *mime_type,
+				 FrCommandCaps  requested_capabilities)
+{
+	guint i;
+
+	if (mime_type == NULL)
+		return 0;
+
+	for (i = 0; i < Registered_Commands->len; i++) {
+		FrRegisteredCommand *command;
+		FrCommandCaps        capabilities;
+
+		command = g_ptr_array_index (Registered_Commands, i);
+		capabilities = fr_registered_command_get_capabilities (command, mime_type);
+
+		/* the command must support all the requested capabilities */
+		if (((capabilities ^ requested_capabilities) & requested_capabilities) == 0)
+			return command->type;
+	}
+
+	return 0;
+}
+
+GType
+get_preferred_command_for_mime_type (const char    *mime_type,
+				     FrCommandCaps  requested_capabilities)
+{
+	guint i;
+
+	for (i = 0; i < Registered_Commands->len; i++) {
+		FrRegisteredCommand *command;
+		FrCommandCaps        capabilities;
+
+		command = g_ptr_array_index (Registered_Commands, i);
+		capabilities = fr_registered_command_get_potential_capabilities (command, mime_type);
+
+		/* the command must support all the requested capabilities */
+		if (((capabilities ^ requested_capabilities) & requested_capabilities) == 0)
+			return command->type;
+	}
+
+	return 0;
+}
+
+void
+update_registered_commands_capabilities (void)
+{
+	guint i;
+
+	g_hash_table_remove_all (ProgramsCache);
+
+	for (i = 0; i < Registered_Commands->len; i++) {
+		FrRegisteredCommand *reg_com;
+		FrCommand           *command;
+		guint                j;
+
+		reg_com = g_ptr_array_index (Registered_Commands, i);
+		command = (FrCommand*) g_object_new (reg_com->type, NULL);
+		for (j = 0; j < reg_com->caps->len; j++) {
+			FrMimeTypeCap *cap = g_ptr_array_index (reg_com->caps, j);
+
+			cap->current_capabilities = fr_command_get_capabilities (command, cap->mime_type, TRUE);
+			cap->potential_capabilities = fr_command_get_capabilities (command, cap->mime_type, FALSE);
+		}
+
+		g_object_unref (command);
+	}
+}
+
+const char *
+get_mime_type_from_extension (const char *ext)
+{
+	int i;
+
+	if (ext == NULL)
+		return NULL;
+
+	for (i = G_N_ELEMENTS (file_ext_type) - 1; i >= 0; i--) {
+		if (file_ext_type[i].ext == NULL)
+			continue;
+		if (strcasecmp (ext, file_ext_type[i].ext) == 0)
+			return get_static_string (file_ext_type[i].mime_type);
+	}
+
+	return NULL;
+}
+
+const char *
+get_archive_filename_extension (const char *filename)
+{
+	const char *ext;
+	int         i;
+
+	if (filename == NULL)
+		return NULL;
+
+	ext = get_file_extension (filename);
+	if (ext == NULL)
+		return NULL;
+
+	for (i = G_N_ELEMENTS (file_ext_type) - 1; i >= 0; i--) {
+		if (file_ext_type[i].ext == NULL)
+			continue;
+		if (strcasecmp (ext, file_ext_type[i].ext) == 0)
+			return ext;
+	}
+
+	return NULL;
+}
+
+static gboolean
+is_mime_type_alias (const char *mime_type)
+{
+	size_t i;
+
+	for (i = 0; mime_type_desc[i].mime_type != NULL; i++)
+		if (g_content_type_equals (mime_type_desc[i].mime_type, mime_type))
+			return TRUE;
+
+	return FALSE;
+}
+
+int
+get_mime_type_index (const char *mime_type)
+{
+	int i;
+
+	for (i = 0; mime_type_desc[i].mime_type != NULL; i++)
+		if (is_mime_type (mime_type_desc[i].mime_type, mime_type))
+			return i;
+	return -1;
+}
+
+static void
+add_if_non_present (int *a,
+	            int *n,
+	            int  o)
+{
+	int i;
+
+	for (i = 0; i < *n; i++) {
+		if (a[i] == o)
+			return;
+	}
+	a[*n] = o;
+	*n = *n + 1;
+}
+
+static int
+cmp_mime_type_by_extension (const void *p1,
+			    const void *p2)
+{
+	int i1 = * (int*) p1;
+	int i2 = * (int*) p2;
+
+	return strcmp (mime_type_desc[i1].default_ext, mime_type_desc[i2].default_ext);
+}
+
+static int
+cmp_mime_type_by_description (const void *p1,
+			      const void *p2)
+{
+	int i1 = * (int*) p1;
+	int i2 = * (int*) p2;
+
+	return g_utf8_collate (_(mime_type_desc[i1].name), _(mime_type_desc[i2].name));
+}
+
+static void
+sort_mime_types (int *a,
+                 int(*compar)(const void *, const void *))
+{
+	int n = 0;
+
+	while (a[n] != -1)
+		n++;
+	qsort (a, n, sizeof (int), compar);
+}
+
+void
+sort_mime_types_by_extension (int *a)
+{
+	sort_mime_types (a, cmp_mime_type_by_extension);
+}
+
+void
+sort_mime_types_by_description (int *a)
+{
+	sort_mime_types (a, cmp_mime_type_by_description);
+}
+
+static void
+compute_supported_archive_types (void)
+{
+	int sf_i = 0, s_i = 0, o_i = 0, c_i = 0;
+	guint i;
+
+	for (i = 0; i < Registered_Commands->len; i++) {
+		FrRegisteredCommand *reg_com;
+		guint                j;
+
+		reg_com = g_ptr_array_index (Registered_Commands, i);
+		for (j = 0; j < reg_com->caps->len; j++) {
+			FrMimeTypeCap *cap;
+			int            idx;
+
+			cap = g_ptr_array_index (reg_com->caps, j);
+			idx = get_mime_type_index (cap->mime_type);
+			if (idx < 0) {
+				if (!is_mime_type_alias (cap->mime_type)) {
+					g_warning ("mime type not recognized: %s", cap->mime_type);
+				}
+				continue;
+			}
+			mime_type_desc[idx].capabilities |= cap->current_capabilities;
+			if (cap->current_capabilities & FR_COMMAND_CAN_READ)
+				add_if_non_present (open_type, &o_i, idx);
+			if (cap->current_capabilities & FR_COMMAND_CAN_WRITE) {
+				if (cap->current_capabilities & FR_COMMAND_CAN_ARCHIVE_MANY_FILES) {
+					add_if_non_present (save_type, &s_i, idx);
+					if (cap->current_capabilities & FR_COMMAND_CAN_WRITE)<--- Condition 'cap->current_capabilities&FR_COMMAND_CAN_WRITE' is always true
+						add_if_non_present (create_type, &c_i, idx);
+				}
+				add_if_non_present (single_file_save_type, &sf_i, idx);
+			}
+		}
+	}
+
+	open_type[o_i] = -1;
+	save_type[s_i] = -1;
+	single_file_save_type[sf_i] = -1;
+	create_type[c_i] = -1;
+}
+
+static gboolean initialized = FALSE;
+
+void
+initialize_data (void)
+{
+	if (initialized)
+		return;
+	initialized = TRUE;
+
+	ProgramsCache = g_hash_table_new_full (g_str_hash,
+					       g_str_equal,
+					       g_free,
+					       NULL);
+
+	migrate_options_directory ();
+	register_commands ();
+	compute_supported_archive_types ();
+}
+
+static void
+command_done (CommandData *cdata)
+{
+	if (cdata == NULL)
+		return;
+
+	if ((cdata->temp_dir != NULL) && path_is_dir (cdata->temp_dir)) {
+		char *argv[4];
+
+		argv[0] = "rm";
+		argv[1] = "-rf";
+		argv[2] = cdata->temp_dir;
+		argv[3] = NULL;
+		g_spawn_sync (g_get_tmp_dir (), argv, NULL,
+			      G_SPAWN_SEARCH_PATH,
+			      NULL, NULL,
+			      NULL, NULL, NULL,
+			      NULL);
+	}
+
+	g_free (cdata->command);
+	if (cdata->app != NULL)
+		g_object_unref (cdata->app);
+	path_list_free (cdata->file_list);
+	g_free (cdata->temp_dir);
+	if (cdata->process != NULL)
+		g_object_unref (cdata->process);
+
+	CommandList = g_list_remove (CommandList, cdata);
+	g_free (cdata);
+}
+
+void
+release_data (void)
+{
+	if (! initialized)
+		return;
+
+	while (CommandList != NULL) {
+		CommandData *cdata = CommandList->data;
+		command_done (cdata);
+	}
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/95.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/95.html new file mode 100644 index 0000000..6dee1d3 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/95.html @@ -0,0 +1,593 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "eggtreemultidnd.h"
+#include "fr-list-model.h"
+#include "fr-window.h"
+
+static GtkListStoreClass *parent_class;
+
+static gboolean
+fr_list_model_multi_row_draggable (EggTreeMultiDragSource *drag_source,
+				   GList                  *path_list)
+{
+	FrWindow     *window;
+	GtkTreeModel *model;
+	GList        *scan;
+
+	window = g_object_get_data (G_OBJECT (drag_source), "FrWindow");
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	model = fr_window_get_list_store (window);
+
+	for (scan = path_list; scan; scan = scan->next) {
+		GtkTreeRowReference *reference = scan->data;
+		GtkTreePath         *path;
+		GtkTreeIter          iter;
+		FileData            *fdata;
+
+		path = gtk_tree_row_reference_get_path (reference);
+		if (path == NULL)
+			continue;
+
+		if (! gtk_tree_model_get_iter (model, &iter, path))
+			continue;
+
+		gtk_tree_model_get (model, &iter,
+				    COLUMN_FILE_DATA, &fdata,
+				    -1);
+
+		if (fdata != NULL)
+			return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+fr_list_model_multi_drag_data_get (EggTreeMultiDragSource *drag_source,
+				   GdkDragContext         *context,
+				   GtkSelectionData       *selection_data,
+				   GList                  *path_list)
+{
+	FrWindow *window;
+
+	window = g_object_get_data (G_OBJECT (drag_source), "FrWindow");
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	return fr_window_file_list_drag_data_get (window,
+						  context,
+						  selection_data,
+						  path_list);
+}
+
+static gboolean
+fr_list_model_multi_drag_data_delete (EggTreeMultiDragSource *drag_source,
+				      GList                  *path_list)
+{
+	return TRUE;
+}
+
+static void
+fr_list_model_finalize (GObject *object)
+{
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+fr_list_model_init (FRListModel *model)
+{
+}
+
+static void
+fr_list_model_class_init (FRListModelClass *klass)
+{
+	GObjectClass *object_class;
+
+	object_class = (GObjectClass *)klass;
+	parent_class = g_type_class_peek_parent (klass);
+
+	object_class->finalize = fr_list_model_finalize;
+}
+
+static void
+fr_list_model_multi_drag_source_init (EggTreeMultiDragSourceIface *iface)
+{
+	iface->row_draggable = fr_list_model_multi_row_draggable;
+	iface->drag_data_get = fr_list_model_multi_drag_data_get;
+	iface->drag_data_delete = fr_list_model_multi_drag_data_delete;
+}
+
+GType
+fr_list_model_get_type (void)
+{
+	static GType object_type = 0;
+
+	if (object_type == 0) {
+		static const GTypeInfo object_info = {
+			sizeof (FRListModelClass),
+			NULL,		/* base_init */
+			NULL,		/* base_finalize */
+			(GClassInitFunc) fr_list_model_class_init,
+			NULL,		/* class_finalize */
+			NULL,		/* class_data */
+			sizeof (FRListModel),
+			0,
+			(GInstanceInitFunc) fr_list_model_init,
+			NULL
+		};
+
+		static const GInterfaceInfo multi_drag_source_info = {
+			(GInterfaceInitFunc) fr_list_model_multi_drag_source_init,
+			NULL,
+			NULL
+		};
+
+		object_type = g_type_register_static (GTK_TYPE_LIST_STORE, "FRListModel", &object_info, 0);
+		g_type_add_interface_static (object_type,
+					     EGG_TYPE_TREE_MULTI_DRAG_SOURCE,
+					     &multi_drag_source_info);
+	}
+
+	return object_type;
+}
+
+GtkListStore *
+fr_list_model_new (int n_columns, ...)
+{
+	GtkListStore *retval;
+	GType        *types;
+	va_list       args;
+	int           i;
+
+	g_return_val_if_fail (n_columns > 0, NULL);
+
+	retval = g_object_new (FR_TYPE_LIST_MODEL, NULL);
+
+	va_start (args, n_columns);
+	types = g_new0 (GType, n_columns);
+	for (i = 0; i < n_columns; i++)
+		types[i] = va_arg (args, GType);
+	va_end (args);
+
+	gtk_list_store_set_column_types (retval, n_columns, types);
+	g_free (types);
+
+	return retval;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/96.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/96.html new file mode 100644 index 0000000..5ea3a93 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/96.html @@ -0,0 +1,329 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2005 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef FR_LIST_MODEL_H
+#define FR_LIST_MODEL_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define FR_TYPE_LIST_MODEL            (fr_list_model_get_type ())
+#define FR_LIST_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_LIST_MODEL, FRListModel))
+#define FR_LIST_MODEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_LIST_MODEL, FRListModelClass))
+#define FR_IS_LIST_MODEL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_LIST_MODEL))
+#define FR_IS_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_LIST_MODEL))
+#define FR_LIST_MODEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_LIST_MODEL, FRListModelClass))
+
+typedef struct FRListModel {
+	GtkListStore __parent;
+} FRListModel;
+
+typedef struct FRListModelClass {
+	GtkListStoreClass __parent_class;
+} FRListModelClass;
+
+GType         fr_list_model_get_type (void);
+GtkListStore *fr_list_model_new      (int n_columns, ...);
+
+#endif /* FR_LIST_MODEL_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/97.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/97.html new file mode 100644 index 0000000..7575509 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/97.html @@ -0,0 +1,559 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
#include "fr-marshal.h"
+/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v)     g_value_get_schar (v)
+#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
+#define g_marshal_value_peek_long(v)     g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
+#define g_marshal_value_peek_float(v)    g_value_get_float (v)
+#define g_marshal_value_peek_double(v)   g_value_get_double (v)
+#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v)    g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+#define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ *          Do not access GValues directly in your code. Instead, use the
+ *          g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
+#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
+#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
+#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+/* VOID:INT,INT (fr-marshal.list:2) */
+void
+fr_marshal_VOID__INT_INT (GClosure     *closure,
+                          GValue       *return_value G_GNUC_UNUSED,
+                          guint         n_param_values,
+                          const GValue *param_values,
+                          gpointer      invocation_hint G_GNUC_UNUSED,
+                          gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1,
+                                              gint arg1,
+                                              gint arg2,
+                                              gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__INT_INT callback;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_int (param_values + 1),
+            g_marshal_value_peek_int (param_values + 2),
+            data2);
+}
+
+/* VOID:INT,BOXED (fr-marshal.list:3) */
+void
+fr_marshal_VOID__INT_BOXED (GClosure     *closure,
+                            GValue       *return_value G_GNUC_UNUSED,
+                            guint         n_param_values,
+                            const GValue *param_values,
+                            gpointer      invocation_hint G_GNUC_UNUSED,
+                            gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1,
+                                                gint arg1,
+                                                gpointer arg2,
+                                                gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__INT_BOXED callback;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__INT_BOXED) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_int (param_values + 1),
+            g_marshal_value_peek_boxed (param_values + 2),
+            data2);
+}
+
+/* VOID:DOUBLE,STRING (fr-marshal.list:7) */
+void
+fr_marshal_VOID__DOUBLE_STRING (GClosure     *closure,
+                                GValue       *return_value G_GNUC_UNUSED,
+                                guint         n_param_values,
+                                const GValue *param_values,
+                                gpointer      invocation_hint G_GNUC_UNUSED,
+                                gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__DOUBLE_STRING) (gpointer data1,
+                                                    gdouble arg1,
+                                                    gpointer arg2,
+                                                    gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__DOUBLE_STRING callback;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__DOUBLE_STRING) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_double (param_values + 1),
+            g_marshal_value_peek_string (param_values + 2),
+            data2);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/98.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/98.html new file mode 100644 index 0000000..55db543 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/98.html @@ -0,0 +1,341 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2001 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-proc-error.h"
+
+static gpointer
+fr_proc_error_copy (gpointer boxed)
+{
+	FrProcError *old_error = boxed;
+	FrProcError *new_error;
+
+	new_error = g_new (FrProcError, 1);
+	new_error->type = old_error->type;
+	new_error->status = old_error->status;
+	new_error->gerror = (old_error->gerror != NULL) ? g_error_copy (old_error->gerror) : NULL;
+
+	return new_error;
+}
+
+static void
+fr_proc_error_free (gpointer boxed)
+{
+	FrProcError *error = boxed;
+
+	if (error->gerror != NULL)
+		g_error_free (error->gerror);
+	g_free (error);
+}
+
+G_DEFINE_BOXED_TYPE (FrProcError,
+		     fr_proc_error,
+		     fr_proc_error_copy,
+		     fr_proc_error_free)
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/99.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/99.html new file mode 100644 index 0000000..b10cd27 --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/99.html @@ -0,0 +1,2431 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  Engrampa
+ *
+ *  Copyright (C) 2001, 2003, 2008 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <signal.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/wait.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "fr-proc-error.h"
+#include "fr-process.h"
+#include "fr-marshal.h"
+#include "glib-utils.h"
+
+#define REFRESH_RATE 20
+#define BUFFER_SIZE 16384
+
+enum {
+	START,
+	DONE,
+	STICKY_ONLY,
+	LAST_SIGNAL
+};
+
+static GObjectClass *parent_class;
+static guint fr_process_signals[LAST_SIGNAL] = { 0 };
+
+static void fr_process_class_init (FrProcessClass *class);
+static void fr_process_init       (FrProcess      *process);
+static void fr_process_finalize   (GObject        *object);
+
+typedef struct {
+	GList        *args;              /* command to execute */
+	char         *dir;               /* working directory */
+	guint         sticky : 1;        /* whether the command must be
+					  * executed even if a previous
+					  * command has failed. */
+	guint         ignore_error : 1;  /* whether to continue to execute
+					  * other commands if this command
+					  * fails. */
+	ContinueFunc  continue_func;
+	gpointer      continue_data;
+	ProcFunc      begin_func;
+	gpointer      begin_data;
+	ProcFunc      end_func;
+	gpointer      end_data;
+} FrCommandInfo;
+
+static FrCommandInfo *
+fr_command_info_new (void)
+{
+	FrCommandInfo *info;
+
+	info = g_new0 (FrCommandInfo, 1);
+	info->args = NULL;
+	info->dir = NULL;
+	info->sticky = FALSE;
+	info->ignore_error = FALSE;
+
+	return info;
+}
+
+static void
+fr_command_info_free (gpointer data)
+{
+	FrCommandInfo *info = data;
+
+	if (info == NULL)
+		return;
+
+	g_list_free_full (info->args, g_free);
+	g_free (info->dir);
+	g_clear_pointer (&info, g_free);
+}
+
+static void
+fr_channel_data_init (FrChannelData *channel)
+{
+	channel->source = NULL;
+	channel->raw = NULL;
+	channel->status = G_IO_STATUS_NORMAL;
+	channel->error = NULL;
+}
+
+static void
+fr_channel_data_close_source (FrChannelData *channel)
+{
+	if (channel->source != NULL) {
+		g_io_channel_shutdown (channel->source, FALSE, NULL);
+		g_io_channel_unref (channel->source);
+		channel->source = NULL;
+	}
+}
+
+static GIOStatus
+fr_channel_data_read (FrChannelData *channel)
+{
+	char  *line;
+	gsize  length;
+	gsize  terminator_pos;
+
+	channel->status = G_IO_STATUS_NORMAL;
+	g_clear_error (&channel->error);
+
+	while ((channel->status = g_io_channel_read_line (channel->source,
+							  &line,
+							  &length,
+							  &terminator_pos,
+							  &channel->error)) == G_IO_STATUS_NORMAL)
+	{
+		line[terminator_pos] = 0;
+		channel->raw = g_list_prepend (channel->raw, line);
+		if (channel->line_func != NULL)
+			(*channel->line_func) (line, channel->line_data);
+	}
+
+	return channel->status;
+}
+
+static GIOStatus
+fr_channel_data_flush (FrChannelData *channel)
+{
+	GIOStatus status;
+
+	while (((status = fr_channel_data_read (channel)) != G_IO_STATUS_ERROR) && (status != G_IO_STATUS_EOF))
+		/* void */;
+	fr_channel_data_close_source (channel);
+
+	return status;
+}
+
+static void
+fr_channel_data_reset (FrChannelData *channel)
+{
+	fr_channel_data_close_source (channel);
+
+	if (channel->raw != NULL) {
+		g_list_free_full (channel->raw, g_free);
+		channel->raw = NULL;
+	}
+}
+
+static void
+fr_channel_data_free (FrChannelData *channel)
+{
+	fr_channel_data_reset (channel);
+}
+
+static void
+fr_channel_data_set_fd (FrChannelData *channel,
+			int            fd,
+			const char    *charset)
+{
+	fr_channel_data_reset (channel);
+
+	channel->source = g_io_channel_unix_new (fd);
+	g_io_channel_set_flags (channel->source, G_IO_FLAG_NONBLOCK, NULL);
+	g_io_channel_set_buffer_size (channel->source, BUFFER_SIZE);
+	if (charset != NULL)
+		g_io_channel_set_encoding (channel->source, charset, NULL);
+}
+
+const char *try_charsets[] = { "UTF-8", "ISO-8859-1", "WINDOW-1252" };
+int n_charsets = G_N_ELEMENTS (try_charsets);
+
+struct _FrProcessPrivate {
+	GPtrArray   *comm;                /* FrCommandInfo elements. */
+	gint         n_comm;              /* total number of commands */
+	gint         current_comm;        /* currenlty editing command. */
+
+	GPid         command_pid;
+	guint        check_timeout;
+
+	FrProcError  first_error;
+
+	gboolean     running;
+	gboolean     stopping;
+	gboolean     suspend;
+	gint         current_command;
+	gint         error_command;       /* command that coused an error. */
+
+	gboolean     use_standard_locale;
+	gboolean     sticky_only;         /* whether to execute only sticky
+			 		   * commands. */
+	int          current_charset;
+};
+
+GType
+fr_process_get_type (void)
+{
+	static GType type = 0;
+
+	if (! type) {
+		GTypeInfo type_info = {
+			sizeof (FrProcessClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) fr_process_class_init,
+			NULL,
+			NULL,
+			sizeof (FrProcess),
+			0,
+			(GInstanceInitFunc) fr_process_init,
+			NULL
+		};
+
+		type = g_type_register_static (G_TYPE_OBJECT,
+					       "FRProcess",
+					       &type_info,
+					       0);
+	}
+
+	return type;
+}
+
+static void
+fr_process_class_init (FrProcessClass *class)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+
+	parent_class = g_type_class_peek_parent (class);
+
+	fr_process_signals[START] =
+		g_signal_new ("start",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrProcessClass, start),
+			      NULL, NULL,
+			      fr_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+	fr_process_signals[DONE] =
+		g_signal_new ("done",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrProcessClass, done),
+			      NULL, NULL,
+			      fr_marshal_VOID__BOXED,
+			      G_TYPE_NONE, 1,
+			      FR_TYPE_PROC_ERROR);
+	fr_process_signals[STICKY_ONLY] =
+		g_signal_new ("sticky_only",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (FrProcessClass, sticky_only),
+			      NULL, NULL,
+			      fr_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
+	gobject_class->finalize = fr_process_finalize;
+
+	class->start = NULL;
+	class->done  = NULL;
+}
+
+static void
+fr_process_init (FrProcess *process)
+{
+	process->priv = g_new0 (FrProcessPrivate, 1);
+
+	process->term_on_stop = TRUE;
+
+	process->priv->comm = g_ptr_array_new_with_free_func (fr_command_info_free);
+	process->priv->n_comm = -1;
+	process->priv->current_comm = -1;
+
+	process->priv->command_pid = 0;
+	fr_channel_data_init (&process->out);
+	fr_channel_data_init (&process->err);
+
+	process->error.gerror = NULL;
+	process->priv->first_error.gerror = NULL;
+
+	process->priv->check_timeout = 0;
+	process->priv->running = FALSE;
+	process->priv->stopping = FALSE;
+	process->restart = FALSE;
+
+	process->priv->current_charset = -1;
+
+	process->priv->use_standard_locale = FALSE;
+}
+
+FrProcess *
+fr_process_new (void)
+{
+	return FR_PROCESS (g_object_new (FR_TYPE_PROCESS, NULL));
+}
+
+static void fr_process_stop_priv (FrProcess *process, gboolean emit_signal);
+static int  fr_switch_process_state (FrProcess *process);
+
+static void
+fr_process_finalize (GObject *object)
+{
+	FrProcess *process;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_PROCESS (object));
+
+	process = FR_PROCESS (object);
+
+	fr_process_stop_priv (process, FALSE);
+
+	g_ptr_array_free (process->priv->comm, TRUE);
+
+	fr_channel_data_free (&process->out);
+	fr_channel_data_free (&process->err);
+
+	g_clear_error (&process->error.gerror);
+	g_clear_error (&process->priv->first_error.gerror);
+
+	g_free (process->priv);
+
+	/* Chain up */
+
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+void
+fr_process_begin_command (FrProcess  *process,
+			  const char *arg)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+
+	info = fr_command_info_new ();
+	info->args = g_list_prepend (NULL, g_strdup (arg));
+
+	g_ptr_array_add (process->priv->comm, info);
+
+	process->priv->n_comm++;
+	process->priv->current_comm = process->priv->n_comm;
+}
+
+void
+fr_process_begin_command_at (FrProcess  *process,
+			     const char *arg,
+			     int         index)
+{
+	FrCommandInfo *info, *old_c_info;
+
+	g_return_if_fail (process != NULL);
+	g_return_if_fail (index >= 0 && index <= process->priv->n_comm);
+
+	process->priv->current_comm = index;
+
+	old_c_info = g_ptr_array_index (process->priv->comm, index);
+	fr_command_info_free (old_c_info);
+
+	info = fr_command_info_new ();
+	info->args = g_list_prepend (NULL, g_strdup (arg));
+
+	g_ptr_array_index (process->priv->comm, index) = info;
+}
+
+void
+fr_process_set_working_dir (FrProcess  *process,
+			    const char *dir)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+	g_return_if_fail (process->priv->current_comm >= 0);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	if (info->dir != NULL)
+		g_free (info->dir);
+	info->dir = g_strdup (dir);
+}
+
+void
+fr_process_set_sticky (FrProcess *process,
+		       gboolean   sticky)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+	g_return_if_fail (process->priv->current_comm >= 0);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->sticky = (sticky != FALSE);
+}
+
+void
+fr_process_set_ignore_error (FrProcess *process,
+			     gboolean   ignore_error)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+	g_return_if_fail (process->priv->current_comm >= 0);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->ignore_error = (ignore_error != FALSE);
+}
+
+void
+fr_process_add_arg (FrProcess  *process,
+		    const char *arg)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+	g_return_if_fail (process->priv->current_comm >= 0);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->args = g_list_prepend (info->args, g_strdup (arg));
+}
+
+void
+fr_process_add_arg_concat (FrProcess  *process,
+			   const char *arg1,
+			   ...)
+{
+	GString *arg;
+	va_list  args;
+	char    *s;
+
+	arg = g_string_new (arg1);
+
+	va_start (args, arg1);
+	while ((s = va_arg (args, char*)) != NULL)
+		g_string_append (arg, s);
+	va_end (args);
+
+	fr_process_add_arg (process, arg->str);
+	g_string_free (arg, TRUE);
+}
+
+void
+fr_process_add_arg_printf (FrProcess    *fr_proc,
+			   const char   *format,
+			   ...)
+{
+	va_list  args;
+	char    *arg;
+
+	va_start (args, format);
+	arg = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	fr_process_add_arg (fr_proc, arg);
+
+	g_free (arg);
+}
+
+void
+fr_process_set_arg_at (FrProcess  *process,
+		       int         n_comm,
+		       int         n_arg,
+		       const char *arg_value)
+{
+	FrCommandInfo *info;
+	GList         *arg;
+
+	g_return_if_fail (process != NULL);
+
+	info = g_ptr_array_index (process->priv->comm, n_comm);
+	arg = g_list_nth (info->args, n_arg);
+	g_return_if_fail (arg != NULL);
+
+	g_free (arg->data);
+	arg->data = g_strdup (arg_value);
+}
+
+void
+fr_process_set_begin_func (FrProcess    *process,
+			   ProcFunc      func,
+			   gpointer      func_data)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->begin_func = func;
+	info->begin_data = func_data;
+}
+
+void
+fr_process_set_end_func (FrProcess    *process,
+			 ProcFunc      func,
+			 gpointer      func_data)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->end_func = func;
+	info->end_data = func_data;
+}
+
+void
+fr_process_set_continue_func (FrProcess    *process,
+			      ContinueFunc  func,
+			      gpointer      func_data)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+
+	if (process->priv->current_comm < 0)
+		return;
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->continue_func = func;
+	info->continue_data = func_data;
+}
+
+void
+fr_process_end_command (FrProcess *process)
+{
+	FrCommandInfo *info;
+
+	g_return_if_fail (process != NULL);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_comm);
+	info->args = g_list_reverse (info->args);
+}
+
+void
+fr_process_clear (FrProcess *process)
+{
+	gint i;
+
+	g_return_if_fail (process != NULL);
+
+	for (i = 0; i <= process->priv->n_comm; i++)
+		g_ptr_array_remove_index_fast (process->priv->comm, 0);
+
+	process->priv->n_comm = -1;
+	process->priv->current_comm = -1;
+}
+
+void
+fr_process_set_out_line_func (FrProcess *process,
+			      LineFunc   func,
+			      gpointer   data)
+{
+	g_return_if_fail (process != NULL);
+
+	process->out.line_func = func;
+	process->out.line_data = data;
+}
+
+void
+fr_process_set_err_line_func (FrProcess *process,
+			      LineFunc   func,
+			      gpointer   data)
+{
+	g_return_if_fail (process != NULL);
+
+	process->err.line_func = func;
+	process->err.line_data = data;
+}
+
+static gboolean check_child (gpointer data);
+
+static void
+child_setup (gpointer user_data)
+{
+	FrProcess *process = user_data;<--- Variable 'process' can be declared as pointer to const
+
+	if (process->priv->use_standard_locale) {
+		putenv ("LC_MESSAGES=C");
+		putenv ("LC_TIME=C");
+		putenv ("LC_NUMERIC=C");
+	}
+
+	/* detach from the tty */
+
+	setsid ();
+
+	/* create a process group to kill all the child processes when
+	 * canceling the operation. */
+
+	setpgid (0, 0);
+}
+
+static const char *
+fr_process_get_charset (FrProcess *process)
+{
+	const char *charset = NULL;
+
+	if (process->priv->current_charset >= 0)
+		charset = try_charsets[process->priv->current_charset];
+	else if (g_get_charset (&charset))
+		charset = NULL;
+
+	return charset;
+}
+
+static void
+start_current_command (FrProcess *process)
+{
+	FrCommandInfo  *info;
+	GList          *scan;
+	char          **argv;
+	int             out_fd, err_fd;
+	int             i = 0;
+	GString        *commandline = g_string_new ("");
+	gboolean        fixname = FALSE;
+
+	debug (DEBUG_INFO, "%d/%d) ", process->priv->current_command, process->priv->n_comm);
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_command);
+
+	argv = g_new (char *, g_list_length (info->args) + 1);
+
+	for (scan = info->args; scan; scan = scan->next) {
+		argv[i++] = scan->data;
+
+		if (g_str_has_prefix (commandline->str, "mv")) {
+
+			if ((i == 3) && (!g_file_test (argv[2], G_FILE_TEST_EXISTS)) && (!fixname)) {
+				char rarfile[strlen (argv[2]) + 7];
+
+				g_strlcpy (rarfile, argv[2], sizeof (rarfile));
+				rarfile[strlen (rarfile) - 3] = 0;
+				g_strlcat (rarfile, "part1.rar", sizeof (rarfile));
+
+				if (g_str_has_suffix (argv[2], ".7z")) {
+					g_string_append (commandline, " ");
+
+					gchar *tempstr = g_shell_quote (argv[2]);
+					g_string_append (commandline, tempstr);
+					g_free (tempstr);
+
+					g_string_append (commandline, ".*");
+					fixname = TRUE;
+				}
+				else if (g_str_has_suffix (argv[2], ".rar")) {
+					rarfile[strlen(rarfile) - 5] = 0;
+					g_string_append (commandline, " ");
+
+					gchar *tempstr = g_shell_quote (rarfile);
+					g_string_append (commandline, tempstr);
+					g_free (tempstr);
+
+					g_string_append (commandline, "*.rar");
+					fixname = TRUE;
+				}
+			}
+			else if ((i == 4) && (fixname)) {
+				g_string_append (commandline, " \"$(dirname ");
+
+				gchar *tempstr = g_shell_quote (argv[3]);
+				g_string_append (commandline, tempstr);
+				g_free (tempstr);
+
+				g_string_append (commandline, ")\"");
+			}
+			else {
+				g_string_append (commandline, " ");
+				g_string_append (commandline, argv[(i - 1)]);
+			}
+		}
+		else if (g_str_has_prefix (argv[0], "mv")) {
+			g_string_append (commandline, "mv");
+		}
+	}
+
+	argv[i] = NULL;
+
+#ifdef MATE_ENABLE_DEBUG
+	{
+		int j;
+
+		if (process->priv->use_standard_locale) {
+			g_print ("\tLC_MESSAGES=C\n");
+			g_print ("\tLC_TIME=C\n");
+			g_print ("\tLC_NUMERIC=C\n");
+		}
+
+		if (info->dir != NULL)
+			g_print ("\tcd %s\n", info->dir);
+
+		g_print ("\t");
+		for (j = 0; j < i; j++)
+			g_print ("%s ", argv[j]);
+		g_print ("\n");
+	}
+#endif
+
+	if ((fixname) && (system (commandline->str) != 0))
+		g_warning ("The files could not be move: %s\n", commandline->str);
+
+	if (info->begin_func != NULL)
+		(*info->begin_func) (info->begin_data);
+
+	if (! g_spawn_async_with_pipes (info->dir,
+					argv,
+					NULL,
+					(G_SPAWN_LEAVE_DESCRIPTORS_OPEN
+					 | G_SPAWN_SEARCH_PATH
+					 | G_SPAWN_DO_NOT_REAP_CHILD),
+					child_setup,
+					process,
+					&process->priv->command_pid,
+					NULL,
+					&out_fd,
+					&err_fd,
+					&process->error.gerror))
+	{
+		process->error.type = FR_PROC_ERROR_SPAWN;
+		g_signal_emit (G_OBJECT (process),
+			       fr_process_signals[DONE],
+			       0,
+			       &process->error);
+		g_string_free (commandline, TRUE);
+		g_free (argv);
+		return;
+	}
+
+	g_string_free (commandline, TRUE);
+	g_free (argv);
+
+	fr_channel_data_set_fd (&process->out, out_fd, fr_process_get_charset (process));
+	fr_channel_data_set_fd (&process->err, err_fd, fr_process_get_charset (process));
+
+	process->priv->check_timeout = g_timeout_add (REFRESH_RATE,
+					              check_child,
+					              process);
+}
+
+static gboolean
+command_is_sticky (FrProcess *process,
+		   int        i)
+{
+	FrCommandInfo *info;<--- Variable 'info' can be declared as pointer to const
+
+	info = g_ptr_array_index (process->priv->comm, i);
+	return info->sticky;
+}
+
+static void
+allow_sticky_processes_only (FrProcess *process,
+			     gboolean   emit_signal)
+{
+	if (! process->priv->sticky_only) {
+		/* Remember the first error. */
+		process->priv->error_command = process->priv->current_command;
+		process->priv->first_error.type = process->error.type;
+		process->priv->first_error.status = process->error.status;
+		g_clear_error (&process->priv->first_error.gerror);
+		if (process->error.gerror != NULL)
+			process->priv->first_error.gerror = g_error_copy (process->error.gerror);
+	}
+
+	process->priv->sticky_only = TRUE;
+	if (emit_signal)
+		g_signal_emit (G_OBJECT (process),
+			       fr_process_signals[STICKY_ONLY],
+			       0);
+}
+
+static void
+fr_process_set_error (FrProcess       *process,
+		      FrProcErrorType  type,
+		      int              status,
+		      GError          *gerror)
+{
+	process->error.type = type;
+	process->error.status = status;
+	if (gerror != process->error.gerror) {
+		g_clear_error (&process->error.gerror);
+		if (gerror != NULL)
+			process->error.gerror = g_error_copy (gerror);
+	}
+}
+
+static gint
+check_child (gpointer data)
+{
+	FrProcess      *process = data;
+	FrCommandInfo  *info;
+	pid_t           pid;
+	int             status;
+	gboolean        continue_process;
+	gboolean        channel_error = FALSE;
+
+	info = g_ptr_array_index (process->priv->comm, process->priv->current_command);
+
+	/* Remove check. */
+
+	g_source_remove (process->priv->check_timeout);
+	process->priv->check_timeout = 0;
+
+	if (fr_channel_data_read (&process->out) == G_IO_STATUS_ERROR) {
+		fr_process_set_error (process, FR_PROC_ERROR_IO_CHANNEL, 0, process->out.error);
+		channel_error = TRUE;
+	}
+	else if (fr_channel_data_read (&process->err) == G_IO_STATUS_ERROR) {
+		fr_process_set_error (process, FR_PROC_ERROR_IO_CHANNEL, 0, process->err.error);
+		channel_error = TRUE;
+	}
+	else {
+		pid = waitpid (process->priv->command_pid, &status, WNOHANG);
+		if (pid != process->priv->command_pid) {
+			/* Add check again. */
+			process->priv->check_timeout = g_timeout_add (REFRESH_RATE,
+							              check_child,
+							              process);
+			return FALSE;
+		}
+	}
+
+	if (info->ignore_error) {
+		process->error.type = FR_PROC_ERROR_NONE;
+		debug (DEBUG_INFO, "[ignore error]\n");
+	}
+	else if (! channel_error && (process->error.type != FR_PROC_ERROR_STOPPED)) {
+		if (WIFEXITED (status)) {
+			if (WEXITSTATUS (status) == 0)
+				process->error.type = FR_PROC_ERROR_NONE;
+			else if (WEXITSTATUS (status) == 255)
+				process->error.type = FR_PROC_ERROR_COMMAND_NOT_FOUND;
+			else {
+				process->error.type = FR_PROC_ERROR_COMMAND_ERROR;
+				process->error.status = WEXITSTATUS (status);
+			}
+		}
+		else {
+			process->error.type = FR_PROC_ERROR_EXITED_ABNORMALLY;
+			process->error.status = 255;
+		}
+	}
+
+	process->priv->command_pid = 0;
+
+	if (fr_channel_data_flush (&process->out) == G_IO_STATUS_ERROR) {
+		fr_process_set_error (process, FR_PROC_ERROR_IO_CHANNEL, 0, process->out.error);
+		channel_error = TRUE;
+	}
+	else if (fr_channel_data_flush (&process->err) == G_IO_STATUS_ERROR) {
+		fr_process_set_error (process, FR_PROC_ERROR_IO_CHANNEL, 0, process->err.error);
+		channel_error = TRUE;
+	}
+
+	if (info->end_func != NULL)
+		(*info->end_func) (info->end_data);
+
+	/**/
+
+	if (channel_error
+	    && (process->error.type == FR_PROC_ERROR_IO_CHANNEL)
+	    && g_error_matches (process->error.gerror, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
+	{
+		if (process->priv->current_charset < n_charsets - 1) {
+			/* try with another charset */
+			process->priv->current_charset++;
+			process->priv->running = FALSE;
+			process->restart = TRUE;
+			fr_process_start (process);
+			return FALSE;
+		}
+		/*fr_process_set_error (process, FR_PROC_ERROR_NONE, 0, NULL);*/
+		fr_process_set_error (process, FR_PROC_ERROR_BAD_CHARSET, 0, process->error.gerror);
+	}
+
+	/* Check whether to continue or stop the process */
+
+	continue_process = TRUE;
+	if (info->continue_func != NULL)
+		continue_process = (*info->continue_func) (info->continue_data);
+
+	/* Execute next command. */
+	if (continue_process) {
+		if (process->error.type != FR_PROC_ERROR_NONE) {
+			allow_sticky_processes_only (process, TRUE);
+#ifdef MATE_ENABLE_DEBUG
+			{
+				GList *scan;
+
+				g_print ("** ERROR **\n");
+				for (scan = process->err.raw; scan; scan = scan->next)
+					g_print ("%s\n", (char *)scan->data);
+			}
+#endif
+		}
+
+		if (process->priv->sticky_only) {
+			do {
+				process->priv->current_command++;
+			} while ((process->priv->current_command <= process->priv->n_comm)
+				 && ! command_is_sticky (process, process->priv->current_command));
+		}
+		else
+			process->priv->current_command++;
+
+		if (process->priv->current_command <= process->priv->n_comm) {
+			start_current_command (process);
+			return FALSE;
+		}
+	}
+
+	/* Done */
+
+	process->priv->current_command = -1;
+	process->priv->use_standard_locale = FALSE;
+
+	if (process->out.raw != NULL)
+		process->out.raw = g_list_reverse (process->out.raw);
+	if (process->err.raw != NULL)
+		process->err.raw = g_list_reverse (process->err.raw);
+
+	process->priv->running = FALSE;
+	process->priv->stopping = FALSE;
+
+	if (process->priv->sticky_only) {
+		/* Restore the first error. */
+		fr_process_set_error (process,
+				      process->priv->first_error.type,
+				      process->priv->first_error.status,
+				      process->priv->first_error.gerror);
+	}
+
+	g_signal_emit (G_OBJECT (process),
+		       fr_process_signals[DONE],
+		       0,
+		       &process->error);
+
+	return FALSE;
+}
+
+void
+fr_process_use_standard_locale (FrProcess *process,
+				gboolean   use_stand_locale)
+{
+	g_return_if_fail (process != NULL);
+	process->priv->use_standard_locale = use_stand_locale;
+}
+
+void
+fr_process_start (FrProcess *process)
+{
+	g_return_if_fail (process != NULL);
+
+	if (process->priv->running)
+		return;
+
+	fr_channel_data_reset (&process->out);
+	fr_channel_data_reset (&process->err);
+
+	process->priv->sticky_only = FALSE;
+	process->priv->current_command = 0;
+	fr_process_set_error (process, FR_PROC_ERROR_NONE, 0, NULL);
+
+	if (! process->restart) {
+		process->priv->current_charset = -1;
+		g_signal_emit (G_OBJECT (process),
+			       fr_process_signals[START],
+			       0);
+	}
+
+	process->priv->stopping = FALSE;
+
+	if (process->priv->n_comm == -1) {
+		process->priv->running = FALSE;
+		g_signal_emit (G_OBJECT (process),
+			       fr_process_signals[DONE],
+			       0,
+			       &process->error);
+	}
+	else {
+		process->priv->running = TRUE;
+		start_current_command (process);
+	}
+}
+static int
+fr_close_suspend_process(FrProcess *process)
+{
+    int ret = -1;
+    g_return_val_if_fail(process != NULL, ret);
+
+    if (process->priv->suspend)
+    {
+        if (process->priv->command_pid > 0)
+        {
+            ret = killpg (process->priv->command_pid,SIGTERM);<--- ret is assigned
+            ret = killpg (process->priv->command_pid,SIGCONT);<--- ret is overwritten
+        }
+        if(ret == 0)
+            process->priv->suspend = FALSE;
+    }
+
+    return ret;
+}
+static int
+fr_switch_process_state (FrProcess *process)
+{
+    int ret = -1;
+    g_return_val_if_fail(process != NULL, ret);
+
+    if (process->priv->stopping)
+        return ret;
+
+    if (process->priv->suspend)
+    {
+
+        if (process->priv->command_pid > 0)
+            ret = killpg (process->priv->command_pid,SIGCONT);
+        if(ret == 0)
+            process->priv->suspend = FALSE;
+    }
+    else
+    {
+        if (process->priv->command_pid > 0)
+            ret = killpg (process->priv->command_pid,SIGSTOP);
+        if(ret == 0)
+            process->priv->suspend = TRUE;
+    }
+
+    return ret;
+}
+static void
+fr_process_stop_priv (FrProcess *process,
+		      gboolean   emit_signal)
+{
+	g_return_if_fail (process != NULL);
+
+	if (! process->priv->running)
+		return;
+
+	if (process->priv->stopping)
+		return;
+
+	process->priv->stopping = TRUE;
+	process->error.type = FR_PROC_ERROR_STOPPED;
+
+	if (command_is_sticky (process, process->priv->current_command))
+		allow_sticky_processes_only (process, emit_signal);
+
+	else if (process->term_on_stop && (process->priv->command_pid > 0))
+		killpg (process->priv->command_pid, SIGTERM);
+
+	else {
+		if (process->priv->check_timeout != 0) {
+			g_source_remove (process->priv->check_timeout);
+			process->priv->check_timeout = 0;
+		}
+
+		process->priv->command_pid = 0;
+		fr_channel_data_close_source (&process->out);
+		fr_channel_data_close_source (&process->err);
+
+		process->priv->running = FALSE;
+
+		if (emit_signal)
+			g_signal_emit (G_OBJECT (process),
+				       fr_process_signals[DONE],
+				       0,
+				       &process->error);
+	}
+}
+
+void
+fr_process_stop (FrProcess *process)
+{
+	fr_process_stop_priv (process, TRUE);
+}
+int start_switch_state (FrProcess *process)
+{
+	return fr_switch_process_state (process);
+}
+void start_close_suspend_process(FrProcess *process)
+{
+    fr_close_suspend_process(process);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/index.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/index.html new file mode 100644 index 0000000..2a8cb7b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/index.html @@ -0,0 +1,908 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
checkersReportinformationActive checkers: There was critical errors (use --checkers-report=<filename> to see details)
caja/caja-engrampa.c
24missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <libcaja-extension/caja-extension-types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <libcaja-extension/caja-file-info.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <libcaja-extension/caja-menu-provider.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
caja/caja-engrampa.h
27missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
caja/engrampa-module.c
24missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <libcaja-extension/caja-extension-types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <libcaja-extension/caja-column-provider.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-submodules/libegg/eggdesktopfile.c
25missingIncludeinformationInclude file: "config.h" not found.
30missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
334constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
348constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
362constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
383constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
497variableScope398styleThe scope of the variable 'try_exec' can be reduced.
497variableScope398styleThe scope of the variable 'found_program' can be reduced.
498variableScope398styleThe scope of the variable 'only_show_in' can be reduced.
498variableScope398styleThe scope of the variable 'not_show_in' can be reduced.
500variableScope398styleThe scope of the variable 'i' can be reduced.
575constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
594constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
610constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
622variableScope398styleThe scope of the variable 'p' can be reduced.
649constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
657constVariablePointer398styleVariable 'doc' can be declared as pointer to const
mate-submodules/libegg/eggdesktopfile.h
23missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-submodules/libegg/eggsmclient-private.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-submodules/libegg/eggsmclient-xsmp.c
24missingIncludeinformationInclude file: "config.h" not found.
31missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <X11/SM/SMlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
182unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
1298missingIncludeSysteminformationInclude file: <X11/ICE/ICElib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1299missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-submodules/libegg/eggsmclient.c
20missingIncludeinformationInclude file: "config.h" not found.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
48unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-submodules/libegg/eggsmclient.h
23missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-submodules/libegg/eggtreemultidnd.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46unusedStructMember563stylestruct member '_TreeViewDragInfo::source_target_list' is never used.
49unusedStructMember563stylestruct member '_TreeViewDragInfo::dest_target_list' is never used.
187constVariablePointer398styleVariable 'priv_data' can be declared as pointer to const
254constVariablePointer398styleVariable 'di' can be declared as pointer to const
mate-submodules/libegg/eggtreemultidnd.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/actions.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
196unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE is a macro then please configure it.
src/actions.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-add-files.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-add-files.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-add-folder.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-add-folder.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-ask-password.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-batch-add.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-delete.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-extract.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-new.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-new.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-open-with.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-open-with.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-package-installer.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-password.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-prop.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-update.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/dlg-update.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/egg-macros.h
12missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/eggfileformatchooser.c
22missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1083uninitStructMember457errorUninitialized struct member: search.format
src/eggfileformatchooser.h
22missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/eggtreemultidnd.c
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/eggtreemultidnd.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/file-data.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
113constParameterPointer398styleParameter 'fdata' can be declared as pointer to const
136constVariablePointer398styleVariable 'data_a' can be declared as pointer to const
137constVariablePointer398styleVariable 'data_b' can be declared as pointer to const
157constVariablePointer398styleVariable 'fd' can be declared as pointer to const
src/file-data.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/file-utils.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <pwd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <strings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <sys/param.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <sys/time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
174varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
513variableScope398styleThe scope of the variable 'tar_exts' can be reduced.
672varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
976constVariablePointer398styleVariable 'value' can be declared as pointer to const
src/file-utils.h
26missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-archive.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/param.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46missingIncludeSysteminformationInclude file: <magic.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1329constParameterPointer398styleParameter 'path' can be declared as pointer to const
1356constVariablePointer398styleVariable 'fdata' can be declared as pointer to const
2174constParameterPointer398styleParameter 'list' can be declared as pointer to const
2188constVariablePointer398styleVariable 'path' can be declared as pointer to const
2325constVariablePointer398styleVariable 'fullpath' can be declared as pointer to const
2410constVariablePointer398styleVariable 'folder_in_list' can be declared as pointer to const
2812constVariablePointer398styleVariable 'name_end' can be declared as pointer to const
2907constVariablePointer398styleVariable 'filename' can be declared as pointer to const
2920constVariablePointer398styleVariable 'dirname' can be declared as pointer to const
2925constVariablePointer398styleVariable 'filename' can be declared as pointer to const
src/fr-archive.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-7z.c
23missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
460constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_line__extract' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
622constParameterCallback398styleParameter 'comm' can be declared as pointer to const. However it seems that 'fr_command_7z_get_capabilities' is a callback function, if 'comm' is declared with const you might also need to cast function pointer(s).
src/fr-command-7z.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-ace.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-ace.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-alz.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
80constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
105knownConditionTrueFalse570styleCondition '!alz_comm->list_started' is always false
222constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_extract_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
src/fr-command-alz.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-ar.c
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
64constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
src/fr-command-ar.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-arj.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-arj.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-cfile.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45constParameterPointer398styleParameter 'comm' can be declared as pointer to const
96constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'list__process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
src/fr-command-cfile.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-cpio.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
47constParameterPointer398styleParameter 'month' can be declared as pointer to const
48constParameterPointer398styleParameter 'mday' can be declared as pointer to const
72constVariablePointer398styleVariable 'now_tm' can be declared as pointer to const
88constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'list__process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
96unreadVariable563styleVariable 'ofs' is assigned a value that is never used.
src/fr-command-cpio.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-dpkg.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
58constParameterPointer398styleParameter 'line' can be declared as pointer to const
src/fr-command-dpkg.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-iso.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45constParameterPointer398styleParameter 'month' can be declared as pointer to const
46constParameterPointer398styleParameter 'mday' can be declared as pointer to const
47constParameterPointer398styleParameter 'year' can be declared as pointer to const
72constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'list__process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
166constVariablePointer398styleVariable 'path' can be declared as pointer to const
src/fr-command-iso.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-jar.c
23missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
62varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
94varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
100varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
src/fr-command-jar.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-lha.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46constParameterPointer398styleParameter 'month' can be declared as pointer to const
47constParameterPointer398styleParameter 'mday' can be declared as pointer to const
74constVariablePointer398styleVariable 'tm_now' can be declared as pointer to const
143constParameterPointer398styleParameter 'line' can be declared as pointer to const
src/fr-command-lha.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-lrzip.c
8missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
10missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
12missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
13missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
98constParameterCallback398styleParameter 'file_list' can be declared as pointer to const. However it seems that 'fr_command_lrzip_add' is a callback function, if 'file_list' is declared with const you might also need to cast function pointer(s).
src/fr-command-lrzip.h
11missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-nomarch.c
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-nomarch.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-rar.c
25missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
192constParameterPointer398styleParameter 'rar_comm' can be declared as pointer to const
251variableScope398styleThe scope of the variable 'size_field' can be reduced.
251variableScope398styleThe scope of the variable 'ratio_field' can be reduced.
251variableScope398styleThe scope of the variable 'date_field' can be reduced.
251variableScope398styleThe scope of the variable 'time_field' can be reduced.
251variableScope398styleThe scope of the variable 'attr_field' can be reduced.
695constParameterCallback398styleParameter 'comm' can be declared as pointer to const. However it seems that 'fr_command_rar_get_capabilities' is a callback function, if 'comm' is declared with const you might also need to cast function pointer(s).
src/fr-command-rar.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-rpm.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
47constParameterPointer398styleParameter 'month' can be declared as pointer to const
48constParameterPointer398styleParameter 'mday' can be declared as pointer to const
80constVariablePointer398styleVariable 'now_tm' can be declared as pointer to const
98constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'list__process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
106unreadVariable563styleVariable 'ofs' is assigned a value that is never used.
src/fr-command-rpm.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-tar.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
250constParameterPointer398styleParameter 'comm' can be declared as pointer to const
256constParameterPointer398styleParameter 'line' can be declared as pointer to const
295constVariablePointer398styleVariable 'c_tar' can be declared as pointer to const
364constVariablePointer398styleVariable 'c_tar' can be declared as pointer to const
723constVariablePointer398styleVariable 'comm' can be declared as pointer to const
949constVariablePointer398styleVariable 'comm_tar' can be declared as pointer to const
src/fr-command-tar.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-unarchiver.c
23missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <json-glib/json-glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
147constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_line__extract' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
src/fr-command-unarchiver.h
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-unstuff.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-unstuff.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-zip.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
98constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'list__process_line' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
206constParameterCallback398styleParameter 'line' can be declared as pointer to const. However it seems that 'process_line__common' is a callback function, if 'line' is declared with const you might also need to cast function pointer(s).
src/fr-command-zip.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command-zoo.c
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46constParameterPointer398styleParameter 'mday_s' can be declared as pointer to const
48constParameterPointer398styleParameter 'year_s' can be declared as pointer to const
109constParameterPointer398styleParameter 'line' can be declared as pointer to const
149constParameterPointer398styleParameter 'line' can be declared as pointer to const
src/fr-command-zoo.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-command.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
733constParameterPointer398styleParameter 'comm' can be declared as pointer to const
src/fr-command.h
26missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-enum-types.h
7missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-error.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-init.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
603knownConditionTrueFalse571styleCondition 'cap->current_capabilities&FR_COMMAND_CAN_WRITE' is always true
src/fr-list-model.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-list-model.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-marshal.c
3missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-marshal.h
5missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-proc-error.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-process.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <signal.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <sys/wait.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
589constVariablePointer398styleVariable 'process' can be declared as pointer to const
757constVariablePointer398styleVariable 'info' can be declared as pointer to const
1008redundantAssignment563styleVariable 'ret' is reassigned a value before the old one has been used.
src/fr-process.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/fr-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
src/fr-window.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6587unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_FILE_ATTRIBUTE_STANDARD_NAME is a macro then please configure it.
src/fr-window.h
26missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/gio-utils.c
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
112constParameterPointer398styleParameter 'filter' can be declared as pointer to const
219constVariablePointer398styleVariable 'sub_directory' can be declared as pointer to const
src/gio-utils.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/glib-utils.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gprintf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
393knownConditionTrueFalse571styleCondition 'scan!=NULL' is always true
src/glib-utils.h
26missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/gtk-utils.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/gtk-utils.h
26missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If _gtk_error_dialog_new is a macro then please configure it.
src/java-utils.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
282constVariablePointer398styleVariable 'class' can be declared as pointer to const
src/main.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <signal.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeinformationInclude file: "eggsmclient.h" not found.
src/open-file.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/open-file.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/preferences.c
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/preferences.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/rar-utils.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/server.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/test-server.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/typedefs.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/stats.html b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/stats.html new file mode 100644 index 0000000..ac4231b --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/stats.html @@ -0,0 +1,200 @@ + + + + + + Cppcheck - HTML report - engrampa + + + + + +
+ + + +
+

Top 10 files for error severity, total findings: 6
+   1  src/gtk-utils.h
+   1  src/fr-window.c
+   1  src/eggfileformatchooser.c
+   1  src/actions.c
+   1  mate-submodules/libegg/eggsmclient.c
+   1  mate-submodules/libegg/eggsmclient-xsmp.c
+

+

Top 10 files for portability severity, total findings: 5
+   3  src/fr-command-jar.c
+   2  src/file-utils.c
+

+

Top 10 files for style severity, total findings: 95
+   15  mate-submodules/libegg/eggdesktopfile.c
+   10  src/fr-archive.c
+   7   src/fr-command-rar.c
+   6   src/fr-command-tar.c
+   5   src/fr-command-rpm.c
+   5   src/fr-command-iso.c
+   5   src/fr-command-cpio.c
+   4   src/fr-command-zoo.c
+   4   src/fr-command-lha.c
+   4   src/file-data.c
+

+

Top 10 files for information severity, total findings: 372
+   16  src/file-utils.c
+   12  mate-submodules/libegg/eggsmclient-xsmp.c
+   11  src/fr-process.c
+   10  src/fr-archive.c
+   9   src/main.c
+   9   src/fr-window.c
+   9   src/fr-command-tar.c
+   8   src/fr-command-cfile.c
+   7   src/java-utils.c
+   7   src/glib-utils.c
+

+ +
+ +
+ + diff --git a/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/style.css b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/style.css new file mode 100644 index 0000000..3897bfa --- /dev/null +++ b/2024-02-21-212011-7272-cppcheck@1f1fb3c13f8f_master/style.css @@ -0,0 +1,177 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + height: 100%; + margin: 0; +} + +#wrapper { + position: fixed; + height: 100vh; + width: 100vw; + display: grid; + grid-template-rows: fit-content(8rem) auto fit-content(8rem); + grid-template-columns: fit-content(25%) 1fr; + grid-template-areas: + "header header" + "menu content" + "footer footer"; +} + +h1 { + margin: 0 0 8px -2px; + font-size: 175%; +} + +.header { + padding: 0 0 5px 15px; + grid-area: header; + border-bottom: thin solid #aaa; +} + +.footer { + grid-area: footer; + border-top: thin solid #aaa; + font-size: 85%; + +} + +.footer > p { + margin: 4px; +} + +#menu, +#menu_index { + grid-area: menu; + text-align: left; + overflow: auto; + padding: 0 23px 15px 15px; + border-right: thin solid #aaa; + min-width: 200px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; +} + +#content, +#content_index { + grid-area: content; + padding: 0px 5px 15px 15px; + overflow: auto; +} + +label { + white-space: nowrap; +} + +label.checkBtn.disabled { + color: #606060; + background: #e0e0e0; + font-style: italic; +} + +label.checkBtn, input[type="text"] { + border: 1px solid grey; + border-radius: 4px; + box-shadow: 1px 1px inset; + padding: 1px 5px; +} + +label.checkBtn { + white-space: nowrap; + background: #ccddff; +} + +label.unchecked { + background: #eff8ff; + box-shadow: 1px 1px 1px; +} + +label.checkBtn:hover, label.unchecked:hover{ + box-shadow: 0 0 2px; +} + +label.disabled:hover { + box-shadow: 1px 1px inset; +} + +label.checkBtn > input { + display:none; +} + +.summaryTable { + width: 100%; +} + +table.summaryTable td { padding: 0 5px 0 5px; } + +.statHeader, .severityHeader { + font-weight: bold; +} + +.warning { + background-color: #ffffa7; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.id-filtered, .severity-filtered, .file-filtered, .tool-filtered, .text-filtered { + visibility: collapse; +} -- cgit v1.2.1