[beast] SFI: compile sfiprimitives as C++ source
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast] SFI: compile sfiprimitives as C++ source
- Date: Mon, 9 May 2011 02:28:55 +0000 (UTC)
commit ce5bd8501a8a596b8f823bc18bad626e7c0eab7b
Author: Tim Janik <timj gtk org>
Date: Mon May 9 03:42:58 2011 +0200
SFI: compile sfiprimitives as C++ source
sfi/Makefile.am | 4 ++--
sfi/{sfiprimitives.c => sfiprimitives.cc} | 26 +++++++++++++-------------
2 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/sfi/Makefile.am b/sfi/Makefile.am
index 1f89cef..c3fbf08 100644
--- a/sfi/Makefile.am
+++ b/sfi/Makefile.am
@@ -19,9 +19,9 @@ sfi_public_headers = $(strip \
)
sfi_all_sources = $(strip \
sfistore.c sficomwire.cc sfifilecrawler.cc \
- glib-extra.c sfiwrapper.cc \
+ glib-extra.c sfiwrapper.cc sfiprimitives.cc \
sfivmarshal.c sfiglue.c sfigluecodec.c sfiglueproxy.c \
- sfinote.c sfiparams.c sfiprimitives.c sfiserial.c \
+ sfinote.c sfiparams.c sfiserial.c \
sfitime.c sfitypes.c sfivalues.c sfiustore.c \
sficxx.cc sfiring.cc sfimemory.cc sficomport.cc \
$(conditional_toyprof_sources) \
diff --git a/sfi/sfiprimitives.c b/sfi/sfiprimitives.cc
similarity index 97%
rename from sfi/sfiprimitives.c
rename to sfi/sfiprimitives.cc
index b73f99c..73ed4fd 100644
--- a/sfi/sfiprimitives.c
+++ b/sfi/sfiprimitives.cc
@@ -90,7 +90,7 @@ sfi_bblock_copy_deep (const SfiBBlock *bblock)
fb = sfi_bblock_new ();
fb->n_bytes = bblock->n_bytes;
- fb->bytes = g_memdup (bblock->bytes, bblock->n_bytes * sizeof (bblock->bytes[0]));
+ fb->bytes = (uint8*) g_memdup (bblock->bytes, bblock->n_bytes * sizeof (bblock->bytes[0]));
return fb;
}
@@ -239,7 +239,7 @@ sfi_fblock_copy_deep (const SfiFBlock *fblock)
fb = sfi_fblock_new ();
fb->n_values = fblock->n_values;
- fb->values = g_memdup (fblock->values, fblock->n_values * sizeof (fblock->values[0]));
+ fb->values = (float*) g_memdup (fblock->values, fblock->n_values * sizeof (fblock->values[0]));
return fb;
}
@@ -355,7 +355,7 @@ sfi_seq_append_copy (SfiSeq *seq,
n = upper_power2 (seq->n_elements);
if (n > l)
{
- seq->elements = g_realloc (seq->elements, n * sizeof (seq->elements[0]));
+ seq->elements = (GValue*) g_realloc (seq->elements, n * sizeof (seq->elements[0]));
memset (seq->elements + l, 0, (n - l) * sizeof (seq->elements[0]));
}
g_value_init (seq->elements + i, value_type);
@@ -887,19 +887,19 @@ sfi_rec_set_copy (SfiRec *rec,
gboolean deep_copy,
const GValue *value)
{
- const gchar *name;
- gchar *dupcanon_name;
- guint i;
-
+ const char *name;
+ char *dupcanon_name;
+ uint i;
+
dupcanon_name = may_dupcanon (field_name);
name = dupcanon_name ? dupcanon_name : field_name;
i = sfi_rec_lookup (rec, name);
if (i >= rec->n_fields)
{
i = rec->n_fields++;
- rec->fields = g_realloc (rec->fields, rec->n_fields * sizeof (rec->fields[0]));
+ rec->fields = (GValue*) g_realloc (rec->fields, rec->n_fields * sizeof (rec->fields[0]));
memset (rec->fields + i, 0, sizeof (rec->fields[0]));
- rec->field_names = g_realloc (rec->field_names, rec->n_fields * sizeof (rec->field_names[0]));
+ rec->field_names = (char**) g_realloc (rec->field_names, rec->n_fields * sizeof (rec->field_names[0]));
rec->field_names[i] = dupcanon_name ? dupcanon_name : g_strdup (name);
/* we don't sort upon insertion to speed up record creation */
rec->sorted = FALSE;
@@ -1026,8 +1026,8 @@ static int
strpointercmp (const void *p1,
const void *p2)
{
- gchar *const *s1 = p1;
- gchar *const *s2 = p2;
+ char *const *s1 = (char**) p1;
+ char *const *s2 = (char**) p2;
return strcmp (*s1, *s2);
}
@@ -1035,10 +1035,10 @@ void
sfi_rec_sort (SfiRec *rec)
{
g_return_if_fail (rec != NULL);
-
+
if (!rec->sorted && rec->n_fields > 1)
{
- gchar **fnames = g_memdup (rec->field_names, rec->n_fields * sizeof (rec->field_names[0]));
+ char **fnames = (char**) g_memdup (rec->field_names, rec->n_fields * sizeof (rec->field_names[0]));
GValue *fields = g_new (GValue, rec->n_fields);
guint i;
/* sort field names */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]