[beast] BSE: const fixups
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast] BSE: const fixups
- Date: Fri, 6 Apr 2012 02:12:45 +0000 (UTC)
commit bb18b201c2d874da5a5b8be2c0076e6d9203e9c8
Author: Tim Janik <timj gnu org>
Date: Fri Apr 6 04:11:49 2012 +0200
BSE: const fixups
bse/bseautodoc.cc | 4 ++--
bse/bsecategories.cc | 31 +++++++++++++++----------------
bse/bsecontainer.cc | 17 ++++++++---------
bse/bsecxxvalue.cc | 2 +-
bse/bsecxxvalue.hh | 4 ++--
bse/bseglue.cc | 4 ++--
bse/bseitem.cc | 8 ++++----
7 files changed, 34 insertions(+), 36 deletions(-)
---
diff --git a/bse/bseautodoc.cc b/bse/bseautodoc.cc
index 23eeab0..9a8f17a 100644
--- a/bse/bseautodoc.cc
+++ b/bse/bseautodoc.cc
@@ -66,7 +66,7 @@ tag_all_boxed_pspecs (void)
if (element)
{
g_param_spec_ref (element);
- g_param_spec_set_qdata (element, boxed_type_tag, g_type_name (children[i]));
+ g_param_spec_set_qdata (element, boxed_type_tag, const_cast<char*> (g_type_name (children[i])));
}
else if (rfields.n_fields)
{
@@ -74,7 +74,7 @@ tag_all_boxed_pspecs (void)
for (j = 0; j < rfields.n_fields; j++)
{
g_param_spec_ref (rfields.fields[j]);
- g_param_spec_set_qdata (rfields.fields[j], boxed_type_tag, g_type_name (children[i]));
+ g_param_spec_set_qdata (rfields.fields[j], boxed_type_tag, const_cast<char*> (g_type_name (children[i])));
}
}
}
diff --git a/bse/bsecategories.cc b/bse/bsecategories.cc
index 1df9ff3..b980d65 100644
--- a/bse/bsecategories.cc
+++ b/bse/bsecategories.cc
@@ -228,9 +228,9 @@ centries_strorder (gconstpointer a,
{
const CEntry *e1 = (const CEntry*) a;
const CEntry *e2 = (const CEntry*) b;
- gchar *c1 = g_quark_to_string (e1->category);
- gchar *c2 = g_quark_to_string (e2->category);
-
+ const char *c1 = g_quark_to_string (e1->category);
+ const char *c2 = g_quark_to_string (e2->category);
+
return strcmp (c2, c1);
}
@@ -268,28 +268,28 @@ categories_match (const gchar *pattern,
BseCategorySeq *cseq = bse_category_seq_new ();
GPatternSpec *pspec = g_pattern_spec_new (pattern);
CEntry *centry;
-
+
for (centry = cat_entries; centry; centry = centry->next)
{
- gchar *category = g_quark_to_string (centry->category);
-
+ const char *category = g_quark_to_string (centry->category);
+
if (g_pattern_match_string (pspec, category) &&
(!base_type || g_type_is_a (centry->type, base_type)))
{
BseCategory cat = { 0, };
-
- cat.category = category;
+
+ cat.category = const_cast<char*> (category);
cat.category_id = centry->category_id;
cat.mindex = centry->mindex;
cat.lindex = centry->lindex;
- cat.type = g_type_name (centry->type);
+ cat.type = const_cast<char*> (g_type_name (centry->type));
cat.icon = centry->icon ? centry->icon : NULL;
if (!check || check (&cat, data))
bse_category_seq_append (cseq, &cat);
}
}
g_pattern_spec_free (pspec);
-
+
return cseq;
}
@@ -321,18 +321,17 @@ BseCategorySeq*
bse_categories_from_type (GType type)
{
BseCategorySeq *cseq = bse_category_seq_new ();
- CEntry *centry;
-
- for (centry = cat_entries; centry; centry = centry->next)
+
+ for (CEntry *centry = cat_entries; centry; centry = centry->next)
if (centry->type == type)
{
BseCategory cat = { 0, };
-
- cat.category = g_quark_to_string (centry->category);
+
+ cat.category = const_cast<char*> (g_quark_to_string (centry->category));
cat.category_id = centry->category_id;
cat.mindex = centry->mindex;
cat.lindex = centry->lindex;
- cat.type = g_type_name (centry->type);
+ cat.type = const_cast<char*> (g_type_name (centry->type));
cat.icon = centry->icon ? centry->icon : NULL;
bse_category_seq_append (cseq, &cat);
}
diff --git a/bse/bsecontainer.cc b/bse/bsecontainer.cc
index f581318..7f24aa9 100644
--- a/bse/bsecontainer.cc
+++ b/bse/bsecontainer.cc
@@ -233,29 +233,28 @@ bse_container_add_item (BseContainer *container,
BseItem *item)
{
BseUndoStack *ustack;
- gchar *uname;
-
+
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (item->parent == NULL);
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->add_item != NULL); /* paranoid */
-
+
g_object_ref (container);
g_object_ref (item);
ustack = bse_item_undo_open (container, "add-child-noundo");
bse_undo_stack_ignore_steps (ustack);
g_object_freeze_notify (G_OBJECT (container));
g_object_freeze_notify (G_OBJECT (item));
-
- uname = BSE_OBJECT_UNAME (item);
-
+
+ const char *uname = BSE_OBJECT_UNAME (item);
+
/* ensure uniqueness of item unames within a container
*/
if (!uname || bse_container_lookup_item (container, uname))
{
gchar *buffer, *p;
guint i = 0, l;
-
+
if (!uname)
uname = (char*) g_object_get_data (G_OBJECT (container), "BseContainer-base-name");
if (!uname)
@@ -274,7 +273,7 @@ bse_container_add_item (BseContainer *container,
do
g_snprintf (p, 11, "-%u", ++i);
while (bse_container_lookup_item (container, buffer));
-
+
g_object_set (item, "uname", buffer, NULL); /* no undo */
g_free (buffer);
}
@@ -283,7 +282,7 @@ bse_container_add_item (BseContainer *container,
BSE_CONTAINER_GET_CLASS (container)->add_item (container, item);
if (item->parent != NULL)
g_signal_emit (container, container_signals[SIGNAL_ITEM_ADDED], 0, item);
-
+
g_object_thaw_notify (G_OBJECT (item));
g_object_thaw_notify (G_OBJECT (container));
bse_undo_stack_unignore_steps (ustack);
diff --git a/bse/bsecxxvalue.cc b/bse/bsecxxvalue.cc
index 96ef6e4..6893055 100644
--- a/bse/bsecxxvalue.cc
+++ b/bse/bsecxxvalue.cc
@@ -51,7 +51,7 @@ Value::get_real () const
throw WrongTypeGValue (G_STRLOC);
}
-const SfiString
+const char*
Value::get_string () const
{
GValue *v = gvalue();
diff --git a/bse/bsecxxvalue.hh b/bse/bsecxxvalue.hh
index a06b5e3..f5577a1 100644
--- a/bse/bsecxxvalue.hh
+++ b/bse/bsecxxvalue.hh
@@ -31,8 +31,8 @@ struct Value : GValue {
SfiInt get_enum () const { return get_num(); }
SfiNum get_num () const;
SfiReal get_real () const;
- const SfiString get_string () const;
- const SfiString get_choice () const { return get_string(); }
+ const char* get_string () const;
+ const char* get_choice () const { return get_string(); }
gpointer get_pointer () const;
CxxBase* get_base () const;
GObject* get_object () const;
diff --git a/bse/bseglue.cc b/bse/bseglue.cc
index 93daf77..8de73d9 100644
--- a/bse/bseglue.cc
+++ b/bse/bseglue.cc
@@ -959,7 +959,7 @@ bclosure_notify_marshal (GClosure *closure,
{
BClosure *bclosure = (BClosure*) closure;
BContext *bcontext = (BContext*) closure->data;
- char *signal = g_quark_to_string (bclosure->qsignal);
+ const char *csignal = g_quark_to_string (bclosure->qsignal);
SfiSeq *args = sfi_seq_new ();
BseItem *item;
uint nref_id = bcontext_new_notify_ref (bcontext);
@@ -973,7 +973,7 @@ bclosure_notify_marshal (GClosure *closure,
bcontext_notify_ref_add_item (bcontext, nref_id, item);
pspec = sfi_value_get_pspec (param_values + 1);
sfi_seq_append_string (args, pspec->name);
- signal = g_strconcat ("property-", signal, NULL);
+ char *signal = g_strconcat ("property-", csignal, NULL);
bcontext_queue_signal (bcontext, nref_id, signal, args);
g_free (signal);
sfi_seq_unref (args);
diff --git a/bse/bseitem.cc b/bse/bseitem.cc
index 380a273..215b3c5 100644
--- a/bse/bseitem.cc
+++ b/bse/bseitem.cc
@@ -745,15 +745,15 @@ find_method_procedure (GType object_type,
GType proc_type, type = object_type; /* assumed to be *derived* from BSE_TYPE_ITEM */
do
{
- char *name, *type_name = g_type_name (type);
+ const char *type_name = g_type_name (type);
uint l1 = strlen (type_name);
-
- name = g_new (char, l1 + 1 + l2 + 1);
+
+ char *name = g_new (char, l1 + 1 + l2 + 1);
memcpy (name, type_name, l1);
name[l1] = '+';
memcpy (name + l1 + 1, method_name, l2);
name[l1 + 1 + l2] = 0;
-
+
proc_type = bse_procedure_lookup (name);
g_free (name);
if (proc_type)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]