diff mbox series

[1/1] package/rpi-rgb-led-matrix: fix musl build

Message ID 20220103220724.559180-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] package/rpi-rgb-led-matrix: fix musl build | expand

Commit Message

Fabrice Fontaine Jan. 3, 2022, 10:07 p.m. UTC
Fix the following build failure on musl raised since the addition of the
package in commit e821078031e14df69e5142f23e9cb7b5a1ea0e77:

text-scroller.cc: In function 'int main(int, char**)':
text-scroller.cc:220:3: error: 'uint' was not declared in this scope; did you mean 'rint'?
  220 |   uint frame_counter = 0;
      |   ^~~~
      |   rint

Fixes:
 - http://autobuild.buildroot.org/results/1a230bd46eac35081bdb6fe9aaacbb7b62ea6b73

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-utils-text-scroller.cc-replace-uint.patch | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 package/rpi-rgb-led-matrix/0002-utils-text-scroller.cc-replace-uint.patch
diff mbox series

Patch

diff --git a/package/rpi-rgb-led-matrix/0002-utils-text-scroller.cc-replace-uint.patch b/package/rpi-rgb-led-matrix/0002-utils-text-scroller.cc-replace-uint.patch
new file mode 100644
index 0000000000..627415bac8
--- /dev/null
+++ b/package/rpi-rgb-led-matrix/0002-utils-text-scroller.cc-replace-uint.patch
@@ -0,0 +1,50 @@ 
+From a56338db0f003d5236f2ce98c73a591d64a70852 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Mon, 3 Jan 2022 22:57:11 +0100
+Subject: [PATCH] utils/text-scroller.cc: replace uint (#1383)
+
+Replace uint by uint64_t to avoid the following build failure on musl:
+
+text-scroller.cc: In function 'int main(int, char**)':
+text-scroller.cc:220:3: error: 'uint' was not declared in this scope; did you mean 'rint'?
+  220 |   uint frame_counter = 0;
+      |   ^~~~
+      |   rint
+
+Fixes:
+ - http://autobuild.buildroot.org/results/1a230bd46eac35081bdb6fe9aaacbb7b62ea6b73
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from:
+https://github.com/hzeller/rpi-rgb-led-matrix/commit/a56338db0f003d5236f2ce98c73a591d64a70852]
+---
+ utils/text-scroller.cc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/utils/text-scroller.cc b/utils/text-scroller.cc
+index a64ba0c89..28d4f7182 100644
+--- a/utils/text-scroller.cc
++++ b/utils/text-scroller.cc
+@@ -21,6 +21,7 @@
+ #include <getopt.h>
+ #include <math.h>
+ #include <signal.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -217,12 +218,12 @@ int main(int argc, char *argv[]) {
+ 
+   struct timespec next_frame = {0, 0};
+ 
+-  uint frame_counter = 0;
++  uint64_t frame_counter = 0;
+   while (!interrupt_received && loops != 0) {
+     ++frame_counter;
+     offscreen_canvas->Fill(bg_color.r, bg_color.g, bg_color.b);
+     const bool draw_on_frame = (blink_on <= 0)
+-      || (frame_counter % (blink_on + blink_off) < (uint)blink_on);
++      || (frame_counter % (blink_on + blink_off) < (uint64_t)blink_on);
+ 
+     if (draw_on_frame) {
+       if (outline_font) {