1From 5e4cb613d9bb287e9f54da86f99a51d0338b1faa Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Tue, 10 Aug 2021 10:36:53 +0200
4Subject: [PATCH] sconex/Descriptor.cpp: fix build with gcc 11
5
6Fix the following build failure with gcc 11:
7
8In file included from ../sconex/sconex.h:229,
9                 from ../sconex/Descriptor.h:63,
10                 from Descriptor.cpp:22:
11Descriptor.cpp: In member function 'void scx::Descriptor::add_stream(scx::Stream*)':
12Descriptor.cpp:150:22: error: ordered comparison of pointer with integer zero ('scx::Stream*' and 'int')
13  150 |   DEBUG_ASSERT(stream>=0,"add_stream() Invalid stream");
14      |                ~~~~~~^~~
15      |                                 ^~~~
16Descriptor.cpp: In member function 'bool scx::Descriptor::remove_stream(scx::Stream*)':
17Descriptor.cpp:204:22: error: ordered comparison of pointer with integer zero ('scx::Stream*' and 'int')
18  204 |   DEBUG_ASSERT(stream>=0,"remove_stream() Invalid stream");
19      |                ~~~~~~^~~
20
21Fixes:
22 - http://autobuild.buildroot.org/results/ccc9562e83fd2bd312d21b3124be42dfe4b7e850
23
24Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
25[Upstream status: https://github.com/sconemad/sconeserver/pull/4]
26---
27 sconex/Descriptor.cpp | 4 ++--
28 1 file changed, 2 insertions(+), 2 deletions(-)
29
30diff --git a/sconex/Descriptor.cpp b/sconex/Descriptor.cpp
31index 590adba..4adfd86 100644
32--- a/sconex/Descriptor.cpp
33+++ b/sconex/Descriptor.cpp
34@@ -147,7 +147,7 @@ bool Descriptor::dup(int d)
35 //=============================================================================
36 void Descriptor::add_stream(Stream* stream)
37 {
38-  DEBUG_ASSERT(stream>=0,"add_stream() Invalid stream");
39+  DEBUG_ASSERT(stream!=0,"add_stream() Invalid stream");
40
41   m_streams.push_back(stream);
42   stream->set_endpoint(this);
43@@ -201,7 +201,7 @@ void Descriptor::add_stream_after(Stream* stream,const Stream* after)
44 //=============================================================================
45 bool Descriptor::remove_stream(Stream* stream)
46 {
47-  DEBUG_ASSERT(stream>=0,"remove_stream() Invalid stream");
48+  DEBUG_ASSERT(stream!=0,"remove_stream() Invalid stream");
49
50   std::list<Stream*>::iterator it = m_streams.begin();
51   while (it != m_streams.end()) {
52--
532.30.2
54
55