[beast/devel: 1/15] SFI: compile glib-extra as C++



commit 8e5a5b8e5d2862522fa1b56d0735215e4d519b23
Author: Tim Janik <timj gnu org>
Date:   Sun Dec 16 01:32:46 2012 +0100

    SFI: compile glib-extra as C++

 sfi/Makefile.am                     |    9 ++++-----
 sfi/{glib-extra.c => glib-extra.cc} |   34 ++++++++++++++++------------------
 sfi/sfidl-utils.cc                  |    1 +
 sfi/tests/Makefile.am               |    2 +-
 4 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/sfi/Makefile.am b/sfi/Makefile.am
index c86bd35..7c2598a 100644
--- a/sfi/Makefile.am
+++ b/sfi/Makefile.am
@@ -19,7 +19,7 @@ sfi_public_headers = $(strip \
 )
 sfi_all_sources = $(strip \
 	sfistore.cc	sficomwire.cc	sfifilecrawler.cc \
-	glib-extra.c			sfiwrapper.cc	sfiprimitives.cc \
+	glib-extra.cc			sfiwrapper.cc	sfiprimitives.cc \
 	sfivmarshal.cc	sfiglue.cc	sfigluecodec.cc	sfiglueproxy.cc	\
 	sfinote.cc	sfiparams.cc			sfiserial.cc	\
 	sfitime.cc	sfitypes.cc	sfivalues.cc	sfiustore.cc	\
@@ -57,20 +57,19 @@ CLEANFILES += libsfi.o libsfi.lo
 # source files
 common_idl_sources = sfidl-generator.cc sfidl-namespace.cc sfidl-options.cc sfidl-parser.cc \
   sfidl-factory.cc sfidl-typelist.cc sfidl-cbase.cc sfidl-clientc.cc sfidl-clientcxx.cc sfidl-corec.cc \
-  sfidl-corecxx.cc sfidl-cxxbase.cc sfidl-hostc.cc glib-extra.c
+  sfidl-corecxx.cc sfidl-cxxbase.cc sfidl-hostc.cc sfidl-utils.cc
 
 bin_PROGRAMS = sfidl
 sfidl_SOURCES = sfidl.cc $(common_idl_sources)
 sfidl_LDADD = $(SFI_LIBS) -lm $(top_builddir)/birnet/libbirnet.o # libsfi.la
-sfidl_CFLAGS = $(AM_CFLAGS) # hack to cause glib-extra.c to be compiled twice (work around automake)
 EXTRA_DIST += sfidl-generator.hh sfidl-namespace.hh sfidl-options.hh sfidl-parser.hh sfidl-factory.hh
 EXTRA_DIST += sfidl-cbase.hh sfidl-clientc.hh sfidl-clientcxx.hh sfidl-cxxbase.hh sfidl-hostc.hh sfidl-utils.hh
 
 #
 # TOYPROF: poor man's profiling toy
 #
-TOYPROF_H_SOURCES = toyprof.h toyprof-mem.h
-TOYPROF_C_SOURCES = toyprof.c toyprof-mem.c
+TOYPROF_H_SOURCES = toyprof.hh toyprof-mem.hh
+TOYPROF_C_SOURCES = toyprof.cc toyprof-mem.cc
 EXTRA_DIST += toyprof.pl toyprof.README $(TOYPROF_H_SOURCES)
 if IF_TOYPROF
 conditional_toyprof_sources = $(TOYPROF_C_SOURCES)
diff --git a/sfi/glib-extra.c b/sfi/glib-extra.cc
similarity index 96%
rename from sfi/glib-extra.c
rename to sfi/glib-extra.cc
index d5bb126..cf47f5f 100644
--- a/sfi/glib-extra.c
+++ b/sfi/glib-extra.cc
@@ -30,7 +30,7 @@ g_object_disconnect_any (gpointer object,
    * disconnection that does not exist (it may do so for all-signals
    * instead).
    */
-  g_signal_handlers_disconnect_matched (object, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+  g_signal_handlers_disconnect_matched (object, GSignalMatchType (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA),
                                         0, 0, 0,
                                         function, data);
 }
@@ -116,7 +116,7 @@ g_strslistv (GSList *slist)
   i = 0;
   while (slist)
     {
-      str_array[i++] = g_strdup (slist->data);
+      str_array[i++] = g_strdup ((const char*) slist->data);
       slist = slist->next;
     }
   str_array[i] = NULL;
@@ -336,7 +336,7 @@ g_option_get (const gchar *option_string,
     return NULL;                        /* option not present */
   else switch (value[0])
     {
-      gchar *s;
+      const char *s;
     case ':':   return g_strdup ("1");  /* option was present, no modifier */
     case 0:     return g_strdup ("1");  /* option was present, no modifier */
     case '+':   return g_strdup ("1");  /* option was present, enable modifier */
@@ -362,7 +362,7 @@ g_option_check (const gchar *option_string,
     return FALSE;                       /* option not present */
   else switch (value[0])
     {
-      gchar *s;
+      const char *s;
     case ':':   return TRUE;            /* option was present, no modifier */
     case 0:     return TRUE;            /* option was present, no modifier */
     case '+':   return TRUE;            /* option was present, enable modifier */
@@ -416,7 +416,7 @@ g_param_spec_set_options (GParamSpec  *pspec,
   if (options)
     g_param_spec_set_qdata (pspec, quark_pspec_options, (gchar*) g_intern_string (options));
   /* pspec->flags &= ~G_PARAM_MASK; */
-  pspec->flags |= pspec_flags (options);
+  pspec->flags = GParamFlags (pspec->flags | pspec_flags (options));
 }
 
 gboolean
@@ -491,9 +491,9 @@ g_param_spec_provides_options (GParamSpec  *pspec,
 const gchar*
 g_param_spec_get_options (GParamSpec *pspec)
 {
-  const gchar *options;
+  const char *options;
   g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
-  options = g_param_spec_get_qdata (pspec, quark_pspec_options);
+  options = (const char*) g_param_spec_get_qdata (pspec, quark_pspec_options);
   return options ? options : "";
 }
 
@@ -520,7 +520,7 @@ g_param_spec_set_istepping (GParamSpec  *pspec,
   else
     {
       g_param_spec_set_qdata (pspec, quark_pspec_istepping64, NULL);
-      g_param_spec_set_qdata (pspec, quark_pspec_istepping, (void*) (guint32) stepping);
+      g_param_spec_set_qdata (pspec, quark_pspec_istepping, (void*) size_t (stepping));
     }
 }
 
@@ -529,10 +529,10 @@ g_param_spec_get_istepping (GParamSpec *pspec)
 {
   guint64 stepping;
   g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), 0);
-  stepping = (guint32) g_param_spec_get_qdata (pspec, quark_pspec_istepping);
+  stepping = size_t (g_param_spec_get_qdata (pspec, quark_pspec_istepping));
   if (!stepping)
     {
-      guint64 *istepping64 = g_param_spec_get_qdata (pspec, quark_pspec_istepping64);
+      guint64 *istepping64 = (guint64*) g_param_spec_get_qdata (pspec, quark_pspec_istepping64);
       stepping = istepping64 ? *istepping64 : 0;
     }
   return stepping;
@@ -560,9 +560,9 @@ g_param_spec_set_fstepping (GParamSpec  *pspec,
 gdouble
 g_param_spec_get_fstepping (GParamSpec *pspec)
 {
-  gdouble *fstepping;
+  double *fstepping;
   g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), 0);
-  fstepping = g_param_spec_get_qdata (pspec, quark_pspec_fstepping);
+  fstepping = (double*) g_param_spec_get_qdata (pspec, quark_pspec_fstepping);
   return fstepping ? *fstepping : 0;
 }
 
@@ -604,7 +604,7 @@ g_param_spec_get_log_scale (GParamSpec  *pspec,
 {
   LogScale *lscale;
   g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
-  lscale = g_param_spec_get_qdata (pspec, quark_pspec_log_scale);
+  lscale = (LogScale*) g_param_spec_get_qdata (pspec, quark_pspec_log_scale);
   if (lscale)
     {
       if (center)
@@ -742,8 +742,8 @@ type_name_to_cname (const gchar *type_name,
   else if (check_lower (s[0]))
     {
       static const struct {
-	gchar *gname;
-	gchar *xname;
+	const char *gname;
+	const char *xname;
       } glib_ftypes[] = {
 	{ "gboolean",   "GBoolean" },
 	{ "gchar",      "GChar" },
@@ -759,9 +759,7 @@ type_name_to_cname (const gchar *type_name,
 	{ "gpointer",   "GPointer" },
 	{ "gchararray", "GString" },	/* G_TYPE_STRING */
       };
-      guint i;
-
-      for (i = 0; i < G_N_ELEMENTS (glib_ftypes); i++)
+      for (size_t i = 0; i < G_N_ELEMENTS (glib_ftypes); i++)
 	if (strcmp (s, glib_ftypes[i].gname) == 0)
 	  {
 	    s = glib_ftypes[i].xname;
diff --git a/sfi/sfidl-utils.cc b/sfi/sfidl-utils.cc
new file mode 100644
index 0000000..84db1ed
--- /dev/null
+++ b/sfi/sfidl-utils.cc
@@ -0,0 +1 @@
+#include "glib-extra.cc" // needed by sfidl
diff --git a/sfi/tests/Makefile.am b/sfi/tests/Makefile.am
index a2fd5e6..d5ed295 100644
--- a/sfi/tests/Makefile.am
+++ b/sfi/tests/Makefile.am
@@ -35,7 +35,7 @@ testsfidl_SOURCES = testsfidl.cc \
 			../sfidl-generator.cc ../sfidl-namespace.cc ../sfidl-options.cc ../sfidl-parser.cc \
 			../sfidl-factory.cc ../sfidl-typelist.cc ../sfidl-cbase.cc ../sfidl-clientc.cc \
 			../sfidl-clientcxx.cc ../sfidl-corec.cc ../sfidl-corecxx.cc ../sfidl-cxxbase.cc \
-			../sfidl-hostc.cc ../glib-extra.c
+			../sfidl-hostc.cc ../glib-extra.cc
 testsfidl_LDADD   = $(progs_nosfi_ldadd)
 $(srcdir)/testsfidl.cc: testidl.h testidl.c
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]