From 761b4c87e8b0b426f93f635f5ec639102b41b0c1 Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Wed, 21 Feb 2024 17:14:24 +0000 Subject: Deploy mate-desktop/caja-extensions to github.com/mate-desktop/caja-extensions.git:gh-pages --- .../0.html | 799 ++++++ .../1.html | 863 ++++++ .../10.html | 659 +++++ .../11.html | 1361 ++++++++++ .../12.html | 1215 +++++++++ .../13.html | 2809 ++++++++++++++++++++ .../14.html | 611 +++++ .../2.html | 1015 +++++++ .../3.html | 1189 +++++++++ .../4.html | 1007 +++++++ .../5.html | 1009 +++++++ .../6.html | 1593 +++++++++++ .../7.html | 565 ++++ .../8.html | 1961 ++++++++++++++ .../9.html | 863 ++++++ .../index.html | 288 ++ .../stats.html | 180 ++ .../style.css | 177 ++ 18 files changed, 18164 insertions(+) create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/0.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/1.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/10.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/11.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/12.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/13.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/14.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/2.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/3.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/4.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/5.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/6.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/7.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/8.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/9.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/index.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/stats.html create mode 100644 2023-08-30-133307-1532-cppcheck@195094cfaa07_master/style.css (limited to '2023-08-30-133307-1532-cppcheck@195094cfaa07_master') diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/0.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/0.html new file mode 100644 index 0000000..276e28d --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/0.html @@ -0,0 +1,799 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/* bacon-video-widget-properties.c
+
+   Copyright (C) 2002 Bastien Nocera
+
+   The Gnome 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.
+
+   The Gnome 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 the Gnome 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.
+
+   Author: Bastien Nocera <hadess@hadess.net>
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include <math.h>
+
+#include "bacon-video-widget-properties.h"
+
+static void bacon_video_widget_properties_dispose (GObject *object);
+
+struct BaconVideoWidgetPropertiesPrivate {
+	GtkBuilder *xml;
+	int time;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (BaconVideoWidgetProperties, bacon_video_widget_properties, GTK_TYPE_BOX)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+bacon_video_widget_properties_class_init (BaconVideoWidgetPropertiesClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	object_class->dispose = bacon_video_widget_properties_dispose;
+}
+
+static void
+bacon_video_widget_properties_init (BaconVideoWidgetProperties *props)
+{
+	props->priv = bacon_video_widget_properties_get_instance_private (props);
+
+	gtk_orientable_set_orientation (GTK_ORIENTABLE (props), GTK_ORIENTATION_VERTICAL);
+}
+
+static void
+bacon_video_widget_properties_dispose (GObject *object)
+{
+	BaconVideoWidgetProperties *props;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (object));
+
+	props = BACON_VIDEO_WIDGET_PROPERTIES (object);
+
+	g_clear_object (&props->priv->xml);
+
+	G_OBJECT_CLASS (bacon_video_widget_properties_parent_class)->dispose (object);
+}
+
+void
+bacon_video_widget_properties_set_label (BaconVideoWidgetProperties *props,
+					 const char                 *name,
+					 const char                 *text)
+{
+	GtkLabel *item;
+
+	g_return_if_fail (props != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+	g_return_if_fail (name != NULL);
+
+	item = GTK_LABEL (gtk_builder_get_object (props->priv->xml, name));
+	g_return_if_fail (item != NULL);
+	gtk_label_set_text (item, text);
+}
+
+void
+bacon_video_widget_properties_reset (BaconVideoWidgetProperties *props)
+{
+	GtkWidget *item;
+
+	g_return_if_fail (props != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "video_vbox"));
+	gtk_widget_show (item);
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "video"));
+	gtk_widget_set_sensitive (item, FALSE);
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "audio"));
+	gtk_widget_set_sensitive (item, FALSE);
+
+	/* Title */
+	bacon_video_widget_properties_set_label (props, "title", C_("Title", "Unknown"));
+	/* Artist */
+	bacon_video_widget_properties_set_label (props, "artist", C_("Artist", "Unknown"));
+	/* Album */
+	bacon_video_widget_properties_set_label (props, "album", C_("Album", "Unknown"));
+	/* Year */
+	bacon_video_widget_properties_set_label (props, "year", C_("Year", "Unknown"));
+	/* Duration */
+	bacon_video_widget_properties_set_duration (props, 0);
+	/* Comment */
+	bacon_video_widget_properties_set_label (props, "comment", "");
+	/* Container */
+	bacon_video_widget_properties_set_label (props, "container", C_("Media container", "Unknown"));
+
+	/* Dimensions */
+	bacon_video_widget_properties_set_label (props, "dimensions", C_("Dimensions", "N/A"));
+	/* Video Codec */
+	bacon_video_widget_properties_set_label (props, "vcodec", C_("Video codec", "N/A"));
+	/* Video Bitrate */
+	bacon_video_widget_properties_set_label (props, "video_bitrate",
+			C_("Video bit rate", "N/A"));
+	/* Framerate */
+	bacon_video_widget_properties_set_label (props, "framerate",
+			C_("Frame rate", "N/A"));
+
+	/* Audio Bitrate */
+	bacon_video_widget_properties_set_label (props, "audio_bitrate",
+			C_("Audio bit rate", "N/A"));
+	/* Audio Codec */
+	bacon_video_widget_properties_set_label (props, "acodec", C_("Audio codec", "N/A"));
+	/* Sample rate */
+	bacon_video_widget_properties_set_label (props, "samplerate", _("0 Hz"));
+	/* Channels */
+	bacon_video_widget_properties_set_label (props, "channels", _("0 Channels"));
+}
+
+static char *
+time_to_string_text (gint64 msecs)
+{
+	char *secs, *mins, *hours, *string;
+	int sec, min, hour, _time;
+
+	_time = (int) (msecs / 1000);
+	sec = _time % 60;
+	_time = _time - sec;
+	min = (_time % (60*60)) / 60;
+	_time = _time - (min * 60);
+	hour = _time / (60*60);
+
+	hours = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%d hour", "%d hours", hour), hour);
+
+	mins = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%d minute",
+					  "%d minutes", min), min);
+
+	secs = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%d second",
+					  "%d seconds", sec), sec);
+
+	if (hour > 0)
+	{
+		/* 5 hours 2 minutes 12 seconds */
+		string = g_strdup_printf (C_("time", "%s %s %s"), hours, mins, secs);
+	} else if (min > 0) {
+		/* 2 minutes 12 seconds */
+		string = g_strdup_printf (C_("time", "%s %s"), mins, secs);
+	} else if (sec > 0) {
+		/* 10 seconds */
+		string = g_strdup (secs);
+	} else {
+		/* 0 seconds */
+		string = g_strdup (_("0 seconds"));
+	}
+
+	g_free (hours);
+	g_free (mins);
+	g_free (secs);
+
+	return string;
+}
+
+void
+bacon_video_widget_properties_set_duration (BaconVideoWidgetProperties *props,
+					    int _time)
+{
+	char *string;
+
+	g_return_if_fail (props != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+
+	if (_time == props->priv->time)
+		return;
+
+	string = time_to_string_text (_time);
+	bacon_video_widget_properties_set_label (props, "duration", string);
+	g_free (string);
+
+	props->priv->time = _time;
+}
+
+void
+bacon_video_widget_properties_set_has_type (BaconVideoWidgetProperties *props,
+					    gboolean                    has_video,
+					    gboolean                    has_audio)
+{
+	GtkWidget *item;
+
+	g_return_if_fail (props != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+
+	/* Video */
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "video"));
+	gtk_widget_set_sensitive (item, has_video);
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "video_vbox"));
+	gtk_widget_set_visible (item, has_video);
+
+	/* Audio */
+	item = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "audio"));
+	gtk_widget_set_sensitive (item, has_audio);
+}
+
+void
+bacon_video_widget_properties_set_framerate (BaconVideoWidgetProperties *props,
+					     float                       framerate)
+{
+	gchar *temp;
+
+	g_return_if_fail (props != NULL);
+	g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+
+	if (framerate > 1.0) {
+		temp = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%0.2f frame per second", "%0.2f frames per second", (int) (ceilf (framerate))), framerate);
+	} else {
+		temp = g_strdup (C_("Frame rate", "N/A"));
+	}
+	bacon_video_widget_properties_set_label (props, "framerate", temp);
+	g_free (temp);
+}
+
+GtkWidget*
+bacon_video_widget_properties_new (void)
+{
+	BaconVideoWidgetProperties *props;
+	GtkBuilder *xml;
+	GtkWidget *vbox;
+	GtkSizeGroup *group;
+	const char *labels[] = { "title_label", "artist_label", "album_label",
+			"year_label", "duration_label", "comment_label", "container_label",
+			"dimensions_label", "vcodec_label", "framerate_label",
+			"vbitrate_label", "abitrate_label", "acodec_label",
+			"samplerate_label", "channels_label" };
+	guint i;
+
+	xml = gtk_builder_new ();
+	gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE);
+	if (gtk_builder_add_from_resource (xml, "/org/mate/caja/extensions/totemproperties/ui/properties.ui", NULL) == 0) {
+		g_object_unref (xml);
+		return NULL;
+	}
+
+	props = BACON_VIDEO_WIDGET_PROPERTIES (g_object_new
+			(BACON_TYPE_VIDEO_WIDGET_PROPERTIES, NULL));
+
+	props->priv->xml = xml;
+	vbox = GTK_WIDGET (gtk_builder_get_object (props->priv->xml, "vbox1"));
+	gtk_box_pack_start (GTK_BOX (props), vbox, FALSE, FALSE, 0);
+
+	bacon_video_widget_properties_reset (props);
+
+	group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+	for (i = 0; i < G_N_ELEMENTS (labels); i++)
+		gtk_size_group_add_widget (group, GTK_WIDGET (gtk_builder_get_object (xml, labels[i])));
+
+	g_object_unref (group);
+
+	gtk_widget_show_all (GTK_WIDGET (props));
+
+	return GTK_WIDGET (props);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/1.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/1.html new file mode 100644 index 0000000..878b81d --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/1.html @@ -0,0 +1,863 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.totemproperties"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1725]; const double alignment; void * const ptr;}  totemproperties_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, 0000, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0010, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0220, 0031, 0335, 0327, 0004, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0003, 0000, 0114, 0000, 
+  0004, 0001, 0000, 0000, 0010, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 0003, 0000, 0000, 0000, 
+  0010, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0020, 0001, 0000, 0000, 0024, 0001, 0000, 0000, 
+  0211, 0027, 0242, 0266, 0000, 0000, 0000, 0000, 0024, 0001, 0000, 0000, 0015, 0000, 0166, 0000, 
+  0050, 0001, 0000, 0000, 0173, 0006, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 
+  0173, 0006, 0000, 0000, 0004, 0000, 0114, 0000, 0200, 0006, 0000, 0000, 0204, 0006, 0000, 0000, 
+  0003, 0225, 0105, 0260, 0006, 0000, 0000, 0000, 0204, 0006, 0000, 0000, 0020, 0000, 0114, 0000, 
+  0224, 0006, 0000, 0000, 0230, 0006, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0230, 0006, 0000, 0000, 0001, 0000, 0114, 0000, 0234, 0006, 0000, 0000, 0240, 0006, 0000, 0000, 
+  0176, 0157, 0252, 0021, 0007, 0000, 0000, 0000, 0240, 0006, 0000, 0000, 0013, 0000, 0114, 0000, 
+  0254, 0006, 0000, 0000, 0260, 0006, 0000, 0000, 0137, 0144, 0153, 0207, 0001, 0000, 0000, 0000, 
+  0260, 0006, 0000, 0000, 0005, 0000, 0114, 0000, 0270, 0006, 0000, 0000, 0274, 0006, 0000, 0000, 
+  0165, 0151, 0057, 0000, 0002, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0160, 0162, 0157, 0160, 0145, 0162, 0164, 0151, 0145, 0163, 0056, 0165, 
+  0151, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0164, 0166, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0115, 0223, 0243, 0066, 0020, 0275, 0357, 0257, 0040, 0134, 0123, 0036, 
+  0033, 0073, 0073, 0331, 0332, 0262, 0275, 0065, 0273, 0251, 0231, 0034, 0122, 0271, 0144, 0066, 
+  0125, 0071, 0271, 0004, 0310, 0266, 0142, 0131, 0042, 0222, 0360, 0307, 0376, 0372, 0025, 0037, 
+  0236, 0061, 0014, 0306, 0006, 0263, 0001, 0114, 0337, 0246, 0260, 0004, 0352, 0326, 0173, 0055, 
+  0272, 0365, 0304, 0214, 0077, 0355, 0326, 0324, 0330, 0140, 0041, 0011, 0147, 0023, 0323, 0272, 
+  0033, 0230, 0006, 0146, 0016, 0167, 0011, 0133, 0114, 0314, 0257, 0317, 0217, 0275, 0017, 0346, 
+  0247, 0351, 0273, 0361, 0117, 0275, 0236, 0361, 0204, 0031, 0026, 0110, 0141, 0327, 0330, 0022, 
+  0265, 0064, 0026, 0024, 0271, 0330, 0030, 0335, 0015, 0007, 0167, 0003, 0243, 0327, 0323, 0215, 
+  0010, 0123, 0130, 0314, 0221, 0203, 0247, 0357, 0014, 0143, 0054, 0360, 0177, 0076, 0021, 0130, 
+  0032, 0224, 0330, 0023, 0163, 0241, 0126, 0077, 0233, 0257, 0017, 0032, 0335, 0131, 0226, 0331, 
+  0017, 0333, 0161, 0373, 0137, 0354, 0050, 0303, 0241, 0110, 0312, 0211, 0371, 0244, 0126, 0237, 
+  0371, 0316, 0064, 0210, 0073, 0061, 0067, 0066, 0337, 0131, 0146, 0320, 0110, 0067, 0363, 0004, 
+  0367, 0260, 0120, 0173, 0203, 0241, 0065, 0236, 0230, 0133, 0342, 0252, 0345, 0054, 0170, 0006, 
+  0226, 0312, 0234, 0216, 0176, 0175, 0077, 0356, 0037, 0232, 0144, 0367, 0330, 0020, 0111, 0154, 
+  0212, 0315, 0351, 0263, 0360, 0361, 0271, 0306, 0016, 0142, 0263, 0071, 0167, 0174, 0151, 0116, 
+  0037, 0021, 0225, 0147, 0333, 0257, 0221, 0130, 0020, 0066, 0263, 0271, 0122, 0174, 0155, 0116, 
+  0255, 0341, 0271, 0016, 0066, 0027, 0056, 0026, 0263, 0320, 0014, 0163, 0172, 0177, 0256, 0071, 
+  0027, 0004, 0063, 0205, 0224, 0166, 0236, 0071, 0325, 0136, 0124, 0304, 0101, 0364, 0134, 0047, 
+  0351, 0041, 0107, 0317, 0243, 0036, 0316, 0207, 0067, 0115, 0235, 0045, 0241, 0156, 0364, 0167, 
+  0356, 0034, 0054, 0302, 0111, 0247, 0263, 0140, 0056, 0314, 0103, 0373, 0202, 0316, 0055, 0343, 
+  0340, 0322, 0116, 0310, 0165, 0304, 0175, 0146, 0353, 0204, 0057, 0262, 0375, 0361, 0007, 0262, 
+  0061, 0215, 0074, 0142, 0157, 0266, 0336, 0354, 0340, 0026, 0032, 0136, 0077, 0356, 0133, 0302, 
+  0067, 0145, 0375, 0223, 0325, 0057, 0032, 0220, 0241, 0004, 0142, 0222, 0042, 0205, 0364, 0203, 
+  0047, 0346, 0036, 0353, 0333, 0104, 0364, 0245, 0227, 0336, 0310, 0227, 0170, 0246, 0121, 0275, 
+  0362, 0275, 0142, 0003, 0337, 0041, 0112, 0026, 0172, 0176, 0006, 0047, 0073, 0040, 0245, 0004, 
+  0261, 0175, 0205, 0145, 0362, 0207, 0343, 0237, 0016, 0054, 0307, 0144, 0261, 0124, 0072, 0156, 
+  0040, 0352, 0207, 0244, 0241, 0156, 0024, 0065, 0216, 0372, 0364, 0263, 0357, 0067, 0356, 0107, 
+  0223, 0230, 0270, 0246, 0161, 0260, 0322, 0100, 0310, 0267, 0000, 0357, 0074, 0304, 0334, 0202, 
+  0176, 0237, 0023, 0112, 0213, 0071, 0312, 0343, 0222, 0104, 0120, 0076, 0341, 0052, 0175, 0065, 
+  0075, 0334, 0161, 0077, 0205, 0325, 0113, 0260, 0373, 0044, 0210, 0233, 0040, 0163, 0223, 0360, 
+  0052, 0370, 0166, 0226, 0117, 0317, 0314, 0247, 0161, 0352, 0257, 0331, 0153, 0307, 0267, 0361, 
+  0366, 0264, 0203, 0316, 0022, 0134, 0021, 0105, 0161, 0046, 0263, 0113, 0173, 0353, 0032, 0217, 
+  0345, 0054, 0067, 0122, 0041, 0241, 0362, 0254, 0057, 0026, 0041, 0236, 0003, 0303, 0077, 0026, 
+  0271, 0327, 0245, 0101, 0242, 0124, 0240, 0070, 0023, 0054, 0062, 0003, 0206, 0124, 0173, 0075, 
+  0027, 0207, 0170, 0101, 0224, 0176, 0206, 0223, 0216, 0030, 0171, 0121, 0343, 0160, 0133, 0307, 
+  0301, 0122, 0317, 0053, 0241, 0044, 0153, 0124, 0341, 0333, 0015, 0015, 0027, 0042, 0103, 0355, 
+  0275, 0203, 0123, 0173, 0163, 0056, 0264, 0143, 0365, 0334, 0140, 0025, 0303, 0350, 0304, 0263, 
+  0363, 0156, 0237, 0025, 0270, 0116, 0007, 0257, 0314, 0031, 0306, 0163, 0065, 0323, 0366, 0041, 
+  0147, 0171, 0316, 0275, 0251, 0236, 0212, 0173, 0227, 0164, 0314, 0210, 0114, 0231, 0321, 0251, 
+  0044, 0001, 0065, 0250, 0211, 0124, 0135, 0144, 0340, 0103, 0150, 0071, 0120, 0260, 0042, 0012, 
+  0106, 0100, 0152, 0061, 0007, 0255, 0332, 0070, 0350, 0372, 0042, 0164, 0156, 0027, 0131, 0370, 
+  0133, 0154, 0073, 0360, 0260, 0042, 0036, 0036, 0300, 0324, 0142, 0046, 0376, 0122, 0033, 0023, 
+  0367, 0030, 0211, 0056, 0262, 0360, 0037, 0155, 0067, 0060, 0260, 0042, 0006, 0006, 0040, 0152, 
+  0061, 0373, 0106, 0365, 0275, 0213, 0122, 0333, 0137, 0167, 0362, 0125, 0064, 0060, 0034, 0370, 
+  0127, 0325, 0233, 0150, 0340, 0315, 0026, 0023, 0160, 0130, 0033, 0001, 0243, 0064, 0372, 0377, 
+  0241, 0136, 0321, 0256, 0161, 0130, 0370, 0312, 0126, 0214, 0157, 0131, 0221, 0236, 0133, 0201, 
+  0112, 0260, 0104, 0142, 0252, 0375, 0204, 0112, 0231, 0211, 0051, 0045, 0236, 0044, 0337, 0164, 
+  0127, 0314, 0334, 0037, 0300, 0315, 0122, 0054, 0241, 0330, 0355, 0331, 0373, 0124, 0321, 0044, 
+  0016, 0267, 0265, 0263, 0305, 0152, 0153, 0351, 0004, 0350, 0322, 0021, 0272, 0044, 0052, 0145, 
+  0355, 0345, 0213, 0125, 0357, 0353, 0035, 0320, 0245, 0053, 0164, 0071, 0172, 0231, 0157, 0057, 
+  0133, 0206, 0265, 0226, 0042, 0156, 0216, 0054, 0267, 0017, 0373, 0243, 0012, 0122, 0173, 0121, 
+  0077, 0252, 0275, 0024, 0336, 0154, 0344, 0017, 0014, 0211, 0035, 0316, 0134, 0011, 0330, 0077, 
+  0306, 0176, 0152, 0037, 0243, 0275, 0370, 0257, 0257, 0000, 0355, 0360, 0365, 0032, 0263, 0116, 
+  0356, 0307, 0176, 0211, 0114, 0207, 0062, 0130, 0105, 0145, 0260, 0030, 0112, 0055, 0056, 0204, 
+  0275, 0257, 0233, 0206, 0220, 0254, 0164, 0144, 0345, 0112, 0206, 0335, 0366, 0056, 0134, 0165, 
+  0062, 0206, 0051, 0104, 0030, 0026, 0335, 0134, 0272, 0142, 0343, 0077, 0336, 0304, 0002, 0324, 
+  0224, 0370, 0177, 0137, 0077, 0232, 0233, 0212, 0343, 0172, 0122, 0360, 0013, 0020, 0333, 0224, 
+  0110, 0130, 0011, 0166, 0132, 0244, 0153, 0267, 0312, 0352, 0332, 0323, 0066, 0276, 0265, 0257, 
+  0260, 0155, 0305, 0354, 0052, 0244, 0325, 0117, 0331, 0223, 0260, 0345, 0342, 0163, 0066, 0033, 
+  0342, 0142, 0016, 0247, 0154, 0222, 0247, 0154, 0042, 0247, 0264, 0350, 0214, 0315, 0337, 0301, 
+  0200, 0341, 0204, 0115, 0167, 0117, 0330, 0204, 0210, 0205, 0363, 0065, 0371, 0365, 0124, 0242, 
+  0363, 0232, 0340, 0030, 0250, 0354, 0244, 0270, 0370, 0305, 0172, 0250, 0052, 0125, 0045, 0057, 
+  0176, 0161, 0051, 0034, 0267, 0051, 0301, 0307, 0215, 0303, 0135, 0354, 0164, 0063, 0107, 0326, 
+  0206, 0003, 0015, 0053, 0242, 0141, 0204, 0043, 0070, 0155, 0123, 0202, 0202, 0163, 0241, 0007, 
+  0023, 0174, 0133, 0241, 0213, 0054, 0174, 0014, 0214, 0067, 0002, 0353, 0201, 0212, 0025, 0121, 
+  0361, 0005, 0117, 0040, 0071, 0056, 0263, 0040, 0332, 0104, 0165, 0225, 0214, 0237, 0211, 0002, 
+  0052, 0126, 0272, 0052, 0206, 0065, 0214, 0030, 0121, 0160, 0004, 0347, 0252, 0174, 0261, 0351, 
+  0012, 0234, 0235, 0061, 0200, 0075, 0314, 0204, 0372, 0046, 0235, 0352, 0203, 0246, 0277, 0154, 
+  0176, 0326, 0154, 0354, 0377, 0331, 0177, 0000, 0344, 0037, 0043, 0077, 0221, 0124, 0203, 0062, 
+  0377, 0212, 0224, 0250, 0351, 0101, 0077, 0034, 0250, 0064, 0364, 0157, 0261, 0002, 0023, 0210, 
+  0160, 0114, 0204, 0164, 0152, 0013, 0272, 0373, 0022, 0053, 0100, 0342, 0035, 0262, 0341, 0174, 
+  0130, 0331, 0036, 0150, 0220, 0223, 0153, 0101, 0062, 0237, 0354, 0270, 0006, 0037, 0004, 0014, 
+  0265, 0012, 0030, 0254, 0037, 0044, 0140, 0100, 0276, 0113, 0100, 0300, 0220, 0022, 0060, 0104, 
+  0116, 0151, 0221, 0200, 0341, 0041, 0030, 0060, 0010, 0030, 0272, 0053, 0140, 0010, 0021, 0013, 
+  0002, 0206, 0134, 0152, 0113, 0264, 0366, 0150, 0147, 0267, 0153, 0376, 0012, 0255, 0207, 0042, 
+  0161, 0225, 0105, 0342, 0127, 0104, 0301, 0206, 0315, 0125, 0204, 0154, 0172, 0162, 0364, 0373, 
+  0267, 0006, 0351, 0242, 0053, 0113, 0160, 0336, 0004, 0104, 0110, 0362, 0113, 0174, 0212, 0002, 
+  0166, 0035, 0141, 0101, 0251, 0152, 0101, 0211, 0022, 0017, 0330, 0165, 0274, 0202, 0216, 0011, 
+  0017, 0102, 0315, 0255, 0155, 0237, 0172, 0201, 0232, 0333, 0325, 0014, 0000, 0135, 0050, 0254, 
+  0105, 0125, 0254, 0105, 0155, 0327, 0205, 0016, 0152, 0246, 0040, 0154, 0375, 0267, 0153, 0351, 
+  0271, 0215, 0255, 0377, 0372, 0120, 0357, 0054, 0021, 0143, 0230, 0166, 0362, 0170, 0320, 0227, 
+  0330, 0166, 0130, 0175, 0252, 0372, 0344, 0114, 0354, 0120, 0070, 0227, 0160, 0005, 0023, 0233, 
+  0236, 0377, 0034, 0130, 0163, 0213, 0305, 0265, 0124, 0064, 0354, 0270, 0226, 0014, 0324, 0003, 
+  0265, 0252, 0007, 0206, 0105, 0324, 0003, 0257, 0166, 0214, 0373, 0107, 0377, 0033, 0366, 0073, 
+  0007, 0021, 0153, 0222, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0157, 0162, 0147, 0057, 0000, 
+  0001, 0000, 0000, 0000, 0164, 0157, 0164, 0145, 0155, 0160, 0162, 0157, 0160, 0145, 0162, 0164, 
+  0151, 0145, 0163, 0057, 0000, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0004, 0000, 0000, 0000, 
+  0143, 0141, 0152, 0141, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { totemproperties_resource_data.data, sizeof (totemproperties_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *totemproperties_get_resource (void);
+GResource *totemproperties_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) { _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) { 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(totempropertiesresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(totempropertiesresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(totempropertiesresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(totempropertiesresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void totempropertiesresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void totempropertiesresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/10.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/10.html new file mode 100644 index 0000000..62ebc0c --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/10.html @@ -0,0 +1,659 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/11.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/11.html new file mode 100644 index 0000000..0f66d09 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/11.html @@ -0,0 +1,1361 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/12.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/12.html new file mode 100644 index 0000000..3d82c2b --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/12.html @@ -0,0 +1,1215 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/13.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/13.html new file mode 100644 index 0000000..d12c464 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/13.html @@ -0,0 +1,2809 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
   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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+    NULL
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+#ifdef ENABLE_NLS
+  bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/14.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/14.html new file mode 100644 index 0000000..87e3e79 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/14.html @@ -0,0 +1,611 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *  Copyright (C) 2014-2021 MATE developers.
+ *
+ *  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.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_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_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+static GType cwe_type = 0;
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+        NULL
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/2.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/2.html new file mode 100644 index 0000000..73116f7 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/2.html @@ -0,0 +1,1015 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ * Copyright (C) 2003  Andrew Sobala <aes@gnome.org>
+ * Copyright (C) 2004  Bastien Nocera <hadess@hadess.net>
+ *
+ * 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
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
+
+#define GST_USE_UNSTABLE_API 1
+#include <gst/tag/tag.h>
+#include <gst/pbutils/pbutils.h>
+
+#include "totem-properties-view.h"
+#include "bacon-video-widget-properties.h"
+
+struct TotemPropertiesViewPriv {
+	GtkWidget *label;
+	GtkWidget *vbox;
+	BaconVideoWidgetProperties *props;
+	GstDiscoverer *disco;
+};
+
+static GObjectClass *parent_class = NULL;
+static void totem_properties_view_finalize (GObject *object);
+
+G_DEFINE_TYPE (TotemPropertiesView, totem_properties_view, GTK_TYPE_GRID)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+void
+totem_properties_view_register_type (GTypeModule *module)
+{
+	totem_properties_view_get_type ();
+}
+
+static void
+totem_properties_view_class_init (TotemPropertiesViewClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+	G_OBJECT_CLASS (class)->finalize = totem_properties_view_finalize;
+}
+
+static void
+update_general (TotemPropertiesView *props,
+		const GstTagList    *list)
+{
+	struct {
+		const char *tag_name;
+		const char *widget;
+	} items[] = {
+		{ GST_TAG_TITLE, "title" },
+		{ GST_TAG_ARTIST, "artist" },
+		{ GST_TAG_ALBUM, "album" },
+	};
+	guint i;
+        GDate *date;
+	GstDateTime *datetime;
+	gchar *comment;
+
+	for (i = 0; i < G_N_ELEMENTS(items); i++) {
+		char *string;
+
+		if (gst_tag_list_get_string_index (list, items[i].tag_name, 0, &string) != FALSE) {
+			bacon_video_widget_properties_set_label (props->priv->props,
+								 items[i].widget,
+								 string);
+			g_free (string);
+		}
+	}
+
+	/* Comment else use Description defined by:
+	 * http://xiph.org/vorbis/doc/v-comment.html */
+	if (gst_tag_list_get_string (list, GST_TAG_COMMENT, &comment) ||
+		gst_tag_list_get_string (list, GST_TAG_DESCRIPTION, &comment)) {
+
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "comment",
+							 comment);
+		g_free (comment);
+        }
+
+	/* Date */
+        if (gst_tag_list_get_date (list, GST_TAG_DATE, &date)) {
+		char *string;
+
+		string = g_strdup_printf ("%d", g_date_get_year (date));
+		g_date_free (date);
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "year",
+							 string);
+		g_free (string);
+        } else if (gst_tag_list_get_date_time (list, GST_TAG_DATE_TIME, &datetime)) {
+		char *string;
+
+		string = g_strdup_printf ("%d", gst_date_time_get_year (datetime));
+		gst_date_time_unref (datetime);
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "year",
+							 string);
+		g_free (string);
+	}
+}
+
+static void
+set_codec (TotemPropertiesView     *props,
+	   GstDiscovererStreamInfo *info,
+	   const char              *widget)
+{
+	GstCaps *caps;
+	const char *nick;
+
+	nick = gst_discoverer_stream_info_get_stream_type_nick (info);
+	if (g_str_equal (nick, "audio") == FALSE &&
+	    g_str_equal (nick, "video") == FALSE &&
+	    g_str_equal (nick, "container") == FALSE) {
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 widget,
+							 _("N/A"));
+		return;
+	}
+
+	caps = gst_discoverer_stream_info_get_caps (info);
+	if (caps) {
+		if (gst_caps_is_fixed (caps)) {
+			char *string;
+
+			string = gst_pb_utils_get_codec_description (caps);
+			bacon_video_widget_properties_set_label (props->priv->props,
+								 widget,
+								 string);
+			g_free (string);
+		}
+		gst_caps_unref (caps);
+	}
+}
+
+static void
+set_bitrate (TotemPropertiesView    *props,
+	     guint                   bitrate,
+	     const char             *widget)
+{
+	char *string;
+
+	if (!bitrate) {
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 widget,
+							 C_("Stream bit rate", "N/A"));
+		return;
+	}
+	string = g_strdup_printf (_("%d kbps"), bitrate / 1000);
+	bacon_video_widget_properties_set_label (props->priv->props,
+						 widget,
+						 string);
+	g_free (string);
+}
+
+static void
+update_video (TotemPropertiesView    *props,
+	      GstDiscovererVideoInfo *info)
+{
+	guint width, height;
+	guint fps_n, fps_d;
+	char *string;
+
+	width = gst_discoverer_video_info_get_width (info);
+	height = gst_discoverer_video_info_get_height (info);
+	string = g_strdup_printf (N_("%d × %d"), width, height);
+	bacon_video_widget_properties_set_label (props->priv->props,
+						 "dimensions",
+						 string);
+	g_free (string);
+
+	set_codec (props, (GstDiscovererStreamInfo *) info, "vcodec");
+	set_bitrate (props, gst_discoverer_video_info_get_bitrate (info), "video_bitrate");
+
+	/* Round up/down to the nearest integer framerate */
+	fps_n = gst_discoverer_video_info_get_framerate_num (info);
+	fps_d = gst_discoverer_video_info_get_framerate_denom (info);
+	if (fps_d > 0.0)
+		bacon_video_widget_properties_set_framerate (props->priv->props,
+							     (float) fps_n / (float) fps_d);
+	else
+		bacon_video_widget_properties_set_framerate (props->priv->props, 0.0);
+}
+
+static void
+update_audio (TotemPropertiesView    *props,
+	      GstDiscovererAudioInfo *info)
+{
+	guint samplerate, channels;
+
+	set_codec (props, (GstDiscovererStreamInfo *) info, "acodec");
+
+	set_bitrate (props, gst_discoverer_audio_info_get_bitrate (info), "audio_bitrate");
+
+	samplerate = gst_discoverer_audio_info_get_sample_rate (info);
+	if (samplerate) {
+		char *string;
+		string = g_strdup_printf (_("%d Hz"), samplerate);
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "samplerate",
+							 string);
+		g_free (string);
+	} else {
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "samplerate",
+							 C_("Sample rate", "N/A"));
+	}
+
+	channels = gst_discoverer_audio_info_get_channels (info);
+	if (channels) {
+		char *string;
+
+		if (channels > 2) {
+			string = g_strdup_printf ("%s %d.1", _("Surround"), channels - 1);
+		} else if (channels == 1) {
+			string = g_strdup (_("Mono"));
+		} else if (channels == 2) {
+			string = g_strdup (_("Stereo"));
+		} else {
+			string = g_strdup (""); //Should not happen
+		}
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "channels",
+							 string);
+		g_free (string);
+	} else {
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 "channels",
+							 C_("Number of audio channels", "N/A"));
+	}
+}
+
+static void
+discovered_cb (GstDiscoverer       *discoverer,
+	       GstDiscovererInfo   *info,
+	       GError              *error,
+	       TotemPropertiesView *props)
+{
+	GList *video_streams, *audio_streams;
+	const GstTagList *taglist;
+	gboolean has_audio, has_video;
+	const char *label;
+        GstClockTime duration;
+        GstDiscovererStreamInfo *sinfo;
+
+	if (error) {
+		g_warning ("Couldn't get information about '%s': %s",
+			   gst_discoverer_info_get_uri (info),
+			   error->message);
+		return;
+	}
+
+	video_streams = gst_discoverer_info_get_video_streams (info);
+	has_video = (video_streams != NULL);
+	audio_streams = gst_discoverer_info_get_audio_streams (info);
+	has_audio = (audio_streams != NULL);
+
+	if (has_audio == has_video)
+		label = N_("Audio/Video");
+	else if (has_audio)
+		label = N_("Audio");
+	else
+		label = N_("Video");
+
+	gtk_label_set_text (GTK_LABEL (props->priv->label), _(label));
+
+	/* Widgets */
+	bacon_video_widget_properties_set_has_type (props->priv->props,
+						    has_video,
+						    has_audio);
+
+	/* General */
+        duration = gst_discoverer_info_get_duration (info);
+        bacon_video_widget_properties_set_duration (props->priv->props, duration / GST_SECOND * 1000);
+
+        sinfo = gst_discoverer_info_get_stream_info (info);
+        if (sinfo) {
+		set_codec (props, sinfo, "container");
+		gst_discoverer_stream_info_unref (sinfo);
+	}
+
+	taglist = gst_discoverer_info_get_tags (info);
+	update_general (props, taglist);
+
+	/* Video and Audio */
+	if (video_streams)
+		update_video (props, video_streams->data);
+	if (audio_streams)
+		update_audio (props, audio_streams->data);
+
+	gst_discoverer_stream_info_list_free (video_streams);
+	gst_discoverer_stream_info_list_free (audio_streams);
+}
+
+static void
+totem_properties_view_init (TotemPropertiesView *props)
+{
+	GError *err = NULL;
+
+	props->priv = g_new0 (TotemPropertiesViewPriv, 1);
+
+	props->priv->vbox = bacon_video_widget_properties_new ();
+	gtk_grid_attach (GTK_GRID (props), props->priv->vbox, 0, 0, 1, 1);
+	gtk_widget_show (GTK_WIDGET (props));
+
+	props->priv->props = BACON_VIDEO_WIDGET_PROPERTIES (props->priv->vbox);
+
+	props->priv->disco = gst_discoverer_new (GST_SECOND * 60, &err);
+	if (props->priv->disco == NULL) {
+		g_warning ("Could not create discoverer object: %s", err->message);
+		g_error_free (err);
+		return;
+	}
+	g_signal_connect (props->priv->disco, "discovered",
+			  G_CALLBACK (discovered_cb), props);
+}
+
+static void
+totem_properties_view_finalize (GObject *object)
+{
+	TotemPropertiesView *props;
+
+	props = TOTEM_PROPERTIES_VIEW (object);
+
+	if (props->priv != NULL) {
+		if (props->priv->disco) {
+			g_signal_handlers_disconnect_by_func (props->priv->disco,
+							      discovered_cb,
+							      props);
+			gst_discoverer_stop (props->priv->disco);
+			g_clear_object (&props->priv->disco);
+		}
+		g_clear_object (&props->priv->label);
+		g_free (props->priv);
+	}
+	props->priv = NULL;
+
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+totem_properties_view_set_location (TotemPropertiesView *props,
+				    const char          *location)
+{
+	g_assert (TOTEM_IS_PROPERTIES_VIEW (props));
+
+	if (props->priv->disco)
+		gst_discoverer_stop (props->priv->disco);
+
+	bacon_video_widget_properties_reset (props->priv->props);
+
+	if (location != NULL && props->priv->disco != NULL) {
+		gst_discoverer_start (props->priv->disco);
+
+		if (gst_discoverer_discover_uri_async (props->priv->disco, location) == FALSE) {
+			g_warning ("Couldn't add %s to list", location);
+			return;
+		}
+	}
+}
+
+GtkWidget *
+totem_properties_view_new (const char *location, GtkWidget *label)
+{
+	TotemPropertiesView *self;
+
+	self = g_object_new (TOTEM_TYPE_PROPERTIES_VIEW, NULL);
+	g_object_ref (label);
+	self->priv->label = label;
+	totem_properties_view_set_location (self, location);
+
+	return GTK_WIDGET (self);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/3.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/3.html new file mode 100644 index 0000000..8b5d9cf --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/3.html @@ -0,0 +1,1189 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_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, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0214, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0214, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0224, 0007, 0000, 0000, 0230, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0230, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0244, 0007, 0000, 0000, 
+  0250, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0250, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0270, 0007, 0000, 0000, 0304, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0304, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0310, 0007, 0000, 0000, 
+  0314, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0314, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0352, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0337, 0163, 0343, 0046, 0020, 0176, 0277, 0277, 0102, 0345, 0265, 0343, 
+  0330, 0126, 0022, 0327, 0271, 0261, 0165, 0223, 0246, 0315, 0265, 0063, 0175, 0272, 0244, 0323, 
+  0107, 0015, 0226, 0210, 0315, 0005, 0203, 0012, 0050, 0266, 0373, 0327, 0027, 0041, 0047, 0261, 
+  0143, 0311, 0002, 0113, 0311, 0371, 0007, 0231, 0311, 0214, 0043, 0263, 0013, 0373, 0301, 0176, 
+  0354, 0202, 0040, 0203, 0057, 0363, 0051, 0361, 0236, 0020, 0027, 0230, 0321, 0041, 0350, 0236, 
+  0165, 0200, 0207, 0150, 0304, 0142, 0114, 0307, 0103, 0360, 0367, 0375, 0155, 0253, 0017, 0276, 
+  0004, 0237, 0006, 0077, 0265, 0132, 0336, 0127, 0104, 0021, 0207, 0022, 0305, 0336, 0014, 0313, 
+  0211, 0067, 0046, 0060, 0106, 0336, 0371, 0231, 0357, 0237, 0371, 0136, 0253, 0245, 0012, 0141, 
+  0052, 0021, 0177, 0200, 0021, 0012, 0076, 0171, 0336, 0200, 0243, 0177, 0123, 0314, 0221, 0360, 
+  0010, 0036, 0015, 0301, 0130, 0076, 0376, 0014, 0136, 0053, 0312, 0304, 0100, 0133, 0227, 0143, 
+  0243, 0357, 0050, 0222, 0136, 0104, 0240, 0020, 0103, 0360, 0125, 0076, 0136, 0307, 0337, 0123, 
+  0041, 0247, 0210, 0112, 0340, 0341, 0170, 0010, 0340, 0313, 0337, 0135, 0220, 0111, 0050, 0231, 
+  0204, 0263, 0004, 0161, 0271, 0360, 0050, 0234, 0242, 0041, 0040, 0154, 0206, 0070, 0010, 0272, 
+  0203, 0366, 0363, 0027, 0305, 0345, 0322, 0044, 0321, 0345, 0072, 0235, 0252, 0222, 0117, 0220, 
+  0244, 0010, 0004, 0227, 0225, 0005, 0205, 0104, 0111, 0210, 0151, 0304, 0221, 0156, 0160, 0165, 
+  0033, 0022, 0070, 0106, 0153, 0002, 0157, 0252, 0030, 0264, 0163, 0100, 0154, 0261, 0361, 0233, 
+  0301, 0346, 0112, 0375, 0030, 0202, 0243, 0140, 0074, 0034, 0170, 0316, 0035, 0074, 0362, 0361, 
+  0317, 0251, 0022, 0317, 0221, 0301, 0331, 0307, 0062, 0177, 0172, 0302, 0002, 0217, 0210, 0262, 
+  0341, 0236, 0247, 0250, 0252, 0111, 0021, 0244, 0341, 0003, 0213, 0122, 0001, 0202, 0133, 0110, 
+  0104, 0145, 0171, 0034, 0061, 0032, 0146, 0037, 0101, 0240, 0110, 0241, 0245, 0304, 0043, 0104, 
+  0154, 0254, 0370, 0015, 0103, 0302, 0306, 0271, 0031, 0212, 0137, 0360, 0177, 0050, 0214, 0363, 
+  0107, 0315, 0064, 0120, 0142, 0251, 0154, 0367, 0044, 0207, 0124, 0020, 0050, 0241, 0102, 0142, 
+  0010, 0026, 0110, 0211, 0177, 0323, 0265, 0171, 0032, 0106, 0121, 0251, 0146, 0221, 0240, 0160, 
+  0202, 0263, 0136, 0312, 0233, 0267, 0041, 0020, 0115, 0060, 0211, 0363, 0317, 0231, 0070, 0121, 
+  0314, 0071, 0141, 0044, 0106, 0274, 0275, 0054, 0320, 0136, 0051, 0221, 0227, 0366, 0064, 0307, 
+  0122, 0110, 0132, 0372, 0117, 0325, 0125, 0043, 0066, 0007, 0057, 0072, 0066, 0260, 0372, 0165, 
+  0345, 0133, 0173, 0144, 0212, 0144, 0246, 0220, 0217, 0061, 0015, 0011, 0172, 0310, 0206, 0237, 
+  0157, 0041, 0302, 0361, 0170, 0142, 0053, 0043, 0131, 0142, 0051, 0061, 0142, 0122, 0262, 0251, 
+  0251, 0020, 0343, 0130, 0371, 0021, 0224, 0152, 0122, 0002, 0201, 0232, 0235, 0044, 0216, 0040, 
+  0061, 0021, 0024, 0011, 0214, 0324, 0034, 0131, 0132, 0117, 0161, 0157, 0301, 0050, 0253, 0051, 
+  0204, 0034, 0301, 0225, 0156, 0051, 0354, 0270, 0124, 0231, 0101, 0327, 0273, 0157, 0327, 0056, 
+  0054, 0344, 0075, 0270, 0140, 0251, 0014, 0205, 0134, 0144, 0176, 0216, 0150, 0134, 0052, 0270, 
+  0066, 0112, 0253, 0032, 0234, 0173, 0345, 0110, 0177, 0356, 0202, 0267, 0122, 0105, 0315, 0030, 
+  0041, 0122, 0350, 0153, 0341, 0115, 0001, 0061, 0154, 0127, 0266, 0225, 0266, 0014, 0101, 0264, 
+  0025, 0345, 0050, 0102, 0370, 0011, 0211, 0060, 0106, 0017, 0060, 0045, 0322, 0136, 0203, 0146, 
+  0142, 0020, 0344, 0204, 0154, 0043, 0230, 0012, 0024, 0246, 0124, 0321, 0005, 0301, 0164, 0007, 
+  0243, 0041, 0231, 0301, 0205, 0010, 0305, 0204, 0315, 0302, 0145, 0033, 0266, 0253, 0130, 0145, 
+  0345, 0165, 0305, 0060, 0172, 0124, 0276, 0120, 0135, 0045, 0232, 0047, 0220, 0306, 0366, 0115, 
+  0175, 0300, 0204, 0330, 0113, 0045, 0114, 0340, 0334, 0261, 0073, 0333, 0214, 0052, 0154, 0375, 
+  0032, 0365, 0326, 0167, 0005, 0277, 0236, 0053, 0344, 0363, 0316, 0361, 0273, 0202, 0325, 0210, 
+  0076, 0334, 0341, 0330, 0155, 0142, 0070, 0026, 0231, 0137, 0154, 0172, 0231, 0331, 0126, 0363, 
+  0105, 0156, 0263, 0225, 0110, 0245, 0377, 0025, 0030, 0273, 0141, 0350, 0246, 0317, 0125, 0005, 
+  0071, 0073, 0273, 0103, 0123, 0123, 0253, 0161, 0114, 0261, 0103, 0134, 0141, 0103, 0103, 0267, 
+  0134, 0007, 0331, 0037, 0302, 0025, 0133, 0001, 0052, 0145, 0273, 0160, 0016, 0011, 0036, 0157, 
+  0047, 0350, 0002, 0210, 0046, 0060, 0126, 0163, 0126, 0026, 0137, 0203, 0200, 0062, 0272, 0275, 
+  0336, 0102, 0260, 0212, 0001, 0273, 0316, 0032, 0223, 0347, 0125, 0005, 0345, 0153, 0000, 0127, 
+  0027, 0274, 0102, 0000, 0125, 0000, 0036, 0046, 0060, 0216, 0053, 0106, 0113, 0065, 0020, 0246, 
+  0116, 0325, 0030, 0024, 0115, 0300, 0121, 0225, 0063, 0364, 0167, 0121, 0140, 0345, 0271, 0106, 
+  0136, 0154, 0326, 0214, 0255, 0135, 0263, 0113, 0367, 0064, 0322, 0105, 0115, 0165, 0123, 0175, 
+  0200, 0314, 0100, 0052, 0006, 0352, 0033, 0214, 0061, 0133, 0215, 0310, 0226, 0321, 0111, 0250, 
+  0027, 0016, 0170, 0366, 0155, 0036, 0243, 0201, 0052, 0335, 0066, 0041, 0333, 0035, 0042, 0131, 
+  0063, 0240, 0227, 0325, 0362, 0331, 0324, 0306, 0306, 0272, 0255, 0146, 0144, 0147, 0037, 0351, 
+  0131, 0015, 0206, 0042, 0225, 0223, 0345, 0114, 0040, 0044, 0344, 0262, 0216, 0242, 0054, 0305, 
+  0176, 0152, 0000, 0256, 0230, 0103, 0225, 0027, 0321, 0130, 0121, 0200, 0144, 0334, 0126, 0137, 
+  0131, 0160, 0272, 0131, 0153, 0131, 0260, 0152, 0032, 0274, 0326, 0106, 0336, 0054, 0232, 0155, 
+  0044, 0331, 0332, 0104, 0311, 0310, 0374, 0302, 0144, 0254, 0051, 0176, 0270, 0141, 0323, 0021, 
+  0123, 0154, 0172, 0217, 0346, 0313, 0105, 0343, 0050, 0173, 0062, 0142, 0163, 0251, 0236, 0150, 
+  0226, 0000, 0373, 0341, 0265, 0015, 0370, 0230, 0010, 0325, 0374, 0306, 0027, 0365, 0233, 0245, 
+  0325, 0204, 0032, 0241, 0210, 0221, 0164, 0152, 0327, 0357, 0112, 0037, 0226, 0150, 0052, 0252, 
+  0313, 0055, 0113, 0006, 0127, 0275, 0371, 0125, 0157, 0320, 0326, 0237, 0215, 0205, 0272, 0176, 
+  0177, 0256, 0176, 0155, 0305, 0172, 0027, 0235, 0371, 0105, 0277, 0143, 0053, 0326, 0357, 0164, 
+  0346, 0275, 0216, 0265, 0130, 0267, 0343, 0137, 0314, 0177, 0351, 0365, 0167, 0060, 0256, 0243, 
+  0060, 0261, 0257, 0257, 0247, 0344, 0272, 0235, 0113, 0173, 0301, 0053, 0137, 0011, 0372, 0346, 
+  0026, 0346, 0345, 0014, 0072, 0271, 0144, 0261, 0164, 0071, 0124, 0115, 0032, 0270, 0341, 0325, 
+  0277, 0153, 0331, 0065, 0167, 0326, 0352, 0132, 0346, 0112, 0033, 0235, 0101, 0315, 0147, 0004, 
+  0103, 0272, 0373, 0310, 0051, 0246, 0056, 0131, 0064, 0075, 0303, 0164, 0017, 0153, 0206, 0371, 
+  0113, 0107, 0211, 0107, 0062, 0207, 0224, 0207, 0274, 0011, 0236, 0043, 0042, 0134, 0210, 0144, 
+  0060, 0200, 0375, 0037, 0061, 0200, 0115, 0360, 0066, 0303, 0272, 0021, 0234, 0353, 0143, 0134, 
+  0073, 0004, 0065, 0300, 0266, 0022, 0127, 0227, 0273, 0177, 0144, 0356, 0256, 0032, 0057, 0331, 
+  0064, 0114, 0042, 0371, 0176, 0231, 0173, 0004, 0211, 0313, 0330, 0117, 0057, 0143, 0337, 0324, 
+  0067, 0346, 0054, 0115, 0100, 0120, 0266, 0136, 0344, 0146, 0272, 0343, 0133, 0014, 0270, 0113, 
+  0060, 0135, 0345, 0233, 0214, 0150, 0204, 0172, 0266, 0063, 0317, 0354, 0043, 0027, 0274, 0276, 
+  0024, 0007, 0202, 0225, 0167, 0053, 0367, 0161, 0074, 0273, 0314, 0303, 0145, 0036, 0006, 0231, 
+  0007, 0342, 0221, 0032, 0301, 0216, 0220, 0135, 0352, 0361, 0303, 0123, 0217, 0256, 0113, 0075, 
+  0216, 0072, 0365, 0170, 0327, 0135, 0303, 0033, 0135, 0207, 0333, 0063, 0164, 0031, 0210, 0313, 
+  0100, 0116, 0064, 0003, 0071, 0221, 0220, 0355, 0037, 0034, 0313, 0311, 0147, 0067, 0200, 0217, 
+  0057, 0347, 0170, 0233, 0102, 0317, 0262, 0236, 0076, 0225, 0044, 0332, 0167, 0111, 0364, 0236, 
+  0246, 0040, 0216, 0221, 0053, 0030, 0371, 0017, 0224, 0035, 0317, 0162, 0224, 0154, 0062, 0202, 
+  0317, 0017, 0233, 0222, 0047, 0272, 0253, 0117, 0205, 0223, 0317, 0035, 0047, 0127, 0217, 0350, 
+  0013, 0307, 0311, 0356, 0225, 0212, 0103, 0246, 0344, 0113, 0267, 0256, 0371, 0256, 0353, 0232, 
+  0376, 0107, 0255, 0153, 0156, 0307, 0164, 0213, 0160, 0271, 0140, 0251, 0320, 0362, 0305, 0303, 
+  0354, 0044, 0321, 0263, 0033, 0232, 0235, 0024, 0332, 0306, 0077, 0373, 0165, 0112, 0250, 0224, 
+  0133, 0364, 0045, 0006, 0336, 0135, 0305, 0271, 0122, 0255, 0023, 0112, 0311, 0261, 0212, 0024, 
+  0120, 0351, 0273, 0234, 0257, 0105, 0226, 0365, 0316, 0164, 0210, 0001, 0074, 0175, 0027, 0306, 
+  0020, 0214, 0030, 0211, 0101, 0273, 0254, 0113, 0267, 0353, 0267, 0356, 0327, 0346, 0016, 0206, 
+  0132, 0237, 0152, 0073, 0260, 0203, 0312, 0356, 0204, 0240, 0347, 0116, 0010, 0032, 0006, 0143, 
+  0356, 0204, 0240, 0073, 0041, 0170, 0042, 0133, 0175, 0060, 0111, 0020, 0215, 0337, 0155, 0227, 
+  0357, 0132, 0253, 0167, 0373, 0173, 0247, 0266, 0277, 0347, 0066, 0341, 0016, 0145, 0171, 0141, 
+  0345, 0364, 0120, 0146, 0111, 0150, 0172, 0150, 0350, 0020, 0374, 0124, 0352, 0163, 0216, 0005, 
+  0264, 0164, 0226, 0337, 0245, 0026, 0273, 0345, 0262, 0243, 0333, 0223, 0073, 0221, 0345, 0062, 
+  0311, 0074, 0325, 0321, 0310, 0323, 0027, 0370, 0071, 0136, 0336, 0327, 0255, 0070, 0167, 0020, 
+  0251, 0371, 0125, 0263, 0335, 0122, 0204, 0215, 0310, 0027, 0123, 0175, 0013, 0245, 0105, 0350, 
+  0153, 0356, 0235, 0313, 0313, 0063, 0061, 0365, 0164, 0035, 0273, 0202, 0333, 0164, 0222, 0122, 
+  0107, 0115, 0315, 0230, 0267, 0221, 0170, 0267, 0211, 0130, 0267, 0311, 0070, 0267, 0344, 0035, 
+  0266, 0315, 0234, 0312, 0324, 0065, 0334, 0253, 0303, 0156, 0211, 0375, 0060, 0227, 0330, 0157, 
+  0125, 0060, 0222, 0225, 0161, 0013, 0354, 0173, 0263, 0300, 0176, 0270, 0127, 0057, 0332, 0334, 
+  0134, 0130, 0151, 0157, 0365, 0315, 0213, 0353, 0066, 0256, 0337, 0104, 0235, 0337, 0142, 0334, 
+  0232, 0341, 0170, 0214, 0344, 0313, 0220, 0132, 0177, 0354, 0251, 0154, 0062, 0141, 0124, 0250, 
+  0326, 0264, 0172, 0040, 0130, 0336, 0010, 0254, 0206, 0342, 0152, 0241, 0152, 0321, 0313, 0147, 
+  0121, 0277, 0120, 0364, 0315, 0103, 0261, 0176, 0171, 0370, 0240, 0275, 0362, 0037, 0011, 0376, 
+  0007, 0217, 0252, 0332, 0352, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 
+  0156, 0163, 0057, 0000, 0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 
+  0166, 0145, 0162, 0164, 0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_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) { _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) { 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(imageconverterresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(imageconverterresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(imageconverterresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(imageconverterresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void imageconverterresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void imageconverterresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/4.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/4.html new file mode 100644 index 0000000..5def235 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/4.html @@ -0,0 +1,1007 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ *  caja-image-resizer.c
+ *
+ *  Copyright (C) 2004-2008 Jürg Billeter
+ *
+ *  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: Jürg Billeter <j@bitron.ch>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-image-resizer.h"
+
+#include <string.h>
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include <libcaja-extension/caja-file-info.h>
+
+struct _CajaImageResizer {
+	GObject parent_instance;
+
+	GList *files;<--- struct member '_CajaImageResizer::files' is never used.
+
+	gchar *suffix;<--- struct member '_CajaImageResizer::suffix' is never used.
+
+	int images_resized;<--- struct member '_CajaImageResizer::images_resized' is never used.
+	int images_total;<--- struct member '_CajaImageResizer::images_total' is never used.
+	gboolean cancelled;
+
+	gchar *size;<--- struct member '_CajaImageResizer::size' is never used.
+
+	GtkDialog *resize_dialog;<--- struct member '_CajaImageResizer::resize_dialog' is never used.
+	GtkRadioButton *default_size_radiobutton;<--- struct member '_CajaImageResizer::default_size_radiobutton' is never used.
+	GtkComboBoxText *size_combobox;<--- struct member '_CajaImageResizer::size_combobox' is never used.
+	GtkRadioButton *custom_pct_radiobutton;<--- struct member '_CajaImageResizer::custom_pct_radiobutton' is never used.
+	GtkSpinButton *pct_spinbutton;<--- struct member '_CajaImageResizer::pct_spinbutton' is never used.
+	GtkRadioButton *custom_size_radiobutton;<--- struct member '_CajaImageResizer::custom_size_radiobutton' is never used.
+	GtkSpinButton *width_spinbutton;<--- struct member '_CajaImageResizer::width_spinbutton' is never used.
+	GtkSpinButton *height_spinbutton;<--- struct member '_CajaImageResizer::height_spinbutton' is never used.
+	GtkRadioButton *append_radiobutton;<--- struct member '_CajaImageResizer::append_radiobutton' is never used.
+	GtkEntry *name_entry;<--- struct member '_CajaImageResizer::name_entry' is never used.
+	GtkRadioButton *inplace_radiobutton;<--- struct member '_CajaImageResizer::inplace_radiobutton' is never used.
+
+	GtkWidget *progress_dialog;<--- struct member '_CajaImageResizer::progress_dialog' is never used.
+	GtkWidget *progress_bar;<--- struct member '_CajaImageResizer::progress_bar' is never used.
+	GtkWidget *progress_label;<--- struct member '_CajaImageResizer::progress_label' is never used.
+};
+
+G_DEFINE_TYPE (CajaImageResizer, caja_image_resizer, G_TYPE_OBJECT)
+
+enum {
+	PROP_FILES = 1,
+};
+
+typedef enum {
+	/* Place Signal Types Here */
+	SIGNAL_TYPE_EXAMPLE,
+	LAST_SIGNAL
+} CajaImageResizerSignalType;
+
+static void
+caja_image_resizer_finalize (GObject *object)
+{
+	CajaImageResizer *resizer = CAJA_IMAGE_RESIZER (object);
+
+	g_free (resizer->suffix);
+
+	if (resizer->size)
+		g_free (resizer->size);
+
+	G_OBJECT_CLASS(caja_image_resizer_parent_class)->finalize(object);
+}
+
+static void
+caja_image_resizer_set_property (GObject      *object,
+                                 guint         property_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+	CajaImageResizer *resizer = CAJA_IMAGE_RESIZER (object);
+
+	switch (property_id) {
+		case PROP_FILES:
+			resizer->files = g_value_get_pointer (value);
+			resizer->images_total = g_list_length (resizer->files);
+			break;
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+	}
+}
+
+static void
+caja_image_resizer_get_property (GObject      *object,
+                                 guint         property_id,
+                                 GValue       *value,
+                                 GParamSpec   *pspec)
+{
+	CajaImageResizer *resizer = CAJA_IMAGE_RESIZER (object);
+
+	switch (property_id) {
+		case PROP_FILES:
+			g_value_set_pointer (value, resizer->files);
+			break;
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+	}
+}
+
+static void
+caja_image_resizer_class_init (CajaImageResizerClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS(klass);
+	GParamSpec *files_param_spec;
+
+	object_class->finalize = caja_image_resizer_finalize;
+	object_class->set_property = caja_image_resizer_set_property;
+	object_class->get_property = caja_image_resizer_get_property;
+
+	files_param_spec = g_param_spec_pointer ("files",
+	"Files",
+	"Set selected files",
+	G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+	g_object_class_install_property (object_class,
+	PROP_FILES,
+	files_param_spec);
+}
+
+static void run_op (CajaImageResizer *resizer);
+
+static GFile *
+caja_image_resizer_transform_filename (CajaImageResizer *resizer,
+                                       GFile            *orig_file)
+{
+	GFile *parent_file, *new_file;
+	char *basename, *extension, *new_basename;
+
+	g_return_val_if_fail (G_IS_FILE (orig_file), NULL);
+
+	parent_file = g_file_get_parent (orig_file);
+
+	basename = g_strdup (g_file_get_basename (orig_file));
+
+	extension = g_strdup (strrchr (basename, '.'));
+	if (extension != NULL)
+		basename[strlen (basename) - strlen (extension)] = '\0';
+
+	new_basename = g_strdup_printf ("%s%s%s", basename,
+	                                resizer->suffix == NULL ? ".tmp" : resizer->suffix,
+	                                extension == NULL ? "" : extension);
+	g_free (basename);
+	g_free (extension);
+
+	new_file = g_file_get_child (parent_file, new_basename);
+
+	g_object_unref (parent_file);
+	g_free (new_basename);
+
+	return new_file;
+}
+
+static void
+op_finished (GPid              pid,
+             gint              status,
+             gpointer          data)
+{
+	CajaImageResizer *resizer = CAJA_IMAGE_RESIZER (data);
+	gboolean          retry = TRUE;
+	CajaFileInfo     *file = CAJA_FILE_INFO (resizer->files->data);
+
+	if (status != 0) {
+		/* resizing failed */
+		GtkBuilder *builder;
+		GtkWidget  *msg_dialog;
+		GObject    *dialog_text;
+		int         response_id;
+		char       *msg;
+		char       *name;
+
+		name = caja_file_info_get_name (file);
+
+		builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/error-dialog.ui");
+		msg_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "error_dialog"));
+		dialog_text = gtk_builder_get_object (builder, "error_text");
+		msg = g_strdup_printf ("'%s' cannot be resized. Check whether you have permission to write to this folder.", name);
+		gtk_label_set_text (GTK_LABEL (dialog_text), msg);
+		g_free (msg);
+		g_object_unref (builder);
+
+		response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog));
+		gtk_widget_destroy (msg_dialog);
+		if (response_id == 0) {
+			retry = TRUE;
+		} else if (response_id == GTK_RESPONSE_CANCEL) {
+			resizer->cancelled = TRUE;
+		} else if (response_id == 1) {
+			retry = FALSE;
+		}
+
+	} else if (resizer->suffix == NULL) {
+		/* resize image in place */
+		GFile *orig_location = caja_file_info_get_location (file);
+		GFile *new_location = caja_image_resizer_transform_filename (resizer, orig_location);
+		g_file_move (new_location, orig_location, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);
+		g_object_unref (orig_location);
+		g_object_unref (new_location);
+	}
+
+	if (status == 0 || !retry) {
+		/* image has been successfully resized (or skipped) */
+		resizer->images_resized++;
+		resizer->files = resizer->files->next;
+	}
+
+	if (!resizer->cancelled && resizer->files != NULL) {
+		/* process next image */
+		run_op (resizer);
+	} else {
+		/* cancel/terminate operation */
+		gtk_widget_destroy (resizer->progress_dialog);
+	}
+}
+
+static void
+run_op (CajaImageResizer *resizer)
+{
+	g_return_if_fail (resizer->files != NULL);
+
+	CajaFileInfo *file = CAJA_FILE_INFO (resizer->files->data);
+
+	GFile *orig_location = caja_file_info_get_location (file);
+	char *filename = g_file_get_path (orig_location);
+	GFile *new_location = caja_image_resizer_transform_filename (resizer, orig_location);
+	char *new_filename = g_file_get_path (new_location);
+	g_object_unref (orig_location);
+	g_object_unref (new_location);
+
+	/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
+
+	gchar *argv[6];
+	argv[0] = "convert";
+	argv[1] = filename;
+	argv[2] = "-resize";
+	argv[3] = resizer->size;
+	argv[4] = new_filename;
+	argv[5] = NULL;
+
+	pid_t pid;
+
+	if (filename == NULL || new_filename == NULL ||
+	    !g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
+		// FIXME: error handling
+		g_free (filename);
+		g_free (new_filename);
+		return;
+	}
+
+	g_free (filename);
+	g_free (new_filename);
+
+	g_child_watch_add (pid, op_finished, resizer);
+
+	char *tmp;
+
+	gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (resizer->progress_bar),
+	                               (double) (resizer->images_resized + 1) / resizer->images_total);
+	tmp = g_strdup_printf (_("Resizing image: %d of %d"),
+	                       resizer->images_resized + 1,
+	                       resizer->images_total);
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (resizer->progress_bar), tmp);
+	g_free (tmp);
+
+	char *name = caja_file_info_get_name (file);
+	tmp = g_strdup_printf (_("<i>Resizing \"%s\"</i>"), name);
+	g_free (name);
+	gtk_label_set_markup (GTK_LABEL (resizer->progress_label), tmp);
+	g_free (tmp);
+
+}
+
+static void
+on_caja_image_resizer_response (GtkDialog        *dialog,
+                                gint              response_id,
+                                CajaImageResizer *resizer)
+{
+	if (response_id == GTK_RESPONSE_OK) {
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (resizer->append_radiobutton))) {
+			if (strlen (gtk_entry_get_text (resizer->name_entry)) == 0) {
+				GtkWidget *msg_dialog;
+				msg_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+				                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+				                                     GTK_MESSAGE_ERROR,
+				                                     GTK_BUTTONS_OK,
+				                                     _("Please enter a valid filename suffix!"));
+				gtk_dialog_run (GTK_DIALOG (msg_dialog));
+				gtk_widget_destroy (msg_dialog);
+				return;
+			}
+			resizer->suffix = g_strdup (gtk_entry_get_text (resizer->name_entry));
+		}
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (resizer->default_size_radiobutton))) {
+			resizer->size = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (resizer->size_combobox));
+		} else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (resizer->custom_pct_radiobutton))) {
+			resizer->size = g_strdup_printf ("%d%%",
+			                                 gtk_spin_button_get_value_as_int (resizer->pct_spinbutton));
+		} else {
+			resizer->size = g_strdup_printf ("%dx%d",
+			                                 gtk_spin_button_get_value_as_int (resizer->width_spinbutton),
+			                                 gtk_spin_button_get_value_as_int (resizer->height_spinbutton));
+		}
+
+		run_op (resizer);
+	}
+
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+caja_image_resizer_init (CajaImageResizer *resizer)
+{
+	GtkBuilder *builder;
+
+	builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/caja-image-resize.ui");
+#ifdef ENABLE_NLS
+	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	/* Grab some widgets */
+	resizer->resize_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "resize_dialog"));
+	resizer->default_size_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "default_size_radiobutton"));
+	resizer->size_combobox = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (builder, "comboboxtext_size"));
+	resizer->custom_pct_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_pct_radiobutton"));
+	resizer->pct_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "pct_spinbutton"));
+	resizer->custom_size_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_size_radiobutton"));
+	resizer->width_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "width_spinbutton"));
+	resizer->height_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "height_spinbutton"));
+	resizer->append_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "append_radiobutton"));
+	resizer->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "name_entry"));
+	resizer->inplace_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "inplace_radiobutton"));
+
+	/* Set default item in combo box */
+	/* gtk_combo_box_set_active  (resizer->size_combobox, 4);  1024x768 */
+
+	/* Connect signal */
+	g_signal_connect (resizer->resize_dialog, "response",
+	                  G_CALLBACK (on_caja_image_resizer_response),
+	                  resizer);
+
+	g_object_unref (builder);
+}
+
+CajaImageResizer *
+caja_image_resizer_new (GList *files)
+{
+	return g_object_new (CAJA_TYPE_IMAGE_RESIZER, "files", files, NULL);
+}
+
+void
+caja_image_resizer_show_dialog (CajaImageResizer *resizer)
+{
+	gtk_widget_show (GTK_WIDGET (resizer->resize_dialog));
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/5.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/5.html new file mode 100644 index 0000000..e323714 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/5.html @@ -0,0 +1,1009 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ *  caja-image-rotator.c
+ *
+ *  Copyright (C) 2004-2008 Jürg Billeter
+ *
+ *  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: Jürg Billeter <j@bitron.ch>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-image-rotator.h"
+
+#include <string.h>
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include <libcaja-extension/caja-file-info.h>
+
+struct _CajaImageRotator {
+	GObject parent_instance;
+
+	GList *files;<--- struct member '_CajaImageRotator::files' is never used.
+
+	gchar *suffix;<--- struct member '_CajaImageRotator::suffix' is never used.
+
+	int images_rotated;<--- struct member '_CajaImageRotator::images_rotated' is never used.
+	int images_total;<--- struct member '_CajaImageRotator::images_total' is never used.
+	gboolean cancelled;
+
+	gchar *angle;<--- struct member '_CajaImageRotator::angle' is never used.
+
+	GtkDialog *rotate_dialog;<--- struct member '_CajaImageRotator::rotate_dialog' is never used.
+	GtkRadioButton *default_angle_radiobutton;<--- struct member '_CajaImageRotator::default_angle_radiobutton' is never used.
+	GtkComboBox *angle_combobox;<--- struct member '_CajaImageRotator::angle_combobox' is never used.
+	GtkRadioButton *custom_angle_radiobutton;<--- struct member '_CajaImageRotator::custom_angle_radiobutton' is never used.
+	GtkSpinButton *angle_spinbutton;<--- struct member '_CajaImageRotator::angle_spinbutton' is never used.
+	GtkRadioButton *append_radiobutton;<--- struct member '_CajaImageRotator::append_radiobutton' is never used.
+	GtkEntry *name_entry;<--- struct member '_CajaImageRotator::name_entry' is never used.
+	GtkRadioButton *inplace_radiobutton;<--- struct member '_CajaImageRotator::inplace_radiobutton' is never used.
+
+	GtkWidget *progress_dialog;<--- struct member '_CajaImageRotator::progress_dialog' is never used.
+	GtkWidget *progress_bar;<--- struct member '_CajaImageRotator::progress_bar' is never used.
+	GtkWidget *progress_label;<--- struct member '_CajaImageRotator::progress_label' is never used.
+};
+
+G_DEFINE_TYPE (CajaImageRotator, caja_image_rotator, G_TYPE_OBJECT)
+
+enum {
+	PROP_FILES = 1,
+};
+
+typedef enum {
+	/* Place Signal Types Here */
+	SIGNAL_TYPE_EXAMPLE,
+	LAST_SIGNAL
+} CajaImageRotatorSignalType;
+
+static void
+caja_image_rotator_finalize (GObject *object)
+{
+	CajaImageRotator *rotator = CAJA_IMAGE_ROTATOR (object);
+
+	g_free (rotator->suffix);
+
+	if (rotator->angle)
+		g_free (rotator->angle);
+
+	G_OBJECT_CLASS(caja_image_rotator_parent_class)->finalize(object);
+}
+
+static void
+caja_image_rotator_set_property (GObject      *object,
+                                 guint         property_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+	CajaImageRotator *rotator = CAJA_IMAGE_ROTATOR (object);
+
+	switch (property_id) {
+		case PROP_FILES:
+			rotator->files = g_value_get_pointer (value);
+			rotator->images_total = g_list_length (rotator->files);
+			break;
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+	}
+}
+
+static void
+caja_image_rotator_get_property (GObject      *object,
+                                 guint         property_id,
+                                 GValue       *value,
+                                 GParamSpec   *pspec)
+{
+	CajaImageRotator *rotator = CAJA_IMAGE_ROTATOR (object);
+
+	switch (property_id) {
+		case PROP_FILES:
+			g_value_set_pointer (value, rotator->files);
+			break;
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+	}
+}
+
+static void
+caja_image_rotator_class_init(CajaImageRotatorClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS(klass);
+	GParamSpec *files_param_spec;
+
+	object_class->finalize = caja_image_rotator_finalize;
+	object_class->set_property = caja_image_rotator_set_property;
+	object_class->get_property = caja_image_rotator_get_property;
+
+	files_param_spec = g_param_spec_pointer ("files",
+	"Files",
+	"Set selected files",
+	G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+	g_object_class_install_property (object_class,
+	PROP_FILES,
+	files_param_spec);
+}
+
+static void run_op (CajaImageRotator *rotator);
+
+static GFile *
+caja_image_rotator_transform_filename (CajaImageRotator *rotator, GFile *orig_file)
+{
+	GFile *parent_file, *new_file;
+	char *basename, *extension, *new_basename;
+
+	g_return_val_if_fail (G_IS_FILE (orig_file), NULL);
+
+	parent_file = g_file_get_parent (orig_file);
+
+	basename = g_strdup (g_file_get_basename (orig_file));
+
+	extension = g_strdup (strrchr (basename, '.'));
+	if (extension != NULL)
+		basename[strlen (basename) - strlen (extension)] = '\0';
+
+	new_basename = g_strdup_printf ("%s%s%s", basename,
+	                                rotator->suffix == NULL ? ".tmp" : rotator->suffix,
+	                                extension == NULL ? "" : extension);
+	g_free (basename);
+	g_free (extension);
+
+	new_file = g_file_get_child (parent_file, new_basename);
+
+	g_object_unref (parent_file);
+	g_free (new_basename);
+
+	return new_file;
+}
+
+static void
+op_finished (GPid      pid,
+             gint      status,
+             gpointer  data)
+{
+	CajaImageRotator *rotator = CAJA_IMAGE_ROTATOR (data);
+	gboolean          retry = TRUE;
+	CajaFileInfo     *file = CAJA_FILE_INFO (rotator->files->data);
+
+	if (status != 0) {
+		/* rotating failed */
+		GtkBuilder *builder;
+		GtkWidget  *msg_dialog;
+		GObject    *dialog_text;
+		int         response_id;
+		char       *msg;
+		char       *name;
+
+		name  = caja_file_info_get_name (file);
+
+		builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/error-dialog.ui");
+		msg_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "error_dialog"));
+		dialog_text = gtk_builder_get_object (builder, "error_text");
+		msg = g_strdup_printf ("'%s' cannot be rotated. Check whether you have permission to write to this folder.", name);
+		gtk_label_set_text (GTK_LABEL (dialog_text), msg);
+		g_free (msg);
+		g_object_unref (builder);
+
+		response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog));
+		gtk_widget_destroy (msg_dialog);
+		if (response_id == 0) {
+			retry = TRUE;
+		} else if (response_id == GTK_RESPONSE_CANCEL) {
+			rotator->cancelled = TRUE;
+		} else if (response_id == 1) {
+			retry = FALSE;
+		}
+
+	} else if (rotator->suffix == NULL) {
+		/* rotate image in place */
+		GFile *orig_location = caja_file_info_get_location (file);
+		GFile *new_location = caja_image_rotator_transform_filename (rotator, orig_location);
+		g_file_move (new_location, orig_location, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);
+		g_object_unref (orig_location);
+		g_object_unref (new_location);
+	}
+
+	if (status == 0 || !retry) {
+		/* image has been successfully rotated (or skipped) */
+		rotator->images_rotated++;
+		rotator->files = rotator->files->next;
+	}
+
+	if (!rotator->cancelled && rotator->files != NULL) {
+		/* process next image */
+		run_op (rotator);
+	} else {
+		/* cancel/terminate operation */
+		gtk_widget_destroy (rotator->progress_dialog);
+	}
+}
+
+static void
+run_op (CajaImageRotator *rotator)
+{
+	g_return_if_fail (rotator->files != NULL);
+
+	CajaFileInfo *file = CAJA_FILE_INFO (rotator->files->data);
+
+	GFile *orig_location = caja_file_info_get_location (file);
+	char *filename = g_file_get_path (orig_location);
+	GFile *new_location = caja_image_rotator_transform_filename (rotator, orig_location);
+	char *new_filename = g_file_get_path (new_location);
+	g_object_unref (orig_location);
+	g_object_unref (new_location);
+
+	/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
+
+	gchar *argv[8];
+	argv[0] = "convert";
+	argv[1] = filename;
+	argv[2] = "-rotate";
+	argv[3] = rotator->angle;
+	argv[4] = "-orient";
+	argv[5] = "TopLeft";
+	argv[6] = new_filename;
+	argv[7] = NULL;
+
+	pid_t pid;
+
+	if (filename == NULL || new_filename == NULL ||
+	    !g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, NULL)) {
+		// FIXME: error handling
+		g_free (filename);
+		g_free (new_filename);
+		return;
+	}
+
+	g_free (filename);
+	g_free (new_filename);
+
+	g_child_watch_add (pid, op_finished, rotator);
+
+	char *tmp;
+
+	gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (rotator->progress_bar), (double) (rotator->images_rotated + 1) / rotator->images_total);
+	tmp = g_strdup_printf (_("Rotating image: %d of %d"), rotator->images_rotated + 1, rotator->images_total);
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (rotator->progress_bar), tmp);
+	g_free (tmp);
+
+	char *name = caja_file_info_get_name (file);
+	tmp = g_strdup_printf (_("<i>Rotating \"%s\"</i>"), name);
+	g_free (name);
+	gtk_label_set_markup (GTK_LABEL (rotator->progress_label), tmp);
+	g_free (tmp);
+
+}
+
+static void
+on_caja_image_rotator_response (GtkDialog        *dialog,
+                                gint              response_id,
+                                CajaImageRotator *rotator)
+{
+	if (response_id == GTK_RESPONSE_OK) {
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rotator->append_radiobutton))) {
+			if (strlen (gtk_entry_get_text (rotator->name_entry)) == 0) {
+				GtkWidget *msg_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+					GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
+					GTK_BUTTONS_OK, _("Please enter a valid filename suffix!"));
+				gtk_dialog_run (GTK_DIALOG (msg_dialog));
+				gtk_widget_destroy (msg_dialog);
+				return;
+			}
+			rotator->suffix = g_strdup (gtk_entry_get_text (rotator->name_entry));
+		}
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rotator->default_angle_radiobutton))) {
+			switch (gtk_combo_box_get_active (GTK_COMBO_BOX (rotator->angle_combobox))) {
+			case 0:
+				rotator->angle = g_strdup_printf ("90");
+				break;
+			case 1:
+				rotator->angle = g_strdup_printf ("-90");
+				break;
+			case 2:
+				rotator->angle = g_strdup_printf ("180");
+				break;
+			default:
+				g_assert_not_reached ();
+			}
+		} else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rotator->custom_angle_radiobutton))) {
+			rotator->angle = g_strdup_printf ("%d",
+			                                  gtk_spin_button_get_value_as_int (rotator->angle_spinbutton));
+		} else {
+			g_assert_not_reached ();
+		}
+
+		run_op (rotator);
+	}
+
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+caja_image_rotator_init (CajaImageRotator *rotator)
+{
+	GtkBuilder *builder;
+
+	builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/caja-image-rotate.ui");
+#ifdef ENABLE_NLS
+	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	/* Grab some widgets */
+	rotator->rotate_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "rotate_dialog"));
+	rotator->default_angle_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "default_angle_radiobutton"));
+	rotator->angle_combobox = GTK_COMBO_BOX (gtk_builder_get_object (builder, "angle_combobox"));
+	rotator->custom_angle_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_angle_radiobutton"));
+	rotator->angle_spinbutton =
+		GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "angle_spinbutton"));
+	rotator->append_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "append_radiobutton"));
+	rotator->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "name_entry"));
+	rotator->inplace_radiobutton =
+		GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "inplace_radiobutton"));
+
+	/* Set default value for combobox */
+	gtk_combo_box_set_active  (rotator->angle_combobox, 0); /* 90° clockwise */
+
+	/* Connect the signal */
+	g_signal_connect (rotator->rotate_dialog, "response",
+	                  G_CALLBACK (on_caja_image_rotator_response),
+			  rotator);
+
+	g_object_unref (builder);
+}
+
+CajaImageRotator *
+caja_image_rotator_new (GList *files)
+{
+	return g_object_new (CAJA_TYPE_IMAGE_ROTATOR, "files", files, NULL);
+}
+
+void
+caja_image_rotator_show_dialog (CajaImageRotator *rotator)
+{
+	gtk_widget_show (GTK_WIDGET (rotator->rotate_dialog));
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/6.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/6.html new file mode 100644 index 0000000..ea7ce8f --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/6.html @@ -0,0 +1,1593 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 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: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+		NULL
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/7.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/7.html new file mode 100644 index 0000000..dea259b --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/7.html @@ -0,0 +1,565 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/*
+ *  Caja-sendto
+ *
+ *  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: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_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_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+static GType nste_type = 0;
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+		NULL
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/8.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/8.html new file mode 100644 index 0000000..f527ec1 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/8.html @@ -0,0 +1,1961 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/9.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/9.html new file mode 100644 index 0000000..ffce6e3 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/9.html @@ -0,0 +1,863 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+
  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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_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, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_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) { _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) { 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(sendtoresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(sendtoresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(sendtoresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(sendtoresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void sendtoresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void sendtoresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/index.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/index.html new file mode 100644 index 0000000..36f3ed4 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/index.html @@ -0,0 +1,288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
audio-video-properties/bacon-video-widget-properties.c
39unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
audio-video-properties/caja-av-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
audio-video-properties/totem-properties-view.c
43unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
image-converter/caja-image-converter-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
image-converter/caja-image-resizer.c
42unusedStructMember563stylestruct member '_CajaImageResizer::files' is never used.
44unusedStructMember563stylestruct member '_CajaImageResizer::suffix' is never used.
46unusedStructMember563stylestruct member '_CajaImageResizer::images_resized' is never used.
47unusedStructMember563stylestruct member '_CajaImageResizer::images_total' is never used.
50unusedStructMember563stylestruct member '_CajaImageResizer::size' is never used.
52unusedStructMember563stylestruct member '_CajaImageResizer::resize_dialog' is never used.
53unusedStructMember563stylestruct member '_CajaImageResizer::default_size_radiobutton' is never used.
54unusedStructMember563stylestruct member '_CajaImageResizer::size_combobox' is never used.
55unusedStructMember563stylestruct member '_CajaImageResizer::custom_pct_radiobutton' is never used.
56unusedStructMember563stylestruct member '_CajaImageResizer::pct_spinbutton' is never used.
57unusedStructMember563stylestruct member '_CajaImageResizer::custom_size_radiobutton' is never used.
58unusedStructMember563stylestruct member '_CajaImageResizer::width_spinbutton' is never used.
59unusedStructMember563stylestruct member '_CajaImageResizer::height_spinbutton' is never used.
60unusedStructMember563stylestruct member '_CajaImageResizer::append_radiobutton' is never used.
61unusedStructMember563stylestruct member '_CajaImageResizer::name_entry' is never used.
62unusedStructMember563stylestruct member '_CajaImageResizer::inplace_radiobutton' is never used.
64unusedStructMember563stylestruct member '_CajaImageResizer::progress_dialog' is never used.
65unusedStructMember563stylestruct member '_CajaImageResizer::progress_bar' is never used.
66unusedStructMember563stylestruct member '_CajaImageResizer::progress_label' is never used.
image-converter/caja-image-rotator.c
42unusedStructMember563stylestruct member '_CajaImageRotator::files' is never used.
44unusedStructMember563stylestruct member '_CajaImageRotator::suffix' is never used.
46unusedStructMember563stylestruct member '_CajaImageRotator::images_rotated' is never used.
47unusedStructMember563stylestruct member '_CajaImageRotator::images_total' is never used.
50unusedStructMember563stylestruct member '_CajaImageRotator::angle' is never used.
52unusedStructMember563stylestruct member '_CajaImageRotator::rotate_dialog' is never used.
53unusedStructMember563stylestruct member '_CajaImageRotator::default_angle_radiobutton' is never used.
54unusedStructMember563stylestruct member '_CajaImageRotator::angle_combobox' is never used.
55unusedStructMember563stylestruct member '_CajaImageRotator::custom_angle_radiobutton' is never used.
56unusedStructMember563stylestruct member '_CajaImageRotator::angle_spinbutton' is never used.
57unusedStructMember563stylestruct member '_CajaImageRotator::append_radiobutton' is never used.
58unusedStructMember563stylestruct member '_CajaImageRotator::name_entry' is never used.
59unusedStructMember563stylestruct member '_CajaImageRotator::inplace_radiobutton' is never used.
61unusedStructMember563stylestruct member '_CajaImageRotator::progress_dialog' is never used.
62unusedStructMember563stylestruct member '_CajaImageRotator::progress_bar' is never used.
63unusedStructMember563stylestruct member '_CajaImageRotator::progress_label' is never used.
open-terminal/caja-open-terminal.c
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
140variableScope398styleThe scope of the variable 'fenum' can be reduced.
141variableScope398styleThe scope of the variable 'file_info' can be reduced.
142variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
315variableScope398styleThe scope of the variable 'show' can be reduced.
412variableScope398styleThe scope of the variable 'value' can be reduced.
414variableScope398styleThe scope of the variable 'contact_props' can be reduced.
419variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
381variableScope398styleThe scope of the variable 'file' can be reduced.
382variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
737duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/stats.html b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/stats.html new file mode 100644 index 0000000..452a1b5 --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/stats.html @@ -0,0 +1,180 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + +
+ + + + + +
+ + diff --git a/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/style.css b/2023-08-30-133307-1532-cppcheck@195094cfaa07_master/style.css new file mode 100644 index 0000000..3897bfa --- /dev/null +++ b/2023-08-30-133307-1532-cppcheck@195094cfaa07_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