summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-30 20:54:49 +0200
committerDavid Robillard <d@drobilla.net>2020-07-30 20:55:28 +0200
commit473d9bd0cb085dee2fc73506ccdfce990aeee147 (patch)
tree3d57ab4200c29b7542bd1f830653acebd5c2a2c8 /src
parente75c1e1873165e269c78d624d194fd165756837d (diff)
downloadganv-473d9bd0cb085dee2fc73506ccdfce990aeee147.tar.gz
ganv-473d9bd0cb085dee2fc73506ccdfce990aeee147.tar.bz2
ganv-473d9bd0cb085dee2fc73506ccdfce990aeee147.zip
Use modern casts in C++ code
Diffstat (limited to 'src')
-rw-r--r--src/Port.cpp2
-rw-r--r--src/color.h5
-rw-r--r--src/ganv_bench.cpp8
3 files changed, 6 insertions, 9 deletions
diff --git a/src/Port.cpp b/src/Port.cpp
index 3f0d02b..73b04ce 100644
--- a/src/Port.cpp
+++ b/src/Port.cpp
@@ -28,7 +28,7 @@ namespace Ganv {
static void
on_value_changed(GanvPort* port, double value, void* portmm)
{
- ((Port*)portmm)->signal_value_changed.emit(value);
+ static_cast<Port*>(portmm)->signal_value_changed.emit(value);
}
/* Construct a Port on an existing module. */
diff --git a/src/color.h b/src/color.h
index ca52d98..97381fb 100644
--- a/src/color.h
+++ b/src/color.h
@@ -54,10 +54,7 @@ highlight_color(guint c, guint delta)
const guint b = MIN(((c >> 8) & 0xFF) + delta, max_char);
const guint a = c & 0xFF;
- return ((((guint)(r)) << 24) |
- (((guint)(g)) << 16) |
- (((guint)(b)) << 8) |
- (((guint)(a))));
+ return ((r << 24) | (g << 16) | (b << 8) | a);
}
#endif // GANV_UTIL_H
diff --git a/src/ganv_bench.cpp b/src/ganv_bench.cpp
index 11fc44e..5f723b3 100644
--- a/src/ganv_bench.cpp
+++ b/src/ganv_bench.cpp
@@ -39,8 +39,8 @@ make_module(Canvas* canvas)
snprintf(name, 8, "mod%d", rand() % 10000);
Module* m(new Module(*canvas, name,
- rand() % (int)canvas->get_width(),
- rand() % (int)canvas->get_height(),
+ rand() % static_cast<int>(canvas->get_width()),
+ rand() % static_cast<int>(canvas->get_height()),
true));
int n_ins = rand() % MAX_NUM_PORTS;
@@ -70,8 +70,8 @@ make_circle(Canvas* canvas)
snprintf(name, 8, "%d", rand() % 10000);
Circle* e(new Circle(*canvas, name,
- rand() % (int)canvas->get_width(),
- rand() % (int)canvas->get_height()));
+ rand() % static_cast<int>(canvas->get_width()),
+ rand() % static_cast<int>(canvas->get_height())));
ins.push_back(e);
outs.push_back(e);