diff --git a/tests/Makefile.am b/tests/Makefile.am index 57a0bd77c..87d87c7ec 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,7 @@ est_epsilon_LDADD = $(opengl_LIBS) gl_info_SOURCES = gl-info.c gl_info_LDADD = $(opengl_LIBS) -alcinfo_SOURCES = alcinfo.c +alcinfo_SOURCES = alcinfo.cxx alcinfo_LDADD = $(openal_LIBS) test_env_map_SOURCES = test-env-map.cxx diff --git a/tests/alcinfo.c b/tests/alcinfo.cxx similarity index 91% rename from tests/alcinfo.c rename to tests/alcinfo.cxx index acc40a22d..2f569390d 100644 --- a/tests/alcinfo.c +++ b/tests/alcinfo.cxx @@ -36,6 +36,9 @@ #include #include #include +#include + +using std::string; #ifndef ALC_ALL_DEVICES_SPECIFIER # define ALC_ALL_DEVICES_SPECIFIER 0x1013 @@ -48,7 +51,7 @@ static const int maxmimumWidth = 79; void printExtensions (const char *, char, const char *); void displayDevices(const char *, const char *); char *getDeviceName(int, char **); -void testForError(void *, char *); +void testForError(void *, const string&); void testForALCError(ALCdevice *); int main(int argc, char **argv) @@ -96,21 +99,23 @@ int main(int argc, char **argv) alcGetIntegerv(device, ALC_FREQUENCY, 1, data); printf("mixer frequency: %u hz\n", data[0]); - testForError(device, "invalid context"); + testForALCError(device); alcGetIntegerv(device, ALC_REFRESH, 1, data+1); printf("refresh rate : %u hz\n", data[0]/data[1]); - testForError(device, "invalid context"); + testForALCError(device); data[0] = 0; alcGetIntegerv(device, ALC_MONO_SOURCES, 1, data); - printf("supported sources; mono: %u, ", data[0]); - testForError(device, "invalid context"); + error = alcGetError(device); + if (error == AL_NONE) { + printf("supported sources; mono: %u, ", data[0]); - data[0] = 0; - alcGetIntegerv(device, ALC_STEREO_SOURCES, 1, data); - printf("stereo: %u\n", data[0]); - testForError(device, "invalid context"); + data[0] = 0; + alcGetIntegerv(device, ALC_STEREO_SOURCES, 1, data); + printf("stereo: %u\n", data[0]); + testForALCError(device); + } printf("ALC version: "); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, data); @@ -248,15 +253,15 @@ printExtensions (const char *header, char separator, const char *extensions) } char * -getCommandLineOption(int argc, char **argv, char *option) +getCommandLineOption(int argc, char **argv, const string& option) { - int slen = strlen(option); + int slen = option.size(); char *rv = 0; int i; for (i=0; i