From 60678d1ddb52b290f24954c98473e3eeb3eaf838 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 8 Sep 2015 09:39:35 -0400 Subject: [PATCH] core/string: Convert file to C And convert the unit test while we're at it. Signed-off-by: Anna Schumaker --- core/Sconscript | 2 +- core/filter.cpp | 3 +++ core/{string.cpp => string.c} | 1 - core/tags/generic.cpp | 2 ++ gui/gst.cpp | 2 ++ gui/queue/model.cpp | 2 ++ gui/tabs.cpp | 2 ++ include/core/database.h | 1 + include/core/string.h | 1 + tests/core/Sconscript | 2 +- tests/core/{string.cpp => string.c} | 2 +- 11 files changed, 16 insertions(+), 4 deletions(-) rename core/{string.cpp => string.c} (98%) rename tests/core/{string.cpp => string.c} (99%) diff --git a/core/Sconscript b/core/Sconscript index bb280463..b95b5165 100644 --- a/core/Sconscript +++ b/core/Sconscript @@ -3,5 +3,5 @@ Import("env") env.UsePackage("taglib") -res = Glob("*.cpp") + SConscript("tags/Sconscript") +res = Glob("*.cpp") + Glob("*.c") + SConscript("tags/Sconscript") Return("res") diff --git a/core/filter.cpp b/core/filter.cpp index eae4b4f2..87678103 100644 --- a/core/filter.cpp +++ b/core/filter.cpp @@ -4,7 +4,10 @@ #include #include + +extern "C" { #include +} #include diff --git a/core/string.cpp b/core/string.c similarity index 98% rename from core/string.cpp rename to core/string.c index 69a229dd..dfa1a43d 100644 --- a/core/string.cpp +++ b/core/string.c @@ -2,7 +2,6 @@ * Copyright 2015 (c) Anna Schumaker. */ #include -#include #define O_SECONDS (1) #define O_MINUTES (60) diff --git a/core/tags/generic.cpp b/core/tags/generic.cpp index 169462c4..e446ed48 100644 --- a/core/tags/generic.cpp +++ b/core/tags/generic.cpp @@ -1,7 +1,9 @@ /** * Copyright 2014 (c) Anna Schumaker. */ +extern "C" { #include +} #include GenericTag :: GenericTag() {} diff --git a/gui/gst.cpp b/gui/gst.cpp index 2af30bef..1ebeab25 100644 --- a/gui/gst.cpp +++ b/gui/gst.cpp @@ -6,7 +6,9 @@ * what options are supported. */ #include +extern "C" { #include +} #include #include diff --git a/gui/queue/model.cpp b/gui/queue/model.cpp index 94bd8bc5..ea0a4b9d 100644 --- a/gui/queue/model.cpp +++ b/gui/queue/model.cpp @@ -5,7 +5,9 @@ * https://git.gnome.org/browse/gtkmm-documentation/tree/examples/others/treemodelcustom */ #include +extern "C" { #include +} #include #include diff --git a/gui/tabs.cpp b/gui/tabs.cpp index eb2d912b..52a1a482 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -3,7 +3,9 @@ */ #include #include +extern "C" { #include +} #include #include diff --git a/include/core/database.h b/include/core/database.h index 3e583e38..8f58efbd 100644 --- a/include/core/database.h +++ b/include/core/database.h @@ -7,6 +7,7 @@ #include #include +#include #include template class Database; diff --git a/include/core/string.h b/include/core/string.h index c889d745..7b6ed084 100644 --- a/include/core/string.h +++ b/include/core/string.h @@ -8,6 +8,7 @@ #define OCARINA_CORE_STRING_H #include +#include /* Convert number of seconds into a string with format mm:ss. */ diff --git a/tests/core/Sconscript b/tests/core/Sconscript index 0060a946..97c84c53 100644 --- a/tests/core/Sconscript +++ b/tests/core/Sconscript @@ -14,7 +14,7 @@ Export("core_objs") res = [ CoreTest("version", "version.c") ] -res += [ CoreTest("string", "string.cpp") ] +res += [ CoreTest("string", "string.c") ] res += [ CoreTest("random", "random.cpp") ] res += [ CoreTest("file", "file.cpp") ] res += [ CoreTest("database", "database.cpp") ] diff --git a/tests/core/string.cpp b/tests/core/string.c similarity index 99% rename from tests/core/string.cpp rename to tests/core/string.c index 4e715002..9cb33ea4 100644 --- a/tests/core/string.cpp +++ b/tests/core/string.c @@ -3,7 +3,7 @@ * Test the string formatting functions. */ #include -#include "test.h" +#include static char buf[25];