diff --git a/core/tags/artist.cpp b/core/tags/artist.c similarity index 91% rename from core/tags/artist.cpp rename to core/tags/artist.c index 6e6ca46d..bf53fcf0 100644 --- a/core/tags/artist.cpp +++ b/core/tags/artist.c @@ -1,9 +1,7 @@ -/** +/* * Copyright 2014 (c) Anna Schumaker. */ -extern "C" { #include -} #include @@ -11,7 +9,7 @@ static struct database artist_db; static struct artist *__artist_alloc(gchar *name) { - struct artist *artist = new struct artist; + struct artist *artist = g_malloc(sizeof(struct artist)); dbe_init(&artist->ar_dbe, artist); artist->ar_name = name; @@ -21,7 +19,7 @@ static struct artist *__artist_alloc(gchar *name) } -static db_entry *artist_alloc(const gchar *name) +static struct db_entry *artist_alloc(const gchar *name) { return &__artist_alloc(g_strdup(name))->ar_dbe; } @@ -29,7 +27,7 @@ static db_entry *artist_alloc(const gchar *name) static void artist_free(struct db_entry *dbe) { g_free(ARTIST(dbe)->ar_lower); - delete ARTIST(dbe); + g_free(ARTIST(dbe)); } static gchar *artist_key(struct db_entry *dbe) diff --git a/core/tags/tags.cpp b/core/tags/tags.cpp index 3180d989..0f6ce009 100644 --- a/core/tags/tags.cpp +++ b/core/tags/tags.cpp @@ -3,8 +3,8 @@ */ extern "C" { #include -} #include +} #include #include #include diff --git a/include/core/tags/artist.h b/include/core/tags/artist.h index 5d69defc..cc94aaad 100644 --- a/include/core/tags/artist.h +++ b/include/core/tags/artist.h @@ -1,18 +1,20 @@ -/** +/* * Copyright 2014 (c) Anna Schumaker. + * + * The Artist tag is used to store the name of artists + * added to the tag database. + * + * When writing an Artist tag to disk, only write out the + * artist_name field: + * + * ... Koji Kondo + * ... Hajime Wakai */ #ifndef OCARINA_CORE_TAGS_ARTIST_H #define OCARINA_CORE_TAGS_ARTIST_H -extern "C" { #include -} -#include -/** - * The Artist tag is used to store the name of artists added - * to the tag database. - */ struct artist { gchar *ar_name; /* This artist's name. */ gchar *ar_lower; /* This artist's name (lowercased). */ diff --git a/include/core/tags/track.h b/include/core/tags/track.h index 3c89ce42..d0b292fc 100644 --- a/include/core/tags/track.h +++ b/include/core/tags/track.h @@ -8,8 +8,8 @@ extern "C" { #include #include #include -} #include +} #include #include diff --git a/tests/core/tags/Sconscript b/tests/core/tags/Sconscript index 5b7d370a..009d6607 100644 --- a/tests/core/tags/Sconscript +++ b/tests/core/tags/Sconscript @@ -12,7 +12,7 @@ def TagTest(name, source): return run res = [ TagTest("album", "album.c") ] -res += [ TagTest("artist", "artist.cpp") ] +res += [ TagTest("artist", "artist.c") ] res += [ TagTest("genre", "genre.cpp") ] res += [ TagTest("library", "library.cpp") ] diff --git a/tests/core/tags/artist.cpp b/tests/core/tags/artist.c similarity index 92% rename from tests/core/tags/artist.cpp rename to tests/core/tags/artist.c index 8cf73d94..da64f1a0 100644 --- a/tests/core/tags/artist.cpp +++ b/tests/core/tags/artist.c @@ -1,8 +1,8 @@ -/** +/* * Copyright 2014 (c) Anna Schumaker. */ #include -#include "../test.h" +#include static void test_verify_empty(struct artist *artist) { @@ -25,7 +25,7 @@ static void test_artist() const struct db_ops *artist_ops = test_artist_ops(); struct artist *artist; unsigned int i; - file f; + struct file f; artist = ARTIST(artist_ops->dbe_alloc("Koji Kondo")); test_verify_koji(artist); @@ -82,9 +82,9 @@ static void test_artist_db() test_verify_koji(artist); - test_equal(artist_find("Koji Kondo"), artist); - test_equal(artist_get(0), artist); - test_equal(artist_get(1), (struct artist *)NULL); + test_equal((void *)artist_find("Koji Kondo"), (void *)artist); + test_equal((void *)artist_get(0), (void *)artist); + test_equal((void *)artist_get(1), (void *)NULL); db_init(&artist_db, "artist.db", false, artist_ops); db_load(&artist_db);