File: 0007-Avoid-compiler-warning.patch

package info (click to toggle)
ruby-serialport 1.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 532 kB
  • sloc: ansic: 1,425; ruby: 74; sh: 16; makefile: 4
file content (29 lines) | stat: -rw-r--r-- 990 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From d1a988c6a6853b41b19aef221d32ac7f76435050 Mon Sep 17 00:00:00 2001
From: Lars Kanis <lars.kanis@sincnovation.com>
Date: Thu, 13 Feb 2025 09:28:18 +0100
Subject: [PATCH 07/10] Avoid compiler warning

warning: initialization discards "const" qualifier from pointer target type [-Wdiscarded-qualifiers]
         "/dev/ttyS0"
---
 ext/native/posix_serialport_impl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/native/posix_serialport_impl.c b/ext/native/posix_serialport_impl.c
index 8c0283e..3d40232 100644
--- a/ext/native/posix_serialport_impl.c
+++ b/ext/native/posix_serialport_impl.c
@@ -76,8 +76,8 @@ VALUE sp_create_impl(VALUE class, VALUE _port)
 {
    int fd;
    int num_port;
-   char *port;
-   char *ports[] = {
+   const char *port;
+   const char *ports[] = {
 #if defined(OS_LINUX) || defined(OS_CYGWIN)
       "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3",
       "/dev/ttyS4", "/dev/ttyS5", "/dev/ttyS6", "/dev/ttyS7"
-- 
2.39.5