summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-05 21:19:56 +0000
committerDavid Robillard <d@drobilla.net>2010-02-05 21:19:56 +0000
commitb8f87a5b55387ad7b698742dcfcc1bc93538a053 (patch)
tree548fee2a6726a26f7592b9715b260be1bc4fe58c /test
parentcd70cc69937afca55dcdae75578bcdd23605eb64 (diff)
downloadraul-b8f87a5b55387ad7b698742dcfcc1bc93538a053.tar.gz
raul-b8f87a5b55387ad7b698742dcfcc1bc93538a053.tar.bz2
raul-b8f87a5b55387ad7b698742dcfcc1bc93538a053.zip
Convert C-style casts to C++ style casts.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2432 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/midi_ringbuffer_test.cpp9
-rw-r--r--test/queue_test.cpp2
-rw-r--r--test/smf_test.cpp2
-rw-r--r--test/table_test.cpp4
-rw-r--r--test/time_test.cpp4
5 files changed, 12 insertions, 9 deletions
diff --git a/test/midi_ringbuffer_test.cpp b/test/midi_ringbuffer_test.cpp
index f75cfd5..a5173b4 100644
--- a/test/midi_ringbuffer_test.cpp
+++ b/test/midi_ringbuffer_test.cpp
@@ -17,15 +17,18 @@ read_write_test(EventRingBuffer& rb, unsigned offset)
unsigned char write_buf[5];
unsigned char read_buf[5];
- snprintf((char*)write_buf, 5, "%d", offset);
- size = strlen((char*)write_buf);
+ snprintf(static_cast<char*>(write_buf), 5, "%d", offset);
+ size = strlen(static_cast<const char*>(write_buf));
const size_t written = rb.write(t, size, write_buf);
assert(written == size);
rb.read(&t, &size, read_buf);
- return (strncmp((const char*)write_buf, (const char*)read_buf, size));
+ return strncmp(
+ static_cast<const char*>(write_buf),
+ static_cast<const char*>(read_buf),
+ size);
}
diff --git a/test/queue_test.cpp b/test/queue_test.cpp
index 49ba6f2..329ec60 100644
--- a/test/queue_test.cpp
+++ b/test/queue_test.cpp
@@ -135,7 +135,7 @@ main()
vector<WriteThread*> writers(NUM_WRITERS, new WriteThread());
for (unsigned i=0; i < NUM_WRITERS; ++i) {
- writers[i]->set_name(string("Writer ") + (char)('0' + i));
+ writers[i]->set_name(string("Writer ") + static_cast<char>('0' + i));
writers[i]->start();
}
diff --git a/test/smf_test.cpp b/test/smf_test.cpp
index 9ff27f5..e848f15 100644
--- a/test/smf_test.cpp
+++ b/test/smf_test.cpp
@@ -55,7 +55,7 @@ main(int argc, char** argv)
cout << ":\t";
cout.flags(ios::hex);
for (uint32_t i=0; i < ev_size; ++i) {
- cout << "0x" << (int)buf[i] << " ";
+ cout << "0x" << static_cast<int>(buf[i]) << " ";
}
cout.flags(ios::dec);
cout << endl;
diff --git a/test/table_test.cpp b/test/table_test.cpp
index 882873a..41d13c2 100644
--- a/test/table_test.cpp
+++ b/test/table_test.cpp
@@ -186,7 +186,7 @@ main(int argc, char** argv)
t.insert(make_pair(val, ((val + 3) * 17)));
}
- for (int i=0; i < (int)table_size; ++i) {
+ for (size_t i=0; i < table_size; ++i) {
int val = rand()%100;
Table<int, int>::iterator iter = t.find(val);
assert(iter == t.end() || iter->second == (val + 3) * 17);
@@ -281,7 +281,7 @@ benchmark(size_t n)
gettimeofday(&t1, NULL);
for (size_t i=0; i < n; ++i)
- useless_accumulator += (int)(*s.find(values[i]))[0];
+ useless_accumulator += static_cast<int>((*s.find(values[i]))[0]);
gettimeofday(&t2, NULL);
diff --git a/test/time_test.cpp b/test/time_test.cpp
index a7479be..b48e3f1 100644
--- a/test/time_test.cpp
+++ b/test/time_test.cpp
@@ -14,8 +14,8 @@ main()
double in_double = 2.5;
- TimeStamp t(unit, (uint32_t)in_double,
- (uint32_t)((in_double - (uint32_t)in_double) * unit.ppt()));
+ TimeStamp t(unit, static_cast<uint32_t>(in_double),
+ static_cast<uint32_t>((in_double - static_cast<uint32_t>(in_double)) * unit.ppt()));
cout << "\tSeconds: ";
cout << ts.beats_to_seconds(t);