hythmbox-2.98/metadata/rb-metadata-dbus.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found rb-metadata-dbus.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found rb-metadata-dbus.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
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  *  Copyright (C) 2006 Jonathan Matthew <jonathan@kaolin.hn.org>
  3  *
  4  *  This program is free software; you can redistribute it and/or modify
  5  *  it under the terms of the GNU General Public License as published by
  6  *  the Free Software Foundation; either version 2 of the License, or
  7  *  (at your option) any later version.
  8  *
  9  *  The Rhythmbox authors hereby grant permission for non-GPL compatible
 10  *  GStreamer plugins to be used and distributed together with GStreamer
 11  *  and Rhythmbox. This permission is above and beyond the permissions granted
 12  *  by the GPL license by which Rhythmbox is covered. If you modify this code
 13  *  you may extend this exception to your version of the code, but you are not
 14  *  obligated to do so. If you do not wish to do so, delete this exception
 15  *  statement from your version.
 16  *
 17  *  This program is distributed in the hope that it will be useful,
 18  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20  *  GNU General Public License for more details.
 21  *
 22  *  You should have received a copy of the GNU General Public License
 23  *  along with this program; if not, write to the Free Software
 24  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 25  *
 26  */
 27 
 28 /*
 29  * Common junk for the out-of-process metadata reader.
 30  */
 31 
 32 #include <config.h>
 33 #include <glib.h>
 34 
 35 #include "rb-metadata.h"
 36 #include "rb-metadata-dbus.h"
 37 #include "rb-debug.h"
 38 
 39 const char *rb_metadata_iface_xml =
 40 "<node>								"
 41 "  <interface name='org.gnome.Rhythmbox3.Metadata'>		"
 42 "    <method name='ping'>					"
 43 "      <arg direction='out' type='b' name='ok'/>		"
 44 "    </method>							"
 45 "    <method name='load'>					"
 46 "      <arg direction='in' type='s' name='uri'/>		"
 47 "      <arg direction='out' type='as' name='missingPlugins'/>	"
 48 "      <arg direction='out' type='as' name='pluginDescriptions'/> "
 49 "      <arg direction='out' type='b' name='hasAudio'/>		"
 50 "      <arg direction='out' type='b' name='hasVideo'/>		"
 51 "      <arg direction='out' type='b' name='hasOtherData'/>	"
 52 "      <arg direction='out' type='s' name='mediaType'/>		"
 53 "      <arg direction='out' type='b' name='ok'/>		"
 54 "      <arg direction='out' type='i' name='errorCode'/>		"
 55 "      <arg direction='out' type='s' name='errorString'/>	"
 56 "      <arg direction='out' type='a{iv}' name='metadata'/>	"
 57 "    </method>							"
 58 "    <method name='getSaveableTypes'>				"
 59 "      <arg direction='out' type='as' name='types'/>		"
 60 "    </method>							"
 61 "    <method name='save'>					"
 62 "      <arg direction='in' type='s' name='uri'/>		"
 63 "      <arg direction='in' type='a{iv}' name='metadata'/>	"
 64 "      <arg direction='out' type='b' name='ok'/>		"
 65 "      <arg direction='out' type='i' name='errorCode'/>		"
 66 "      <arg direction='out' type='s' name='errorString'/>	"
 67 "    </method>							"
 68 "  </interface>							"
 69 "</node>";
 70 
 71 GVariantBuilder *
 72 rb_metadata_dbus_get_variant_builder (RBMetaData *md)
 73 {
 74 	GVariantBuilder *b;
 75 	RBMetaDataField field;
 76 	int count = 0;
 77 
 78 	b = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
 79 	for (field = RB_METADATA_FIELD_TITLE; field < RB_METADATA_FIELD_LAST; field++) {
 80 		GValue v = {0,};
 81 		GVariant *value;
 82 
 83 		if (!rb_metadata_get (md, field, &v))
 84 			continue;
 85 
 86 		if (G_VALUE_HOLDS_STRING (&v)) {
 87 			value = g_variant_new_string (g_value_get_string (&v));
 88 		} else if (G_VALUE_HOLDS_ULONG (&v)) {
 89 			value = g_variant_new_uint32 (g_value_get_ulong (&v));
 90 		} else if (G_VALUE_HOLDS_DOUBLE (&v)) {
 91 			value = g_variant_new_double (g_value_get_double (&v));
 92 		} else {
 93 			g_assert_not_reached ();
 94 		}
 95 		g_value_unset (&v);
 96 
 97 		g_variant_builder_add (b, "{iv}", field, value);
 98 		count++;
 99 	}
100 
101 	/* make sure there's at least one entry in the map so we can
102 	 * build the response message.
103 	 */
104 	if (count == 0) {
105 		g_variant_builder_add (b, "{iv}", RB_METADATA_FIELD_TRACK_NUMBER, g_variant_new_uint32 (0));
106 	}
107 
108 	return b;
109 }