[beast/devel: 8/15] BSE: compile bseutils as C++



commit 918bc5a76d30beb9723eb869be0ed4fc1d98ad55
Author: Tim Janik <timj gnu org>
Date:   Sun Dec 16 05:13:27 2012 +0100

    BSE: compile bseutils as C++

 bse/Makefile.am                 |    2 +-
 bse/{bseutils.c => bseutils.cc} |   14 +++++++-------
 sfi/sfinote.cc                  |   13 ++++++-------
 sfi/sfinote.h                   |    2 +-
 sfi/tests/misctests.cc          |    5 ++---
 5 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 76a590d..292dfd9 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -83,7 +83,7 @@ bse_sources = $(strip \
 	bsesource.c		bsestandardosc.c	bsestandardsynths.c		bsestorage.c \
 	bseinstrumentoutput.cc	bsesubiport.c		bseinstrumentinput.cc		bsesuboport.c \
 	bsesubsynth.c		bsesuper.c		bsetrack.c			bsetype.c \
-	bseutils.c		bsemidivoice.c		bsewave.c			bsewaveosc.c \
+	bseutils.cc		bsemidivoice.c		bsewave.c			bsewaveosc.c \
 	bsecsynth.cc		bsewaverepo.c		bseladspamodule.cc		bsepcmwriter.cc \
 	bsecompat.cc		bseundostack.c		bsemidiinput.cc			bsemididecoder.cc \
 	bsenote.cc		bsemidifile.cc		bseblockutils.cc		\
diff --git a/bse/bseutils.c b/bse/bseutils.cc
similarity index 97%
rename from bse/bseutils.c
rename to bse/bseutils.cc
index c3479e7..202fd11 100644
--- a/bse/bseutils.c
+++ b/bse/bseutils.cc
@@ -189,7 +189,7 @@ bse_item_seq_from_ring (SfiRing *ring)
   BseItemSeq *iseq = bse_item_seq_new();
   SfiRing *node;
   for (node = ring; node; node = sfi_ring_walk (node, ring))
-    bse_item_seq_append (iseq, node->data);
+    bse_item_seq_append (iseq, (BseItem*) node->data);
   return iseq;
 }
 
@@ -382,7 +382,7 @@ bse_icon_from_pixstream (const guint8 *pixstream)
 
   g_return_val_if_fail (pixstream != NULL, NULL);
 
-  if (strncmp (s, "GdkP", 4) != 0)
+  if (strncmp ((const char*) s, "GdkP", 4) != 0)
     return NULL;
   s += 4;
 
@@ -401,7 +401,7 @@ bse_icon_from_pixstream (const guint8 *pixstream)
   if (width < 1 || height < 1)
     return NULL;
 
-  pixd.type = BSE_PIXDATA_RGBA | (type >> 24 == 2 ? BSE_PIXDATA_1BYTE_RLE : 0);
+  pixd.type = BsePixdataType (BSE_PIXDATA_RGBA | (type >> 24 == 2 ? BSE_PIXDATA_1BYTE_RLE : 0));
   pixd.width = width;
   pixd.height = height;
   pixd.encoded_pix_data = s;
@@ -644,8 +644,8 @@ bse_xinfos_dup_consolidated (gchar  **xinfos,
           i = 0;
           while (xinfo_list)
             {
-              const gchar *xinfo = sfi_ring_pop_head (&xinfo_list);
-              const gchar *e = strchr (xinfo, '=');
+              const char *xinfo = (const char*) sfi_ring_pop_head (&xinfo_list);
+              const char *e = strchr (xinfo, '=');
               if (e[1] &&       /* non-empty xinfo */
                   (e[0] != '.' || copy_interns))
                 dest_xinfos[i++] = g_strdup (xinfo);
@@ -675,7 +675,7 @@ bse_xinfo_stub_compare (const gchar     *xinfo1,  /* must contain '=' */
 guint
 bse_string_hash (gconstpointer string)
 {
-  const gchar *p = string;
+  const char *p = (const char*) string;
   guint h = 0;
   if (!p)
     return 1;
@@ -689,7 +689,7 @@ bse_string_equals (gconstpointer string1,
 		   gconstpointer string2)
 {
   if (string1 && string2)
-    return strcmp (string1, string2) == 0;
+    return strcmp ((const char*) string1, (const char*) string2) == 0;
   else
     return string1 == string2;
 }
diff --git a/sfi/sfinote.cc b/sfi/sfinote.cc
index c79da90..ec2cfa9 100644
--- a/sfi/sfinote.cc
+++ b/sfi/sfinote.cc
@@ -145,9 +145,8 @@ sfi_note_to_string (SfiInt note)
 {
   if (SFI_NOTE_IS_VALID (note))
     {
-      guint ht = 0;
-      gint o = 0;
-      
+      gint ht = 0, o = 0;
+
       sfi_note_examine (note, &o, &ht, NULL, NULL);
       if (o)
 	return g_strdup_printf ("%s%+d", sfi_note_name_table[ht], o);
@@ -161,21 +160,21 @@ sfi_note_to_string (SfiInt note)
 void
 sfi_note_examine (gint      note,
 		  gint     *octave_p,
-		  guint    *semitone_p,
+		  gint     *semitone_p,
 		  gboolean *black_semitone_p,
 		  gchar	   *letter_p)
 {
   static const gint8 semitone_flags[12] = { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 };
   guint semitone;
   gint octave;
-  
+
   g_return_if_fail (SFI_NOTE_IS_VALID (note));
-  
+
   semitone = note % 12 + (9 - (SFI_KAMMER_NOTE % 12));
   note -= semitone;
   octave = note - (SFI_KAMMER_NOTE - 9);
   octave = octave / 12 + SFI_KAMMER_OCTAVE;
-  
+
   if (octave_p)
     *octave_p = octave;
   if (semitone_p)
diff --git a/sfi/sfinote.h b/sfi/sfinote.h
index 6261cb4..2e34d46 100644
--- a/sfi/sfinote.h
+++ b/sfi/sfinote.h
@@ -83,7 +83,7 @@ G_BEGIN_DECLS
 /* --- functions --- */
 void	sfi_note_examine	 (SfiInt	 note,
 				  gint          *octave_p,
-				  guint         *semitone_p,
+				  gint          *semitone_p,
 				  gboolean	*black_semitone_p,
 				  gchar         *letter_p);
 /* return a newly allocated string which describes `note' literally */
diff --git a/sfi/tests/misctests.cc b/sfi/tests/misctests.cc
index 2f3175b..bb0ed55 100644
--- a/sfi/tests/misctests.cc
+++ b/sfi/tests/misctests.cc
@@ -557,11 +557,10 @@ test_notes (void)
   g_free (str);
   for (i = SFI_MIN_NOTE; i <= SFI_MAX_NOTE; i++)
     {
-      gint octave;
-      guint semitone;
+      int octave, semitone;
       gboolean black_semitone;
       gchar letter;
-      
+
       sfi_note_examine (i, &octave, &semitone, &black_semitone, &letter);
       TASSERT (octave == SFI_NOTE_OCTAVE (i));
       TASSERT (semitone == SFI_NOTE_SEMITONE (i));



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