tracker-0.16.2/src/tracker-needle/tracker-utils.c

Location Tool Test ID Function Issue
tracker-utils.c:163:9 gcc unused-but-set-variable uri_launch variable '_tmp13__length1' set but not used
tracker-utils.c:317:7 gcc unused-but-set-variable g_time_format variable '_tmp3__length1' set but not used
tracker-utils.c:597:2 gcc tracker_time_format_from_seconds passing argument 1 of 'g_strchug' discards 'const' qualifier from pointer target type [enabled by default]
tracker-utils.c:755:26 gcc tracker_pixbuf_new_from_file assignment from incompatible pointer type [enabled by default]

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found tracker-utils.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /* tracker-utils.c generated by valac 0.18.1, the Vala compiler
  2  * generated from tracker-utils.vala, do not modify */
  3 
  4 /**/
  5 /* Copyright 2010, Martyn Russell <martyn@lanedo.com>*/
  6 /**/
  7 /* This program is free software; you can redistribute it and/or*/
  8 /* modify it under the terms of the GNU General Public License*/
  9 /* as published by the Free Software Foundation; either version 2*/
 10 /* of the License, or (at your option) any later version.*/
 11 /**/
 12 /* This program is distributed in the hope that it will be useful,*/
 13 /* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
 14 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
 15 /* GNU General Public License for more details.*/
 16 /**/
 17 /* You should have received a copy of the GNU General Public License*/
 18 /* along with this program; if not, write to the Free Software*/
 19 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA*/
 20 /* 02110-1301, USA.*/
 21 /**/
 22 
 23 #include <glib.h>
 24 #include <glib-object.h>
 25 #include <gtk/gtk.h>
 26 #include <stdlib.h>
 27 #include <string.h>
 28 #include <gio/gio.h>
 29 #include <time.h>
 30 #include <glib/gi18n-lib.h>
 31 #include <float.h>
 32 #include <math.h>
 33 #include <gdk-pixbuf/gdk-pixbuf.h>
 34 
 35 #define _g_free0(var) (var = (g_free (var), NULL))
 36 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 37 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 38 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
 39 
 40 
 41 
 42 #define secs_per_day ((60 * 60) * 24)
 43 gchar* uri_get_selected (GtkTreeModel* model, GtkTreePath* path, gint col);
 44 void uri_launch (const gchar* uri);
 45 void tracker_model_launch_selected (GtkTreeModel* model, GtkTreePath* path, gint col);
 46 void tracker_model_launch_selected_parent_dir (GtkTreeModel* model, GtkTreePath* path, gint col);
 47 gchar* tracker_time_format_from_iso8601 (const gchar* s);
 48 gchar* tracker_time_format_from_seconds (const gchar* seconds_str);
 49 GdkPixbuf* tracker_pixbuf_new_from_file (GtkIconTheme* theme, const gchar* filename, gint size, gboolean is_image);
 50 GdkPixbuf* tracker_pixbuf_new_from_name (GtkIconTheme* theme, const gchar* name, gint size);
 51 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 52 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 53 static gint _vala_array_length (gpointer array);
 54 
 55 
 56 gchar* uri_get_selected (GtkTreeModel* model, GtkTreePath* path, gint col) {
 57 	gchar* result = NULL;
 58 	GtkTreeIter iter = {0};
 59 	GtkTreeModel* _tmp0_;
 60 	GtkTreePath* _tmp1_;
 61 	GtkTreeIter _tmp2_ = {0};
 62 	const gchar* uri = NULL;
 63 	GtkTreeModel* _tmp3_;
 64 	GtkTreeIter _tmp4_;
 65 	gint _tmp5_;
 66 	gchar* _tmp6_;
 67 	g_return_val_if_fail (model != NULL, NULL);
 68 	g_return_val_if_fail (path != NULL, NULL);
 69 	_tmp0_ = model;
 70 	_tmp1_ = path;
 71 	gtk_tree_model_get_iter (_tmp0_, &_tmp2_, _tmp1_);
 72 	iter = _tmp2_;
 73 	_tmp3_ = model;
 74 	_tmp4_ = iter;
 75 	_tmp5_ = col;
 76 	gtk_tree_model_get (_tmp3_, &_tmp4_, _tmp5_, &uri, -1);
 77 	_tmp6_ = g_strdup (uri);
 78 	result = _tmp6_;
 79 	return result;
 80 }
 81 
 82 
 83 static gint string_index_of (const gchar* self, const gchar* needle, gint start_index) {
 84 	gint result = 0;
 85 	gint _tmp0_;
 86 	const gchar* _tmp1_;
 87 	gchar* _tmp2_ = NULL;
 88 	gchar* _result_;
 89 	gchar* _tmp3_;
 90 	g_return_val_if_fail (self != NULL, 0);
 91 	g_return_val_if_fail (needle != NULL, 0);
 92 	_tmp0_ = start_index;
 93 	_tmp1_ = needle;
 94 	_tmp2_ = strstr (((gchar*) self) + _tmp0_, (gchar*) _tmp1_);
 95 	_result_ = _tmp2_;
 96 	_tmp3_ = _result_;
 97 	if (_tmp3_ != NULL) {
 98 		gchar* _tmp4_;
 99 		_tmp4_ = _result_;
100 		result = (gint) (_tmp4_ - ((gchar*) self));
101 		return result;
102 	} else {
103 		result = -1;
104 		return result;
105 	}
106 }
107 
108 
109 void uri_launch (const gchar* uri) {
110 	const gchar* _tmp0_;
111 	gint _tmp1_ = 0;
112 	GError * _inner_error_ = NULL;
113 	g_return_if_fail (uri != NULL);
114 	_tmp0_ = uri;
115 	_tmp1_ = string_index_of (_tmp0_, "://", 0);
116 	if (_tmp1_ < 1) {
117 		const gchar* _tmp2_;
118 		gchar** _tmp3_;
119 		gchar** _tmp4_ = NULL;
120 		gchar** command;
121 		gint command_length1;
122 		gint _command_size_;
123 		gchar** _tmp5_;
124 		gint _tmp5__length1;
125 		const gchar* _tmp6_;
126 		GPid child_pid = 0;
127 		gchar** _tmp7_ = NULL;
128 		gchar** argv;
129 		gint argv_length1;
130 		gint _argv_size_;
131 		gchar** _tmp8_;
132 		gint _tmp8__length1;
133 		gchar** _tmp9_;
134 		gint _tmp9__length1;
135 		const gchar* _tmp10_;
136 		gchar* _tmp11_;
137 		gchar* _tmp12_;
138 		GPid _tmp22_;
139 		_tmp2_ = uri;
140 		_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, " ", 0);
141 		command = _tmp4_;
142 		command_length1 = _vala_array_length (_tmp3_);
143 		_command_size_ = command_length1;
144 		_tmp5_ = command;
145 		_tmp5__length1 = command_length1;
146 		_tmp6_ = _tmp5_[0];
147 		g_debug ("tracker-utils.vala:39: Attempting to spawn_async() '%s'", _tmp6_);
148 		_tmp7_ = g_new0 (gchar*, 1 + 1);
149 		argv = _tmp7_;
150 		argv_length1 = 1;
151 		_argv_size_ = argv_length1;
152 		_tmp8_ = argv;
153 		_tmp8__length1 = argv_length1;
154 		_tmp9_ = command;
155 		_tmp9__length1 = command_length1;
156 		_tmp10_ = _tmp9_[0];
157 		_tmp11_ = g_strdup (_tmp10_);
158 		_g_free0 (_tmp8_[0]);
159 		_tmp8_[0] = _tmp11_;
160 		_tmp12_ = _tmp8_[0];
161 		{
162 			gchar** _tmp13_;
163 			gint _tmp13__length1;
variable '_tmp13__length1' set but not used
(emitted by gcc)
164 GPid _tmp14_ = 0; 165 _tmp13_ = argv; 166 _tmp13__length1 = argv_length1; 167 g_spawn_async ("/usr/bin", _tmp13_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &_tmp14_, &_inner_error_); 168 child_pid = _tmp14_; 169 if (_inner_error_ != NULL) { 170 goto __catch22_g_error; 171 } 172 } 173 goto __finally22; 174 __catch22_g_error: 175 { 176 GError* e = NULL; 177 gchar** _tmp15_; 178 gint _tmp15__length1; 179 const gchar* _tmp16_; 180 GError* _tmp17_; 181 gint _tmp18_; 182 GError* _tmp19_; 183 gint _tmp20_; 184 const gchar* _tmp21_ = NULL; 185 e = _inner_error_; 186 _inner_error_ = NULL; 187 _tmp15_ = command; 188 _tmp15__length1 = command_length1; 189 _tmp16_ = _tmp15_[0]; 190 _tmp17_ = e; 191 _tmp18_ = _tmp17_->code; 192 _tmp19_ = e; 193 _tmp20_ = _tmp19_->code; 194 _tmp21_ = g_strerror (_tmp20_); 195 g_warning ("tracker-utils.vala:53: Could not launch '%s', %d->%s", _tmp16_, _tmp18_, _tmp21_); 196 _g_error_free0 (e); 197 argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); 198 command = (_vala_array_free (command, command_length1, (GDestroyNotify) g_free), NULL); 199 return; 200 } 201 __finally22: 202 if (_inner_error_ != NULL) { 203 argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); 204 command = (_vala_array_free (command, command_length1, (GDestroyNotify) g_free), NULL); 205 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); 206 g_clear_error (&_inner_error_); 207 return; 208 } 209 _tmp22_ = child_pid; 210 g_debug ("tracker-utils.vala:57: Launched application with PID:%d", (gint) _tmp22_); 211 argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); 212 command = (_vala_array_free (command, command_length1, (GDestroyNotify) g_free), NULL); 213 return; 214 } 215 { 216 const gchar* _tmp23_; 217 const gchar* _tmp24_; 218 _tmp23_ = uri; 219 g_debug ("tracker-utils.vala:62: Attempting to launch application for uri:'%s'", _tmp23_); 220 _tmp24_ = uri; 221 g_app_info_launch_default_for_uri (_tmp24_, NULL, &_inner_error_); 222 if (_inner_error_ != NULL) { 223 goto __catch23_g_error; 224 } 225 } 226 goto __finally23; 227 __catch23_g_error: 228 { 229 GError* e = NULL; 230 GError* _tmp25_; 231 const gchar* _tmp26_; 232 gchar* _tmp27_; 233 gchar* _tmp28_; 234 e = _inner_error_; 235 _inner_error_ = NULL; 236 _tmp25_ = e; 237 _tmp26_ = _tmp25_->message; 238 _tmp27_ = g_strconcat ("Could not launch application: ", _tmp26_, NULL); 239 _tmp28_ = _tmp27_; 240 g_warning ("tracker-utils.vala:65: %s", _tmp28_); 241 _g_free0 (_tmp28_); 242 _g_error_free0 (e); 243 } 244 __finally23: 245 if (_inner_error_ != NULL) { 246 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); 247 g_clear_error (&_inner_error_); 248 return; 249 } 250 } 251 252 253 void tracker_model_launch_selected (GtkTreeModel* model, GtkTreePath* path, gint col) { 254 GtkTreeModel* _tmp0_; 255 GtkTreePath* _tmp1_; 256 gint _tmp2_; 257 gchar* _tmp3_ = NULL; 258 gchar* uri; 259 g_return_if_fail (model != NULL); 260 g_return_if_fail (path != NULL); 261 _tmp0_ = model; 262 _tmp1_ = path; 263 _tmp2_ = col; 264 _tmp3_ = uri_get_selected (_tmp0_, _tmp1_, _tmp2_); 265 uri = _tmp3_; 266 g_debug ("tracker-utils.vala:71: Selected uri:'%s'", uri); 267 uri_launch (uri); 268 _g_free0 (uri); 269 } 270 271 272 void tracker_model_launch_selected_parent_dir (GtkTreeModel* model, GtkTreePath* path, gint col) { 273 GtkTreeModel* _tmp0_; 274 GtkTreePath* _tmp1_; 275 gint _tmp2_; 276 gchar* _tmp3_ = NULL; 277 gchar* uri; 278 GFile* _tmp4_ = NULL; 279 GFile* f; 280 GFile* _tmp5_ = NULL; 281 GFile* p; 282 gchar* _tmp6_ = NULL; 283 gchar* parent_uri; 284 g_return_if_fail (model != NULL); 285 g_return_if_fail (path != NULL); 286 _tmp0_ = model; 287 _tmp1_ = path; 288 _tmp2_ = col; 289 _tmp3_ = uri_get_selected (_tmp0_, _tmp1_, _tmp2_); 290 uri = _tmp3_; 291 g_debug ("tracker-utils.vala:78: Selected uri:'%s'", uri); 292 _tmp4_ = g_file_new_for_uri (uri); 293 f = _tmp4_; 294 _tmp5_ = g_file_get_parent (f); 295 p = _tmp5_; 296 _tmp6_ = g_file_get_uri (p); 297 parent_uri = _tmp6_; 298 g_debug ("tracker-utils.vala:84: Parent uri:'%s'", parent_uri); 299 uri_launch (parent_uri); 300 _g_free0 (parent_uri); 301 _g_object_unref0 (p); 302 _g_object_unref0 (f); 303 _g_free0 (uri); 304 } 305 306 307 static gchar* g_time_format (struct tm *self, const gchar* format) { 308 gchar* result = NULL; 309 gchar* _tmp0_ = NULL; 310 gchar* buffer; 311 gint buffer_length1; 312 gint _buffer_size_; 313 gchar* _tmp1_; 314 gint _tmp1__length1; 315 const gchar* _tmp2_; 316 gchar* _tmp3_; 317 gint _tmp3__length1;
variable '_tmp3__length1' set but not used
(emitted by gcc)
318 gchar* _tmp4_; 319 g_return_val_if_fail (format != NULL, NULL); 320 _tmp0_ = g_new0 (gchar, 64); 321 buffer = _tmp0_; 322 buffer_length1 = 64; 323 _buffer_size_ = buffer_length1; 324 _tmp1_ = buffer; 325 _tmp1__length1 = buffer_length1; 326 _tmp2_ = format; 327 strftime (_tmp1_, _tmp1__length1, _tmp2_, &(*self)); 328 _tmp3_ = buffer; 329 _tmp3__length1 = buffer_length1; 330 _tmp4_ = g_strdup ((const gchar*) _tmp3_); 331 result = _tmp4_; 332 buffer = (g_free (buffer), NULL); 333 return result; 334 } 335 336 337 gchar* tracker_time_format_from_iso8601 (const gchar* s) { 338 gchar* result = NULL; 339 struct tm t = {0}; 340 const gchar* _tmp0_; 341 GTimeVal tv_now = {0}; 342 GTimeVal tv_then = {0}; 343 const gchar* _tmp1_; 344 GTimeVal _tmp2_; 345 glong _tmp3_; 346 GTimeVal _tmp4_; 347 glong _tmp5_; 348 glong diff_sec; 349 glong _tmp6_; 350 glong diff_days; 351 glong _tmp7_; 352 glong _tmp8_ = 0L; 353 glong diff_days_abs; 354 glong _tmp9_; 355 glong _tmp12_; 356 g_return_val_if_fail (s != NULL, NULL); 357 memset (&t, 0, sizeof (struct tm)); 358 _tmp0_ = s; 359 strptime (_tmp0_, "%FT%T", &t); 360 g_get_current_time (&tv_now); 361 g_get_current_time (&tv_now); 362 g_get_current_time (&tv_then); 363 _tmp1_ = s; 364 g_time_val_from_iso8601 (_tmp1_, &tv_then); 365 _tmp2_ = tv_now; 366 _tmp3_ = _tmp2_.tv_sec; 367 _tmp4_ = tv_then; 368 _tmp5_ = _tmp4_.tv_sec; 369 diff_sec = _tmp3_ - _tmp5_; 370 _tmp6_ = diff_sec; 371 diff_days = _tmp6_ / secs_per_day; 372 _tmp7_ = diff_days; 373 _tmp8_ = labs (_tmp7_); 374 diff_days_abs = _tmp8_; 375 _tmp9_ = diff_days_abs; 376 if (_tmp9_ > ((glong) 7)) { 377 const gchar* _tmp10_ = NULL; 378 gchar* _tmp11_ = NULL; 379 _tmp10_ = _ ("%x"); 380 _tmp11_ = g_time_format (&t, _tmp10_); 381 result = _tmp11_; 382 return result; 383 } 384 _tmp12_ = diff_days_abs; 385 if (_tmp12_ == ((glong) 0)) { 386 const gchar* _tmp13_ = NULL; 387 gchar* _tmp14_; 388 _tmp13_ = _ ("Today"); 389 _tmp14_ = g_strdup (_tmp13_); 390 result = _tmp14_; 391 return result; 392 } else { 393 gboolean future; 394 glong _tmp15_; 395 glong _tmp16_; 396 future = FALSE; 397 _tmp15_ = diff_days; 398 if (_tmp15_ < ((glong) 0)) { 399 future = TRUE; 400 } 401 _tmp16_ = diff_days; 402 if (_tmp16_ <= ((glong) 1)) { 403 gboolean _tmp17_; 404 _tmp17_ = future; 405 if (_tmp17_) { 406 const gchar* _tmp18_ = NULL; 407 gchar* _tmp19_; 408 _tmp18_ = _ ("Tomorrow"); 409 _tmp19_ = g_strdup (_tmp18_); 410 result = _tmp19_; 411 return result; 412 } else { 413 const gchar* _tmp20_ = NULL; 414 gchar* _tmp21_; 415 _tmp20_ = _ ("Yesterday"); 416 _tmp21_ = g_strdup (_tmp20_); 417 result = _tmp21_; 418 return result; 419 } 420 } else { 421 gboolean _tmp22_; 422 _tmp22_ = future; 423 if (_tmp22_) { 424 glong _tmp23_; 425 const gchar* _tmp24_ = NULL; 426 glong _tmp25_; 427 gchar* _tmp26_ = NULL; 428 _tmp23_ = diff_days_abs; 429 _tmp24_ = ngettext ("%ld day from now", "%ld days from now", (gulong) _tmp23_); 430 _tmp25_ = diff_days_abs; 431 _tmp26_ = g_strdup_printf (_tmp24_, _tmp25_); 432 result = _tmp26_; 433 return result; 434 } else { 435 glong _tmp27_; 436 const gchar* _tmp28_ = NULL; 437 glong _tmp29_; 438 gchar* _tmp30_ = NULL; 439 _tmp27_ = diff_days_abs; 440 _tmp28_ = ngettext ("%ld day ago", "%ld days ago", (gulong) _tmp27_); 441 _tmp29_ = diff_days_abs; 442 _tmp30_ = g_strdup_printf (_tmp28_, _tmp29_); 443 result = _tmp30_; 444 return result; 445 } 446 } 447 } 448 } 449 450 451 gchar* tracker_time_format_from_seconds (const gchar* seconds_str) { 452 gchar* result = NULL; 453 const gchar* _tmp0_; 454 gint _tmp1_ = 0; 455 gdouble seconds; 456 gdouble total = 0.0; 457 gint d = 0; 458 gint h = 0; 459 gint m = 0; 460 gint s = 0; 461 gdouble _tmp2_; 462 gdouble _tmp5_; 463 gdouble _tmp6_; 464 gdouble _tmp7_; 465 gdouble _tmp8_; 466 gdouble _tmp9_; 467 gdouble _tmp10_; 468 gdouble _tmp11_; 469 GString* _tmp12_; 470 GString* output; 471 gint _tmp13_; 472 gint _tmp18_; 473 gint _tmp23_; 474 const gchar* _tmp31_ = NULL; 475 gint _tmp32_; 476 GString* _tmp33_; 477 const gchar* _tmp34_; 478 gint _tmp35_; 479 gchar* _tmp36_ = NULL; 480 gchar* _tmp37_; 481 GString* _tmp38_; 482 gssize _tmp39_; 483 GString* _tmp42_; 484 const gchar* _tmp43_; 485 gchar* _tmp44_; 486 gchar* str; 487 const gchar* _tmp45_; 488 const gchar* _tmp46_ = NULL; 489 gchar* _tmp47_; 490 g_return_val_if_fail (seconds_str != NULL, NULL); 491 _tmp0_ = seconds_str; 492 _tmp1_ = atoi (_tmp0_); 493 seconds = (gdouble) _tmp1_; 494 _tmp2_ = seconds; 495 if (_tmp2_ == 0.0) { 496 const gchar* _tmp3_ = NULL; 497 gchar* _tmp4_; 498 _tmp3_ = _ ("Less than one second"); 499 _tmp4_ = g_strdup (_tmp3_); 500 result = _tmp4_; 501 return result; 502 } 503 _tmp5_ = seconds; 504 total = _tmp5_; 505 _tmp6_ = total; 506 s = ((gint) _tmp6_) % 60; 507 _tmp7_ = total; 508 total = _tmp7_ / 60; 509 _tmp8_ = total; 510 m = ((gint) _tmp8_) % 60; 511 _tmp9_ = total; 512 total = _tmp9_ / 60; 513 _tmp10_ = total; 514 h = ((gint) _tmp10_) % 24; 515 _tmp11_ = total; 516 d = ((gint) _tmp11_) / 24; 517 _tmp12_ = g_string_new (""); 518 output = _tmp12_; 519 _tmp13_ = d; 520 if (_tmp13_ > 0) { 521 GString* _tmp14_; 522 gint _tmp15_; 523 gchar* _tmp16_ = NULL; 524 gchar* _tmp17_; 525 _tmp14_ = output; 526 _tmp15_ = d; 527 _tmp16_ = g_strdup_printf (" %dd", _tmp15_); 528 _tmp17_ = _tmp16_; 529 g_string_append (_tmp14_, _tmp17_); 530 _g_free0 (_tmp17_); 531 } 532 _tmp18_ = h; 533 if (_tmp18_ > 0) { 534 GString* _tmp19_; 535 gint _tmp20_; 536 gchar* _tmp21_ = NULL; 537 gchar* _tmp22_; 538 _tmp19_ = output; 539 _tmp20_ = h; 540 _tmp21_ = g_strdup_printf (" %.2d", _tmp20_); 541 _tmp22_ = _tmp21_; 542 g_string_append (_tmp19_, _tmp22_); 543 _g_free0 (_tmp22_); 544 } 545 _tmp23_ = m; 546 if (_tmp23_ > 0) { 547 const gchar* _tmp24_ = NULL; 548 gint _tmp25_; 549 GString* _tmp26_; 550 const gchar* _tmp27_; 551 gint _tmp28_; 552 gchar* _tmp29_ = NULL; 553 gchar* _tmp30_; 554 _tmp25_ = h; 555 if (_tmp25_ > 0) { 556 _tmp24_ = ":"; 557 } else { 558 _tmp24_ = ""; 559 } 560 _tmp26_ = output; 561 _tmp27_ = _tmp24_; 562 _tmp28_ = m; 563 _tmp29_ = g_strdup_printf ("%s%.2d", _tmp27_, _tmp28_); 564 _tmp30_ = _tmp29_; 565 g_string_append (_tmp26_, _tmp30_); 566 _g_free0 (_tmp30_); 567 } 568 _tmp32_ = m; 569 if (_tmp32_ > 0) { 570 _tmp31_ = ":"; 571 } else { 572 _tmp31_ = "0:"; 573 } 574 _tmp33_ = output; 575 _tmp34_ = _tmp31_; 576 _tmp35_ = s; 577 _tmp36_ = g_strdup_printf ("%s%.2d", _tmp34_, _tmp35_); 578 _tmp37_ = _tmp36_; 579 g_string_append (_tmp33_, _tmp37_); 580 _g_free0 (_tmp37_); 581 _tmp38_ = output; 582 _tmp39_ = _tmp38_->len; 583 if (_tmp39_ < ((gssize) 1)) { 584 const gchar* _tmp40_ = NULL; 585 gchar* _tmp41_; 586 _tmp40_ = _ ("Less than one second"); 587 _tmp41_ = g_strdup (_tmp40_); 588 result = _tmp41_; 589 _g_string_free0 (output); 590 return result; 591 } 592 _tmp42_ = output; 593 _tmp43_ = _tmp42_->str; 594 _tmp44_ = g_strdup (_tmp43_); 595 str = _tmp44_; 596 _tmp45_ = str; 597 _tmp46_ = g_strchug (_tmp45_);
passing argument 1 of 'g_strchug' discards 'const' qualifier from pointer target type [enabled by default]
(emitted by gcc)
598 _tmp47_ = g_strdup (_tmp46_); 599 result = _tmp47_; 600 _g_free0 (str); 601 _g_string_free0 (output); 602 return result; 603 } 604 605 606 static gpointer _g_object_ref0 (gpointer self) { 607 return self ? g_object_ref (self) : NULL; 608 } 609 610 611 GdkPixbuf* tracker_pixbuf_new_from_file (GtkIconTheme* theme, const gchar* filename, gint size, gboolean is_image) { 612 GdkPixbuf* result = NULL; 613 const gchar* _tmp0_; 614 GFile* _tmp1_ = NULL; 615 GFile* file; 616 GdkPixbuf* _tmp2_; 617 GdkPixbuf* pixbuf; 618 gboolean _tmp3_; 619 GFile* _tmp17_; 620 gboolean _tmp18_ = FALSE; 621 GdkPixbuf* _tmp50_; 622 GtkIconTheme* _tmp51_; 623 gint _tmp52_; 624 GdkPixbuf* _tmp53_ = NULL; 625 GError * _inner_error_ = NULL; 626 g_return_val_if_fail (theme != NULL, NULL); 627 g_return_val_if_fail (filename != NULL, NULL); 628 _tmp0_ = filename; 629 _tmp1_ = g_file_new_for_uri (_tmp0_); 630 file = _tmp1_; 631 _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (NULL, GDK_TYPE_PIXBUF) ? ((GdkPixbuf*) NULL) : NULL); 632 pixbuf = _tmp2_; 633 _tmp3_ = is_image; 634 if (_tmp3_) { 635 GdkPixbuf* _tmp16_; 636 { 637 GFile* _tmp4_; 638 gchar* _tmp5_ = NULL; 639 gchar* _tmp6_; 640 gint _tmp7_; 641 gint _tmp8_; 642 GdkPixbuf* _tmp9_; 643 GdkPixbuf* _tmp10_; 644 GdkPixbuf* _tmp11_; 645 _tmp4_ = file; 646 _tmp5_ = g_file_get_path (_tmp4_); 647 _tmp6_ = _tmp5_; 648 _tmp7_ = size; 649 _tmp8_ = size; 650 _tmp9_ = gdk_pixbuf_new_from_file_at_size (_tmp6_, _tmp7_, _tmp8_, &_inner_error_); 651 _tmp10_ = _tmp9_; 652 _g_free0 (_tmp6_); 653 _tmp11_ = _tmp10_; 654 if (_inner_error_ != NULL) { 655 goto __catch24_g_error; 656 } 657 _g_object_unref0 (pixbuf); 658 pixbuf = _tmp11_; 659 } 660 goto __finally24; 661 __catch24_g_error: 662 { 663 GError* e = NULL; 664 GError* _tmp12_; 665 const gchar* _tmp13_; 666 gchar* _tmp14_; 667 gchar* _tmp15_; 668 e = _inner_error_; 669 _inner_error_ = NULL; 670 _tmp12_ = e; 671 _tmp13_ = _tmp12_->message; 672 _tmp14_ = g_strconcat ("Error loading icon pixbuf: ", _tmp13_, NULL); 673 _tmp15_ = _tmp14_; 674 g_warning ("tracker-utils.vala:188: %s", _tmp15_); 675 _g_free0 (_tmp15_); 676 _g_error_free0 (e); 677 } 678 __finally24: 679 if (_inner_error_ != NULL) { 680 _g_object_unref0 (pixbuf); 681 _g_object_unref0 (file); 682 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); 683 g_clear_error (&_inner_error_); 684 return NULL; 685 } 686 _tmp16_ = pixbuf; 687 if (_tmp16_ != NULL) { 688 result = pixbuf; 689 _g_object_unref0 (file); 690 return result; 691 } 692 } 693 _tmp17_ = file; 694 _tmp18_ = g_file_query_exists (_tmp17_, NULL); 695 if (_tmp18_) { 696 { 697 GFile* _tmp19_; 698 GFileInfo* _tmp20_ = NULL; 699 GFileInfo* file_info; 700 GFileInfo* _tmp21_; 701 _tmp19_ = file; 702 _tmp20_ = g_file_query_info (_tmp19_, "standard::icon", G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_); 703 file_info = _tmp20_; 704 if (_inner_error_ != NULL) { 705 goto __catch25_g_error; 706 } 707 _tmp21_ = file_info; 708 if (_tmp21_ != NULL) { 709 GFileInfo* _tmp22_; 710 GIcon* _tmp23_ = NULL; 711 GIcon* _tmp24_; 712 GIcon* icon; 713 _tmp22_ = file_info; 714 _tmp23_ = g_file_info_get_icon (_tmp22_); 715 _tmp24_ = _g_object_ref0 (_tmp23_); 716 icon = _tmp24_; 717 { 718 GIcon* _tmp25_; 719 _tmp25_ = icon; 720 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp25_, g_file_icon_get_type ())) { 721 GIcon* _tmp26_; 722 GFile* _tmp27_ = NULL; 723 gchar* _tmp28_ = NULL; 724 gchar* _tmp29_; 725 GdkPixbuf* _tmp30_; 726 GdkPixbuf* _tmp31_; 727 GdkPixbuf* _tmp32_; 728 _tmp26_ = icon; 729 _tmp27_ = g_file_icon_get_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, g_file_icon_get_type (), GFileIcon)); 730 _tmp28_ = g_file_get_path (_tmp27_); 731 _tmp29_ = _tmp28_; 732 _tmp30_ = gdk_pixbuf_new_from_file (_tmp29_, &_inner_error_); 733 _tmp31_ = _tmp30_; 734 _g_free0 (_tmp29_); 735 _tmp32_ = _tmp31_; 736 if (_inner_error_ != NULL) { 737 goto __catch26_g_error; 738 } 739 _g_object_unref0 (pixbuf); 740 pixbuf = _tmp32_; 741 } else { 742 GIcon* _tmp33_; 743 _tmp33_ = icon; 744 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp33_, g_themed_icon_get_type ())) { 745 GtkIconTheme* _tmp34_; 746 GIcon* _tmp35_; 747 gchar** _tmp36_; 748 gchar** _tmp37_ = NULL; 749 const gchar* _tmp38_; 750 gint _tmp39_; 751 GdkPixbuf* _tmp40_ = NULL; 752 GdkPixbuf* _tmp41_; 753 _tmp34_ = theme; 754 _tmp35_ = icon; 755 _tmp37_ = _tmp36_ = g_themed_icon_get_names (G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, g_themed_icon_get_type (), GThemedIcon));
assignment from incompatible pointer type [enabled by default]
(emitted by gcc)
756 _tmp38_ = _tmp37_[0]; 757 _tmp39_ = size; 758 _tmp40_ = gtk_icon_theme_load_icon (_tmp34_, _tmp38_, _tmp39_, GTK_ICON_LOOKUP_USE_BUILTIN, &_inner_error_); 759 _tmp41_ = _tmp40_; 760 if (_inner_error_ != NULL) { 761 goto __catch26_g_error; 762 } 763 _g_object_unref0 (pixbuf); 764 pixbuf = _tmp41_; 765 } 766 } 767 } 768 goto __finally26; 769 __catch26_g_error: 770 { 771 GError* e = NULL; 772 GError* _tmp42_; 773 const gchar* _tmp43_; 774 gchar* _tmp44_; 775 gchar* _tmp45_; 776 e = _inner_error_; 777 _inner_error_ = NULL; 778 _tmp42_ = e; 779 _tmp43_ = _tmp42_->message; 780 _tmp44_ = g_strconcat ("Error loading icon pixbuf: ", _tmp43_, NULL); 781 _tmp45_ = _tmp44_; 782 g_warning ("tracker-utils.vala:212: %s", _tmp45_); 783 _g_free0 (_tmp45_); 784 _g_error_free0 (e); 785 } 786 __finally26: 787 if (_inner_error_ != NULL) { 788 _g_object_unref0 (icon); 789 _g_object_unref0 (file_info); 790 goto __catch25_g_error; 791 } 792 _g_object_unref0 (icon); 793 } 794 _g_object_unref0 (file_info); 795 } 796 goto __finally25; 797 __catch25_g_error: 798 { 799 GError* e = NULL; 800 GError* _tmp46_; 801 const gchar* _tmp47_; 802 gchar* _tmp48_; 803 gchar* _tmp49_; 804 e = _inner_error_; 805 _inner_error_ = NULL; 806 _tmp46_ = e; 807 _tmp47_ = _tmp46_->message; 808 _tmp48_ = g_strconcat ("Error looking up file for pixbuf: ", _tmp47_, NULL); 809 _tmp49_ = _tmp48_; 810 g_warning ("tracker-utils.vala:216: %s", _tmp49_); 811 _g_free0 (_tmp49_); 812 _g_error_free0 (e); 813 } 814 __finally25: 815 if (_inner_error_ != NULL) { 816 _g_object_unref0 (pixbuf); 817 _g_object_unref0 (file); 818 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); 819 g_clear_error (&_inner_error_); 820 return NULL; 821 } 822 } 823 _tmp50_ = pixbuf; 824 if (_tmp50_ != NULL) { 825 result = pixbuf; 826 _g_object_unref0 (file); 827 return result; 828 } 829 _tmp51_ = theme; 830 _tmp52_ = size; 831 _tmp53_ = tracker_pixbuf_new_from_name (_tmp51_, "text-x-generic", _tmp52_); 832 result = _tmp53_; 833 _g_object_unref0 (pixbuf); 834 _g_object_unref0 (file); 835 return result; 836 } 837 838 839 GdkPixbuf* tracker_pixbuf_new_from_name (GtkIconTheme* theme, const gchar* name, gint size) { 840 GdkPixbuf* result = NULL; 841 GdkPixbuf* _tmp0_; 842 GdkPixbuf* pixbuf; 843 GError * _inner_error_ = NULL; 844 g_return_val_if_fail (theme != NULL, NULL); 845 g_return_val_if_fail (name != NULL, NULL); 846 _tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (NULL, GDK_TYPE_PIXBUF) ? ((GdkPixbuf*) NULL) : NULL); 847 pixbuf = _tmp0_; 848 { 849 GtkIconTheme* _tmp1_; 850 const gchar* _tmp2_; 851 gint _tmp3_; 852 GdkPixbuf* _tmp4_ = NULL; 853 GdkPixbuf* _tmp5_; 854 _tmp1_ = theme; 855 _tmp2_ = name; 856 _tmp3_ = size; 857 _tmp4_ = gtk_icon_theme_load_icon (_tmp1_, _tmp2_, _tmp3_, GTK_ICON_LOOKUP_USE_BUILTIN, &_inner_error_); 858 _tmp5_ = _tmp4_; 859 if (_inner_error_ != NULL) { 860 goto __catch27_g_error; 861 } 862 _g_object_unref0 (pixbuf); 863 pixbuf = _tmp5_; 864 } 865 goto __finally27; 866 __catch27_g_error: 867 { 868 GError* e = NULL; 869 const gchar* _tmp6_; 870 GError* _tmp7_; 871 const gchar* _tmp8_; 872 e = _inner_error_; 873 _inner_error_ = NULL; 874 _tmp6_ = name; 875 _tmp7_ = e; 876 _tmp8_ = _tmp7_->message; 877 g_warning ("tracker-utils.vala:234: Could not load default icon pixbuf from theme " \ 878 "for '%s': %s", _tmp6_, _tmp8_); 879 _g_error_free0 (e); 880 } 881 __finally27: 882 if (_inner_error_ != NULL) { 883 _g_object_unref0 (pixbuf); 884 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); 885 g_clear_error (&_inner_error_); 886 return NULL; 887 } 888 result = pixbuf; 889 return result; 890 } 891 892 893 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { 894 if ((array != NULL) && (destroy_func != NULL)) { 895 int i; 896 for (i = 0; i < array_length; i = i + 1) { 897 if (((gpointer*) array)[i] != NULL) { 898 destroy_func (((gpointer*) array)[i]); 899 } 900 } 901 } 902 } 903 904 905 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { 906 _vala_array_destroy (array, array_length, destroy_func); 907 g_free (array); 908 } 909 910 911 static gint _vala_array_length (gpointer array) { 912 int length; 913 length = 0; 914 if (array) { 915 while (((gpointer*) array)[length]) { 916 length++; 917 } 918 } 919 return length; 920 }